[Fwd: [Fwd: Re: Phoenix.pm: Inheriting from DateTime]]
Douglas E. Miles
doug at phoenixinternet.com
Thu Feb 19 18:58:11 CST 2004
eden wrote:
> I'm forwarding this for eden, because majordomo didn't like the "sub" in
> "Sub new". I turned off this (mis)feature. I should have done this a
> long time ago. Hopefully we'll have fewer legitimate emails bouncing.
> We now return to your regularly scheduled email...
>
>
> Hmmm... I think there might be a way for you to turn off warnings for a
> certain block. It's been such a long time since I touched Perl (oh how
> I miss'er), but... maybe...
>
> sub new
> {
> my $package = shift;
> my $class = ref($package) || $package;
>
> {
> local ($SIG{'__WARN__'}) = sub {};
> my $self = $class->SUPER::new(@_);
> }
> bless($self, $class);
>
> return $self;
> }
>
> Actually, I tested this, so it won't send out that warning.
>
> The only problem I see with this is that DateTime->new()'s legitimate
> warnings would go unheard.
>
> Hope this was helpful......
Hmmm... This didn't work for me. According to the documentation for
Params::Validate (which DateTime uses), it does a Carp::confess (which
is a equivalent to 'die'. Maybe you have a different version of one or
more of the modules which gives a warning rather than 'die'ing? I'm not
sure. Thanks for the reply.
More information about the Phoenix-pm
mailing list