Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: system command with arguments Error

by Sandy (Curate)
on Jan 07, 2013 at 18:01 UTC ( #1012076=note: print w/replies, xml ) Need Help??

in reply to system command with arguments Error

Try this for debugging:
my $cmd = "perl $manuf $series $model $url $kb_color_style_nam +e $kb_color_image_url $kb_color_image_id"; print "cmd is $cmd\n"; system($cmd) == 0 or die "cant run!!";
When it doesn't work, try running the command printed to the screen, and debug that statement.

Replies are listed 'Best First'.
Re^2: system command with arguments Error
by ansh batra (Friar) on Jan 07, 2013 at 18:19 UTC

    this outputs cant run!!

      It should also output what the command was, and you should be able to look at that command and see what's wrong with it. We can't perform the debugging steps for you.


      It should output something more.

      Anyway, a better snippet for debugging:

      use Cwd; my $cmd = "perl $manuf $series $model $url $kb_color_style_nam +e $kb_color_image_url $kb_color_image_id"; print "cmd is $cmd\n"; printf "running at %s\n", getcwd; system($cmd) == 0 or die "cant run!!";

      What does that output?

        Please do output $? and $^E in your error message when system fails.

        system($cmd) == 0 or die "system $cmd failed: $? / $^E"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012076]
[1nickt]: For multiple dirs use iterator(): $it = path("/foo")-> iterator; while ( my $path = $it->() ) {...}
[1nickt]: (also skips . and .. automatically, and follows subdirs if you set <c\>recurse => 1</c>
[1nickt]: $it = path("/foo")-> iterator(recurse => 1 );

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (13)
As of 2017-03-28 18:47 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (340 votes). Check out past polls.