Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^9: Constant subroutine main::C redefined

by tinita (Parson)
on Sep 10, 2012 at 13:50 UTC ( [id://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 (Patriarch) 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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (9)
As of 2024-04-23 10:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found