Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Windows - dirname(__FILE__)

by aitap (Deacon)
on Apr 11, 2014 at 17:53 UTC ( #1082005=note: print w/replies, xml ) Need Help??


in reply to Re: Windows - dirname(__FILE__)
in thread Windows - dirname(__FILE__)

Sadly, this won't work when script is called from another directory by full path:

$ pwd /home/aitap $ cat /tmp/1.pl #!/usr/bin/perl use strict; use warnings; use Cwd; my $script_dirname = cwd; print "dirname: $script_dirname\n"; use Cwd 'abs_path'; use File::Basename; $script_dirname = dirname(abs_path($0)); print "script dirname: $script_dirname\n"; $ perl /tmp/1.pl dirname: /home/aitap script dirname: /tmp

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1082005]
help
Chatterbox?
[Discipulus]: ahi ahi ahi!!
[Lady_Aleena]: paco is a little over 2 years before my time.
[Discipulus]: you can try tachyon's iterative approach Re: Win32 Recursive Directory Listing
[Lady_Aleena]: I'm on Linux/
[beech]: isn't 2 year about standard recovery time for that kind of surgery?
[Discipulus]: if you hate FIle::Find
[Lady_Aleena]: I don't hate it, it just drives me crazy.
[Discipulus]: LA the solution is portable to whatever
[Lady_Aleena]: File::Find doesn't have a simple sub wanted example, like get the name of the file.

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2017-04-23 20:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.