Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Re: RFC: Shell::DWIM

by erikharrison (Deacon)
on Oct 07, 2002 at 17:21 UTC ( #203412=note: print w/replies, xml ) Need Help??

in reply to Re: RFC: Shell::DWIM
in thread RFC: Shell::DWIM

On *nix, the value returned by system doesn't necessarily reflect an OS error

Which is a common newbie error. They check the value of $! inappropriately after system. According to perlvar, $! (or $^E on some systems) will have useful information after system or backticks if (and only if) $? == -1. Hence the check.

What distinct information is available on exit from a VMS, Win32 or OS/2 system call? How much different are the extended error returns?

system returns the same. However, system may fail with $? = -1 when the child process fails due to an OS error. $! is C's errno, but on VMS, Win32, and OS/2 the underlying API provides it's own error messages which C's errno does not reflect. On these systems $^E holds that value (see perlvar for the specific API calls made to get that value). This is a workaround for the fact that Perl and C are still a bit *nix centric. $^E exists for people who aren't on *nix systems while still allowing *nix programmers on Windows or the like still get what they expect from $!.


Light a man a fire, he's warm for a day. Catch a man on fire, and he's warm for the rest of his life. - Terry Pratchet

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://203412]
[james28909]: i can extract a certain tree manually by regexing the html file for a starting anchor, then i send the position of the match to a sub and then seek to that position in the file and keep up with div tags (for now)
[james28909]: how can i manage multiple tags? other than div?
[james28909]: i count the div and /div and when count == 0 it means i have got that nested tree

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-04-25 03:58 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (448 votes). Check out past polls.