Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

You say that the above isn't satisfactory for 'singletons'.

Because you're using two screens of fragile and complicated code to replace two lines of code.

To invoke the code, I called a sub 'instance_vars', that was in a begin block.

No, it's not in a BEGIN block. The sub's definition is in a BEGIN block, but I already indicates how that's useless.

Aren't they global variables to each package that are initialized only once

No, they're initialised by the constructor, any number of times.

and then retain their value as global variables in each package (or accessible via package::var) from without the package?

That may be, but you access them via method calls.

I think you are showing me an alternate way of doing what I'm doing, but I don't think it's answering my question

I did. Like I said, you called it too late. You only call class_vars after you try to compile the code that uses them. All I did was made a change to call it earlier.


In reply to Re^3: More Macro work...out to export a definition to next-outer level? by ikegami
in thread More Macro work...out to export a definition to next-outer level? by perl-diddler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-20 04:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found