Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Get Entire Command Line of a Program

by kcott (Archbishop)
on Oct 20, 2010 at 03:14 UTC ( [id://866236]=note: print w/replies, xml ) Need Help??


in reply to Get Entire Command Line of a Program

As noted, you can get your commandline arguments, except for IO redirection, via @ARGV.

Whatever IO redirection has been specified is available within your Perl script via STDIN, STDOUT and STDERR.

Here's how you can get at the filenames:

$ perl -wE 'use IO::Handle; my $inode = (*STDERR{IO}->stat)[1]; say `f +ind -inum $inode`;' 2> derf ./derf $ perl -wE 'use IO::Handle; my $inode = (*STDOUT{IO}->stat)[1]; say `f +ind -inum $inode`;' > fred; cat fred ./fred

That obviously needs substantial error checking and other work for a serious script but hopefully it's at least a start in right direction.

-- Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2024-04-23 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found