Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: File::Spec::Win32 returning different result than File::Spec when doing catfile with empty string

by davido (Cardinal)
on Sep 09, 2019 at 15:17 UTC ( [id://11105883]=note: print w/replies, xml ) Need Help??


in reply to Re^2: File::Spec::Win32 returning different result than File::Spec when doing catfile with empty string
in thread File::Spec::Win32 returning different result than File::Spec when doing catfile with empty string

Conceptually directory structures are trees, and paths are lists of nodes that represent traversal(1). When you think of things that way instead of strings with slashes, life becomes easier, and common tools tend to just work. Pushing to the boundaries of your application as much representational decoration as possible, and internally working with more native data structure types is a principal that doesn't only apply to data serialization formats, it also applies to filesystem paths.

Your algorithm should be working with lists of directory names and file names, and converting to slash-delimited strings at the ingress and egress boundaries.

(1) Actually many file systems are directed acyclic graphs, thanks to concepts such as hard linking, but conceptually we can treat them like heirarchical data structures, keeping in mind that it's possible for a node in the tree to point to any other node anywhere else in the tree. ...so the tree concept does sort of break down, but is a useful white lie.


Dave

  • Comment on Re^3: File::Spec::Win32 returning different result than File::Spec when doing catfile with empty string

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2024-04-19 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found