On Wed, 14 May 2003 11:58:10 -0700, Edward Peschko <esp5@mdssirds.comp.pge.com> wrote: [...] >Believe me, the first thing that I tried to do was use the 'link' interface in perl. You >say that it works, my windows XP and windows 2000 box says that it doesn't. Or it 'works' >in a weird, microsoftish way that only microsoft folks find in any way useful. Try: > >link('file','file2'); > >where 'file' is 5000 bytes long. Edit 'file2' - add a byte. Do 'dir file*' and you will >get > >05/14/2003 11:05 5000 file >05/14/2003 11:05 5001 file2 It depends on how you "edit" the file. If you delete and recreate it, then the link is obviously destroyed. Note that you cannot rely on "dir" to display the correct information. It sometimes takes NTFS a little while to update the directory entries of linked files. Check the content of the files instead. The following snippet shows that you can update a hardlinked file without severing the link: use strict; open A, '>A' or die; print A "AA"; close A; unlink "B"; link qw(A B) or die; open B, ">>B" or die; print B "BB"; close B; >I was wrong - it doesn't make a copy. It makes a fragile link, one which is broken any >time you edit the file. Doing a directory link simply doesn't work. I disagree about the "fragile" part, except for the annoying delayed update of directory entries. You are correct in that you cannot hardlink directories on NTFS. >Anyways, I'm getting sick of trying to make hard links work, and even if did get them >to work, they aren't going to be a full solution - as someone said, anything with FAT32 >is excluded. I'm going to write a module for shortcuts. However, I'd like to make it >*truly* integrated into perl, and to do that, I'd hope that: > > 1) `` could be overloaded Sounds good to me. > 2) perl <shortcut> would follow the shortcut and run the file behind the shortcut. You can easily do this with a module that will modify @ARGV for you: perl -MLinks shortcut.lnk and then put "-MLinks" into PERL5OPT. Cheers, -Jan >#1 I think would be a given nice to have, I'd hope that #2 would be accepted. > >EdThread Previous | Thread Next