Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Can not remove 'redefined' warning

by grondilu (Pilgrim)
on Jun 08, 2012 at 13:28 UTC ( #975161=perlquestion: print w/ replies, xml ) Need Help??
grondilu has asked for the wisdom of the Perl Monks concerning the following question:

I have a package where I redefine the multiplication operator defined in Math::BigInt:

use bigint; package MyPackage; sub F; ... package Math::BigInt; no warnings 'redefine'; use overload '*' => sub { return ref($_[1]) eq 'MyPackage' ? MyPackage::F($_[0], $_[1]) : $_ +[0]->copy->bmult($_[1]); };

Unfortunatly the 'no warnings "redefine"' doesn't suppress a 'subroutine Math::BigInt::(* redefined at...' warning.

What am I missing?

Comment on Can not remove 'redefined' warning
Download Code
Replies are listed 'Best First'.
Re: Can not remove 'redefined' warning (no)
by tye (Cardinal) on Jun 08, 2012 at 13:56 UTC

    warnings.pm has lexical scope and so your use of it has no impact on the actual assignment code inside of overload.pm.

    package Math::BigInt; no overload '*'; use overload '*' => sub { ... };

    - tye        

      It works! Thanks a lot :) !

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://975161]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (18)
As of 2015-07-30 20:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls