Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Is there any way to override "file test operator"?

by Anonymous Monk
on Aug 09, 2011 at 08:09 UTC ( [id://919411]=note: print w/replies, xml ) Need Help??


in reply to Is there any way to override "file test operator"?

Um, why would you even want to do this? You want to lie to your program about whether a file exists or not? Without some pretty specific and esoteric reasons, that just sounds silly

  • Comment on Re: Is there any way to override "file test operator"?

Replies are listed 'Best First'.
Re^2: Is there any way to override "file test operator"?
by Corion (Patriarch) on Aug 09, 2011 at 08:13 UTC

    One use I could see for this would be filenames that refer to a virtual file system. For example -f 'smb://server/share/file.name' or -r 'ssh:user@host:some/file' could be resource tests that make sense if you want to provide a different syntax than just local filenames.

Re^2: Is there any way to override "file test operator"?
by perlancar (Hermit) on Jan 31, 2018 at 11:40 UTC
    Another use-case is for testing, e.g. I have a test script that detects whether bash exists using -x "/bin/bash". I'd like to be able to simulate the absence of bash by returning false to that expression even though /bin/bash is actually on my filesystem.
Re^2: Is there any way to override "file test operator"?
by obfuscated (Initiate) on Mar 17, 2018 at 17:48 UTC
    Another use case is implementing support for symlinks on Windows. See Win32::Links for a situation where someone has taken the effort to do so, and could use a means of supporting -l to make it seamless.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://919411]
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: (2)
As of 2024-04-26 00:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found