Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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]
and monks are getting baked in the sun...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2018-05-27 19:28 GMT
Find Nodes?
    Voting Booth?