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

Re^2: Difference between $0 and __FILE__

by Your Mother (Archbishop)
on Jul 21, 2017 at 05:32 UTC ( [id://1195670]=note: print w/replies, xml ) Need Help??


in reply to Re: Difference between $0 and __FILE__
in thread Difference between $0 and __FILE__

Good point; part of why I eschew chdir style code. A little more on your call out–

package AB; # File: /Users/moo/AB.pm use strict; use Path::Tiny; sub ohai { __FILE__ } sub ohai_der { path(__FILE__)->absolute } 1;
moo@cow[54]~>perl -MAB -le 'print AB->ohai; print AB->ohai_der' AB.pm /Users/moo/AB.pm
moo@cow[55]~>perl -MAB -le 'chdir "/tmp"; print AB->ohai; print AB->oh +ai_der;' AB.pm /private/tmp/AB.pm

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-26 00:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found