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

Re^2: Cross platform coding advice

by nothingmuch (Priest)
on Oct 08, 2005 at 15:54 UTC ( [id://498424]=note: print w/replies, xml ) Need Help??


in reply to Re: Cross platform coding advice
in thread Cross platform coding advice

Don't use forward or backslashes, instead use File::Spec or Path::Class:
use File::Spec; # could also use File::Spec::Functions my $file_name = File::Spec->catfile(File::Spec->updir, qw/foo bar.txt/ +); # "../foo/bar.txt" on unix # or use Path::Class; # these return Path::Class::File objects which can be used as strings # and also have some convenient methods ($file->open, etc) my $file_a = Path::Class->new()->parent->subdir("foo")->file("bar.txt" +); my $file_b = file(dir()->parent, "foo", "bar.txt');
-nuffin
zz zZ Z Z #!perl

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://498424]
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: (4)
As of 2024-05-28 03:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found