Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Reading through old stuff...(I sometimes do)...

I do not understand what you are trying to say.

use mem, which for simple assignments, I've found can be more easily simplified to:

use mem ($::INC{'Dbg.pm'}=1);
is a substitute for the UGLY BEGIN block. If there is a more structured way to do it that is prettier, please tell me, but I find BEGIN blocks to be ugly -- I don't like all caps keywords -- they are hard to type and bother my RSI when I do it. So I tend to find lower cost workarounds.

But the bit you said about "use mem 'Dbg'" -- I don't understand -- are you thinking or saying that such would be a substitute for the previously mentioned code or that I should write a separate module to make it so? If it is the latter, yeah, I could, but its a tradeoff. Any module that doesn't have mem in it's library path can recreated it in 1 line:

BEGIN{$::INC{mem.pm}=1}
After that, I can use mem and anything on it's parameter line will be evaluated at BEGIN time without all those ugly BEGIN blocks.

The most common usage I have for use mem (besides assigning to INC so a module in the same file doesn't have to be loaded), is to assign to ISA and EXPORT at BEGIN time, so various modules, including Exporter will work correctly.

Exporter won't work fully if you don't do that. It will include the functions you want -- but not their types. I try to always use typed functions. You only get the benefit of that typing if you have your EXPORT list included at BEGIN time.... usemem does that.

So I'm not sure what you are suggesting I write a module that would have to be included to provide syntactic sugar so it looks nicer? (not necessarily a bad thing, but right now utility beats pretty... pretty comes after it's working -- and I do go back and pretty up code...but usually on a 2nd revision...1st revision is to get it working)...

Is that wrong, or what are you suggesting?


In reply to Re^4: Correct syntax for using $INC to keep modules in same file by perl-diddler
in thread can't import using exporter 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 having an uproarious good time at the Monastery: (2)
As of 2024-04-24 18:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found