Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^3: 'use subs' causes method to vanish

by chromatic (Archbishop)
on Feb 05, 2009 at 22:51 UTC ( #741721=note: print w/replies, xml ) Need Help??

in reply to Re^2: 'use subs' causes method to vanish
in thread 'use subs' causes method to vanish

I only encountered this because I used a script to use subs for all subs, to be able to begin to get rid of parentheses for non-object subs.

As you've seen, that's a bad idea. If you're rigorous about the order in which Perl compiles your code, you can get away with it... but I like to avoid code which relies on a well-defined order of appearance in the compilation process, as it seems fragile.

  • Comment on Re^3: 'use subs' causes method to vanish

Replies are listed 'Best First'.
Re^4: 'use subs' causes method to vanish
by gnosti (Hermit) on Feb 05, 2009 at 23:56 UTC
    Hi chromatic,

    I'm honored. I agree that it's not a good idea to code using fragile features. In this case, I can't get my updated test case to break whereever I place my 'use subs' statement. I'm curious, because I expect use subs to be part of the extremely beaten-on core of the core of perl. I'm also curious, because I've found such suprising behavior in my bugs that I wondered if it might be worth exploring them more, rather than just fixing or working around them and moving on.

      The subs pragma is fine. The fragile part of the code is the use of barewords.

      You don't see any trouble in your single file because it's a single file. When you start exporting subs and pulling in classes and packages from other files, then life can get complicated. There are some seven to ten cases of bareword disambiguation in the Perl 5 lexer, and almost no one can enumerate all of them; the complexity of those heuristics and the fact that even experts have trouble remembering all of the ways things that go weird make me want to avoid them where possible.

        And here I thought I was in a coding-style backwater 'cos of all the parentheses cluttering my code. I'll look at them with different eyes. Seems like avoiding use of barewords is a good topic for Modern Perl.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://741721]
[marto]: yeah, so our hackerspace, we run mailman. that's a public discussion list, not a weekly buy our crap marketing list, people can unsubscribe at any time. What they can't do is delete their mails from the archive, or from the inboxes of our hundreds of user
[Corion]: marto: I'm not sure on how to treat mail archives. I think you could either set an auto-deletion timespan or an auto-anonymisation timespan if you wanted to do it right.
[Corion]: For PM, I think we'll create a user "gdpr", who gets assigned the nodes of users who want to give up their user status here.

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2018-05-22 08:26 GMT
Find Nodes?
    Voting Booth?