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:
85EADE5D-0AB8-11D8-90A4-00039398CFD2@spurious.biz
On Oct 30, 2003, at 10:01 AM, Nick Ing-Simmons (via RT) wrote:
>
> No - you do not need to have a .pm file for package to exist.
>
> Consider
>
> package Base;
>
> sub method { ... }
>
> ...
>
> package Derived;
>
> use base 'Base';
>
> ...
>
> The class 'Base' is already defined in same file as derived class.
> It does not have a .pm file of its own.
> Base was originaly intended (as I recall) as a BEGIN time way to
> set ISA. Lots of classes use it that way. The handy do the
> require for you code came later.
> The existing code reflects this usage pattern buy changing the error
> message so point out that base class is empty, rather than that its
> .pm file could not be found.
>
> ...
>

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




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