develooper Front page | perl.perl5.porters | Postings from August 2001

Re: How to redefine sub that has prototypes without warning at runtim e?

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
August 18, 2001 13:11
Subject:
Re: How to redefine sub that has prototypes without warning at runtim e?
Message ID:
20010818221300.A692@rafael
On 2001.08.18 07:33 Michael G Schwern wrote:
> On Fri, Aug 17, 2001 at 04:04:03PM -0500, Neulinger, Nathan wrote:
> > The following snippet generates the following warning:
> > 
> > ---
> > sub foo () { print "foo"; }
> > undef &foo;
> > eval 'sub foo () { print "bar"; }';
> > ---

You might be interested in the fact that perl@11711 doesn't generate the
warning.

> Drop the C<undef &foo> and use a C<no warnings 'redefine'>
> 
>     {
>         no warnings 'redefine';

To suppress the warning (with perl 5.6.0), the category should be 'prototype'.

>         eval q{ sub foo () { print "bar"; } };
>     }

Thread Previous | Thread Next


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