Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Intermixed perl?

by Corion (Patriarch)
on Nov 09, 2007 at 14:33 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2023-02-04 06:05 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (31 votes). Check out past polls.