Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: Get filename of STDOUT

by Ven'Tatsu (Deacon)
on Aug 10, 2004 at 19:20 UTC ( [id://381718]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Get filename of STDOUT
in thread Get filename of STDOUT

ActivePerl build 810 (5.8.4) gives me the following:
> perl -e "print $0" -e > echo print $0 >test.pl > perl test.pl test.pl
5.6.1 on Linux gave me the same values for aproxamitly the same tests. (adjusting for shell differences)
Setting $0 has no noticeable effect on windows that I could see.

Replies are listed 'Best First'.
Re^5: Get filename of STDOUT
by gaal (Parson) on Aug 11, 2004 at 07:41 UTC
    Wow, I was really sure I did see this broken on Windows, but you're right, it does work.

    What really *doesn't* happen is this name being propagated to the process list (either ctrl-shift-esc or ps if using Cygwin). Apparently the Windows kernel doesn't honor changing $0 with the same method perl does it on unix.

    Now that I see I was wrong, I looked this up in perlvar:

    On some (read: not all) operating systems assigning to $0 modifies the argument area that the "ps" program sees. On some platforms you may have to use special "ps" options or a different "ps" to see the changes. Modifying the $0 is more useful as a way of indicating the current program state than it is for hiding the program you're running.

    I stand corrected!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-19 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found