Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

An excellent recommendation, just keep in mind that EPP is getting a little long in the tooth. It came out in pre-5.005 days so some recommendations are no longer really optimal. An example that comes readily to mind since I just happened to be thumbing through my copy the other day: it recommends avoiding the overhead of /o on dynamically generated regexen by creating an anonymous coderef using string eval and calling that instead.

## not the exact code, but a close facsimile from memory: sub make_matcher { eval qq{sub { \$_[0] =~ /$_[0]/o } } } my $matcher = make_matcher( "dynamic" ); if( $matcher->( "dynamicorama" ) ) { # ... }

Nowadays you can use qr// and get the same performance with less scaffolding (presuming Perl newer than 5.6.1 if I'm recalling correctly from the recent threads here on the topic).

So keep in mind the vintage of the advice. 85%+ of it is probably still germane as is, and the remainder is sound underneath but needs slight tweaks. Of course now I probably should actually get around to swiping a coworker's PBP and reading it this weekend. :)


In reply to Re^2: Best Perl Practices reviews? by Fletch
in thread Best Perl Practices reviews? by Anonymous Monk

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? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2023-02-09 03:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (44 votes). Check out past polls.

    Notices?