Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^4: Any way to simulate a Windows path handling for File::Spec without Windows?

by nysus (Parson)
on Sep 08, 2019 at 06:06 UTC ( [id://11105826]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Any way to simulate a Windows path handling for File::Spec without Windows?
in thread Any way to simulate a Windows path handling for File::Spec without Windows?

I'm doing my best to try to use File::Spec but it's giving me headaches when the same method gives me different results on different platforms. PIA. I'll probably just change the algorithm so it looks at raw file path strings instead of directory components. It'll be slightly slower but I won't have to worry about this nonsense.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re^5: Any way to simulate a Windows path handling for File::Spec without Windows?
by jcb (Parson) on Sep 08, 2019 at 06:16 UTC

    The reason that File::Spec gives different results on different platforms is that File::Spec is intended to adapt to the platform that your program is running on — and different platforms expect different filenames!

    If you are only processing filenames within your program, and do not need to map back from these "internal names" to file names (because you are storing the actual local filenames separately), you could use File::Spec to split the names and then specifically use File::Spec::Unix on all platforms to construct *nix-style "internal names" for processing. If I understand correctly, File::Spec::Unix will load on all platforms, so it is always available.

      That's a good suggestion. But I have already changed the algorithm which is no longer dependent upon File::Spec and released a new version of the module.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
      $nysus = $PM . ' ' . $MCF;
      Click here if you love Perl Monks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-03-29 06:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found