मैं निम्नलिखित पर्ल कोड है:टेर्ल :: सीएमडी :: सामान्य-> अनलिंक से पर्ल की eval पकड़ समस्याओं क्यों नहीं है?
use strict;
use warnings;
use Test::Cmd::Common;
my $path = "/something/not/available";
my $test = Test::Cmd::Common->new(string => 'File system operations');
eval{
$test->unlink("$path");
};
ok([email protected], "file unlike");
print "done.\n";
$ परीक्षण> अनलिंक() लाइन असफल हो जायेगी और फेंक अपवाद। लेकिन समस्या: eval उस अपवाद को संभालने नहीं है और कोड निष्पादन बाधित हो रहा है।
उत्पादन:
$ perl test.pl
could not unlink files (/something/not/available): No such file or directory
NO RESULT for test at line 561 of /home/y/lib/perl5/site_perl/5.8/Test/Cmd/Common.pm (Test::Cmd::Common::unlink)
from line 9 of test.pl.
eval यहाँ सही काम कर रहा है? या मैं कुछ गलत समझ रहा हूँ?
एफ
untested है, लेकिन कैसे 'के बारे में * टेस्ट :: Cmd :: no_result = उप { मरना 'कोई परिणाम नहीं'} '? – jrockway