Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Intermixed perl?

by Corion (Patriarch)
on Nov 09, 2007 at 14:33 UTC ( [id://649907]=note: print w/replies, xml ) Need Help??


in reply to Intermixed perl?

Turn the problem around. If you look at it as having Perl around command interpreter snippets, the problem becomes different:

#!/usr/bin/perl -w use strict; use vars qw($last_status); sub run_external { my $cmd = shift; print "Running [$cmd]"; $last_status = system($cmd); $last_sys_error = $?; return $last_status }; run_external(<<COMMAND); command1 param1=value1 param2=value2 COMMAND for my $machine (@machines) { run_external(<<COMMAND); command1 machine=$machine param1=value1 param2=value2 COMMAND if ($last_status) { run_external(<<COMMAND); debugging_command machine=$machine debug_param1=debug_va +lue1 COMMAND }; };

Of course, this requires you to start all your new/complex files with Perl and your simple files with the other interpreter/the shell. I would write a wrapper that checks (say) the file extension or whatnot to launch the correct interpreter for the program.

Replies are listed 'Best First'.
Re^2: Intermixed perl?
by sg (Pilgrim) on Nov 11, 2007 at 16:34 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-23 12:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found