All right:
-- def_macro eval_inplace
my $count = 0;
$main::c->Set("In place evaluation started. If you wish to disable, pl
+ease copy -- end");
while ($main::c->WaitForChange) {
$count++ % 2 or next;
my $t = $main::c->GetText or next;
last if $t =~ /^-- END/i;
my $to = TempOut->new();
eval { eval "\$\\=\$/;$t;1" or die $@;1 } or $main::c->Set("Error
+executing perl: $@ ($t)") and next;
$main::c->Set($to->as_string);
$to->release;
}
print "Exited successfully, clipcommand returned to normal";
This is definitely a hack and shows why I need to clean up some things. However, if you run the script, copy that macro and copy -- eval_inplace, the macro will see everything you copy as perl code to execute and will dutifully populate the clipboard with its output (or the error it generated). To stop it, copy -- end. Also, you can't promote this macro and expect it to work (like I said, hack =)).
Update: I forgot this part. I have the *nix style shebang line out of habit. I personally use it with ActiveState build 822.