Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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?


Comment on Re^9: Constant subroutine main::C redefined
Download Code
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
      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.

      no strict "refs"; my $p = "main"; delete ${ $p."::" }{C};

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-07-30 22:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (241 votes), past polls