Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: clipcommand.pl (Embed perl into your clipboard)

by antirice (Priest)
on Nov 02, 2007 at 16:28 UTC ( #648678=note: print w/ replies, xml ) Need Help??


in reply to Re: clipcommand.pl (Embed perl into your clipboard)
in thread clipcommand.pl (Embed perl into your clipboard)

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.


Comment on Re^2: clipcommand.pl (Embed perl into your clipboard)
Select or Download Code
Re^3: clipcommand.pl (Embed perl into your clipboard)
by bradenshep (Beadle) on Nov 02, 2007 at 17:02 UTC
    Alright, I'll have to live without it for now (not being able to promote it kind of defeats the effect) and hope for an eventual new version.

    I looked into getting it going on AS 822, but couldn't find various packages it seems to need. I'm not familiar enough with AS to know if it will work. I guess I'll just try it and see what errors come back, if any.

    Again, many, many thanks for this.
        Not to pester for help, but I'm wondering how you run it? I would like it to be running by default when I start Windows. Is it possible to register an AS Perl program as a Service without the PDK? What about just Startup and a batch file or something? Heck, I'll even remember to double-click the shortcut. I just don't have enough experience with AS on Windows to see how to get it running in the background.

        Thanks in advance.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://648678]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-09-20 11:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (158 votes), past polls