Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^2: (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: (Embed perl into your clipboard)
in thread (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.

Replies are listed 'Best First'.
Re^3: (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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://648678]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2018-06-25 07:06 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.