Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re^9: Constant subroutine main::C redefined

by tinita (Parson)
on Sep 10, 2012 at 13:50 UTC ( #992763=note: print w/replies, xml ) Need Help??

in reply to Re^8: Constant subroutine main::C redefined
in thread Constant subroutine main::C redefined

so what about delete $main::{C}? did you try?

Replies are listed 'Best First'.
Re^10: Constant subroutine main::C redefined
by BrowserUk (Pope) on Sep 10, 2012 at 14:37 UTC

    It works in main, but the target won't always be main. Still trying to get the syntax right for an arbitrary package.

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

    /divp align=right
      no strict "refs"; my $p = "main"; delete ${ $p."::" }{C};
      String eval for sub definition might be helpful here, though I don't know if that messes with the optimization. Minus that,
      sub FOO(){23}; BEGIN{eval sprintf 'delete $%s::{FOO}', __PACKAGE__} sub FOO(){42};
      might hit your need.

      #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992763]
NodeReaper writes the same droll phrase again

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2018-06-21 01:02 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.