Pod::Snippets

Extract and reformat snippets of POD so as to use them in a unit test (or other Perl code)
Download

Pod::Snippets Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Dominique QUATRAVAUX
  • Publisher web site:
  • http://search.cpan.org/~domq/

Pod::Snippets Tags


Pod::Snippets Description

Extract and reformat snippets of POD so as to use them in a unit test (or other Perl code) Pod::Snippets is a Perl module that extract and reformat snippets of POD so as to use them in a unit test (or other Perl code).SYNOPSIS use Pod::Snippets; my $snips = load Pod::Snippets($file_or_handle, -markup => "test"); my $code_snippet = $snips->named("synopsis")->as_code; # ... Maybe borg $code_snippet with regexes or something... my $result = eval $code_snippet; die $@ if $@; like($result->what_happen(), qr/bomb/);The Perl code that we want to extract snippets from might look like this: package Zero::Wing; =head1 NAME Zero::Wing - For great justice! =head1 SYNOPSIS =for test "synopsis" begin use Zero::Wing; my $capitain = Zero::Wing->capitain; =for test "synopsis" end =cut # ... 1;This class is a very simple extension of Pod::Parser that extracts POD snippets from Perl code, and pretty-prints it so as to make it useable from other Perl code. As demonstrated above, Pod::Snipets is immediately useful to test-driven-development nutcases who want to put every single line of Perl code under test, including code that is in the POD (typically a SYNOPSIS section). There are other uses, such as storing a piece of information that is both human- and machine-readable (eg an XML schema) simultaneously as documentation and code. Requirements: · Perl


Pod::Snippets Related Software