Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Detecting if a folder is a symbolic link

by dasgar (Priest)
on Mar 28, 2018 at 14:18 UTC ( #1211918=note: print w/replies, xml ) Need Help??


in reply to Re: Detecting if a folder is a symbolic link
in thread Detecting if a folder is a symbolic link

If you look at the documentation for the -X functions, the -l test is described as:

File is a symbolic link (false if symlinks aren't supported by the file system).

If you look at the Alphabetical Listing of Perl Functions section of perlport, the following note is listed under -X:

(Win32, VMS, RISC OS) -g , -k , -l , -u , -A are not particularly meaningful.

Based on those documents, it looks like -l is not going to work on Windows.

I'm not saying this is the best alternative, but one alternative that you could consider is the testL function from the Win32::LongPath module.

  • Comment on Re^2: Detecting if a folder is a symbolic link

Replies are listed 'Best First'.
Re^3: Detecting if a folder is a symbolic link
by borodache (Novice) on Apr 01, 2018 at 07:29 UTC
    Hi,
    I am doing this script in my workplace, and we are not allowed to add any external (cpan) library. Is there another solution?

      Of course. Simply look at how Win32::LongPath does it and do it the same way in your own script. This kind of lift-and-drop coding is a great waste of time compared to simply installing the module but since your employer makes the rules they will surely be happy to pay for your time.

      Other alternatives include:

      • Don't use Windows
      • Change employer
      • Tap your employer gently on the head with a copy of The Mythical Man-Month until they realise that CPAN is one of Perl's greatest strengths and not something to be shunned out of fear or suspicion
      I am doing this script in my workplace, and we are not allowed to add any external (cpan) library. Is there another solution?

      Sure. Your employer could hire someone to develop a program to do what you're trying to do and to provide support for that program. I think using CPAN would be a bit cheaper.

      You could try to find a utility that can examine a file to determine if it is a link or not and call that from your Perl code. If its not freeware, then there will be a fee involved. If it is freeware, then I'm not seeing much difference between using that and using CPAN.

      You could try to use a different scripting/programming language. In addition to any financial costs related to purchasing needed software (such as a compiler), there's the cost of time spent porting your Perl code to another language and possibly time lost for having to learn a new language. Using CPAN seems to be a faster and cheaper option in my mind.

      If internet access is the issue, you could look into CPAN::Mini to put a CPAN mirror on a USB stick drive or network share that could be used. Or you could develop the code on a system with internet and CPAN access and then bundle your code into a stand alone executable. There are software packages that you can purchase that can help with that process. Or you can look at something like the pp utility from PAR::Packer or check out salva's Win32::Packer module.

      Are there alternatives to using CPAN? Yes. I've listed some alternatives above and I'm sure there other individuals who could list more alternatives. But the alternatives may or may not be worth it for you and/or your employer.

      If you've invested time to develop Perl code for what you're doing and you're asking for help on a Perl site, why not utilize the full capabilities of the language (such as CPAN)?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2021-01-23 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?