Stickybit:

When the documentation of a module doesn't give you quite enough detail, I find it helpful to go to the tests (./t/) directory for the module, and then grep the files to find which tests exercise the function of interest. Then you can see how to call the function. One advantage of this method is that authors try to make the tests as small as possible, so it won't be cluttered up with a bunch of extraneous things you don't need.

I don't have PDF::Builder on my machine, so I just chose a module at random (Ref::Util) from my cpan folder and scanned through the test directory for the test files that use the "is_plain_hashref(" function:

$ grep -r "is_plain_hashref(" .cpan/build/Ref-Util-0.204-0/t/*.t .cpan/build/Ref-Util-0.204-0/t/all-permutations.t: is_p +lain_hashref($value), .cpan/build/Ref-Util-0.204-0/t/all-permutations.t: "is_ +plain_hashref($plain_type) is true", .cpan/build/Ref-Util-0.204-0/t/all-permutations.t: !is_ +plain_hashref($value), .cpan/build/Ref-Util-0.204-0/t/all-permutations.t: "is_ +plain_hashref($plain_type) is false", .cpan/build/Ref-Util-0.204-0/t/all-permutations.t: !is_plai +n_hashref($value), .cpan/build/Ref-Util-0.204-0/t/all-permutations.t: "is_plai +n_hashref($blessed_type) is false", .cpan/build/Ref-Util-0.204-0/t/functions.t: is_plain_hashre +f => is_plain_hashref($value), .cpan/build/Ref-Util-0.204-0/t/magic-readonly.t:ok( is_plain_hashref($ +rh2), 'They are not plain!' );

From here, you can simply look at the test files and see how they do it.

Note: for poorly-tested modules, you may not find anything useful. But in that case, how interested are you in using the module? :^P

...roboticus

When your only tool is a hammer, all problems look like your thumb.


In reply to Re: Images with PDF::Builder by roboticus
in thread Images with PDF::Builder by Stickybit

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.