doubledecker has asked for the wisdom of the Perl Monks concerning the following question:
Monks,
I'm checking the return code of symlink using the following code. But, it is not reporting any error if source link is not existing. Is there any better way of handling this?
use strict; my ($link1, $link2); # source $link1 = '/var/tmp/sample.txt; #destination $link2 = '/tmp/sample.txt'; my $stat = symlink("$link1", "$link2"); if ( $stat ) { print "Link got created \n"; } else { print "Link not created \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: error handling using symlink
by cheekuperl (Monk) on Jun 18, 2012 at 07:19 UTC | |
by cheekuperl (Monk) on Jun 18, 2012 at 08:11 UTC | |
by doubledecker (Scribe) on Jun 18, 2012 at 09:11 UTC | |
by MidLifeXis (Monsignor) on Jun 18, 2012 at 13:05 UTC |