Jim has asked for the wisdom of the Perl Monks concerning the following question:

The ActivePerl 5.8 documentation says the link function is unimplemented, yet it works for me:
C:\Temp>dir /a:-d /b File Not Found C:\Temp>perl -e "link 'C:\Perl\lib\ActivePerl.pm', 'HardLinkToActivePe +rl.pm'" C:\Temp>dir /a:-d /b HardLinkToActivePerl.pm C:\Temp>head -7 HardLinkToActivePerl.pm package ActivePerl; sub perl_version { return sprintf("%vd.%s", $^V, BUILD()); } 1; C:\Temp>
I have to write a Perl script to create hard links to many files on a Windows NTFS file system and I don't want to use the internal link function if it only works for me by accident somehow.

My question is simply this: Is the documentation just plain wrong? Is link fully implemented in ActivePerl 5.8 for Windows despite what the ActivePerl-faq5 - Implementation Quirks document says?

Jim

  • Comment on ActivePerl 5.8 Documentation Discrepancy: "Unimplemented" link Function
  • Download Code

Replies are listed 'Best First'.
Re: ActivePerl 5.8 Documentation Discrepancy: "Unimplemented" link Function
by ysth (Canon) on May 26, 2008 at 01:17 UTC
    Per http://search.cpan.org/dist/perl-5.8.8/pod/perlport.pod (which is supposed to be the authoritative source for this sort of information):
    link

    Not implemented. (Mac OS, MPE/iX, VMS, RISC OS)

    Link count not updated because hard links are not quite that hard (They are sort of half-way between hard and soft links). (AmigaOS)

    Hard links are implemented on Win32 (Windows NT and Windows 2000) under NTFS only.

      ysth++!

      "Hard links are implemented on Win32...under NTFS only" is good enough for me and makes perfect sense because only NTFS supports hard links; FAT doesn't. Thank you for pointing me to the better documentation in this case, FUNCTION IMPLEMENTATIONS. It helpfully guided me to do this with Config:

      C:\>perl -MConfig -le "print $Config{d_link}" define C:\>perl -MConfig -le "print Config::config_sh()" | grep link d_link='define' d_readlink='undef' d_symlink='undef' issymlink='' ld='link' C:\>
      This is arguably the very best documentation of what my Perl can do.

      I'll be back later with questions about how to create and manage multiple processes in Perl under Win32. For now, I'm off to study Mr. Peabody Explains fork() and a few perldoc pages.

      Thanks!

      Jim

Re: ActivePerl 5.8 Documentation Discrepancy: "Unimplemented" link Function
by syphilis (Archbishop) on May 26, 2008 at 00:31 UTC
    Is the documentation just plain wrong?

    It's certainly seems to be deficient. I get the same as you on my Vista box (ActivePerl builds 822 and 806), but on my XP laptop (ActivePerl builds 822 and 806), the command fails silently. I suspect the difference in behaviour is that the Vista box is NTFS, whereas the XP laptop is FAT32.

    Cheers,
    Rob