Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Review of my script

by tobyink (Canon)
on May 16, 2013 at 09:31 UTC ( [id://1033797]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Review of my script
in thread Review of my script

When you type something like:

find-junk | xargs rm -f

... and find-junk bails out with an error message, you don't want the error message piped to rm -f, do you?

So a convention has arisen to provide usage instructions on STDERR if the program has been called incorrectly, but on STDOUT if the program has been called with an explicit --help.

fisher's suggested code does precisely this. It only selects STDERR if $err is a true value.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Replies are listed 'Best First'.
Re^4: Review of my script
by Anonymous Monk on May 16, 2013 at 10:06 UTC

    When you type something like

    That is a very specific case , I never do stuff like that (xargs + rm )

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 05:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found