Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

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

Hmm, yeah, sounds like an interesting use case.

You might not even need Type::Params. The Tuple type from Types::Standard might be sufficient. Something like:

use Types::Standard -types; my $row_type = Tuple[ Str, Str, Int, Bool, Optional[Num] ]; my $row_check = $row_type->compiled_check; while (my $row = $csv->get_line($fh)) { $row_check->($row) or die $row_type->get_message($row); }

If you've got Type::Tiny::XS installed, and your row specification is simple enough, you might even find that $row_type was able to generate $row_check as an xsub. (Off the top of my head, I don't think the one in the example is, as I don't think Optional is implemented in XS yet.)

If you end up with something cool, I would love to see and maybe incorporate it or something like it into the documentation.


In reply to Re^2: Type::Tiny 1.8.0 released by tobyink
in thread Type::Tiny 1.8.0 released by tobyink

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 cooling their heels in the Monastery: (4)
As of 2024-04-25 16:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found