PugSA has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks
I wrote this little sub, it runs a system command that executes a external package called htmldoc. I did not install the software to see when the software is not running proparly, if it will return anything in $@
When I execute the sub it spools to the screen
'htmldoc' is not recognised as an internal or external command, but $@ is empty. I need the sub routine to return a 1 if it was successful or 0 if there was an error
Please Help
sub html_to_pdf { my($pdffile,$htmlfile)=@_; $command = "htmldoc --webpage -f \"$pdffile\" \"$htmlfile\""; print $command."\n"; eval{system("$command");}; print "\$\@:$@\n"; if($@) { print "html to pdf Failed->\n$@\n"; return 0; } #if($@) else { return 1; } #else for if($@) } #sub html_to_pdf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Another eval $@ question
by ikegami (Patriarch) on Oct 13, 2006 at 05:40 UTC | |
by ysth (Canon) on Oct 13, 2006 at 05:47 UTC | |
by ambrus (Abbot) on Oct 13, 2006 at 11:17 UTC | |
| |
|
Re: Another eval $@ question
by bobf (Monsignor) on Oct 13, 2006 at 05:33 UTC | |
by PugSA (Beadle) on Oct 13, 2006 at 05:43 UTC | |
|
Re: Another eval $@ question
by blazar (Canon) on Oct 13, 2006 at 10:12 UTC |