Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Execute commands in a string

by etcshadow (Priest)
on Aug 15, 2004 at 19:38 UTC ( #383125=note: print w/replies, xml ) Need Help??


in reply to Execute commands in a string

my $sourcepackage = caller; eval "package $sourcepackage; $code"; print "Error in eval: $@" if $@ ne '';
Change the print to be whatever you want to do if there are errors (syntax or runtime) in the string of $code.
------------ :Wq Not an editor command: Wq

Replies are listed 'Best First'.
Re^2: Execute commands in a string
by aplonis (Pilgrim) on Aug 15, 2004 at 20:13 UTC

    That was it! Just the trick, Thanks a heap.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2019-10-20 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?