Front page | perl.perl5.porters |
Postings from April 2000
Is this desirable?
From:
Tom Christiansen
Date:
April 4, 2000 08:50
Subject:
Is this desirable?
Message ID:
24064.954863447@chthon
I notice that the "existing blah through next/last" is warned of
even though the label should be in one's lexical scope. Isn't it
the dynamic scope jump that's the scary one? Or are they
both too scary to live?
--tom
local *confirm = sub () {
next PATHNAME unless accesstty();
print TTYOUT $renaming
? "rename $oldname to $newname? "
: "symlink $oldslink to point to $newname? ";
my $answer = <TTYIN>;
>>>> no warnings 'exiting'; # hush you! it's in my lexical scope!
last PATHNAME unless defined $answer; # exit?
chomp $answer;
last PATHNAME if "QUIT" =~ /^\Q$answer/i;
next PATHNAME unless "YES" =~ /^\Q$answer/i;
};
confirm() if $inspect;
# "I'd like to teach
# The world to race
# In perfect hackery!"
my $was_there = do {
no warnings 'newline';
-e $newname;
};
if ($renaming) {
if ($was_there && !$inspect && $careful) {
confirm() unless $force || $quiet;
next PATHNAME if $quiet;
}
unless (vrename($oldname, $newname)) {
warn "$0: can't rename $oldname to $newname: $!\n";
$errcnt++;
next PATHNAME;
}
}
-
Is this desirable?
by Tom Christiansen