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

Re: How to tell whether script is invoked from command line or not

by Corion (Pope)
on Dec 20, 2004 at 19:59 UTC ( #416295=note: print w/replies, xml ) Need Help??


in reply to How to tell whether script is invoked from command line or not

See perldoc -f -X:

my $loglevel; $loglevel++ if -t STDOUT; print "Log level is $loglevel\n";

This will not work if the user is running your program through less or any other pager I guess.

  • Comment on Re: How to tell whether script is invoked from command line or not
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2020-05-25 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (144 votes). Check out past polls.

    Notices?