Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

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

Please use typeglob not glob in future to avoid confusion with the glob function. Perl typeglobs have a notoriously obscure syntax. They are rarely used in high-level user code. They are often used in low level system code and when building tools. Some background and references:

Though I've used typeglobs occasionally, for example in an automated testing hack to verify a file being used by a module contained the expected content, their syntax always does my head in. That I'm no typeglob expert is proved by not finding Ton's famous winning typeglob hack, despite hacking away for a whole week in Christmas 2006. :)

References added later:

  • The Symbol Table Describes Itself: examples comparing Perl, Raku and Python (especially task 2). Note that typeglobs do not exist in Raku because the sigil is part of the name stored in a symbol table, while in Perl 5 the name is stored without the sigil.
  • Test::More - this core module uses a cute typeglob alias (sub isnt { ... } *isn't = \&isnt) allowing you to write isn't in your tests, as an alternative to isnt
  • Dollar Bracket Star ${*...} by snoopyjc (2021)

Updated: Changed title from glob to typeglob in step with xiaoyafeng. Added more examples of typeglobs long after original reply was made.


In reply to Re: Is typeglob feature really useful? (typeglob references) by eyepopslikeamosquito
in thread Is typeglob feature really useful? by xiaoyafeng

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 examining the Monastery: (3)
As of 2024-04-26 03:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found