Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

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

Update:

  • I thought you wanted the hashes stored in another file, if that's not the case then have a look at getopt::long for argument passing.

    else you can just test argv0:
    if($ARGV[0] eq "first"){ dump $firsthash; }
  • Disregard above, I got it right the first time... I think?
  • Updated the part about a separate conf language for clarification


  • It seems like it boils down to HOW you are storing your hashes.
    If you are only interested in pure data storage, then you might want to have a look at the YAML format. If you want to be able to extend your application and dont care about the computation cost, create a package, load it and export whatever you need.

    On the other end of the spectrum (I put this possibility last for a good reason) if you want to use said hashes for configuration purposes but still need some logic to be applied to them (from within so you can have a consistant api and thus blurring the line between configuration files and "proto plugins") you might want to have a look at a specialised language(lua) and its just in time compiler. As it should give you C like performances its something to explore as well. You can even get it to play nice with perl.

    Thats it for the doc part, what have you tried? You could easily use the do command after filtering the file content to select what you want to execute, or (cleaner imo) go the package way.

    Hope that helps, keep in mind its only my brand of fishing so you might want to keep asking around.


    In reply to Re: Working with Hashes by QuillMeantTen
    in thread Working with Hashes by LovePerling

    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 lurking in the Monastery: (6)
As of 2024-04-25 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found