From 3f771df8bcae92c7c63adf76f22d615a4827ba42 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 14 Nov 2012 18:36:04 +0000 Subject: [PATCH] compiler_vm: added -paste flag to send formatted source/output to paste site and show link instead of output; e.g. `cc -paste ` --> http://somepastesite.com --- PBot/VERSION.pm | 4 ++-- modules/compiler_vm/compiler_vm_client.pl | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 876df5f0..bd517c7c 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,8 +13,8 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 392, - BUILD_DATE => "2012-11-04", + BUILD_REVISION => 393, + BUILD_DATE => "2012-11-14", }; 1; diff --git a/modules/compiler_vm/compiler_vm_client.pl b/modules/compiler_vm/compiler_vm_client.pl index 87fc33fd..2c1ffde5 100755 --- a/modules/compiler_vm/compiler_vm_client.pl +++ b/modules/compiler_vm/compiler_vm_client.pl @@ -151,6 +151,9 @@ $lang = uc $1 if $code =~ s/-lang=([^\b\s]+)//i; my $input = ""; $input = $1 if $code =~ s/-(?:input|stdin)=(.*)$//i; +my $got_paste = undef; +$got_paste = 1 if $code =~ s/^\s*-paste\s*//i; + my $args = ""; $args .= "$1 " while $code =~ s/^\s*(-[^ ]+)\s*//; $args =~ s/\s+$//; @@ -938,7 +941,7 @@ unless($got_run) { close FILE; } -if(defined $got_run and $got_run eq "paste") { +if(defined $got_paste or (defined $got_run and $got_run eq "paste")) { $code .= "\n\n/************* OUTPUT *************\n$output************** OUTPUT **************/\n"; my $uri = paste_sprunge(pretty($code)); print "$nick: $uri\n";