Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Images with PDF::Builder

by roboticus (Chancellor)
on Sep 12, 2019 at 16:34 UTC ( #11106078=note: print w/replies, xml ) Need Help??


in reply to Images with PDF::Builder

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11106078]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2020-05-27 23:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (162 votes). Check out past polls.

    Notices?