develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [perl #24350] package base produces incorrect error messages

From:
Paul Kremer
Date:
October 30, 2003 02:50
Subject:
Re: [perl #24350] package base produces incorrect error messages
Message ID:
7EC6BCCC-0AB6-11D8-8B53-00039398CFD2@spurious.biz
On Oct 30, 2003, at 5:40 AM, Michael G Schwern (via RT) wrote:

> On Wed, Oct 29, 2003 at 10:32:21AM -0000, pkremer@spurious.biz (via 
> RT) wrote:
>> When trying to use a module as base package which does not exist,
>> package base will bail out with the message:
>>
>>   Base class package "MODULE::DOES::NOT::EXIST" is empty.
>>   (Perhaps you need to 'use' the module which defines that package 
>> first.)
>>
>> Code which leads to this error:
>>
>>   use base 'MODULE::DOES::NOT::EXIST';
>>
>> The error message should state:
>>
>>    Can't locate MODULE/DOES/NOT/EXIST.pm in @INC ....
>
> base.pm cannot assume that the base class maps to a real file.  
> Consider
> the following.
>
>     use base qw(Tie::StdHandle);
>
> There is no Tie/StdHandle.pm.  Its (unfortunately) in Tie/Handle.pm.
> With your patch the error message would be incorrect.

what about changing the problematic line to:

    die if $@ && ! ( $@ =~ /^Can't locate .*? at \(eval / && 
%{"$base\::"});

instead of the original line:

    die if $@ && $@ !~ /^Can't locate .*? at \(eval /;

the first patch was crap, I apologize for the waste of your time.

hand,
paul

-- 
0207 F4BD 060D 1442 BAB5  648F C7E9 D3F4 28D2 6EF8




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About