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

Re: relaying arguments using system call

by and (Pilgrim)
on Mar 21, 2003 at 07:39 UTC ( [id://244808]=note: print w/replies, xml ) Need Help??


in reply to relaying arguments using system call

system(@args) == 0 or die ...

No! It is supposed to be system(@args) and die ... Please.

I am sure it seems like a small matter to you. But with the new language coming out and the clamor about it being too complex, I'm afraid they are looking for things to cut. I don't want to have to find a new job in the current economy.

Replies are listed 'Best First'.
Re: Re: relaying arguments using system call
by jonnyfolk (Vicar) on Mar 21, 2003 at 08:54 UTC
    Now I know why it's called @ARGV - as in @AAARRRGH!V. I tend to tiptoe around the site on my best behaviour because I don't know very much and there's a lot I can learn here by watching and 'listening'.

    I thought if I looked at perldocs and used their suggested code that this time I would be beyond reproach.

    Apparently not.
    Have a nice day!
      I think your perldoc inspired code is just fine.

      I think "and" is mistaken.

      --
      Regards,
      Helgi Briem
      helgi AT decode DOT is

Re: Re: relaying arguments using system call
by helgi (Hermit) on Mar 21, 2003 at 10:35 UTC
    Why do you feel this is better?

    I personally find the former much more readable and understandable to others.

    Is there any reason to expect this not to work in Perl6?

    Enquiring minds want to know.

    --
    Regards,
    Helgi Briem
    helgi AT decode DOT is

      Well actually neither way (system == 0 or die versus system and die) will work as expected in Perl 6 for the simple reason that the return code of system will be switched around. 0 will indicate failure, 1, success.

      Which means that you'll finally be able to write code which appears follows the usual logic such as for opening files:

      if( !system( qw/ifconfig eth0 down/ )) { die "could not ignore the world\n"; }

      You can fix Perl5 to behave like this now. japhy posted some code in japhygesis that switches this (and other inconsistencies) around to make things flow more naturally.

      _____________________________________________
      Come to YAPC::Europe 2003 in Paris, 23-25 July 2003.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-03-29 00:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found