Pod-Simple-3.43/0000755000175000017500000000000014066435222011564 5ustar khwkhwPod-Simple-3.43/Makefile.PL0000644000175000017500000000511514062242374013540 0ustar khwkhw# This -*- perl -*- script writes the Makefile for Pod::Simple # # Time-stamp: "2004-05-24 00:21:20 ADT" # # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. # require 5; use strict; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( NAME => 'Pod::Simple', VERSION_FROM => 'lib/Pod/Simple.pm', ABSTRACT_FROM => 'lib/Pod/Simple.pod', TEST_REQUIRES => { # RT#29439 'Test' => 1.25, }, PREREQ_PM => { 'Text::Wrap' => '98.112902', 'Pod::Escapes' => '1.04', # And finally, things I don't have any particular version in mind for: map { ; $_ => 0 } qw[ File::Spec File::Basename Cwd Config Carp overload Symbol strict if integer File::Find Test::More ] }, INSTALLDIRS => $] >= 5.009003 && $] <= 5.011000 ? 'perl' : 'site', LICENSE => 'perl', AUTHOR => 'Allison Randal ', META_MERGE => { "meta-spec" => { version => 2 }, resources => { homepage => 'https://metacpan.org/pod/Pod::Simple', license => 'http://dev.perl.org/licenses/', repository => { url => 'git://github.com/perl-pod/pod-simple.git', web => 'https://github.com/perl-pod/pod-simple', type => 'git', }, bugtracker => { web => 'https://github.com/perl-pod/pod-simple/issues', mailto => 'bug-pod-simple@rt.cpan.org', }, x_MailingList => 'https://lists.perl.org/list/pod-people.html', }, prereqs => { runtime => { recommends => { 'Encode' => 2.78, # Pod::Simple's new default code page (1252) is # pre-compiled in 2.78, which improves performance. }, }, }, }, ); unless ( eval { ExtUtils::MakeMaker->VERSION('6.63_03') } ) { $WriteMakefileArgs{BUILD_REQUIRES} = { %{ delete $WriteMakefileArgs{TEST_REQUIRES} || {} }, %{ $WriteMakefileArgs{BUILD_REQUIRES} || {} }, }; } unless ( eval { ExtUtils::MakeMaker->VERSION('6.55_01') } ) { $WriteMakefileArgs{PREREQ_PM} = { %{ delete $WriteMakefileArgs{BUILD_REQUIRES} || {} }, %{ $WriteMakefileArgs{PREREQ_PM} || {} }, }; } WriteMakefile(%WriteMakefileArgs); package MY; sub libscan { # Determine things that should *not* be installed my ( $self, $path ) = @_; return '' if $path =~ m/~/; $path; } __END__ Pod-Simple-3.43/README0000644000175000017500000000322314062242374012444 0ustar khwkhwPod::Simple Pod::Simple is a Perl library for parsing text in the Pod ("plain old documentation") markup language that is typically used for writing documentation for Perl and for Perl modules. The Pod format is explained in the file shipped with Perl5; the most common formatter is called . Pod formatters can use Pod::Simple to parse Pod documents and render them into plain text, HTML, or any number of other formats. Installation To install this module, type the following: perl Makefile.PL make make test make install Support Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail list. Send an empty email to pod-people-subscribe@perl.org to subscribe. This module is managed in an open GitHub repository, . Feel free to fork and contribute, or to clone it and send patches! Patches against Pod::Simple are welcome. Please send bug reports to . Copyright and Disclaimers Copyright (c) 2002 Sean M. Burke. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. Author Pod::Simple was created by Sean M. Burke . But don't bother him, he's retired. Pod::Simple is maintained by: * Allison Randal * Hans Dieter Pearcey * David E. Wheeler * Marc Green Pod-Simple-3.43/META.json0000644000175000017500000000375114066435222013213 0ustar khwkhw{ "abstract" : "framework for parsing Pod", "author" : [ "Allison Randal " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Pod-Simple", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "recommends" : { "Encode" : "2.78" }, "requires" : { "Carp" : "0", "Config" : "0", "Cwd" : "0", "File::Basename" : "0", "File::Find" : "0", "File::Spec" : "0", "Pod::Escapes" : "1.04", "Symbol" : "0", "Test::More" : "0", "Text::Wrap" : "98.112902", "if" : "0", "integer" : "0", "overload" : "0", "strict" : "0" } }, "test" : { "requires" : { "Test" : "1.25" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-pod-simple@rt.cpan.org", "web" : "https://github.com/perl-pod/pod-simple/issues" }, "homepage" : "https://metacpan.org/pod/Pod::Simple", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/perl-pod/pod-simple.git", "web" : "https://github.com/perl-pod/pod-simple" }, "x_MailingList" : "https://lists.perl.org/list/pod-people.html" }, "version" : "3.43", "x_serialization_backend" : "JSON::PP version 4.02" } Pod-Simple-3.43/ChangeLog0000644000175000017500000010557314066433720013352 0ustar khwkhw # ChangeLog for Pod::Simple dist #--------------------------------------------------------------------------- 3.43 2021-06-28 Karl Williamson - Remove pod markup from README - Update homepage to metacpan - "use" not "require" Pod::Simple::TiedOutFH, (PR#131, Jim Keenan) 3.42 2020-11-10 Karl Williamson - Drop EUMM version prereq, Graham Knop++ 3.41 2020-10-09 Karl Williamson - Factorize tests functions in one helper module, Nicolas Rochelmagne++ - Support =head5, =head6, John M. Gamble++ - Support SOURCE_DATE_EPOCH, Bernhard M. Wiedemann++ - Enforce warnings for tests, Nicolas Rochelmagne++ - Add github CI, atoomic++ - suppress "UTF-16 surrogate 0xd800" warning, Shoichi Kaji++ 3.40 2019-10-23 Karl Williamson - Fixed iusse #108, Roy Storey++ - Make case sensitivity determination overridable by user, Kenneth Ölwing++ - Add expand_verbatim_tabs() method, which also can turn off expansion, fixing #110 3.39 2019-06-30 Karl Williamson - Fixed JustPod not opening file with :raw. Spotted by Dave Mitchell. Fixed by James Keenan - Fixed garbage line looking like pod. Spotted by Todd Rinaldo. - Finished fixing Issue 95 by adding note that = in column 1 can be misinterpreted as pod. 3.38 2019-05-30 Karl Williamson - Removed some alien files that somehow got in the tar, including a copy of Pod::Escapes. Spotted by Petr Pisar++ 3.37 2019-05-30 Karl Williamson - Suppressed some expected diagnostics under harness - Pod::Simple now depends on the 'if' module 3.36 2019-05-15 Karl Williamson - Added Pod::Simple::JustPod to extract the pod lines from a file - Improved detection of input encoding CP1252 vs UTF-8 - Fixed github issue #79, =cut event out of order - Fixed github issue #85, verbatim_indent doesn't work on HTML - Fixed github issue #89, css files refer to themselves - Fixed github issue #92, broken RTF with Unicode inputs - Extended RTF to handle Unicode code points above 0xFFFF - Nested L<> is now flagged as an error - Turned off negative repeat count does nothing warnings - Fixed/improved some docs about this distribution 3.35 2016-11-29 Karl Williamson - Needed to 'make manifest' before uploading to CPAN. No changes beyond version bump 3.34 2016-11-29 Karl Williamson - Stabilize t/search50.t. Thanks to rurban for the patch! - Turn off utf8 warnings when trying to see if a file is UTF-8 or not. 3.32 2015-11-02 Marc Green - Fixed failing tests on Windows. Thanks to A. Sinan Unur for the patch! - Switched debugging output from STDOUT to STDERR. Should rarely be used, but modules that do depend on debugging output might need to change how they handle it. Patch from Karl Williamson (GitHub Pull Request #76). - Added errata_seen() to make POD errors easily accessible. Thanks to Sean Zellmer for the pull request! 3.31 2015-08-23 Marc Green - No changes since 3.30_1. 3.30_1 2015-07-19 Marc Green - Simplified the detection of case-insensitivity in Pod::Simple::Search. - Fixed "Use of uninitialized value $1 in lc" warning in Pod::Simple::Search. - If @INC includes the current directory symbol, '.', the survey() method of Pod::Simple::Search no longer excludes it from its list of directories to search. Instead, The survey() and find() methods now both exclude duplicate directories from @INC (RT #102344). - Moved source repository and updated links to new perl-pod GitHub organization: https://github.com/perl-pod/pod-simple. - Improved repository links and added GitHub issue tracking link to the distribution metadata. - Switched from File::Spec's catdir to catfile for path names, to fix failures on VMS. Also now use Unix path semantics where they're not required to be platform-specific. Thanks to Craig A. Berry for the patch (RT #105511). - Improved the example use of the 'html_encode_chars()' method in the Pod::Simple::XHTML documentation. Patch from Randy Stauner. 3.30 2015-02-23 David E. Wheeler - No changes since 3.29_6. 3.29_6 2015-02-19 David E. Wheeler - The survey() method in Pod::Simple::Search now ignores duplicate files with varying lettercasing on case-insensitive file systems. This allows - When pondering files in a given directory, the survey() method in Pod::Simple::Search now prefers files with extensions in the following order: no extension, .pod, .pm, .plx, .pl. - The find() method in Pod::Simple::Search now records the './pod' subdirectory of each directory it considers in such a way as to preserve its case on the file system. - The find() method in Pod::Simple::Search now tries harder to find the proper file on case-insensitive file systems when searching for modules starting with "Pod". For example, when searching for 'Pod::Perldoc' it now returns a file ending in 'Pod/Perldoc.pm' instead of 'Pod/perldoc.pod', as the latter is actually the documention for the 'perldoc' program. 3.29_5 2015-02-17 David E. Wheeler - No changes except that the release tarball should no longer be empty. 3.29_4 2015-02-16 David E. Wheeler - Removed "Caveats" from the docs. Pod::Simple has been out of beta for years. - The survey() method in Pod::Simple::Search no longer assumes that files ending in '.pod' are actually Pod. Like .pm and .pl files, .pod files must contains at least one valid POD command, as documented. This brings the behavior in line with find(), which already required that .pod files contain Pod. - The survey() method in Pod::Simple::Search now prefers files ending in .pod over those ending in .pm, and .pm over those ending in .pl, when it finds duplicate pod files for a given name. 3.29_3 2015-02-11 David E. Wheeler - Tightened up the first pass at recognizing a Pod command so that fewer invalid Pod lines will be recognized. Suggested by Randy Stauner. - Fixed bug where Pod::Simple would attempt to call utf8::unicode_to_native on Perl 5.6, where that function does not exist. - Typos and minor wordsmithing changes in Pod::Simple::Subclassing, thanks to Randy Stauner. - The Pod::Simple::Search survey() and find() methods now use the same code for determining @INC directories to search. The only difference is that find() also includes $Config::Config{'scriptdir'}. 3.29 2015-01-13 David E. Wheeler - NOTE: This will be the last release of Pod::Simple to support versions of Perl earlier than 5.6. - Fixed test failure for unsupported encoding on Perl 5.6. - Removed unnecessary dependency on constant. Reported by Petr Pisar (RT #85578). - Many documentation and comment typos fixed by David Steinbrunner. - Fixed issue when an encoding is declared via an '=encoding' directive *after* Pod::Simple has already detected an encoding. Thanks to Graham Knop for the patch and Patrice Dumas for the tests. - Added '>&STDERR' as an output to better emulate Pod::Parser::parse_from_file(). Florent Angly. - Tidied the description of the different Pod::Simple interfaces, with greater emphasis on the four different steps to subclassing. Florent Angly. - Added the 'top_anchor' attribue to Pod::Simple::HTML, to allow specification of a custom top anchor format. Gabor Szabo. - Fixed the text formatter to properly set the Text::Wrap overflow policy. Thanks to Nigel Metheringham for the fix! - Fixed mis-matched quotation marks when adding JavaScript elements to the XHTML output. Patch from jonathancast. - Fixed issues on EBCDIC. Patch from Karl Williamson (GitHub Pull Request #58). - Fixed bug where the value passed to Pod::Simple::XHTML's html_css() method would be output twice. Thanks to Andrew Johnson for the report (RT #99303). - Documented the 'recurse' attribute of Pod::Simple::Search. Thanks to Jim Keenan for the report (RT #91886). - An error is no longer thrown when '=encoding' directives are found on subsequent lines. Instead, we now log a an error message, "Cannot have multiple =encoding directives" (RT #91757). - The HTML and XHTML formatters now do a better job of preserving lines in 'begin html' blocks. Fixes a bug that dates from 2002 (Perl RT#9385, CPAN RT #91851). 3.28 2013-05-04 David E. Wheeler - Removed use of 'done_testing' in t/white.t, which was added in v3.27. Thanks to Paul Howarth for the catch. - Fixed inproperly calculated number of skipped tests in t/xhtml01.t when HTML::Entities is not intalled. 3.27 2013-05-03 David E. Wheeler - Added new warnings as defined by Pod::Checker, thanks to RJBS: + "=over" without "=back" + "L<>" starts or ends with whitespace + raw "|" or "/" in "L" text - Added ->keep_encoding_directive, which is false by default, to prevent formatters from emitting a document's '=encoding' directive in most cases. That they emitted the encoding was a bug introduced in v3.26 (RT #84093). Now, only the DumpAsText and DumpAsXML formats set it to true. Patch from Patrice Dumas. 3.26 2013-02-27 David E. Wheeler - Fixed another test script to skip all tests when Encode is not installed. - Added 'encoding()' and 'detected_encoding()' to return the current encoding and the encoding actually to decode the input file. The value from "=encoding" is also now kept in the output tree. Patch from Patrice Dumas (RT #74390). 3.25 2013-02-16 David E. Wheeler - Improved the warning when "=item" types mismatch within one "=over"/"=back" block. 3.24 2013-02-14 David E. Wheeler - Fixed corner case bug for unlikely scenario in which non-UTF-8 text could be parsed as UTF-8. Grant McLean. - XHTML IDs can no longer end with punctuation. Thanks to Smylers for the patch. - Fixed test failure on Perl 5.6.2. - Changed the default installation location from "perl" to "site" on 5.12 and higher, since as of that version of Perl, dual-life modules no longer need to be installed in "perl" to replace in-core versions. Patch from tzccinct. - Fixed hash order dependency test failures on Perl 5.17. Thanks to Yves Orton for the patch. - Inlined the code that tries to guess a Pod file's encoding. This reduces the time Pod::Simple takes to build the core Perl documentation by 15-20%. Thanks to Dagfinn Ilmari Mannsåker for the patch! - Added a warning when "=item" types mismatch within one "=over"/"=back" block. Marc Green/Google Summer of Code, with assist from RJBS. - Fixed regression introduced in 3.22 in which "C< >" tags were incorrectly treated as verbatim text in table of contents items emitted by Pod::Simple::XHTML. Thanks to Randy Stauner for the report and to Thomas Sibley for the fix! - Loosened up the matching of "L< >" tags for man pages so that they allow names with dots, underscores, and any other chararacters other than "/", just so long as they end in '[(][-a-zA-Z0-9]+[)]'. Thanks to Dave Rolsky and Kevin Ryde for the reports (RT #82975 & RT #82972). - Fixed inverted mapping of "keyboard" to "kbd" in Pod::Simple::HTML. Thanks to Robert Boisvert for the bug report (RT #79201). - Added two new Tagmap entries to Pod::Simple::HTML: "preformat" maps to "pre", and "teletype" maps to "tt". Suggested by Robert Boisvert (RT #79201). - "X< >" tags are now ignored by the pull parser when it searches for titles, as is any trailing whitespace. Thanks to Patrice Dumas for the report (RT #74389). 3.23 2012-08-14 David E. Wheeler - Eliminated nested elements in table of contents (index) items output of Pod::Simple::XHTML. This was especially problematic for headers that included links, as the TOC then got nested anchor elements, which simply would not work. Thanks to Ben Bullock for the report and test case (RT #77686). - Fixed semantically invalid nested XHTML generated by Pod::Simple::XHTML since v3.21. Gisle Aas. - Improved support for nested "C< >" tags in Pod::Simple::XHTML. Gisle Aas. - No longer tries to decode a string with the "utf8" flag set, as the double-decoding only triggered an error. Grant McLean. - Added documentation note that the API expects encoded text (octets). Grant McLean. - Added "parse_characters()" option to specify that strings to are already decoded from octets into characters. Grant McLean. 3.22 2012-05-27 David E. Wheeler - Fix but where Pod::Simple would whine about non-ASCII bytes in code or comments. Now only does so for Pod (in the absence of an "=encoding" tag. Broken in 3.21. Grant McLean. 3.21 2012-05-23 David E. Wheeler - NOTE: COMPATABILITY CHANGE: The 'codes_in_verbatim' option in Pod::Simple::XHTML is no longer enabled by default. This brings it agreement with the other formatting classes, and eliminates unexpected behavior in XHTML-formatted Pod. Users who depended on this functionality can still get it by enabling 'codes_in_verbatim' in their code. - Fixed some typos in the documentation. Thanks to Jonathan Yu via the Debian packagers via Florian Ragwitz (RT #75532). - Now emit a warning the first time a non-ASCII byte is encountered when no "=encoding" has been seen. Grant McLean. - When a non-ASCII byte is encounted before an "=encoding" line has been seen, a heuristic (as described in perlpodspec) is applied to select UTF-8 encoding if the non-ASCII bytes form a valid UTF-8 byte sequence, or Latin-1 otherwise. Grant McLean. - Added 'handle_code' method to Pod::Simple::XHTML. This allows subclasses to override the handling of verbatim blocks, and makes for a more cohesive interface, to boot. Gisle Aas. - Subsequent text segments are now joined together and passed as a single unit to text handling code. This makes it easier for custom handlers to process complete blocks of text in a single call to 'handle_text', rather than in dribs and drabs. Gisle Aas. - Replaced naive text wrapping code in Pod::Simple::DumpAsXML with Text::Wrap, which was already used for similar purposes elsewhere in Pod::Simple. Gisle Aas. 3.20 2012-03-01 David E. Wheeler - Removed use of 'done_testing' in t/xhtml15.t, which was added in v3.19. Thanks to Paul Howarth for the catch. - Fixed quoting of links in a regular expression Pod::Simple::Text. Reported by Father Chrysostomos. - Fix test failure on case-insensitive, non-case-preserving file systems (VMS I'm looking at *you*). Patch from Craig A. Berry. - Pod::Simple::HTML no longer emits "href='#___top'" if a TOC (index) is not output. Patch from Rick Myers. - Fixed links in the TOC of XHTML output to use IDs derived from encoded text, rather than raw Pod, so that it will link to the ID actually generated for the section. Thanks to Randy Stauner for the report (with test case!) (RT #72544). - PullParser now throws an exception on an attempt to set a source more than once. Necessary because data from the previous source will be cached, so the new source would be ignored anyway. Create a new PullParser, instead. Thanks to Paul Boldra for the report (RT #74265). 3.19 2011-08-23 David E. Wheeler - Fixed occasional test failure when tests are run in parallel (HARNESS_OPTIONS=j6:c). Thanks to Alexei Znamensky for the report and Marc Green for the fix. - Added "pod_handler" option. This is a callback that can be used to inspect the content on a "=pod" line. Marc Green/Google Summer of Code. - Added tests for proper line-ending parsing from the previous release. The tests were in the repository, but didn't make it into the MANIFEST or, therefore, the release. Reported by Marc Green. - Added the "parse_empty_lists" option. When enabled, Pod::Simple will recognize empty lists (that is, a blocks with '=over' and '=back' but nothing in between). Disabled by default. Marc Green/Google Summer of Code. - Added the "whiteline_handler" attribute. It's much like "code_handler", "cut_handler", and "pod_handler", except it's triggered on lines that contain only whitespace characters. Marc Green/Google Summer of Code. - Added "raw" attribute to L<> treelet that contains the L<>'s raw contents. Marc Green/Google Summer of Code. - Pod directives autoclosed by Pod::Simple are now denoted as such by the new "fake_closer" attribue. Marc Green/Google Summer of Code. - Fixed incompatibility with Pod::Simple::HTMLBatch in Pod::Simple::XHTML. Patch by Eric Johnson. 3.18 2011-07-16 David E. Wheeler - Pod::Simple now properly parses Pod files using Mac OS Classic line- endings (\r). Marc Green/Google Summer of Code. - Fixed test failure in 't/search50.t when the test finds a .pod but the module is in a .pm. Thanks to the cpan-testers who reported this when the test searched for Capture::Tiny. 3.17 2011-07-09 David E. Wheeler - Documented tertiary methods. Patch from Shawn H Corey. - Added "backlink" option to Pod::Simple::XHTML. Thanks to Marc Green/Google Summer of Code for the pull request. - Typos fixed in Pod::Simple::HTMLBatch. Reported by Shawn H Corey. - Fixed quoting of value returned by a "strip_verbatim_indent()" code reference so that regex meta characters are properly escaped. - Added "anchor_items" option to Pod::Simple::XHMTL. This allows text items (which are output as
elements) to have IDs that can be referenced in the "#" part of a URL. Marc Green/Google Summer of Code. - Added "recurse" option to Pod::Simple::Search. It's enabled by default; disable it to turn off recursion into subdirectories. Marc Green/Google Summer of Code. - Added documentation to clarify the behavior of the "content_seen" method. Thanks to Olaf Alders for the pull request. 3.16 2011-03-14 David E. Wheeler - Fixed invalid HTML generated for nested lists by Pod::Simple::XHTML (Fitz Elliott). - Replaced the invalid "" tag -- created for "S<>" -- with '' (Fitz Elliott). - Fixed some nerbles in our own Pod (Michael Stevens) - Improved the "Minimal code" example in Pod::Simple::HTML. The key is to use pase_file(), not parse_from_file() (which should otherwise be undocumented, and is just there for Pod::Parser compatibility. Thanks to prodding from Ævar Arnfjörð Bjarmason (RT #65428). - Added the html_charset() and html_encode_chars() attributes to Pod::Simple::XHTML. Inspired by a bug report from Agent Zhang (章亦春) (RT #29587). - Added "Minimal code" example to the Pod::Simple::XHTML documentation. - Fixed mispelling of the "=encoding" markup in the parser (it was spelled "=encode"). Thanks to "TTY" for the patch. (RT #24820). 3.15 2010-11-11 David E. Wheeler - Removed "perlpod.pod" and "perlpodspec.pod". These now just live in the Perl core. - Fixed stylesheet names output by HTMLBatch to match the names of the actual stylesheet files (broken in 3.09). Thanks to Kevin Ryde for the report (RT #56725). - Added missing closing slash to the CSS links in the XHTML output. Thanks to HarleyPig for the patch! - Added parens around bar "qw(...)" in t/xhtml05.t. Thanks to Jerry D. Hedden for the patch. - Improved the Pod::Simple::HTML docs. Thanks to Gabor Szabo for the patch. - Pod::Simple::XHTML now properly encodes entities in URLs in the anchor tag. Thanks to John McNamara for the report (RT-60249). - Pod::Simple::HTML and XHTML now strip whitespace from the end of section names that appear as anchor names for headers (in HTML) and IDs (in XHTML). Such whitespace appeared when "X<>" entities were stripped out but not the space between them (RT-56572). - Make test "t/search50.t" always pass on case-insensitive file systems rather than just skip VMS. 3.14 2009-04-27 - Removed explicit loading of UNIVERSAL. RJBS. - Reversed the change applied in release 3.09 to fix RT #12239. POD tag found inside a complex POD tag (e.g., "C<<< I >>>") is again parsed as a tag embedded in a tag instead of text and entities. The previous interpretation of `perldoc perlpod` was mistaken. (RT #55602 from Christopher J. Madsen). 3.13 2009-12-17 David E. Wheeler - Removed deleted test file from MANIFEST. 3.12 2009-12-17 David E. Wheeler - Removed "All rights reserved" from all files. - Added acknowledgements to man.he.net and search.cpan.org for permission to link man pages and Perl module links to their sites in the output of Pod::Simple::HTML and Pod::Simple::XHTML. - Add "html_h_level" option to Pod::Simple::XHTML and ::HTML to allow a =head1 to become an

and so on. RJBS. - Add batch_mode_page_object_init() method to Pod::Simple::XHTML. This allows it to be used by Pod::Simple::HTMLBatch. - Fixed a regression in Pod::Simple::XHTML where '=begin html' blocks were incorrectly escaped rather than simply passed through unmolested. RJBS. - Removed the undocumented "fullstop_space_harden" attribute, which apparently was only used by Pod::Text a very long time ago. 3.11 2009-12-09 David E. Wheeler - Restored code to HTMLBatch that allows the TOC (index) to be created in batch jobs (RT #52324 from Martin J. Evans). - Added resources to META.yml, including bug tracker, license, and repository. - Turned man page links into links to man.he.net in Pod::Simple::HTML and Pod::Simple::XHTML output. Subclass and override resolve_man_page_link() to use a different URL. - Added the resolve_pod_page_link() and resolve_man_page_link() methods to Pod::Simple::XHTML to make it easier for subclasses to change the URLs created for POD and man page links. - Fixed the output of entities in L<> tags by Pod::Simple::XHTML. - Fixed the output of POD links from Pod::Simple::XHTML so that the section part (/foo) is turned into a proper fragment identifier (#foo) in the resulting search.cpan.org link. - Pod::Simple::Text now outputs URLs for links created in the L format. For example, L is now output as "Perl " rather than just as "Perl". - Updated perlpod.pod and perlpodspec.pod to sync up with Perl core (and to be released in Perl 5.12). Changes include: * Removing the prohibition against L * Deprecation of L
and L<"section"> * Legalization of "=begin formatname parameter" - A couple of bug fixes in Pod::Simple::HTML from Graham Barr. - Added the do_section() method to Pod::Simple::HTML. Graham Barr. - Word-smithed the "DESCRIPTION" a bit and wrote the README. - Synced up all module version numbers to 3.11 except for Pod::Simple::HTMLLegacy, which is at 5.01 and should not have its version number lowered. 3.10 2009-11-12 David E. Wheeler - Converted test files that had DOS endings to have Unix endings (RT #50922 from Steve Hay). - Skip tests on VMS where the lack of filename case preservation can wreak havoc (RT #51184 from Craig A. Berry). - Fix nested definition list format in the XHTML output (RT #51187 from Lars Dɪᴇᴄᴋᴏᴡ). - Added some files missing from the MANIFEST (and therefore the distribution) in the last two releases. 3.09 2009-10-27 Allison Randal - Add support for an index (TOC) in the XHTML output from David E. Wheeler. - Add strip_verbatim_indent() from David E. Wheeler. - Added the "nocase" option to PullParser's get_title(), get_version(), get_description(), and get_author() methods. This allows one to fetch the contents of those sections regardless of the case of the labels (e.g., "NAME" and "Name" and "name" are all valid). Graham Barr. - Added the search_class() accessor to Pod::Simple::HTMLBatch. David E. Wheeler. - XHTML output now properly encodes entities in all places, not just in verbatim blocks and code spans. David E. Wheeler. - Fixed XHTML to output definition lists when it should, rather than (broken) unordered lists. David E. Wheeler. - Fixed XHTML so that multiparagraph list items work correctly. David E. Wheeler. - Fixed XHTML ordered list output so that it does not include the number specified in the POD in the output. This is on a par with out the HTML output works. David E. Wheeler. - Applied URL patch from Leon Brocard for The Perl Journal archives. - Fixed test failures with older versions of HTML::Entities (RT #43903 from Salvador Tercia). - Changed CSS files generated by HTMLBatch to be no more than 8.3 characters long. (RT #40450 from Renee Baecker) - Added entity handling for E and E to Pod::Simple::XHTML. (RT #49615 from Chas Owens.) - Fixed a bug in Pod::Simple::HTML where a definition term item with no corresponding definition item would be output with no closing

. (RT # 37107 from Kevin Ryde). - Added entity handling for numeric entities to Pod::Simple::XHTML, following perlpod specification. - A POD tag found inside a complex POD tag (e.g., "C<<< C >>>") is now properly parsed as text and entities instead of a tag embedded in a tag. This is in compliance with `perldoc perlpod` (RT #12239 from Michael Schwern). - Thanks to David E. Wheeler for applying patches, resolving bugs, and generally getting ready for the release. 3.08 2009-07-16 Allison Randal - Fix installdirs for Perl versions where Pod::Simple was core; RT#36446 & RT#39709, thanks to Jerry Hedden. - Fix encoding handling for code in paragraphs; RT#45829, thanks to David Wheeler. 3.07 2008-06-04 Allison Randal - Fix module dependencies, make HTML::Entities optional and require Test::More. 3.06 2008-06-03 Allison Randal - Fix bugs related to passing $1 to File::Spec, reported by Andrew Hamlin and John McNamara. - Applied a suggested fix from Kevin Ryde to return a successful exit code when Pod::Simple::HTML is run from the command line. - Fix handling of complex L entries, thanks to tests supplied in RT#4896. - Fix incorrect handling of S<> entries made up of entirely whitespace, thanks to test case from Andreas Koenig. - Launch Pod::Simple::XHTML, an XHTML compliant, more easily extensible HTML formatter. - Add feature to parse additional text after =begin target as a block title, requested by Adam Kennedy. - Thanks to Hans Dieter Pearcey for applying patches, resolving bugs, and generally getting ready for the release. 3.05 2007-03-03 Allison Randal - Standardized all test files on 8.3 naming scheme for Perl core. - Applied test patches from Jerry Hedden for Perl core when Encode not installed. - Applied test patch from Ken Williams for 5.005_04 compatibility. - Applied a patch from Christopher Madsen to fix architecture directory searches on Gentoo. - Fixed a failing search test on Debian-based distributions caused by Debian stripping Pod documentation out of core modules. (Three cheers to the CPAN testers and James Ponza for sending enough reports that I could work out the pattern.) 3.04 2006-01-18 Allison Randal - Applied test patches for Perl core integration from Steve Peters. - Added a 'reinit' method to Pod::Simple::BlackBox for Russ Allbery so Pod::Man can provide backward compatibility to existing users (such as Module::Build and ExtUtils::MakeMaker). - Applied patch for extracting case-preserved package names on VMS from Craig Berry. 3.03 2005-11-21 Allison Randal - Applied whitespace patches for Pod::Man and Pod::Text from Russ Allbery. - Applied validation patches to Pod::Simple::HTML from Graham Barr. 3.02 2004-05-24 Sean M. Burke - Just fixing some typos in the CSS generated by Pod::Simple:HTMLBatch. 3.01 2004-05-24 Sean M. Burke - No big changes to the main modules, but there's many changes to the important Pod::Simple::HTML module. - Also, new modules: - Pod::Simple::HTMLBatch - Pod::Simple::HTMLLegacy - Pod::Simple::Progress - Pod::Simple::Search - and tests for these (well, most). - Some prettying up of the Makefile.PL. - The test 00about.t is a bit more careful and verbose now. - The docs are still incomplete, esp. for Pod::Simple::HTML and Pod::Simple::HTMLBatch, which I hope to improve quite soon. 2.06 2004-05-07 Sean M. Burke - Allison Randal brilliantly refactors a huge monolithic sub in Blackbox.pm. Code is now actually sanely readable! - I add the new option-attributes fullstop_space_harden and codes_in_verbatim, and the two methods abandon_output_string and abandon_output_fh. Not yet documented. - New test fullstop_spaces.t and new corpus document greek_iso_8859_7.pod. - Another version should be forthcoming in a few days that has the new Pod::Simple::HTML stuff in it. - Note to self: document =extend and =encoding in perlpodspec ASAP! 2.05 2003-11-04 Sean M. Burke -- bugfix version - In an attempt to stop Perl 5.6 versions from going completely crazy, I've tried to basically turn off all Unicode/utf8 support under 5.6. Under 5.8 and above, Unicode should work fine, and under 5.6, all Unicode characters should be replaced with a little "can't render" symbol, either a "¤" or a "?". Many many thanks to Jarkko Hietaniemi for helping out. - (Works under 5.005 now too?) 2.04 2003-10-10 Sean M. Burke -- minor bugfix version * Added some code to insulate Pod::Simple to runtime changes in the value of $/. Thanks to Iain Truskett for catching this. * Added FILENO method to TiedOutFH.pm, to work quietly under some perls. Thanks to Jochen Stenzel for catching this. * Fixed some tests that erroneously failed under some 5.6's because of chdir()s in *.t files messing up @INC Thanks to many who caught this, including Rocco Caputo. 2.03 2003-09-07 Sean M. Burke -- minor upgrade * A =head[1234] command now closes any currently open =over, and warns. * Fixing a few obscure bugs, including one to do with the Makefile. * Added some tests for those bugs. 2.02 2003-09-02 Sean M. Burke -- fixing a testing bug * Autrijus Tang found a silly bug of mine in corpustest.t's testing of corpus/t/nonesuch.txt. Fixed, * I add encoding_nonesuch.t to test corpus/t/nonesuch.txt better. 2.01 2003-09-01 Sean M. Burke * Moved all version numbers up to 2.01 for reasons of Tibetan numerology. * Implemented =encoding. Thanks a million to Jarkko, Autrijus, Dan Kogai, and many others for their help, patience, and encouragement. * It's not yet documented, but see ./t/corpus/*.txt for examples at least. * Added 'use utf8' to all the modules. Byebye perl-5.005 compatibility, hello decent perl-5.6 compatibility. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0.98 2003-09-01 Sean M. Burke * At Michael Schwern's suggestion, a list that begins with a "=item [number]" line where number isn't a 1, is no longer treated as an error, but instead is silently coerced into being a text-item list, just as if it were "=item wubble" or whatever. 0.97 2003-08-12 Sean M. Burke * Loooking goooooood. Not smelling so much like beta anymore! * I think this might be the last version before I go putting "use utf8" all over the place. * Added placefolders for "=encoding" support. If you use "=encoding", you'll get an error about "not yet implemented" instead of "unknown directive". * Rewrote Pod::Simple::Pullparser's get_title, and added get_version, get_author, and get_description. Documented them. Thanks to Graham Barr for contributing an initial get_title and then being patient while I seemed to do nothing with it for months on end! * More tests. * Otherwise just minor changes since last version: * Fixed error in Pod::Simple::RTF. * Added new but undocumented methods to Pod::Simple: unaccept_directive(s) unaccept_target(s) unaccept_code(s) * Corrected '=back without =open' error to '=back without =over' * A little tweaking to the _verbatim_format code. * Dump routines may use \x{NN} instead of \xNN format. * Pod::Simple::HTML now uses VerbatimFormatted * A few changes ot DEBUG messages -- nothing you'd normally see. 0.96 2002-11-19 Sean M. Burke * Still kinda sorta beta. * Much much more docs in this version. Only a few feature changes: * Added any_errata_seen to Pod::Simple. Should've been in there ages ago. Oops! * Fixed some errors in the experimental VerbatimFormatted code. * Added is_tagname / is_tag to Pod::Simple::PullParserStartToken and Pod::Simple::PullParserEndToken * Added RTFDEFLANG stuff to Pod::Simple::RTF. 0.95 2002-11-10 Sean M. Burke * Beta release. Much documentation still to write, many features still to add. The APIs might change in future versions. * Now including perlpod and perlpodspec in the dist. * Pod::Simple -- added parse_from_file * Pod::Simple::RTF -- minor style changes, and minor change to the RTF-wrapping logic. * Pod::Simple::BlackBox -- a =cut opening a block is no longer a fatal(ish) error. * Pod::Simple::BlackBox -- added experimental new VerbatimFormatted stuff. 0.94 2002-10-16 Sean M. Burke * Beta release. Much documentation still to write, many features still to add. The APIs might change in future versions. * Pod::Simple::RTF -- minor style tweaks * Pod::Simple::PullParserEndToken and ::PullParserStartToken -- added ->tag as an alias for ->tagname. * Pod::Simple and Pod::Simple::BlackBox -- added tolerance for "=item * Foo" as a variant syntax for "=item *\n\nFoo". Tests added/changed accordingly. * Pod::Simple::HTML -- added stuff, and a hack at doing something with X<...>'s. 0.93 2002-09-29 Sean M. Burke * Beta release. Much documentation still to write, many features still to add. The APIs might change in future versions. * Pod::Simple -- added errors_seen attribute * Pod::Simple::HTML -- added support for =for HTML ... directives, and =extend directives. * Oh, and I added Pod::Simple::RTF in 0.92 but forgot to note it until now. 0.92 2002-09-29 Sean M. Burke * Beta release. Much documentation still to write, many features still to add. The APIs might change in future versions. * Fixing bungled distribution. 0.91 2002-09-29 Sean M. Burke * Beta release. Much documentation still to write, many features still to add. The APIs might change in future versions. * Pod::Simple::PullParserTextToken -- added 'text_r' * Pod::Simple::PullParser -- added 'get_title' and 'get_title_short' to * Pod::Simple -- corrected wording of "Format for second =extend parameter" error message. * Pod::PullParser -- made its filter() run as intended, like Pod::Simple's filter. * Pod::Subclassing -- more docs 0.90 2002-09-11 Sean M. Burke * Beta release. Much documentation still to write, many features still to add. The APIs might change in future versions. Pod-Simple-3.43/t/0000755000175000017500000000000014066435222012027 5ustar khwkhwPod-Simple-3.43/t/encod02.t0000644000175000017500000000242314062242376013451 0ustar khwkhw# encoding not error BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 4 }; #use Pod::Simple::Debug (5); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; { my @output_lines = split m/[\cm\cj]+/, Pod::Simple::XMLOutStream->_out( q{ =encoding koi8-r =head1 NAME -- Fet's "When you were reading" =cut } ); if(grep m/Unknown directive/i, @output_lines ) { ok 0; print "# I saw an Unknown directive warning here! :\n", map("#==> $_\n", @output_lines), "#\n#\n"; } else { ok 1; } } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - print "# Now a control group, to make sure that =fishbladder DOES\n", "# cause an 'unknown directive' error...\n"; { my @output_lines = split m/[\cm\cj]+/, Pod::Simple::XMLOutStream->_out( q{ =fishbladder =head1 NAME Fet's "When you were reading" =cut } ); if(grep m/Unknown directive/i, @output_lines ) { ok 1; } else { ok 0; print "# But I didn't see an Unknows directive warning here! :\n", map("#==> $_\n", @output_lines), "#\n#\n"; } } print "#\n# And one for the road...\n"; ok 1; Pod-Simple-3.43/t/chunking.t0000644000175000017500000000236314062242375014027 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } #use Pod::Simple::Debug (2); use strict; use warnings; use Test; BEGIN { plan tests => 11 }; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; ok( Pod::Simple::XMLOutStream->_out("=head1 =head1"), '=head1' ); ok( Pod::Simple::XMLOutStream->_out("\n=head1 =head1"), '=head1' ); ok( Pod::Simple::XMLOutStream->_out("\n=head1 =head1\n"), '=head1' ); ok( Pod::Simple::XMLOutStream->_out("\n=head1 =head1\n\n"), '=head1' ); &ok(e "\n=head1 =head1\n\n" , "\n=head1 =head1\n\n"); &ok(e "\n=head1\n=head1\n\n", "\n=head1 =head1\n\n"); &ok(e "\n=pod\n\nCha cha cha\n\n" , "\n=pod\n\nCha cha cha\n\n"); &ok(e "\n=pod\n\nCha\tcha cha\n\n" , "\n=pod\n\nCha cha cha\n\n"); &ok(e "\n=pod\n\nCha\ncha cha\n\n" , "\n=pod\n\nCha cha cha\n\n"); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/verbatim.t0000644000175000017500000001734414062242377014041 0ustar khwkhw# Testing verbatim sections use strict; use warnings; use Test; BEGIN { plan tests => 31 }; #use Pod::Simple::Debug (6); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } &ok( e "", "" ); &ok( e "\n", "", ); &ok( e "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz" ); &ok( e "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz\n" ); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n"), qq{ foo bar baz} ); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n quux\n"), qq{ foo bar baz\n quux} ); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\nquux\n"), qq{ foo bar baz\nquux} ); print "# Contiguous verbatims...\n"; ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n quux\n"), qq{ foo bar baz\n\n quux} ); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n\n quux\n"), qq{ foo bar baz\n\n\n quux} ); print "# Testing =cut...\n"; ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\n quux\n"), qq{ foo bar baz} ); # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . { my $it = qq{ foo bar bazFoo quux\nquum} ; print "# Various \\n-(in)significance sanity checks...\n"; print "# verbatim/cut/head/verbatim sanity zero...\n"; ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity one...\n"; ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity two...\n"; ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\n\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity three...\n"; ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity four...\n"; ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Testing tab expansion...\n"; &ok( e q{=pod here we go now a b c d e f g h i j k l m n o p q r s t u v w x y z }, q{=pod here we go now a b c d e f g h i j k l m n o p q r s t u v w x y z }, ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &ok( e q{=pod here we go now a .b . c . d . e . f . g . h . i . j . k . l . m . n . o . p . q . r . s . t . u . v . w . x . y . z }, q{=pod here we go now a .b . c . d . e . f . g . h . i . j . k . l . m . n . o . p . q . r . s . t . u . v . w . x . y . z }, ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &ok( e q{=pod here we go now a .b ..c .. d .. e .. f .. g .. h .. i .. j .. k .. l .. m .. n .. o .. p .. q .. r .. s .. t .. u .. v .. w .. x .. y .. z }, q{=pod here we go now a .b ..c .. d .. e .. f .. g .. h .. i .. j .. k .. l .. m .. n .. o .. p .. q .. r .. s .. t .. u .. v .. w .. x .. y .. z }, ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &ok( e q{=pod here we go now a .b ..c .. d .. e .. f .. g .. h .. i .. .j .. . k .. . l .. . m .. . n .. . o .. . p .. . q .. . r .. . s .. . t .. . u .. . v .. . w .. . x .. . y .. . z }, q{=pod here we go now a .b ..c .. d .. e .. f .. g .. h .. i .. .j .. . k .. . l .. . m .. . n .. . o .. . p .. . q .. . r .. . s .. . t .. . u .. . v .. . w .. . x .. . y .. . z }, ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # TODO: long-line splitting? print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/cbacks.t0000644000175000017500000000444414062242375013451 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 8 }; my $d; #use Pod::Simple::Debug (\$d, 0); ok 1; use Pod::Simple::XMLOutStream; use Pod::Simple::DumpAsXML; use Pod::Simple::DumpAsText; my @from = ( 'Pod::Simple::XMLOutStream' => 'I LIKE PIE', 'Pod::Simple::DumpAsXML' => "\n \n I LIKE PIE\n \n\n", 'Pod::Simple::DumpAsText' => "++Document\n ++head1\n * \"I LIKE PIE\"\n --head1\n--Document\n", ); # Might as well test all the classes... while(@from) { my($x => $expected) = splice(@from, 0,2); my $more = ''; print "#Testing via class $x, version ", $x->VERSION(), "\n"; my $p = $x->new; my($got, $exp); ok scalar($got = $x->_out( # Mutor: sub { $_[0]->code_handler(sub { $more .= $_[1] . ":" . $_[0] . "\n" } ); $_[0]->cut_handler( sub { $more .= "~" . $_[1] . ":" . $_[0]. "\n" } ); $_[0]->pod_handler( sub { $more .= "+" . $_[1] . ":" . $_[0]. "\n" } ); $_[0]->whiteline_handler( sub { $more .= "=" . $_[1] . ":" . $_[0]. "\n" } ); } => join "\n", " ", # space outside pod "\t# This is handy...", "=pod text", "\t", # tab inside pod "=cut more text", "\t", # tab outside pod "=pod", " \t ", # spaces and tabs inside pod "=head1 I LIKE PIE", " ", # space inside pod "=cut", "use Test::Harness;", "runtests(sort glob 't/*.t');", "", "", )) => scalar($exp = $expected); ; unless($got eq $exp) { print '# Got vs exp:\n# ', Pod::Simple::BlackBox::pretty($got), "\n# ",Pod::Simple::BlackBox::pretty($exp),"\n"; } ok scalar($got = $more), scalar($exp = join "\n" => "1: ", "2:\t# This is handy...", "=4:\t", "+3:=pod text", "~5:=cut more text", "6:\t", "=8: \t ", "+7:=pod", "=10: ", "~11:=cut", "12:use Test::Harness;", "13:runtests(sort glob 't/*.t');", "14:", "", ); unless($got eq $exp) { print '# Got vs exp:\n# ', Pod::Simple::BlackBox::pretty($got), "\n# ",Pod::Simple::BlackBox::pretty($exp),"\n"; } } print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/for.t0000644000175000017500000001216014062242376013004 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 21 }; #use Pod::Simple::Debug (5); BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; my $x = 'Pod::Simple::XMLOutStream'; $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output sub moj {shift->accept_target('mojojojo')} sub mojtext {shift->accept_target_as_text('mojojojo')} sub any {shift->accept_target('*')} #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ok( $x->_out( "=pod\n\nI like pie.\n\n=for mojojojo stuff\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=for psketti,mojojojo,crunk stuff\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=for mojojojo I\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=for psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=for :psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.Yup.' ); print "# Testing accept_target ...\n"; ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for crunk stuff\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for mojojojo I\n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for :mojojojo I\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for :psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.stuffYup.' ); print "# Testing accept_target_as_text ...\n"; ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=for mojojojo I\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=for psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=for :mojojojo I\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=for :psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.stuffYup.' ); print "# Testing accept_target(*) ...\n"; ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for mojojojo I\n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for mojojojo I\n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for :mojojojo I\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for :psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.stuffYup.' ); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/eol.t0000644000175000017500000000427214062242376013002 0ustar khwkhw#!/usr/bin/perl # t/eol.t - check handling of \r, \n, and \r\n as line separators BEGIN { chdir 't' if -d 't'; } use warnings; use strict; use lib '../lib'; use Test::More tests => 7; use_ok('Pod::Simple::XHTML') or exit; open(POD, ">$$.pod") or die "$$.pod: $!"; print POD <<__EOF__; =pod =head1 NAME crlf =head1 DESCRIPTION crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf =cut __EOF__ close(POD); # --- CR --- my $p1 = Pod::Simple::XHTML->new (); isa_ok ($p1, 'Pod::Simple::XHTML'); open(POD, "<$$.pod") or die "$$.pod: $!"; open(IN, ">$$.in") or die "$$.in: $!"; while () { s/[\r\n]+/\r/g; print IN $_; } close(POD); close(IN); $p1->output_string(\my $o1); $p1->parse_file("$$.in"); # --- LF --- my $p2 = Pod::Simple::XHTML->new (); isa_ok ($p2, 'Pod::Simple::XHTML'); open(POD, "<$$.pod") or die "$$.pod: $!"; open(IN, ">$$.in") or die "$$.in: $!"; while () { s/[\r\n]+/\n/g; print IN $_; } close(POD); close(IN); $p2->output_string(\my $o2); $p2->parse_file("$$.in"); # --- CRLF --- my $p3 = Pod::Simple::XHTML->new (); isa_ok ($p3, 'Pod::Simple::XHTML'); open(POD, "<$$.pod") or die "$$.pod: $!"; open(IN, ">$$.in") or die "$$.in: $!"; while () { s/[\r\n]+/\r\n/g; print IN $_; } close(POD); close(IN); $p3->output_string(\my $o3); $p3->parse_file("$$.in"); # --- now test --- my $cksum1 = unpack("%32C*", $o1); my $cksum2 = unpack("%32C*", $o2); my $cksum3 = unpack("%32C*", $o3); ok($cksum1 == $cksum2, "CR vs LF"); ok($cksum1 == $cksum3, "CR vs CRLF"); ok($cksum2 == $cksum3, "LF vs CRLF"); END { 1 while unlink("$$.pod", "$$.in"); } Pod-Simple-3.43/t/encod03.t0000644000175000017500000000235714062242376013460 0ustar khwkhw# encoding not error 0 BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 4 }; #use Pod::Simple::Debug (5); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; { my @output_lines = split m/[\cm\cj]+/, Pod::Simple::XMLOutStream->_out( q{ =encoding koi8-r =head1 NAME Bippitty Boppity Boo -- Yormp =cut } ); if(grep m/Unknown directive/i, @output_lines ) { ok 0; print "# I saw an Unknown directive warning here! :\n", map("#==> $_\n", @output_lines), "#\n#\n"; } else { ok 1; } } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - print "# Now a control group, to make sure that =fishbladder DOES\n", "# cause an 'unknown directive' error...\n"; { my @output_lines = split m/[\cm\cj]+/, Pod::Simple::XMLOutStream->_out( q{ =fishbladder =head1 NAME Fet's "When you were reading" =cut } ); if(grep m/Unknown directive/i, @output_lines ) { ok 1; } else { ok 0; print "# But I didn't see an Unknows directive warning here! :\n", map("#==> $_\n", @output_lines), "#\n#\n"; } } print "#\n# And one for the road...\n"; ok 1; Pod-Simple-3.43/t/perlfaq.pod0000644000175000017500000007513114062242376014176 0ustar khwkhw=head1 NAME perlfaq3 - Programming Tools ($Revision: 1.38 $, $Date: 1999/05/23 16:08:30 $) =head1 DESCRIPTION This section of the FAQ answers questions related to programmer tools and programming support. =head2 How do I do (anything)? Have you looked at CPAN (see L)? The chances are that someone has already written a module that can solve your problem. Have you read the appropriate man pages? Here's a brief index: Basics perldata, perlvar, perlsyn, perlop, perlsub Execution perlrun, perldebug Functions perlfunc Objects perlref, perlmod, perlobj, perltie Data Structures perlref, perllol, perldsc Modules perlmod, perlmodlib, perlsub Regexes perlre, perlfunc, perlop, perllocale Moving to perl5 perltrap, perl Linking w/C perlxstut, perlxs, perlcall, perlguts, perlembed Various http://www.perl.com/CPAN/doc/FMTEYEWTK/index.html (not a man-page but still useful) A crude table of contents for the Perl man page set is found in L. =head2 How can I use Perl interactively? The typical approach uses the Perl debugger, described in the perldebug(1) man page, on an ``empty'' program, like this: perl -de 42 Now just type in any legal Perl code, and it will be immediately evaluated. You can also examine the symbol table, get stack backtraces, check variable values, set breakpoints, and other operations typically found in symbolic debuggers. =head2 Is there a Perl shell? In general, no. The Shell.pm module (distributed with Perl) makes Perl try commands which aren't part of the Perl language as shell commands. perlsh from the source distribution is simplistic and uninteresting, but may still be what you want. =head2 How do I debug my Perl programs? Have you tried C or used C<-w>? They enable warnings to detect dubious practices. Have you tried C? It prevents you from using symbolic references, makes you predeclare any subroutines that you call as bare words, and (probably most importantly) forces you to predeclare your variables with C, C, or C. Did you check the return values of each and every system call? The operating system (and thus Perl) tells you whether they worked, and if not why. open(FH, "> /etc/cantwrite") or die "Couldn't write to /etc/cantwrite: $!\n"; Did you read L? It's full of gotchas for old and new Perl programmers and even has sections for those of you who are upgrading from languages like I and I. Have you tried the Perl debugger, described in L? You can step through your program and see what it's doing and thus work out why what it's doing isn't what it should be doing. =head2 How do I profile my Perl programs? You should get the Devel::DProf module from the standard distribution (or separately on CPAN) and also use Benchmark.pm from the standard distribution. The Benchmark module lets you time specific portions of your code, while Devel::DProf gives detailed breakdowns of where your code spends its time. Here's a sample use of Benchmark: use Benchmark; @junk = `cat /etc/motd`; $count = 10_000; timethese($count, { 'map' => sub { my @a = @junk; map { s/a/b/ } @a; return @a }, 'for' => sub { my @a = @junk; local $_; for (@a) { s/a/b/ }; return @a }, }); This is what it prints (on one machine--your results will be dependent on your hardware, operating system, and the load on your machine): Benchmark: timing 10000 iterations of for, map... for: 4 secs ( 3.97 usr 0.01 sys = 3.98 cpu) map: 6 secs ( 4.97 usr 0.00 sys = 4.97 cpu) Be aware that a good benchmark is very hard to write. It only tests the data you give it and proves little about the differing complexities of contrasting algorithms. =head2 How do I cross-reference my Perl programs? The B::Xref module, shipped with the new, alpha-release Perl compiler (not the general distribution prior to the 5.005 release), can be used to generate cross-reference reports for Perl programs. perl -MO=Xref[,OPTIONS] scriptname.plx =head2 Is there a pretty-printer (formatter) for Perl? There is no program that will reformat Perl as much as indent(1) does for C. The complex feedback between the scanner and the parser (this feedback is what confuses the vgrind and emacs programs) makes it challenging at best to write a stand-alone Perl parser. Of course, if you simply follow the guidelines in L, you shouldn't need to reformat. The habit of formatting your code as you write it will help prevent bugs. Your editor can and should help you with this. The perl-mode or newer cperl-mode for emacs can provide remarkable amounts of help with most (but not all) code, and even less programmable editors can provide significant assistance. Tom swears by the following settings in vi and its clones: set ai sw=4 map! ^O {^M}^[O^T Now put that in your F<.exrc> file (replacing the caret characters with control characters) and away you go. In insert mode, ^T is for indenting, ^D is for undenting, and ^O is for blockdenting-- as it were. If you haven't used the last one, you're missing a lot. A more complete example, with comments, can be found at http://www.perl.com/CPAN-local/authors/id/TOMC/scripts/toms.exrc.gz If you are used to using the I program for printing out nice code to a laser printer, you can take a stab at this using http://www.perl.com/CPAN/doc/misc/tips/working.vgrind.entry, but the results are not particularly satisfying for sophisticated code. The a2ps at http://www.infres.enst.fr/%7Edemaille/a2ps/ does lots of things related to generating nicely printed output of documents. =head2 Is there a ctags for Perl? There's a simple one at http://www.perl.com/CPAN/authors/id/TOMC/scripts/ptags.gz which may do the trick. And if not, it's easy to hack into what you want. =head2 Is there an IDE or Windows Perl Editor? Perl programs are just plain text, so any editor will do. If you're on Unix, you already have an IDE--Unix itself. The UNIX philosophy is the philosophy of several small tools that each do one thing and do it well. It's like a carpenter's toolbox. If you want a Windows IDE, check the following: =over 4 =item CodeMagicCD http://www.codemagiccd.com/ =item Komodo ActiveState's cross-platform, multi-language IDE has Perl support, including a regular expression debugger and remote debugging (http://www.ActiveState.com/Products/Komodo/index.html). (Visual Perl, a Visual Studio.NET plug-in is currently (early 2001) in beta (http://www.ActiveState.com/Products/VisualPerl/index.html)). =item The Object System (http://www.castlelink.co.uk/object_system/) is a Perl web applications development IDE. =item PerlBuilder (http://www.solutionsoft.com/perl.htm) is an integrated development environment for Windows that supports Perl development. =item Perl code magic (http://www.petes-place.com/codemagic.html). =item visiPerl+ http://helpconsulting.net/visiperl/, from Help Consulting. =back For editors: if you're on Unix you probably have vi or a vi clone already, and possibly an emacs too, so you may not need to download anything. In any emacs the cperl-mode (M-x cperl-mode) gives you perhaps the best available Perl editing mode in any editor. For Windows editors: you can download an Emacs =over 4 =item GNU Emacs http://www.gnu.org/software/emacs/windows/ntemacs.html =item MicroEMACS http://members.nbci.com/uemacs/ =item XEmacs http://www.xemacs.org/Download/index.html =back or a vi clone such as =over 4 =item Elvis ftp://ftp.cs.pdx.edu/pub/elvis/ http://www.fh-wedel.de/elvis/ =item Vile http://vile.cx/ =item Vim http://www.vim.org/ win32: http://www.cs.vu.nl/%7Etmgil/vi.html =back For vi lovers in general, Windows or elsewhere: http://www.thomer.com/thomer/vi/vi.html. nvi (http://www.bostic.com/vi/, available from CPAN in src/misc/) is yet another vi clone, unfortunately not available for Windows, but in UNIX platforms you might be interested in trying it out, firstly because strictly speaking it is not a vi clone, it is the real vi, or the new incarnation of it, and secondly because you can embed Perl inside it to use Perl as the scripting language. nvi is not alone in this, though: at least also vim and vile offer an embedded Perl. The following are Win32 multilanguage editor/IDESs that support Perl: =over 4 =item Codewright http://www.starbase.com/ =item MultiEdit http://www.MultiEdit.com/ =item SlickEdit http://www.slickedit.com/ =back There is also a toyedit Text widget based editor written in Perl that is distributed with the Tk module on CPAN. The ptkdb (http://world.std.com/~aep/ptkdb/) is a Perl/tk based debugger that acts as a development environment of sorts. Perl Composer (http://perlcomposer.sourceforge.net/vperl.html) is an IDE for Perl/Tk GUI creation. In addition to an editor/IDE you might be interested in a more powerful shell environment for Win32. Your options include =over 4 =item Bash from the Cygwin package (http://sources.redhat.com/cygwin/) =item Ksh from the MKS Toolkit (http://www.mks.com/), or the Bourne shell of the U/WIN environment (http://www.research.att.com/sw/tools/uwin/) =item Tcsh ftp://ftp.astron.com/pub/tcsh/, see also http://www.primate.wisc.edu/software/csh-tcsh-book/ =item Zsh ftp://ftp.blarg.net/users/amol/zsh/, see also http://www.zsh.org/ =back MKS and U/WIN are commercial (U/WIN is free for educational and research purposes), Cygwin is covered by the GNU Public License (but that shouldn't matter for Perl use). The Cygwin, MKS, and U/WIN all contain (in addition to the shells) a comprehensive set of standard UNIX toolkit utilities. If you're transferring text files between Unix and Windows using FTP be sure to transfer them in ASCII mode so the ends of lines are appropriately converted. On Mac OS the MacPerl Application comes with a simple 32k text editor that behaves like a rudimentary IDE. In contrast to the MacPerl Application the MPW Perl tool can make use of the MPW Shell itself as an editor (with no 32k limit). =over 4 =item BBEdit and BBEdit Lite are text editors for Mac OS that have a Perl sensitivity mode (http://web.barebones.com/). =item Alpha is an editor, written and extensible in Tcl, that nonetheless has built in support for several popular markup and programming languages including Perl and HTML (http://alpha.olm.net/). =back Pepper and Pe are programming language sensitive text editors for Mac OS X and BeOS respectively (http://www.hekkelman.com/). =head2 Where can I get Perl macros for vi? For a complete version of Tom Christiansen's vi configuration file, see http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/toms.exrc.gz , the standard benchmark file for vi emulators. The file runs best with nvi, the current version of vi out of Berkeley, which incidentally can be built with an embedded Perl interpreter--see http://www.perl.com/CPAN/src/misc. =head2 Where can I get perl-mode for emacs? Since Emacs version 19 patchlevel 22 or so, there have been both a perl-mode.el and support for the Perl debugger built in. These should come with the standard Emacs 19 distribution. In the Perl source directory, you'll find a directory called "emacs", which contains a cperl-mode that color-codes keywords, provides context-sensitive help, and other nifty things. Note that the perl-mode of emacs will have fits with C<"main'foo"> (single quote), and mess up the indentation and highlighting. You are probably using C<"main::foo"> in new Perl code anyway, so this shouldn't be an issue. =head2 How can I use curses with Perl? The Curses module from CPAN provides a dynamically loadable object module interface to a curses library. A small demo can be found at the directory http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/rep; this program repeats a command and updates the screen as needed, rendering B similar to B. =head2 How can I use X or Tk with Perl? Tk is a completely Perl-based, object-oriented interface to the Tk toolkit that doesn't force you to use Tcl just to get at Tk. Sx is an interface to the Athena Widget set. Both are available from CPAN. See the directory http://www.perl.com/CPAN/modules/by-category/08_User_Interfaces/ Invaluable for Perl/Tk programming are the Perl/Tk FAQ at http://w4.lns.cornell.edu/%7Epvhp/ptk/ptkTOC.html , the Perl/Tk Reference Guide available at http://www.perl.com/CPAN-local/authors/Stephen_O_Lidie/ , and the online manpages at http://www-users.cs.umn.edu/%7Eamundson/perl/perltk/toc.html . =head2 How can I generate simple menus without using CGI or Tk? The http://www.perl.com/CPAN/authors/id/SKUNZ/perlmenu.v4.0.tar.gz module, which is curses-based, can help with this. =head2 What is undump? See the next question on ``How can I make my Perl program run faster?'' =head2 How can I make my Perl program run faster? The best way to do this is to come up with a better algorithm. This can often make a dramatic difference. Jon Bentley's book ``Programming Pearls'' (that's not a misspelling!) has some good tips on optimization, too. Advice on benchmarking boils down to: benchmark and profile to make sure you're optimizing the right part, look for better algorithms instead of microtuning your code, and when all else fails consider just buying faster hardware. A different approach is to autoload seldom-used Perl code. See the AutoSplit and AutoLoader modules in the standard distribution for that. Or you could locate the bottleneck and think about writing just that part in C, the way we used to take bottlenecks in C code and write them in assembler. Similar to rewriting in C, modules that have critical sections can be written in C (for instance, the PDL module from CPAN). In some cases, it may be worth it to use the backend compiler to produce byte code (saving compilation time) or compile into C, which will certainly save compilation time and sometimes a small amount (but not much) execution time. See the question about compiling your Perl programs for more on the compiler--the wins aren't as obvious as you'd hope. If you're currently linking your perl executable to a shared I, you can often gain a 10-25% performance benefit by rebuilding it to link with a static libc.a instead. This will make a bigger perl executable, but your Perl programs (and programmers) may thank you for it. See the F file in the source distribution for more information. Unsubstantiated reports allege that Perl interpreters that use sfio outperform those that don't (for I/O intensive applications). To try this, see the F file in the source distribution, especially the ``Selecting File I/O mechanisms'' section. The undump program was an old attempt to speed up your Perl program by storing the already-compiled form to disk. This is no longer a viable option, as it only worked on a few architectures, and wasn't a good solution anyway. =head2 How can I make my Perl program take less memory? When it comes to time-space tradeoffs, Perl nearly always prefers to throw memory at a problem. Scalars in Perl use more memory than strings in C, arrays take more than that, and hashes use even more. While there's still a lot to be done, recent releases have been addressing these issues. For example, as of 5.004, duplicate hash keys are shared amongst all hashes using them, so require no reallocation. In some cases, using substr() or vec() to simulate arrays can be highly beneficial. For example, an array of a thousand booleans will take at least 20,000 bytes of space, but it can be turned into one 125-byte bit vector--a considerable memory savings. The standard Tie::SubstrHash module can also help for certain types of data structure. If you're working with specialist data structures (matrices, for instance) modules that implement these in C may use less memory than equivalent Perl modules. Another thing to try is learning whether your Perl was compiled with the system malloc or with Perl's builtin malloc. Whichever one it is, try using the other one and see whether this makes a difference. Information about malloc is in the F file in the source distribution. You can find out whether you are using perl's malloc by typing C. =head2 Is it unsafe to return a pointer to local data? No, Perl's garbage collection system takes care of this. sub makeone { my @a = ( 1 .. 10 ); return \@a; } for $i ( 1 .. 10 ) { push @many, makeone(); } print $many[4][5], "\n"; print "@many\n"; =head2 How can I free an array or hash so my program shrinks? You can't. On most operating systems, memory allocated to a program can never be returned to the system. That's why long-running programs sometimes re-exec themselves. Some operating systems (notably, FreeBSD and Linux) allegedly reclaim large chunks of memory that is no longer used, but it doesn't appear to happen with Perl (yet). The Mac appears to be the only platform that will reliably (albeit, slowly) return memory to the OS. We've had reports that on Linux (Redhat 5.1) on Intel, C will return memory to the system, while on Solaris 2.6 it won't. In general, try it yourself and see. However, judicious use of my() on your variables will help make sure that they go out of scope so that Perl can free up that space for use in other parts of your program. A global variable, of course, never goes out of scope, so you can't get its space automatically reclaimed, although undef()ing and/or delete()ing it will achieve the same effect. In general, memory allocation and de-allocation isn't something you can or should be worrying about much in Perl, but even this capability (preallocation of data types) is in the works. =head2 How can I make my CGI script more efficient? Beyond the normal measures described to make general Perl programs faster or smaller, a CGI program has additional issues. It may be run several times per second. Given that each time it runs it will need to be re-compiled and will often allocate a megabyte or more of system memory, this can be a killer. Compiling into C B because the process start-up overhead is where the bottleneck is. There are two popular ways to avoid this overhead. One solution involves running the Apache HTTP server (available from http://www.apache.org/) with either of the mod_perl or mod_fastcgi plugin modules. With mod_perl and the Apache::Registry module (distributed with mod_perl), httpd will run with an embedded Perl interpreter which pre-compiles your script and then executes it within the same address space without forking. The Apache extension also gives Perl access to the internal server API, so modules written in Perl can do just about anything a module written in C can. For more on mod_perl, see http://perl.apache.org/ With the FCGI module (from CPAN) and the mod_fastcgi module (available from http://www.fastcgi.com/) each of your Perl programs becomes a permanent CGI daemon process. Both of these solutions can have far-reaching effects on your system and on the way you write your CGI programs, so investigate them with care. See http://www.perl.com/CPAN/modules/by-category/15_World_Wide_Web_HTML_HTTP_CGI/ . A non-free, commercial product, ``The Velocity Engine for Perl'', (http://www.binevolve.com/ or http://www.binevolve.com/velocigen/ ) might also be worth looking at. It will allow you to increase the performance of your Perl programs, running programs up to 25 times faster than normal CGI Perl when running in persistent Perl mode or 4 to 5 times faster without any modification to your existing CGI programs. Fully functional evaluation copies are available from the web site. =head2 How can I hide the source for my Perl program? Delete it. :-) Seriously, there are a number of (mostly unsatisfactory) solutions with varying levels of ``security''. First of all, however, you I take away read permission, because the source code has to be readable in order to be compiled and interpreted. (That doesn't mean that a CGI script's source is readable by people on the web, though--only by people with access to the filesystem.) So you have to leave the permissions at the socially friendly 0755 level. Some people regard this as a security problem. If your program does insecure things and relies on people not knowing how to exploit those insecurities, it is not secure. It is often possible for someone to determine the insecure things and exploit them without viewing the source. Security through obscurity, the name for hiding your bugs instead of fixing them, is little security indeed. You can try using encryption via source filters (Filter::* from CPAN), but any decent programmer will be able to decrypt it. You can try using the byte code compiler and interpreter described below, but the curious might still be able to de-compile it. You can try using the native-code compiler described below, but crackers might be able to disassemble it. These pose varying degrees of difficulty to people wanting to get at your code, but none can definitively conceal it (true of every language, not just Perl). If you're concerned about people profiting from your code, then the bottom line is that nothing but a restrictive license will give you legal security. License your software and pepper it with threatening statements like ``This is unpublished proprietary software of XYZ Corp. Your access to it does not give you permission to use it blah blah blah.'' We are not lawyers, of course, so you should see a lawyer if you want to be sure your license's wording will stand up in court. =head2 How can I compile my Perl program into byte code or C? Malcolm Beattie has written a multifunction backend compiler, available from CPAN, that can do both these things. It is included in the perl5.005 release, but is still considered experimental. This means it's fun to play with if you're a programmer but not really for people looking for turn-key solutions. Merely compiling into C does not in and of itself guarantee that your code will run very much faster. That's because except for lucky cases where a lot of native type inferencing is possible, the normal Perl run-time system is still present and so your program will take just as long to run and be just as big. Most programs save little more than compilation time, leaving execution no more than 10-30% faster. A few rare programs actually benefit significantly (even running several times faster), but this takes some tweaking of your code. You'll probably be astonished to learn that the current version of the compiler generates a compiled form of your script whose executable is just as big as the original perl executable, and then some. That's because as currently written, all programs are prepared for a full eval() statement. You can tremendously reduce this cost by building a shared I library and linking against that. See the F podfile in the Perl source distribution for details. If you link your main perl binary with this, it will make it minuscule. For example, on one author's system, F is only 11k in size! In general, the compiler will do nothing to make a Perl program smaller, faster, more portable, or more secure. In fact, it can make your situation worse. The executable will be bigger, your VM system may take longer to load the whole thing, the binary is fragile and hard to fix, and compilation never stopped software piracy in the form of crackers, viruses, or bootleggers. The real advantage of the compiler is merely packaging, and once you see the size of what it makes (well, unless you use a shared I), you'll probably want a complete Perl install anyway. =head2 How can I compile Perl into Java? You can also integrate Java and Perl with the Perl Resource Kit from O'Reilly and Associates. See http://www.oreilly.com/catalog/prkunix/ . Perl 5.6 comes with Java Perl Lingo, or JPL. JPL, still in development, allows Perl code to be called from Java. See jpl/README in the Perl source tree. =head2 How can I get C<#!perl> to work on [MS-DOS,NT,...]? For OS/2 just use extproc perl -S -your_switches as the first line in C<*.cmd> file (C<-S> due to a bug in cmd.exe's `extproc' handling). For DOS one should first invent a corresponding batch file and codify it in C (see the F file in the source distribution for more information). The Win95/NT installation, when using the ActiveState port of Perl, will modify the Registry to associate the C<.pl> extension with the perl interpreter. If you install another port, perhaps even building your own Win95/NT Perl from the standard sources by using a Windows port of gcc (e.g., with cygwin or mingw32), then you'll have to modify the Registry yourself. In addition to associating C<.pl> with the interpreter, NT people can use: C to let them run the program C merely by typing C. Macintosh Perl programs will have the appropriate Creator and Type, so that double-clicking them will invoke the Perl application. I: Whatever you do, PLEASE don't get frustrated, and just throw the perl interpreter into your cgi-bin directory, in order to get your programs working for a web server. This is an EXTREMELY big security risk. Take the time to figure out how to do it correctly. =head2 Can I write useful Perl programs on the command line? Yes. Read L for more information. Some examples follow. (These assume standard Unix shell quoting rules.) # sum first and last fields perl -lane 'print $F[0] + $F[-1]' * # identify text files perl -le 'for(@ARGV) {print if -f && -T _}' * # remove (most) comments from C program perl -0777 -pe 's{/\*.*?\*/}{}gs' foo.c # make file a month younger than today, defeating reaper daemons perl -e '$X=24*60*60; utime(time(),time() + 30 * $X,@ARGV)' * # find first unused uid perl -le '$i++ while getpwuid($i); print $i' # display reasonable manpath echo $PATH | perl -nl -072 -e ' s![^/+]*$!man!&&-d&&!$s{$_}++&&push@m,$_;END{print"@m"}' OK, the last one was actually an Obfuscated Perl Contest entry. :-) =head2 Why don't Perl one-liners work on my DOS/Mac/VMS system? The problem is usually that the command interpreters on those systems have rather different ideas about quoting than the Unix shells under which the one-liners were created. On some systems, you may have to change single-quotes to double ones, which you must I do on Unix or Plan9 systems. You might also have to change a single % to a %%. For example: # Unix perl -e 'print "Hello world\n"' # DOS, etc. perl -e "print \"Hello world\n\"" # Mac print "Hello world\n" (then Run "Myscript" or Shift-Command-R) # VMS perl -e "print ""Hello world\n""" The problem is that none of these examples are reliable: they depend on the command interpreter. Under Unix, the first two often work. Under DOS, it's entirely possible that neither works. If 4DOS was the command shell, you'd probably have better luck like this: perl -e "print "Hello world\n"" Under the Mac, it depends which environment you are using. The MacPerl shell, or MPW, is much like Unix shells in its support for several quoting variants, except that it makes free use of the Mac's non-ASCII characters as control characters. Using qq(), q(), and qx(), instead of "double quotes", 'single quotes', and `backticks`, may make one-liners easier to write. There is no general solution to all of this. It is a mess, pure and simple. Sucks to be away from Unix, huh? :-) [Some of this answer was contributed by Kenneth Albanowski.] =head2 Where can I learn about CGI or Web programming in Perl? For modules, get the CGI or LWP modules from CPAN. For textbooks, see the two especially dedicated to web stuff in the question on books. For problems and questions related to the web, like ``Why do I get 500 Errors'' or ``Why doesn't it run from the browser right when it runs fine on the command line'', see these sources: WWW Security FAQ http://www.w3.org/Security/Faq/ Web FAQ http://www.boutell.com/faq/ CGI FAQ http://www.webthing.com/tutorials/cgifaq.html HTTP Spec http://www.w3.org/pub/WWW/Protocols/HTTP/ HTML Spec http://www.w3.org/TR/REC-html40/ http://www.w3.org/pub/WWW/MarkUp/ CGI Spec http://www.w3.org/CGI/ CGI Security FAQ http://www.go2net.com/people/paulp/cgi-security/safe-cgi.txt =head2 Where can I learn about object-oriented Perl programming? A good place to start is L, and you can use L, L, and L for reference. Perltoot didn't come out until the 5.004 release; you can get a copy (in pod, html, or postscript) from http://www.perl.com/CPAN/doc/FMTEYEWTK/ . =head2 Where can I learn about linking C with Perl? [h2xs, xsubpp] If you want to call C from Perl, start with L, moving on to L, L, and L. If you want to call Perl from C, then read L, L, and L. Don't forget that you can learn a lot from looking at how the authors of existing extension modules wrote their code and solved their problems. =head2 I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong? Download the ExtUtils::Embed kit from CPAN and run `make test'. If the tests pass, read the pods again and again and again. If they fail, see L and send a bug report with the output of C along with C. =head2 When I tried to run my script, I got this message. What does it mean? A complete list of Perl's error messages and warnings with explanatory text can be found in L. You can also use the splain program (distributed with Perl) to explain the error messages: perl program 2>diag.out splain [-v] [-p] diag.out or change your program to explain the messages for you: use diagnostics; or use diagnostics -verbose; =head2 What's MakeMaker? This module (part of the standard Perl distribution) is designed to write a Makefile for an extension module from a Makefile.PL. For more information, see L. =head1 AUTHOR AND COPYRIGHT Copyright (c) 1997-1999 Tom Christiansen and Nathan Torkington. All rights reserved. When included as an integrated part of the Standard Distribution of Perl or of its documentation (printed or otherwise), this works is covered under Perl's Artistic License. For separate distributions of all or part of this FAQ outside of that, see L. Irrespective of its distribution, all code examples here are in the public domain. You are permitted and encouraged to use this code and any derivatives thereof in your own programs for fun or for profit as you see fit. A simple comment in the code giving credit to the FAQ would be courteous but is not required. Pod-Simple-3.43/t/encod01.t0000644000175000017500000000325414062242376013453 0ustar khwkhw# encoding nonesuch BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } #use Pod::Simple::Debug (10); use Test; use File::Spec; #use utf8; use strict; use warnings; #use Pod::Simple::Debug (10); BEGIN { plan tests => 6 } use Pod::Simple; use Pod::Simple::DumpAsXML; my $thefile; BEGIN { # Find the path to the test source files. This requires some fiddling when # these tests are run as part of Perl core. sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { require File::Spec; my $updir = File::Spec->updir; my $dir = File::Spec->catdir ($updir, 'lib', 'Pod', 'Simple', 't', 'corpus'); return File::Spec->catfile ($dir, $file); } else { return $file; } } if( -e ($thefile = source_path('nonesuch.txt')) #or (print("# Nope, not $thefile\n"), 0) ) { # okay, } elsif( -e ($thefile = File::Spec::->catfile( File::Spec::->curdir, 'corpus', 'nonesuch.txt' )) #or (print("# Nope, not $thefile\n"), 0) ) { # okay, } elsif (-e ($thefile = File::Spec::->catfile( File::Spec::->curdir, 't', 'corpus', 'nonesuch.txt' )) #or (print("# Nope, not $thefile\n"), 0) ) { # okay, } else { die "Can't find the corpus directory\n Aborting"; } } print "# Testing that $thefile parses right.\n"; my $outstring; { my $p = Pod::Simple::DumpAsXML->new; $p->output_string( \$outstring ); $p->parse_file( $thefile ); undef $p; } ok 1 ; # make sure it parsed at all ok( $outstring && length($outstring) ); # make sure it parsed to something. #print $outstring; ok( $outstring =~ m/Blorp/ ); ok( $outstring =~ m/errata/ ); ok( $outstring =~ m/unsupported/ ); ok 1; Pod-Simple-3.43/t/verb_fmt.t0000644000175000017500000003171514062242377014032 0ustar khwkhw# Testing verbatim formatted sections use strict; use warnings; use Test; BEGIN { plan tests => 62 }; #use Pod::Simple::Debug (6); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; sub e { Pod::Simple::DumpAsXML->_duo(\&without_vf, @_) } sub ev { Pod::Simple::DumpAsXML->_duo(\&with_vf, @_) } sub with_vf { $_[0]-> accept_codes('VerbatimFormatted') } sub without_vf { $_[0]->unaccept_codes('VerbatimFormatted') } # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ print "# Testing VerbatimFormatted...\n"; # A formatty line has to have #: in the first two columns, and uses # "^" to mean bold, "/" to mean underline, and "%" to mean bold italic. # Example: # What do you want? i like pie. [or whatever] # #:^^^^^^^^^^^^^^^^^ ///////////// &ok( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ ///////////// Hooboy. =cut }) => qq{ What do you want? i like pie. [or whatever]\n Hooboy.} ); &ok( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ ///////////// Hooboy. =cut }) => qq{ What do you want? i like pie. [or whatever]\n Hooboy.} ); &ok( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ ///////////// =cut }) => qq{ What do you want? i like pie. [or whatever]} ); &ok( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ /////////////} ) => qq{ What do you want? i like pie. [or whatever]} ); &ok( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ //////////////////} ) => qq{ What do you want? i like pie. [or whatever]} ); &ok( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ ///} ) => qq{ What do you want? i like pie. [or whatever]} ); &ok( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ /// #:^^^^^^^^^^^^^^^^^ ///} ) => qq{ What do you want? i like pie. [or whatever]\n#:^^^^^^^^^^^^^^^^^ ///} ); &ok( Pod::Simple::XMLOutStream->_out(\&with_vf, # with a tab: q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ /// } ) => qq{ What do you want? i like pie. [or whatever]} ); # Now testing the % too: &ok( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod What do you want? i like pie. [or whatever] #:^^^^^^^^^^^^^^^^^ %%%% //////////////////} ) => qq{ What do you want? i like pie. [or whatever]} ); &ok( Pod::Simple::XMLOutStream->_out(\&with_vf, q{=pod Hooboy! What do you want? i like pie. [or whatever] #: ^^^^^ %%%% //////////////////} ) => qq{ Hooboy!\n What do you want? i like pie. [or whatever]} ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ print "# Now running some tests adapted from verbatims.t...\n#\n#\n"; print "# Without VerbatimFormatted...\n"; &ok( e "", "" ); &ok( e "\n", "", ); &ok( e "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz" ); &ok( e "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz\n" ); print "# With VerbatimFormatted...\n"; &ok( ev "", "" ); &ok( ev "\n", "", ); &ok( ev "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz" ); &ok( ev "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz\n" ); print "# Now testing via XMLOutStream without VerbatimFormatted...\n"; ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n"), qq{ foo bar baz} ); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n quux\n"), qq{ foo bar baz\n quux} ); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\nquux\n"), qq{ foo bar baz\nquux} ); print "# Contiguous verbatims...\n"; ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n quux\n"), qq{ foo bar baz\n\n quux} ); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n\n quux\n"), qq{ foo bar baz\n\n\n quux} ); print "# Testing =cut...\n"; ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\n quux\n"), qq{ foo bar baz} ); print "#\n# Now retesting with VerbatimFormatted...\n"; ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n"), qq{ foo bar baz} ); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n quux\n"), qq{ foo bar baz\n quux} ); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\nquux\n"), qq{ foo bar baz\nquux} ); print "# Contiguous verbatims...\n"; ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n quux\n"), qq{ foo bar baz\n\n quux} ); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n\n quux\n"), qq{ foo bar baz\n\n\n quux} ); print "# Testing =cut...\n"; ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\n quux\n"), qq{ foo bar baz} ); # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . { my $it = qq{ foo bar bazFoo quux\nquum} ; print "# Various \\n-(in)significance sanity checks...\n"; print "# verbatim/cut/head/verbatim sanity zero...\n"; ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity one...\n"; ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity two...\n"; ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity three...\n"; ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity four...\n"; ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&without_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); } # : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : print "#\n# Now retesting with VerbatimFormatted...\n"; { my $it = qq{ foo bar bazFoo quux\nquum} ; print "# Various \\n-(in)significance sanity checks...\n"; print "# verbatim/cut/head/verbatim sanity zero...\n"; ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity one...\n"; ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity two...\n"; ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity three...\n"; ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); print "# verbatim/cut/head/verbatim sanity four...\n"; ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); ok( Pod::Simple::XMLOutStream->_out(\&with_vf, "\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it); } print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/content_seen.t0000644000175000017500000000121014062242375014673 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 2 }; use Pod::Simple::Text; my $p = Pod::Simple::Text->new(); $p->parse_string_document('dm+aSxLl7V3VUJFIe6CFDU13zhZ3yvjIuVkp6l//ZHcDcX014vnnh3FoElI92kFB JGFU23Vga5Tfz0Epybwio9dq1gzrZ/PIcil2MnEcUWSrIStriv4hAbf0MXcNRHOM oOV7xKU= =y6KV -----END PGP PUBLIC KEY BLOCK-----}; print $key; exit; '); # The =y6KV should not make this appear to be pod ok ! $p->content_seen; my $q = Pod::Simple::Text->new(); $q->parse_string_document('=head1 yes this is pod And this fills it in '); ok $q->content_seen; Pod-Simple-3.43/t/fcodes_e.t0000644000175000017500000000530514062242376013770 0ustar khwkhw# fcodes E BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 20 }; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } #use Pod::Simple::Debug (6); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; print "# Pod::Escapes version $Pod::Escapes::VERSION\n", if $Pod::Escapes::VERSION; # Presumably that's the library being used &ok( e "", "" ); &ok( e "\n", "", ); print "# Testing some basic mnemonic E sequences...\n"; &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2\n"), Pod::Simple::XMLOutStream->_out("=pod\n\n1<2") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2\n"), Pod::Simple::XMLOutStream->_out("=pod\n\n1>2") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2\n"), Pod::Simple::XMLOutStream->_out("=pod\n\n1|2") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2\n"), Pod::Simple::XMLOutStream->_out("=pod\n\n1/2\n") ); print "# Testing some more mnemonic E sequences...\n"; &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2\n"), Pod::Simple::XMLOutStream->_out("=pod\n\n1'2") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2\n"), Pod::Simple::XMLOutStream->_out("=pod\n\n1\"2") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1&2"), Pod::Simple::XMLOutStream->_out("=pod\n\n1E2\n") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2"), Pod::Simple::XMLOutStream->_out("=pod\n\n1E<233>2\n") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2"), Pod::Simple::XMLOutStream->_out("=pod\n\n1E<8734>2\n") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2"), Pod::Simple::XMLOutStream->_out("=pod\n\n1E<171>2\n") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2"), Pod::Simple::XMLOutStream->_out("=pod\n\n1E<187>2\n") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2"), Pod::Simple::XMLOutStream->_out("=pod\n\n1E<171>2\n") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E2"), Pod::Simple::XMLOutStream->_out("=pod\n\n1E<187>2\n") ); print "# Testing numeric E sequences...\n"; &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E<0101>2\n"), Pod::Simple::XMLOutStream->_out("=pod\n\n1A2") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E<65>2\n"), Pod::Simple::XMLOutStream->_out("=pod\n\n1A2") ); &ok( Pod::Simple::XMLOutStream->_out("=pod\n\n1E<0x41>2\n"), Pod::Simple::XMLOutStream->_out("=pod\n\n1A2") ); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/xhtml20.t0000644000175000017500000000226414062242377013521 0ustar khwkhw#!/usr/bin/perl -w # t/xhtml20.t - test subclassing of Pod::Simple::XHTML use strict; use warnings; use Test::More tests => 1; BEGIN { package MyXHTML; use base 'Pod::Simple::XHTML'; sub handle_code { my($self, $code, $kind) = @_; $code = $kind . "[$code]"; $self->SUPER::handle_code($code); } sub start_code { my($self, $kind) = @_; $self->{scratch} .= ""; } sub end_code { my($self, $kind) = @_; $self->{scratch} .= ""; } } my ($parser, $results); initialize(); $parser->parse_string_document(<<'EOT'); =head1 Foo This is C<$code> and so is: my $foo = 1; Code might even be C<<< nested( B<< C<1> >> ) >>>. EOT is($results, <<'EOT');

Foo

This is C[$code] and so is:

Verbatim[  my $foo = 1;]

Code might even be C[nested( ]C[1]C[ )].

EOT sub initialize { $parser = MyXHTML->new; $parser->html_header(''); $parser->html_footer(''); $parser->output_string( \$results ); $results = ''; } Pod-Simple-3.43/t/search25.t0000644000175000017500000000542714062242376013642 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; #sub Pod::Simple::Search::DEBUG () {5}; use Pod::Simple::Search; use Test; BEGIN { plan tests => 10 } print "# ", __FILE__, ": Testing limit_glob ...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; $x->inc(0); $x->shadows(1); use File::Spec; use Cwd; my $cwd = cwd(); print "# CWD: $cwd\n"; my $dir; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { my $updir = File::Spec->updir; $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't'); return File::Spec->catdir ($dir, $file); } else { return $file; } } my($here1, $here2, $here3); if( -e ($here1 = source_path( 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = source_path( 'testlib2')); die "But where's $here3?" unless -e ($here3 = source_path( 'testlib3')); } elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = File::Spec->catdir($cwd, 't', 'testlib2')); die "But where's $here3?" unless -e ($here3 = File::Spec->catdir($cwd, 't', 'testlib3')); } else { die "Can't find the test corpora: $dir"; } print "# OK, found the test corpora\n# as $here1\n# and $here2\n# and $here3\n#\n"; ok 1; print $x->_state_as_string; #$x->verbose(12); use Pod::Simple; *pretty = \&Pod::Simple::BlackBox::pretty; my $glob = 'squaa::*'; print "# Limiting to $glob\n"; $x->limit_glob($glob); my($name2where, $where2name) = $x->survey($here1, $here2, $here3); my $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; { my $names = join "|", sort keys %$name2where; skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, $names, "squaa::Glunk|squaa::Vliff|squaa::Wowo"; } { my $names = join "|", sort values %$where2name; skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, $names, "squaa::Glunk|squaa::Vliff|squaa::Vliff|squaa::Vliff|squaa::Wowo"; my %count; for(values %$where2name) { ++$count{$_} }; #print pretty(\%count), "\n\n"; delete @count{ grep $count{$_} < 2, keys %count }; my $shadowed = join "|", sort keys %count; ok $shadowed, "squaa::Vliff"; sub thar { print "# Seen $_[0] :\n", map "# {$_}\n", sort grep $where2name->{$_} eq $_[0],keys %$where2name; return; } ok $count{'squaa::Vliff'}, 3; thar 'squaa::Vliff'; } ok ! $name2where->{'squaa'}; # because squaa.pm isn't squaa::* ok( ($name2where->{'squaa::Vliff'} || 'huh???'), '/[^\^]testlib1/' ); skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, ($name2where->{'squaa::Wowo'} || 'huh???'), '/testlib2/'; print "# OK, bye from ", __FILE__, "\n"; ok 1; __END__ Pod-Simple-3.43/t/items02.t0000644000175000017500000000260714062242376013506 0ustar khwkhw# Testing the =item directive BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 4 }; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } my $d; #use Pod::Simple::Debug (\$d,0); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; my $x = 'Pod::Simple::XMLOutStream'; print "##### Tests for =item directives via class $x\n"; $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output print "#\n# Tests for =item [number] that are icky...\n"; ok( $x->_out(sub { $_[0]->no_errata_section(1) }, "\n=over\n\n=item 5\n\nStuff\n\n=cut\n\nCrunk\nZorp\n\n=item 4\n\nQuux\n\n=back\n\n"), '5Stuff4Quux' ); ok( $x->_out(sub { $_[0]->no_errata_section(1) }, "\n=over\n\n=item 5.\n\nStuff\n\n=cut\n\nCrunk\nZorp\n\n=item 4.\n\nQuux\n\n=back\n\n"), '5.Stuff4.Quux' ); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/testlib3/0000755000175000017500000000000014066435222013560 5ustar khwkhwPod-Simple-3.43/t/testlib3/squaa/0000755000175000017500000000000014066435222014672 5ustar khwkhwPod-Simple-3.43/t/testlib3/squaa/Vliff.pm0000644000175000017500000000016514062242377016303 0ustar khwkhw =head1 NAME squaa::Vliff -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut print "HOOBOY!\n"; 1; Pod-Simple-3.43/t/stree.t0000644000175000017500000000625214062242376013345 0ustar khwkhw use strict; use warnings; use Test; BEGIN { plan tests => 33 }; #use Pod::Simple::Debug (6); ok 1; use Pod::Simple::SimpleTree; print "# Pod::Simple version $Pod::Simple::VERSION\n"; my $hashes_dont_matter = 0; my $x = 'Pod::Simple::SimpleTree'; sub x { my $p = $x->new; $p->merge_text(1); $p->parse_string_document( shift )->root; } ok 1; print "# a bit of meta-testing...\n"; &ok( deq( 1, 1 )); &ok(!deq( 2, 1 )); &ok( deq( undef, undef )); &ok(!deq( undef, 1 )); &ok(!deq( 1, undef )); &ok( deq( [ ], [ ] )); &ok(!deq( [ ], 1 )); &ok(!deq( 1, [ ] )); &ok( deq( [1], [1] )); &ok(!deq( [1], 1 )); &ok(!deq( 1, [1] )); &ok(!deq( [1], [ ] )); &ok(!deq( [ ], [1] )); &ok(!deq( [1], [2] )); &ok(!deq( [2], [1] )); &ok( deq( [ ], [ ] )); &ok(!deq( [ ], 1 )); &ok(!deq( 1, [ ] )); &ok( deq( {}, {} )); &ok(!deq( {}, 1 )); &ok(!deq( 1, {} )); &ok(!deq( {1,2}, {} )); &ok(!deq( {}, {1,2} )); &ok( deq( {1,2}, {1,2} )); &ok(!deq( {2,1}, {1,2} )); print '# ', Pod::Simple::pretty(x( "=pod\n\nI like pie.\n" )), "\n"; print "# Making sure we get a tree at all...\n"; ok x( "=pod\n\nI like pie.\n" ); print "# Some real tests...\n"; &ok( deq( x( "=pod\n\nI like pie.\n"), [ "Document", {"start_line"=>1}, [ "Para", {"start_line"=>3}, "I like pie." ] ] )); $hashes_dont_matter = 1; &ok( deq( x("=pod\n\nB\n"), [ "Document", {}, [ "Para", {}, ["B", {}, "foo " ] ] ] )); &ok( deq( x("=pod\n\nBXI>\n"), [ "Document", {}, [ "Para", {}, ["B", {}, "pie", ['F',{}, 'zorch'], ['X',{}, 'foo' ], ['I',{}, 'pling'], ] ] ] )); &ok( deq( x("=over\n\n=item BXI>!\n\n=back"), [ "Document", {}, [ "over-text", {}, [ "item-text", {}, ["B", {}, "pie", ['F',{}, 'zorch'], ['X',{}, 'foo' ], ['I',{}, 'pling'], ], '!' ] ] ] )); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; sub deq { # deep-equals #print "# deq ", Pod::Simple::pretty($_[0], $_[1]), "\n"; return 1 unless defined $_[0] or defined $_[1]; # two undefs = same return '' if defined $_[0] xor defined $_[1]; return '' if ref($_[0]) ne ref($_[1]); # unequal referentiality return $_[0] eq $_[1] unless ref $_[0]; # So it's a ref: if(UNIVERSAL::isa($_[0], 'ARRAY')) { return '' unless @{$_[0]} == @{$_[1]}; for(my $i = 0; $i < @{$_[0]}; $i++) { print("# NEQ ", Pod::Simple::pretty($_[0]), "\n# != ", Pod::Simple::pretty($_[1]), "\n"), return '' unless deq($_[0][$i], $_[1][$i]); # recurse! } return 1; } elsif(UNIVERSAL::isa($_[0], 'HASH')) { return 1 if $hashes_dont_matter; return '' unless keys %{$_[0]} == keys %{$_[1]}; foreach my $k (keys %{$_[0]}) { return '' unless exists $_[1]{$k}; return '' unless deq($_[0]{$k}, $_[1]{$k}); } return 1; } else { print "# I don't know how to deque $_[0] & $_[1]\n"; return 1; } } Pod-Simple-3.43/t/corpus2/0000755000175000017500000000000014066435222013424 5ustar khwkhwPod-Simple-3.43/t/corpus2/polish_utf8_bom.xml0000644000175000017500000000560214062242376017254 0ustar khwkhw NAME WÅšRÓD NOCNEJ CISZY -- implicitly utf8 test document in Polish DESCRIPTION This is a test Pod document in UTF8. Its content is the lyrics to the Polish Christmas carol "WÅ›ród nocnej ciszy". WÅ›ród nocnej ciszy gÅ‚os siÄ™ rozchodzi: / WstaÅ„cie, pasterze, Bóg siÄ™ nam rodzi! / Czym prÄ™dzej siÄ™ wybierajcie, / Do Betlejem pospieszajcie / Przywitać Pana. Poszli, znaleźli DzieciÄ tko w żłobie / Z wszystkimi znaki danymi sobie. / Jako Bogu cześć Mu dali, / A witajÄ c zawoÅ‚ali / Z wielkiej radoÅ›ci: Ach, witaj Zbawco z dawno Å¼Ä dany, / Wiele tysiÄ™cy lat wyglÄ dany / Na Ciebie króle, prorocy / Czekali, a TyÅ› tej nocy / Nam siÄ™ objawiÅ‚. I my czekamy na Ciebie, Pana, / A skoro przyjdziesz na gÅ‚os kapÅ‚ana, / Padniemy na twarz przed TobÄ , / WierzÄ c, żeÅ› jest pod osÅ‚onÄ / Chleba i wina. As Verbatim And now as verbatim text: WÅ›ród nocnej ciszy gÅ‚os siÄ™ rozchodzi: WstaÅ„cie, pasterze, Bóg siÄ™ nam rodzi! Czym prÄ™dzej siÄ™ wybierajcie, Do Betlejem pospieszajcie Przywitać Pana. Poszli, znaleźli DzieciÄ…tko w żłobie Z wszystkimi znaki danymi sobie. Jako Bogu cześć Mu dali, A witajÄ…c zawoÅ‚ali Z wielkiej radoÅ›ci: Ach, witaj Zbawco z dawno żądany, Wiele tysiÄ™cy lat wyglÄ…dany Na Ciebie króle, prorocy Czekali, a TyÅ› tej nocy Nam siÄ™ objawiÅ‚. I my czekamy na Ciebie, Pana, A skoro przyjdziesz na gÅ‚os kapÅ‚ana, Padniemy na twarz przed TobÄ…, WierzÄ…c, żeÅ› jest pod osÅ‚onÄ… Chleba i wina. [end] Pod-Simple-3.43/t/corpus2/polish_utf8_bom2.xml0000644000175000017500000000560214062242376017336 0ustar khwkhw NAME WÅšRÓD NOCNEJ CISZY -- implicitly utf8 test document in Polish DESCRIPTION This is a test Pod document in UTF8. Its content is the lyrics to the Polish Christmas carol "WÅ›ród nocnej ciszy". WÅ›ród nocnej ciszy gÅ‚os siÄ™ rozchodzi: / WstaÅ„cie, pasterze, Bóg siÄ™ nam rodzi! / Czym prÄ™dzej siÄ™ wybierajcie, / Do Betlejem pospieszajcie / Przywitać Pana. Poszli, znaleźli DzieciÄ tko w żłobie / Z wszystkimi znaki danymi sobie. / Jako Bogu cześć Mu dali, / A witajÄ c zawoÅ‚ali / Z wielkiej radoÅ›ci: Ach, witaj Zbawco z dawno Å¼Ä dany, / Wiele tysiÄ™cy lat wyglÄ dany / Na Ciebie króle, prorocy / Czekali, a TyÅ› tej nocy / Nam siÄ™ objawiÅ‚. I my czekamy na Ciebie, Pana, / A skoro przyjdziesz na gÅ‚os kapÅ‚ana, / Padniemy na twarz przed TobÄ , / WierzÄ c, żeÅ› jest pod osÅ‚onÄ / Chleba i wina. As Verbatim And now as verbatim text: WÅ›ród nocnej ciszy gÅ‚os siÄ™ rozchodzi: WstaÅ„cie, pasterze, Bóg siÄ™ nam rodzi! Czym prÄ™dzej siÄ™ wybierajcie, Do Betlejem pospieszajcie Przywitać Pana. Poszli, znaleźli DzieciÄ…tko w żłobie Z wszystkimi znaki danymi sobie. Jako Bogu cześć Mu dali, A witajÄ…c zawoÅ‚ali Z wielkiej radoÅ›ci: Ach, witaj Zbawco z dawno żądany, Wiele tysiÄ™cy lat wyglÄ…dany Na Ciebie króle, prorocy Czekali, a TyÅ› tej nocy Nam siÄ™ objawiÅ‚. I my czekamy na Ciebie, Pana, A skoro przyjdziesz na gÅ‚os kapÅ‚ana, Padniemy na twarz przed TobÄ…, WierzÄ…c, żeÅ› jest pod osÅ‚onÄ… Chleba i wina. [end] Pod-Simple-3.43/t/corpus2/polish_utf8_bom.txt0000644000175000017500000000300214062242376017263 0ustar khwkhw =head1 NAME WŚRÓD NOCNEJ CISZY -- implicitly utf8 test document in Polish =head1 DESCRIPTION This is a test Pod document in UTF8. Its content is the lyrics to the Polish Christmas carol "Wśród nocnej ciszy". Wśród nocnej ciszy głos się rozchodzi: / Wstańcie, pasterze, Bóg się nam rodzi! / Czym prędzej się wybierajcie, / Do Betlejem pospieszajcie / Przywitać Pana. Poszli, znaleźli Dzieciątko w żłobie / Z wszystkimi znaki danymi sobie. / Jako Bogu cześć Mu dali, / A witając zawołali / Z wielkiej radości: Ach, witaj Zbawco z dawno żądany, / Wiele tysięcy lat wyglądany / Na Ciebie króle, prorocy / Czekali, a Tyś tej nocy / Nam się objawił. I my czekamy na Ciebie, Pana, / A skoro przyjdziesz na głos kapłana, / Padniemy na twarz przed Tobą, / Wierząc, żeś jest pod osłoną / Chleba i wina. =head2 As Verbatim And now as verbatim text: Wśród nocnej ciszy głos się rozchodzi: Wstańcie, pasterze, Bóg się nam rodzi! Czym prędzej się wybierajcie, Do Betlejem pospieszajcie Przywitać Pana. Poszli, znaleźli Dzieciątko w żłobie Z wszystkimi znaki danymi sobie. Jako Bogu cześć Mu dali, A witając zawołali Z wielkiej radości: Ach, witaj Zbawco z dawno żądany, Wiele tysięcy lat wyglądany Na Ciebie króle, prorocy Czekali, a Tyś tej nocy Nam się objawił. I my czekamy na Ciebie, Pana, A skoro przyjdziesz na głos kapłana, Padniemy na twarz przed Tobą, Wierząc, żeś jest pod osłoną Chleba i wina. [end] =cut Pod-Simple-3.43/t/corpus2/README0000644000175000017500000000024414062242376014306 0ustar khwkhwThis is a corpus of data that hasn't been implemented yet. It's included for future reference, and will be moved to the main corpus directory as it is implemented. Pod-Simple-3.43/t/corpus2/polish_utf8_bom2.txt0000644000175000017500000000300214062242376017345 0ustar khwkhw=head1 NAME WŚRÓD NOCNEJ CISZY -- implicitly utf8 test document in Polish =head1 DESCRIPTION This is a test Pod document in UTF8. Its content is the lyrics to the Polish Christmas carol "Wśród nocnej ciszy". Wśród nocnej ciszy głos się rozchodzi: / Wstańcie, pasterze, Bóg się nam rodzi! / Czym prędzej się wybierajcie, / Do Betlejem pospieszajcie / Przywitać Pana. Poszli, znaleźli Dzieciątko w żłobie / Z wszystkimi znaki danymi sobie. / Jako Bogu cześć Mu dali, / A witając zawołali / Z wielkiej radości: Ach, witaj Zbawco z dawno żądany, / Wiele tysięcy lat wyglądany / Na Ciebie króle, prorocy / Czekali, a Tyś tej nocy / Nam się objawił. I my czekamy na Ciebie, Pana, / A skoro przyjdziesz na głos kapłana, / Padniemy na twarz przed Tobą, / Wierząc, żeś jest pod osłoną / Chleba i wina. =head2 As Verbatim And now as verbatim text: Wśród nocnej ciszy głos się rozchodzi: Wstańcie, pasterze, Bóg się nam rodzi! Czym prędzej się wybierajcie, Do Betlejem pospieszajcie Przywitać Pana. Poszli, znaleźli Dzieciątko w żłobie Z wszystkimi znaki danymi sobie. Jako Bogu cześć Mu dali, A witając zawołali Z wielkiej radości: Ach, witaj Zbawco z dawno żądany, Wiele tysięcy lat wyglądany Na Ciebie króle, prorocy Czekali, a Tyś tej nocy Nam się objawił. I my czekamy na Ciebie, Pana, A skoro przyjdziesz na głos kapłana, Padniemy na twarz przed Tobą, Wierząc, żeś jest pod osłoną Chleba i wina. [end] =cut Pod-Simple-3.43/t/corpus2/polish_implicit_utf8.txt0000644000175000017500000000277714062242376020342 0ustar khwkhw =head1 NAME WŚRÓD NOCNEJ CISZY -- implicitly utf8 test document in Polish =head1 DESCRIPTION This is a test Pod document in UTF8. Its content is the lyrics to the Polish Christmas carol "Wśród nocnej ciszy". Wśród nocnej ciszy głos się rozchodzi: / Wstańcie, pasterze, Bóg się nam rodzi! / Czym prędzej się wybierajcie, / Do Betlejem pospieszajcie / Przywitać Pana. Poszli, znaleźli Dzieciątko w żłobie / Z wszystkimi znaki danymi sobie. / Jako Bogu cześć Mu dali, / A witając zawołali / Z wielkiej radości: Ach, witaj Zbawco z dawno żądany, / Wiele tysięcy lat wyglądany / Na Ciebie króle, prorocy / Czekali, a Tyś tej nocy / Nam się objawił. I my czekamy na Ciebie, Pana, / A skoro przyjdziesz na głos kapłana, / Padniemy na twarz przed Tobą, / Wierząc, żeś jest pod osłoną / Chleba i wina. =head2 As Verbatim And now as verbatim text: Wśród nocnej ciszy głos się rozchodzi: Wstańcie, pasterze, Bóg się nam rodzi! Czym prędzej się wybierajcie, Do Betlejem pospieszajcie Przywitać Pana. Poszli, znaleźli Dzieciątko w żłobie Z wszystkimi znaki danymi sobie. Jako Bogu cześć Mu dali, A witając zawołali Z wielkiej radości: Ach, witaj Zbawco z dawno żądany, Wiele tysięcy lat wyglądany Na Ciebie króle, prorocy Czekali, a Tyś tej nocy Nam się objawił. I my czekamy na Ciebie, Pana, A skoro przyjdziesz na głos kapłana, Padniemy na twarz przed Tobą, Wierząc, żeś jest pod osłoną Chleba i wina. [end] =cut Pod-Simple-3.43/t/corpus2/fiqhakbar_iso6.xml0000644000175000017500000002251114062242376017041 0ustar khwkhw NAME متن الفقه الاكبر -- test document: "al-Fiqh al-Akbar" as ISO-8859-6 DESCRIPTION This document is Abu Hanifah's "al-Fiqh al-Akbar" as ISO-8859-6, presented as an item-number list: متن الفقه الاكبر المنسوب الى ابي حنيفة النعمان بن ثابت لا نكفر أحدا بذنب ولا ننفي أحدا من الايمان . إنا نأمر بالمعروف وننهي عن المنكر . واعلم أن ما أصابك لم يكن ليخطئك ، وما أخطأك لم يكن ليصيبك . لا نتبرأ من أحد من أصحاب رسول الله صلى الله عليه وسلم ولا يتوالى أحد دون أحد . إنا نرد أمر عثمان وعلي الى الله وهو عالم السر والخفيات . الفقه في الدين أفضل من الفقه في العلم . واختلاف الامة رحمة . من آمن بجميع ما يؤمر به الا أنه قال لا أعرف موسى وعيسى عليهما السلام أمن المرسلين أم من غير المرسلين فإنه يكفر . من قال لا أعرف الله أفي السماء أم في الارض فقد كفر . من قال لا أعرف عذاب القبر فهو من الطبقة الجهمية والهالكية . And now run together as a paragraph: لا نكفر أحدا بذنب ولا ننفي أحدا من الايمان . إنا نأمر بالمعروف وننهي عن المنكر . واعلم أن ما أصابك لم يكن ليخطئك ، وما أخطأك لم يكن ليصيبك . لا نتبرأ من أحد من أصحاب رسول الله صلى الله عليه وسلم ولا يتوالى أحد دون أحد . إنا نرد أمر عثمان وعلي الى الله وهو عالم السر والخفيات . الفقه في الدين أفضل من الفقه في العلم . واختلاف الامة رحمة . من آمن بجميع ما يؤمر به الا أنه قال لا أعرف موسى وعيسى عليهما السلام أمن المرسلين أم من غير المرسلين فإنه يكفر . من قال لا أعرف الله أفي السماء أم في الارض فقد كفر . من قال لا أعرف عذاب القبر فهو من الطبقة الجهمية والهالكية . And now the first three as a verbatim section: لا نكفر أحدا بذنب ولا ننفي أحدا من الايمان . إنا نأمر بالمعروف وننهي عن المنكر . واعلم أن ما أصابك لم يكن ليخطئك ، وما أخطأك لم يكن ليصيبك . [end] Pod-Simple-3.43/t/corpus2/fiqhakbar_iso6.txt0000644000175000017500000000337114062242376017063 0ustar khwkhw =encoding iso-8859-6 =head1 NAME -- test document: "al-Fiqh al-Akbar" as ISO-8859-6 =head1 DESCRIPTION This document is Abu Hanifah's "al-Fiqh al-Akbar" as ISO-8859-6, presented as an item-number list: =over =item 1 . =item 2 . =item 3 . =item 4 . =item 5 . =item 6 . =item 7 . =item 8 . =item 9 . =item 10 . =back And now run together as a paragraph: . . . . . . . . . . And now the first three as a verbatim section: . . . [end] =cut Pod-Simple-3.43/t/corpus2/polish_utf16be_bom.txt0000644000175000017500000000576214062242376017670 0ustar khwkhw =head1 NAME WZRD NOCNEJ CISZY -- implicitly utf8 test document in Polish =head1 DESCRIPTION This is a test Pod document in UTF8. Its content is the lyrics to the Polish Christmas carol "W[rd nocnej ciszy". W[rd nocnej ciszy gBos si rozchodzi: / WstaDcie, pasterze, Bg si nam rodzi! / Czym prdzej si wybierajcie, / Do Betlejem pospieszajcie / Przywita Pana. Poszli, znalezli Dziecitko w |Bobie / Z wszystkimi znaki danymi sobie. / Jako Bogu cze[ Mu dali, / A witajc zawoBali / Z wielkiej rado[ci: Ach, witaj Zbawco z dawno |dany, / Wiele tysicy lat wygldany / Na Ciebie krle, prorocy / Czekali, a Ty[ tej nocy / Nam si objawiB. I my czekamy na Ciebie, Pana, / A skoro przyjdziesz na gBos kapBana, / Padniemy na twarz przed Tob, / Wierzc, |e[ jest pod osBon / Chleba i wina. =head2 As Verbatim And now as verbatim text: W[rd nocnej ciszy gBos si rozchodzi: WstaDcie, pasterze, Bg si nam rodzi! Czym prdzej si wybierajcie, Do Betlejem pospieszajcie Przywita Pana. Poszli, znalezli Dziecitko w |Bobie Z wszystkimi znaki danymi sobie. Jako Bogu cze[ Mu dali, A witajc zawoBali Z wielkiej rado[ci: Ach, witaj Zbawco z dawno |dany, Wiele tysicy lat wygldany Na Ciebie krle, prorocy Czekali, a Ty[ tej nocy Nam si objawiB. I my czekamy na Ciebie, Pana, A skoro przyjdziesz na gBos kapBana, Padniemy na twarz przed Tob, Wierzc, |e[ jest pod osBon Chleba i wina. [end] =cut Pod-Simple-3.43/t/corpus2/polish_utf16le_bom.txt0000644000175000017500000000576214062242376017702 0ustar khwkhw =head1 NAME WZRD NOCNEJ CISZY -- implicitly utf8 test document in Polish =head1 DESCRIPTION This is a test Pod document in UTF8. Its content is the lyrics to the Polish Christmas carol "W[rd nocnej ciszy". W[rd nocnej ciszy gBos si rozchodzi: / WstaDcie, pasterze, Bg si nam rodzi! / Czym prdzej si wybierajcie, / Do Betlejem pospieszajcie / Przywita Pana. Poszli, znalezli Dziecitko w |Bobie / Z wszystkimi znaki danymi sobie. / Jako Bogu cze[ Mu dali, / A witajc zawoBali / Z wielkiej rado[ci: Ach, witaj Zbawco z dawno |dany, / Wiele tysicy lat wygldany / Na Ciebie krle, prorocy / Czekali, a Ty[ tej nocy / Nam si objawiB. I my czekamy na Ciebie, Pana, / A skoro przyjdziesz na gBos kapBana, / Padniemy na twarz przed Tob, / Wierzc, |e[ jest pod osBon / Chleba i wina. =head2 As Verbatim And now as verbatim text: W[rd nocnej ciszy gBos si rozchodzi: WstaDcie, pasterze, Bg si nam rodzi! Czym prdzej si wybierajcie, Do Betlejem pospieszajcie Przywita Pana. Poszli, znalezli Dziecitko w |Bobie Z wszystkimi znaki danymi sobie. Jako Bogu cze[ Mu dali, A witajc zawoBali Z wielkiej rado[ci: Ach, witaj Zbawco z dawno |dany, Wiele tysicy lat wygldany Na Ciebie krle, prorocy Czekali, a Ty[ tej nocy Nam si objawiB. I my czekamy na Ciebie, Pana, A skoro przyjdziesz na gBos kapBana, Padniemy na twarz przed Tob, Wierzc, |e[ jest pod osBon Chleba i wina. [end] =cut Pod-Simple-3.43/t/fcodes.t0000644000175000017500000001047314062242376013466 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 23 }; #use Pod::Simple::Debug (5); BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; print "# With weird leading whitespace...\n"; # With weird whitespace ok( Pod::Simple::XMLOutStream->_out("=pod\n\nI\n"), 'foo' ); ok( Pod::Simple::XMLOutStream->_out("=pod\n\nB< foo>\n"), ' foo' ); ok( Pod::Simple::XMLOutStream->_out("=pod\n\nB<\tfoo>\n"), ' foo' ); ok( Pod::Simple::XMLOutStream->_out("=pod\n\nB<\nfoo>\n"), ' foo' ); ok( Pod::Simple::XMLOutStream->_out("=pod\n\nB\n"), 'foo' ); ok( Pod::Simple::XMLOutStream->_out("=pod\n\nB\n"), 'foo ' ); ok( Pod::Simple::XMLOutStream->_out("=pod\n\nB\n"), 'foo ' ); print "#\n# Tests for wedges outside of formatting codes...\n"; &ok( Pod::Simple::XMLOutStream->_out("=pod\n\nX < 3 and N > 19\n"), Pod::Simple::XMLOutStream->_out("=pod\n\nX E 3 and N E 19\n") ); print "# A complex test with internal whitespace...\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nIB< bar>CF< quux\t?>\n"), 'foo barbaz quux ?' ); print "# Without any nesting...\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nF
CIBX\n"), 'abcde' ); print "# Without any nesting, but with Z's...\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nZ<>FCIBX\n"), 'abcde' ); print "# With lots of nesting, and Z's...\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nZ<>Ffoo> I> B>baz>\n"), 'foo bar thingbaz' ); print "#\n# *** Now testing different numbers of wedges ***\n"; print "# Without any nesting...\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nF<< a >>C<<< b >>>I<<<< c >>>>B<< d >>X<< e >>\n"), 'abcde' ); print "# Without any nesting, but with Z's, and odder whitespace...\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nF<< aZ<> >>C<<< Z<>b >>>I<<<< c >>>>B<< d \t >>X<<\ne >>\n"), 'abcde' ); print "# With nesting and Z's, and odder whitespace...\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nF<< aZ<> >>C<<< Z<>bZ<>B<< d \t >>X<<\ne >> >>>I<<<< c >>>>\n"), "abdec" ); print "# Regression https://rt.cpan.org/Ticket/Display.html?id=55602 (vs 12239)\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nC<<< foo->bar >>>\n"), 'foo->bar' ); ok( Pod::Simple::XMLOutStream->_out("=pod\n\nC<<< C >>>\n"), 'foo' ); ok( Pod::Simple::XMLOutStream->_out("=pod\n\nC<<< C<> >>>\n"), '<foo>' ); ok( Pod::Simple::XMLOutStream->_out("=pod\n\nC<<< CZ<><> >>>\n"), 'C<<foo>>' ); ok( Pod::Simple::XMLOutStream->_out("=pod\n\nC<<< CE> >>>\n"), 'C<<foo>>' ); print "# Misc...\n"; ok( Pod::Simple::XMLOutStream->_out( "=pod\n\nI like I with B and Stuff and N < 3 and X<< things >> hoohah\n" ."And I a happy time>.\n" ."And B>>.>\n" ) => "I like PIE with cream and Stuff and N < 3 and things hoohah " ."And pie is also a happy time. " ."And I like pie." ); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/testlib2/0000755000175000017500000000000014066435222013557 5ustar khwkhwPod-Simple-3.43/t/testlib2/Suzzle.pm0000644000175000017500000000012214062242377015407 0ustar khwkhw 1; __END__ =head1 NAME Sizzlesuzzle -- hooboy, this is a test file too. =cut Pod-Simple-3.43/t/testlib2/pods/0000755000175000017500000000000014066435222014524 5ustar khwkhwPod-Simple-3.43/t/testlib2/pods/perlzoned.pod0000644000175000017500000000007314062242377017235 0ustar khwkhw=head1 NAME perlzoned - This is just some test file =cut Pod-Simple-3.43/t/testlib2/pod/0000755000175000017500000000000014066435222014341 5ustar khwkhwPod-Simple-3.43/t/testlib2/pod/perlthng.pod0000644000175000017500000000007514062242377016675 0ustar khwkhw =head1 NAME perlthang - This is just some test file =cut Pod-Simple-3.43/t/testlib2/pod/perlzuk.pod0000644000175000017500000000007514062242377016546 0ustar khwkhw =head1 NAME perlthang - This is just some test file =cut Pod-Simple-3.43/t/testlib2/squaa/0000755000175000017500000000000014066435222014671 5ustar khwkhwPod-Simple-3.43/t/testlib2/squaa/Wowo.pod0000644000175000017500000000013614062242377016333 0ustar khwkhw =head1 NAME squaa::Glunk -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut Pod-Simple-3.43/t/testlib2/squaa/Vliff.pm0000644000175000017500000000016514062242377016302 0ustar khwkhw =head1 NAME squaa::Vliff -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut print "HOOBOY!\n"; 1; Pod-Simple-3.43/t/testlib2/hinkhonk/0000755000175000017500000000000014066435222015370 5ustar khwkhwPod-Simple-3.43/t/testlib2/hinkhonk/readme.txt0000644000175000017500000000005014062242377017364 0ustar khwkhwThis directory should never be scanned. Pod-Simple-3.43/t/testlib2/hinkhonk/Vliff.pm0000644000175000017500000000016514062242377017001 0ustar khwkhw =head1 NAME squaa::Vliff -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut print "HOOBOY!\n"; 1; Pod-Simple-3.43/t/testlib2/hinkhonk/Glunk.pod0000644000175000017500000000013614062242377017157 0ustar khwkhw =head1 NAME squaa::Glunk -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut Pod-Simple-3.43/t/JustPod02.t0000644000175000017500000002122614062242376013753 0ustar khwkhwuse strict; use warnings; use Test::More; BEGIN { plan tests => 1 } use Pod::Simple::JustPod; my @orig = ; my $parsed; my $parser = Pod::Simple::JustPod->new(); $parser->output_string(\$parsed); $parser->parse_lines(@orig, undef); my $orig = join "", @orig; my $msg = "Verify parsed pod sufficiently matches original"; if ($parsed eq $orig) { pass($msg); } elsif ($ENV{PERL_TEST_DIFF}) { fail($msg); require File::Temp; my $orig_file = File::Temp->new(); local $/ = "\n"; chomp $orig; print $orig_file $orig, "\n"; close $orig_file || die "Can't close orig_file: $!"; chomp $parsed; my $parsed_file = File::Temp->new(); print $parsed_file $parsed, "\n"; close $parsed_file || die "Can't close parsed_file"; my $diff = File::Temp->new(); system("$ENV{PERL_TEST_DIFF} $orig_file $parsed_file > $diff"); open my $fh, "<", $diff || die "Can't open $diff"; my @diffs = <$fh>; diag(@diffs); } else { eval { require Text::Diff; }; if ($@) { is($parsed, $orig, $msg); diag("Set environment variable PERL_TEST_DIFF=diff_tool or install" . " Text::Diff to see just the differences."); } else { fail($msg); diag Text::Diff::diff(\$orig, \$parsed, { STYLE => 'Unified' }); } } # The data is adapted from a test file from pod2lators. Extra spaces are # added in places to make sure they get retained, and some extra tests __DATA__ =pod =encoding ASCII =head1 NAME basic.pod - Test of various basic POD features in translators. =head1 HEADINGS Try a few different levels of headings, with embedded formatting codes and other interesting bits. =head1 This C a "level 1" heading =head2 ``Level'' "2 I =head3 Level 3 B>>> =head4 Level "4 C =head5 Level "5 B =head6 Level "6 I Now try again with B F. =head1 This C a "level 1" heading Text. =head2 ``Level'' 2 I Text. =head3 Level 3 B>>> Text. =head4 Level "4 C Text. =head5 Level "5 B Text. =head6 Level "6 I Text. =head1 LINKS These are all taken from the Pod::Parser tests. Try out I of different ways of specifying references: Reference the L Reference the L<"manpage"/section> Reference the L Now try it using the new "|" stuff ... Reference the L| Reference the L| Reference the L| Reference the L| Reference the L| Reference the L| And then throw in a few new ones of my own. L L L L L L L L L<"boo var baz"> L L, L, and L Lbar> L|foo/bar> L text> LbarZ<>/Section C I markup>> =head1 OVER AND ITEMS Taken from Pod::Parser tests, this is a test to ensure that multiline =item paragraphs get indented appropriately. =over 4 =item This is a test. =back There should be whitespace now before this line. Taken from Pod::Parser tests, this is a test to ensure the nested =item paragraphs get indented appropriately. =over 2 =item 1 First section. =over 2 =item a this is item a =item b this is item b =back =item 2 Second section. =over 2 =item a this is item a =item b this is item b =item c =item d This is item c & d. =back =back Now some additional weirdness of our own. Make sure that multiple tags for one paragraph are properly compacted. =over 4 =item "foo" =item B =item C There shouldn't be any spaces between any of these item tags; this idiom is used in perlfunc. =item Some longer item text Just to make sure that we test paragraphs where the item text doesn't fit in the margin of the paragraph (and make sure that this paragraph fills a few lines). Let's also make it multiple paragraphs to be sure that works. =back Test use of =over without =item as a block "quote" or block paragraph. =over 4 This should be indented four spaces but otherwise formatted the same as any other regular text paragraph. Make sure it's long enough to see the results of the formatting..... =back Now try the same thing nested, and make sure that the indentation is reset back properly. =over 4 =over 4 This paragraph should be doubly indented. =back This paragraph should only be singly indented. =over 4 =item This is an item in the middle of a block-quote, which should be allowed. =item We're also testing tagless item commands. =back Should be back to the single level of indentation. =back Should be back to regular indentation. Now also check the transformation of * into real bullets for man pages. =over =item * An item. We're also testing using =over without a number, and making sure that item text wraps properly. =item * Another item. =back and now test the numbering of item blocks. =over 4 =item 1. First item. =item 2. Second item. =back =head1 FORMATTING CODES Another test taken from Pod::Parser. This is a test to see if I can do not only C<$self> and C, but also C<< $self->method() >> and C<< $self->{FIELDNAME} >> and C<< $Foo <=> $Bar >> without resorting to escape sequences. If I want to refer to the right-shift operator I can do something like C<<< $x >> 3 >>> or even C<<<< $y >> 5 >>>>. Now for the grand finale of C<< $self->method()->{FIELDNAME} = {FOO=>BAR} >>. And I also want to make sure that newlines work like this C<<< $self->{FOOBAR} >> 3 and [$b => $a]->[$a <=> $b] >>> Of course I should still be able to do all this I escape sequences too: C<$self-Emethod()> and C<$self-E{FIELDNAME}> and C<{FOO=EBAR}>. Dont forget C<$self-Emethod()-E{FIELDNAME} = {FOO=EBAR}>. And make sure that C<0> works too! Now, if I use << or >> as my delimiters, then I have to use whitespace. So things like C<<$self->method()>> and C<<$self->{FIELDNAME}>> wont end up doing what you might expect since the first > will still terminate the first < seen. Lets make sure these work for empty ones too, like C<<< >>>, C<<<< >>>>, and C<< >> >> (just to be obnoxious) The statement: C hour!> is a parody of a quotation from Winston Churchill. The following tests are added to those: Make sure that a few othZ<>er odd Ithings> still work. This should be a vertical bar: E. Here's a test of a few more special escapes that have to be supported: =over 3 =item E An ampersand. =item E An apostrophe. =item E A less-than sign. =item E A greater-than sign. =item E A double quotation mark. =item E A forward slash. =back Try to get this bit of text over towards the edge so S<|that all of this text inside SEE won't|> be wrapped. Also test the |sameEthingEwithEnon-breakingS< spaces>.| There is a soft hyEphen in hyphen at hy-phen. This is a test of an Xindex entry. =head1 VERBATIM Throw in a few verbatim paragraphs. use Term::ANSIColor; print color 'bold blue'; print "This text is bold blue.\n"; print color 'reset'; print "This text is normal.\n"; print colored ("Yellow on magenta.\n", 'yellow on_magenta'); print "This text is normal.\n"; print colored ['yellow on_magenta'], "Yellow on magenta.\n"; use Term::ANSIColor qw(uncolor); print uncolor '01;31', "\n"; But this isn't verbatim (make sure it wraps properly), and the next paragraph is again: use Term::ANSIColor qw(:constants); print BOLD, BLUE, "This text is in bold blue.\n", RESET; use Term::ANSIColor qw(:constants); $Term::ANSIColor::AUTORESET = 1; print BOLD BLUE "This text is in bold blue.\n"; print "This text is normal.\n"; (Ugh, that's obnoxiously long.) Try different spacing: Starting with a tab. Not starting with a tab. But this should still be verbatim. As should this. This isn't. This is. And this: is an internal tab. It should be: |--| <= lined up with that. (Tricky, but tabs should be expanded before the translator starts in on the text since otherwise text with mixed tabs and spaces will get messed up.) And now we test verbatim paragraphs right before a heading. Older versions of Pod::Man generated two spaces between paragraphs like this and the heading. (In order to properly test this, one may have to visually inspect the nroff output when run on the generated *roff text, unfortunately.) =head1 CONCLUSION That's all, folks! =cut Pod-Simple-3.43/t/search22.t0000644000175000017500000000700214062242376013626 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Pod::Simple::Search; use Test; BEGIN { plan tests => 15 } print "# ", __FILE__, ": Testing the scanning of several docroots...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; $x->inc(0); $x->shadows(1); use File::Spec; use Cwd; my $cwd = cwd(); print "# CWD: $cwd\n"; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { return "../lib/Pod/Simple/t/$file"; } else { return $file; } } my($here1, $here2, $here3); if( -e ($here1 = source_path('testlib1' ))) { die "But where's $here2?" unless -e ($here2 = source_path('testlib2')); die "But where's $here3?" unless -e ($here3 = source_path('testlib3')); } elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = File::Spec->catdir($cwd, 't', 'testlib2')); die "But where's $here3?" unless -e ($here3 = File::Spec->catdir($cwd, 't', 'testlib3')); } else { die "Can't find the test corpora"; } print "# OK, found the test corpora\n# as $here1\n# and $here2\n# and $here3\n#\n"; ok 1; print $x->_state_as_string; #$x->verbose(12); use Pod::Simple; *pretty = \&Pod::Simple::BlackBox::pretty; my($name2where, $where2name) = $x->survey($here1, $here2, $here3); my $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; my $ascii_order; if( -e ($ascii_order = source_path('ascii_order.pl'))) { # } elsif(-e ($ascii_order = File::Spec->catfile($cwd, 't', 'ascii_order.pl'))) { # } else { die "Can't find ascii_order.pl"; } require $ascii_order; { print "# won't show any shadows, since we're just looking at the name2where keys\n"; my $names = join "|", sort ascii_order keys %$name2where; skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, $names, "Blorm|Suzzle|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|perlzoned|perlzuk|squaa|squaa::Glunk|squaa::Vliff|squaa::Wowo|zikzik"; } { print "# but here we'll see shadowing:\n"; my $names = join "|", sort ascii_order values %$where2name; skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, $names, "Blorm|Suzzle|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Glunk|hinkhonk::Vliff|hinkhonk::Vliff|perlflif|perlthng|perlthng|perlzoned|perlzuk|squaa|squaa::Glunk|squaa::Vliff|squaa::Vliff|squaa::Vliff|squaa::Wowo|zikzik"; my %count; for(values %$where2name) { ++$count{$_} }; #print pretty(\%count), "\n\n"; delete @count{ grep $count{$_} < 2, keys %count }; my $shadowed = join "|", sort ascii_order keys %count; ok $shadowed, "hinkhonk::Glunk|hinkhonk::Vliff|perlthng|squaa::Vliff"; sub thar { print "# Seen $_[0] :\n", map "# {$_}\n", sort ascii_order grep $where2name->{$_} eq $_[0],keys %$where2name; return; } ok $count{'perlthng'}, 2; thar 'perlthng'; ok $count{'squaa::Vliff'}, 3; thar 'squaa::Vliff'; } ok( ($name2where->{'squaa'} || 'huh???'), '/squaa\.pm$/'); ok grep( m/squaa\.pm/, keys %$where2name ), 1; ok( ($name2where->{'perlthng'} || 'huh???'), '/[^\^]testlib1/' ); ok( ($name2where->{'squaa::Vliff'} || 'huh???'), '/[^\^]testlib1/' ); # Some sanity: skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, ($name2where->{'squaa::Wowo'} || 'huh???'), '/testlib2/'; my $in_pods = $x->find('perlzoned', $here2); ok $in_pods, qr{^\Q$here2\E}; ok $in_pods, qr{perlzoned.pod$}; print "# OK, bye from ", __FILE__, "\n"; ok 1; __END__ Pod-Simple-3.43/t/perlcyg.pod0000644000175000017500000004770314062242376014215 0ustar khwkhwIf you read this file _as_is_, just ignore the funny characters you see. It is written in the POD format (see pod/perlpod.pod) which is specially designed to be readable as is. =head1 NAME README.cygwin - Perl for Cygwin =head1 SYNOPSIS This document will help you configure, make, test and install Perl on Cygwin. This document also describes features of Cygwin that will affect how Perl behaves at runtime. B There are pre-built Perl packages available for Cygwin and a version of Perl is provided on the Cygwin CD. If you do not need to customize the configuration, consider using one of these packages: http://cygutils.netpedia.net/ =head1 PREREQUISITES =head2 Cygwin = GNU+Cygnus+Windows (Don't leave UNIX without it) The Cygwin tools are ports of the popular GNU development tools for Win32 platforms. They run thanks to the Cygwin library which provides the UNIX system calls and environment these programs expect. More information about this project can be found at: http://www.cygwin.com/ A recent net or commercial release of Cygwin is required. At the time this document was last updated, Cygwin 1.1.5 was current. B At this point, minimal effort has been made to provide compatibility with old (beta) Cygwin releases. The focus has been to provide a high quality release and not worry about working around old bugs. If you wish to use Perl with Cygwin B20.1 or earlier, consider using perl5.005_03, which is available in source and binary form at C. If there is significant demand, a patch kit can be developed to port back to earlier Cygwin versions. =head2 Cygwin Configuration While building Perl some changes may be necessary to your Cygwin setup so that Perl builds cleanly. These changes are B required for normal Perl usage. B The binaries that are built will run on all Win32 versions. They do not depend on your host system (Win9x/WinME, WinNT/Win2K) or your Cygwin configuration (I, I, binary/text mounts). The only dependencies come from hard-coded pathnames like C. However, your host system and Cygwin configuration will affect Perl's runtime behavior (see L). =over 4 =item * C Set the C environment variable so that Configure finds the Cygwin versions of programs. Any Windows directories should be removed or moved to the end of your C. =item * I If you do not have I (which is part of the I package), Configure will B prompt you to install I pages. =item * Permissions On WinNT with either the I or I C settings, directory and file permissions may not be set correctly. Since the build process creates directories and files, to be safe you may want to run a `C' on the entire Perl source tree. Also, it is a well known WinNT "feature" that files created by a login that is a member of the I group will be owned by the I group. Depending on your umask, you may find that you can not write to files that you just created (because you are no longer the owner). When using the I C setting, this is not an issue because it "corrects" the ownership to what you would expect on a UNIX system. =back =head1 CONFIGURE The default options gathered by Configure with the assistance of F will build a Perl that supports dynamic loading (which requires a shared F). This will run Configure and keep a record: ./Configure 2>&1 | tee log.configure If you are willing to accept all the defaults run Configure with B<-de>. However, several useful customizations are available. =head2 Strip Binaries It is possible to strip the EXEs and DLLs created by the build process. The resulting binaries will be significantly smaller. If you want the binaries to be stripped, you can either add a B<-s> option when Configure prompts you, Any additional ld flags (NOT including libraries)? [none] -s Any special flags to pass to gcc to use dynamic linking? [none] -s Any special flags to pass to ld2 to create a dynamically loaded library? [none] -s or you can edit F and uncomment the relevant variables near the end of the file. =head2 Optional Libraries Several Perl functions and modules depend on the existence of some optional libraries. Configure will find them if they are installed in one of the directories listed as being used for library searches. Pre-built packages for most of these are available at C. =over 4 =item * C<-lcrypt> The crypt package distributed with Cygwin is a Linux compatible 56-bit DES crypt port by Corinna Vinschen. Alternatively, the crypt libraries in GNU libc have been ported to Cygwin. The DES based Ultra Fast Crypt port was done by Alexey Truhan: ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin/porters/Okhapkin_Sergey/cw32crypt-dist-0.tgz NOTE: There are various export restrictions on DES implementations, see the glibc README for more details. The MD5 port was done by Andy Piper: ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin/porters/Okhapkin_Sergey/libcrypt.tgz =item * C<-lgdbm> (C) GDBM is available for Cygwin. GDBM's ndbm/dbm compatibility feature also makes C and C possible (although they add little extra value). NOTE: The ndbm/dbm emulations only completely work on NTFS partitions. =item * C<-ldb> (C) BerkeleyDB is available for Cygwin. Some details can be found in F. NOTE: The BerkeleyDB library only completely works on NTFS partitions. =item * C<-lcygipc> (C) A port of SysV IPC is available for Cygwin. NOTE: This has B been extensively tested. In particular, C is undefined because it fails a Configure test and on Win9x the I functions seem to hang. It also creates a compile time dependency because F includes F<> and F<> (which will be required in the future when compiling CPAN modules). =back =head2 Configure-time Options The F document describes several Configure-time options. Some of these will work with Cygwin, others are not yet possible. Also, some of these are experimental. You can either select an option when Configure prompts you or you can define (undefine) symbols on the command line. =over 4 =item * C<-Uusedl> Undefining this symbol forces Perl to be compiled statically. =item * C<-Uusemymalloc> By default Perl uses the malloc() included with the Perl source. If you want to force Perl to build with the system malloc() undefine this symbol. =item * C<-Dusemultiplicity> Multiplicity is required when embedding Perl in a C program and using more than one interpreter instance. This works with the Cygwin port. =item * C<-Duseperlio> The PerlIO abstraction works with the Cygwin port. =item * C<-Duse64bitint> I supports 64-bit integers. However, several additional long long functions are necessary to use them within Perl (I<{strtol,strtoul}l>). These are B yet available with Cygwin. =item * C<-Duselongdouble> I supports long doubles (12 bytes). However, several additional long double math functions are necessary to use them within Perl (I<{atan2,cos,exp,floor,fmod,frexp,isnan,log,modf,pow,sin,sqrt}l,strtold>). These are B yet available with Cygwin. =item * C<-Dusethreads> POSIX threads are B yet implemented in Cygwin. =item * C<-Duselargefiles> Although Win32 supports large files, Cygwin currently uses 32-bit integers for internal size and position calculations. =back =head2 Suspicious Warnings You may see some messages during Configure that seem suspicious. =over 4 =item * I I is needed to build dynamic libraries, but it does not exist when dlsym() checking occurs (it is not created until `C' runs). You will see the following message: Checking whether your dlsym() needs a leading underscore ... ld2: not found I can't compile and run the test program. I'm guessing that dlsym doesn't need a leading underscore. Since the guess is correct, this is not a problem. =item * Win9x and C Win9x does not correctly report C with a non-blocking read on a closed pipe. You will see the following messages: But it also returns -1 to signal EOF, so be careful! WARNING: you can't distinguish between EOF and no data! *** WHOA THERE!!! *** The recommended value for $d_eofnblk on this machine was "define"! Keep the recommended value? [y] At least for consistency with WinNT, you should keep the recommended value. =item * Compiler/Preprocessor defines The following error occurs because of the Cygwin C<#define> of C<_LONG_DOUBLE>: Guessing which symbols your C compiler and preprocessor define... try.c:: parse error This failure does not seem to cause any problems. =back =head1 MAKE Simply run I and wait: make 2>&1 | tee log.make =head2 Warnings Warnings like these are normal: warning: overriding commands for target warning: ignoring old commands for target dllwrap: no export definition file provided dllwrap: creating one, but that may not be what you want =head2 ld2 During `C', I will be created and installed in your $installbin directory (where you said to put public executables). It does not wait until the `C' process to install the I script, this is because the remainder of the `C' refers to I without fully specifying its path and does this from multiple subdirectories. The assumption is that $installbin is in your current C. If this is not the case `C' will fail at some point. If this happens, just manually copy I from the source directory to somewhere in your C. =head1 TEST There are two steps to running the test suite: make test 2>&1 | tee log.make-test cd t;./perl harness 2>&1 | tee ../log.harness The same tests are run both times, but more information is provided when running as `C<./perl harness>'. Test results vary depending on your host system and your Cygwin configuration. If a test can pass in some Cygwin setup, it is always attempted and explainable test failures are documented. It is possible for Perl to pass all the tests, but it is more likely that some tests will fail for one of the reasons listed below. =head2 File Permissions UNIX file permissions are based on sets of mode bits for {read,write,execute} for each {user,group,other}. By default Cygwin only tracks the Win32 read-only attribute represented as the UNIX file user write bit (files are always readable, files are executable if they have a F<.{com,bat,exe}> extension or begin with C<#!>, directories are always readable and executable). On WinNT with the I C setting, the additional mode bits are stored as extended file attributes. On WinNT with the I C setting, permissions use the standard WinNT security descriptors and access control lists. Without one of these options, these tests will fail: Failed Test List of failed ------------------------------------ io/fs.t 5, 7, 9-10 lib/anydbm.t 2 lib/db-btree.t 20 lib/db-hash.t 16 lib/db-recno.t 18 lib/gdbm.t 2 lib/ndbm.t 2 lib/odbm.t 2 lib/sdbm.t 2 op/stat.t 9, 20 (.tmp not an executable extension) =head2 Hard Links FAT partitions do not support hard links (whereas NTFS does), in which case Cygwin implements link() by copying the file. On remote (network) drives Cygwin's stat() always sets C to 1, so the link count for remote directories and files is not available. In either case, these tests will fail: Failed Test List of failed ------------------------------------ io/fs.t 4 op/stat.t 3 =head2 Filetime Granularity On FAT partitions the filetime granularity is 2 seconds. The following test will fail: Failed Test List of failed ------------------------------------ io/fs.t 18 =head2 Tainting Checks When Perl is running in taint mode, C<$ENV{PATH}> is considered tainted and not used, so DLLs not in the default system directories will not be found. While the tests are running you will see warnings popup from the system with messages like: Win9x Error Starting Program A required .DLL file, CYGWIN1.DLL, was not found WinNT perl.exe - Unable to Locate DLL The dynamic link library cygwin1.dll could not be found in the specified path ... Just click OK and ignore them. When running `C', 2 popups occur. During `C<./perl harness>', 4 popups occur. Also, these tests will fail: Failed Test List of failed ------------------------------------ op/taint.t 1, 3, 31, 37 Alternatively, you can copy F into the directory where the tests run: cp /bin/cygwin1.dll t or one of the Windows system directories (although, this is B recommended). =head2 /etc/group Cygwin does not require F, in which case the F test will be skipped. The check performed by F expects to see entries that use the members field, otherwise this test will fail: Failed Test List of failed ------------------------------------ op/grent.t 1 =head2 Script Portability Cygwin does an outstanding job of providing UNIX-like semantics on top of Win32 systems. However, in addition to the items noted above, there are some differences that you should know about. This is a very brief guide to portability, more information can be found in the Cygwin documentation. =over 4 =item * Pathnames Cygwin pathnames can be separated by forward (F) or backward (F<\>) slashes. They may also begin with drive letters (F) or Universal Naming Codes (F). DOS device names (F, F, F, F, F, F) are invalid as base filenames. However, they can be used in extensions (e.g., F). Names may contain all printable characters except these: : * ? " < > | File names are case insensitive, but case preserving. A pathname that contains a backslash or drive letter is a Win32 pathname (and not subject to the translations applied to POSIX style pathnames). =item * Text/Binary When a file is opened it is in either text or binary mode. In text mode a file is subject to CR/LF/Ctrl-Z translations. With Cygwin, the default mode for an open() is determined by the mode of the mount that underlies the file. Perl provides a binmode() function to set binary mode on files that otherwise would be treated as text. sysopen() with the C flag sets text mode on files that otherwise would be treated as binary: sysopen(FOO, "bar", O_WRONLY|O_CREAT|O_TEXT) lseek(), tell() and sysseek() only work with files opened in binary mode. The text/binary issue is covered at length in the Cygwin documentation. =item * F<.exe> The Cygwin stat(), lstat() and readlink() functions make the F<.exe> extension transparent by looking for F when you ask for F (unless a F also exists). Cygwin does not require a F<.exe> extension, but I adds it automatically when building a program. However, when accessing an executable as a normal file (e.g., I in a makefile) the F<.exe> is not transparent. The I included with Cygwin automatically appends a F<.exe> when necessary. =item * chown() On WinNT chown() can change a file's user and group IDs. On Win9x chown() is a no-op, although this is appropriate since there is no security model. =item * Miscellaneous File locking using the C command to fcntl() is a stub that returns C. Win9x can not rename() an open file (although WinNT can). The Cygwin chroot() implementation has holes (it can not restrict file access by native Win32 programs). =back =head1 INSTALL This will install Perl, including I pages. make install | tee log.make-install NOTE: If C is redirected `C' will B prompt you to install I into F. You may need to be I to run `C'. If you are not, you must have write access to the directories in question. Information on installing the Perl documentation in HTML format can be found in the F document. =head1 MANIFEST These are the files in the Perl release that contain references to Cygwin. These very brief notes attempt to explain the reason for all conditional code. Hopefully, keeping this up to date will allow the Cygwin port to be kept as clean as possible. =over 4 =item Documentation INSTALL README.cygwin README.win32 MANIFEST Changes Changes5.005 Changes5.004 Changes5.6 pod/perl.pod pod/perlport.pod pod/perlfaq3.pod pod/perldelta.pod pod/perl5004delta.pod pod/perl56delta.pod pod/perlhist.pod pod/perlmodlib.pod pod/buildtoc.PL pod/perltoc.pod =item Build, Configure, Make, Install cygwin/Makefile.SHs cygwin/ld2.in cygwin/perlld.in ext/IPC/SysV/hints/cygwin.pl ext/NDBM_File/hints/cygwin.pl ext/ODBM_File/hints/cygwin.pl hints/cygwin.sh Configure - help finding hints from uname, shared libperl required for dynamic loading Makefile.SH - linklibperl Porting/patchls - cygwin in port list installman - man pages with :: translated to . installperl - install dll/ld2/perlld, install to pods makedepend.SH - uwinfix =item Tests t/io/tell.t - binmode t/lib/b.t - ignore Cwd from os_extras t/lib/glob-basic.t - Win32 directory list access differs from read mode t/op/magic.t - $^X/symlink WORKAROUND, s/.exe// t/op/stat.t - no /dev, skip Win32 ftCreationTime quirk (cache manager sometimes preserves ctime of file previously created and deleted), no -u (setuid) =item Compiled Perl Source EXTERN.h - __declspec(dllimport) XSUB.h - __declspec(dllexport) cygwin/cygwin.c - os_extras (getcwd, spawn) perl.c - os_extras perl.h - binmode doio.c - win9x can not rename a file when it is open pp_sys.c - do not define h_errno, pp_system with spawn util.c - use setenv =item Compiled Module Source ext/POSIX/POSIX.xs - tzname defined externally ext/SDBM_File/sdbm/pair.c - EXTCONST needs to be redefined from EXTERN.h ext/SDBM_File/sdbm/sdbm.c - binary open =item Perl Modules/Scripts lib/Cwd.pm - hook to internal Cwd::cwd lib/ExtUtils/MakeMaker.pm - require MM_Cygwin.pm lib/ExtUtils/MM_Cygwin.pm - canonpath, cflags, manifypods, perl_archive lib/File/Find.pm - on remote drives stat() always sets st_nlink to 1 lib/File/Spec/Unix.pm - preserve //unc lib/File/Temp.pm - no directory sticky bit lib/perl5db.pl - use stdin not /dev/tty utils/perldoc.PL - version comment =back =head1 BUGS When I starts, it warns about overriding commands for F. `C' does not remove library F<.def> or F<.exe.stackdump> files. The I script contains references to the source directory. You should change these to $installbin after `C'. Support for swapping real and effective user and group IDs is incomplete. On WinNT Cygwin provides setuid(), seteuid(), setgid() and setegid(). However, additional Cygwin calls for manipulating WinNT access tokens and security contexts are required. When building DLLs, `C' is used to export global symbols. It might be better to generate an explicit F<.def> file (see F). Also, DLLs can now be build with `C'. =head1 AUTHORS Charles Wilson , Eric Fifer , alexander smishlajev , Steven Morlock , Sebastien Barre , Teun Burgers . =head1 HISTORY Last updated: 9 November 2000 Pod-Simple-3.43/t/00about.t0000644000175000017500000000621714062242374013474 0ustar khwkhw require 5; # Time-stamp: "2004-05-23 19:48:32 ADT" # Summary of, well, things. BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; my @modules; BEGIN { @modules = qw( Pod::Escapes Pod::Simple Pod::Simple::BlackBox Pod::Simple::Checker Pod::Simple::DumpAsText Pod::Simple::DumpAsXML Pod::Simple::HTML Pod::Simple::HTMLBatch Pod::Simple::HTMLLegacy Pod::Simple::LinkSection Pod::Simple::Methody Pod::Simple::JustPod Pod::Simple::Progress Pod::Simple::PullParser Pod::Simple::PullParserEndToken Pod::Simple::PullParserStartToken Pod::Simple::PullParserTextToken Pod::Simple::PullParserToken Pod::Simple::RTF Pod::Simple::Search Pod::Simple::SimpleTree Pod::Simple::Text Pod::Simple::TextContent Pod::Simple::TiedOutFH Pod::Simple::Transcode Pod::Simple::XMLOutStream ); plan tests => 2 + @modules; }; ok 1; #chdir "t" if -e "t"; foreach my $m (@modules) { print "# Loading $m ...\n"; eval "require $m;"; unless($@) { ok 1; next } my $e = $@; $e =~ s/\s+$//s; $e =~ s/[\n\r]+/\n# > /; print "# Error while trying to load $m --\n# > $e\n"; ok 0; } { my @out; push @out, "\n\nPerl v", defined($^V) ? sprintf('%vd', $^V) : $], " under $^O ", (defined(&Win32::BuildNumber) and defined &Win32::BuildNumber()) ? ("(Win32::BuildNumber ", &Win32::BuildNumber(), ")") : (), (defined $MacPerl::Version) ? ("(MacPerl version $MacPerl::Version)") : (), "\n" ; # Ugly code to walk the symbol tables: my %v; my @stack = (''); # start out in %:: my $this; my $count = 0; my $pref; while(@stack) { $this = shift @stack; die "Too many packages?" if ++$count > 1000; next if exists $v{$this}; next if $this eq 'main'; # %main:: is %:: #print "Peeking at $this => ${$this . '::VERSION'}\n"; no strict 'refs'; if( defined ${$this . '::VERSION'} ) { $v{$this} = ${$this . '::VERSION'} } elsif( defined *{$this . '::ISA'} or defined &{$this . '::import'} or ($this ne '' and grep defined *{$_}{'CODE'}, values %{$this . "::"}) # If it has an ISA, an import, or any subs... ) { # It's a class/module with no version. $v{$this} = undef; } else { # It's probably an unpopulated package. ## $v{$this} = '...'; } $pref = length($this) ? "$this\::" : ''; push @stack, map m/^(.+)::$/ ? "$pref$1" : (), do { no strict 'refs'; keys %{$this . '::'} }; #print "Stack: @stack\n"; } push @out, " Modules in memory:\n"; delete @v{'', '[none]'}; foreach my $p (sort {lc($a) cmp lc($b)} keys %v) { my $indent = ' ' x (2 + ($p =~ tr/:/:/)); push @out, ' ', $indent, $p, defined($v{$p}) ? " v$v{$p};\n" : ";\n"; } push @out, sprintf "[at %s (local) / %s (GMT)]\n", scalar(gmtime), scalar(localtime); my $x = join '', @out; $x =~ s/^/#/mg; print $x; } print "# Running", (chr(65) eq 'A') ? " in an ASCII world.\n" : " in a non-ASCII world.\n", "#\n", ; print "# \@INC:\n", map("# [$_]\n", @INC), "#\n#\n"; print "# \%INC:\n"; foreach my $x (sort {lc($a) cmp lc($b)} keys %INC) { print "# [$x] = [", $INC{$x} || '', "]\n"; } ok 1; Pod-Simple-3.43/t/search10.t0000644000175000017500000000515114062242376013626 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } # Time-stamp: "2004-05-23 22:38:58 ADT" use strict; use warnings; #sub Pod::Simple::Search::DEBUG () {5}; use Pod::Simple::Search; use Test; BEGIN { plan tests => 11 } print "# ", __FILE__, ": Testing the surveying of a single specified docroot...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; print "# Testing the surveying of a single docroot...\n"; $x->inc(0); use File::Spec; use Cwd; my $cwd = cwd(); print "# CWD: $cwd\n"; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { return "../lib/Pod/Simple/t/$file"; } else { return $file; } } my $here; if( -e ($here = source_path('testlib1'))) { # } elsif(-e ($here = File::Spec->catdir($cwd, 't', 'testlib1'))) { # } else { die "Can't find the test corpus"; } print "# OK, found the test corpus as $here\n"; ok 1; print $x->_state_as_string; #$x->verbose(12); use Pod::Simple; *pretty = \&Pod::Simple::BlackBox::pretty; my($name2where, $where2name) = $x->survey($here); my $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; my $ascii_order; if( -e ($ascii_order = source_path('ascii_order.pl'))) { # } elsif(-e ($ascii_order = File::Spec->catfile($cwd, 't', 'ascii_order.pl'))) { # } else { print STDERR __FILE__, ": ", __LINE__, ": ascii_order='$ascii_order'; curdir=", $cwd, "; ", File::Spec->catfile($cwd, 't', 'ascii_order.pl'), "\n"; die "Can't find ascii_order.pl"; } require $ascii_order; { my $names = join "|", sort ascii_order values %$where2name; ok $names, "Blorm|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|squaa|squaa::Glunk|squaa::Vliff|zikzik"; } { my $names = join "|", sort ascii_order keys %$name2where; ok $names, "Blorm|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|squaa|squaa::Glunk|squaa::Vliff|zikzik"; } ok( ($name2where->{'squaa'} || 'huh???'), '/squaa\.pm$/'); ok grep( m/squaa\.pm/, keys %$where2name ), 1; ###### Now with recurse(0) print "# Testing the surveying of a single docroot without recursing...\n"; $x->recurse(0); ($name2where, $where2name) = $x->survey($here); $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; { my $names = join "|", sort ascii_order values %$where2name; ok $names, "Blorm|squaa|zikzik"; } { my $names = join "|", sort ascii_order keys %$name2where; ok $names, "Blorm|squaa|zikzik"; } ok( ($name2where->{'squaa'} || 'huh???'), '/squaa\.pm$/'); ok grep( m/squaa\.pm/, keys %$where2name ), 1; ok 1; __END__ Pod-Simple-3.43/t/closeys.t0000644000175000017500000000140114062242375013672 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 3 }; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import('f'); } my $d; #use Pod::Simple::Debug (\$d,0); #use Pod::Simple::Debug (10); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; sub nowhine { # $_[0]->{'no_whining'} = 1; $_[0]->accept_targets("*"); } local $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; &ok(f( \&nowhine, "=begin :foo\n\n=begin :bar\n\nZaz\n\n", "=begin :foo\n\n=begin :bar\n\nZaz\n\n=end :bar\n\n=end :foo\n\n", )); print "# Ending ", __FILE__, "\n"; ok 1; __END__ Pod-Simple-3.43/t/search27.t0000644000175000017500000000535114062242376013640 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Pod::Simple::Search; use Test; BEGIN { plan tests => 10 } print "# ", __FILE__, ": Testing limit_glob ...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; $x->inc(0); $x->shadows(1); use File::Spec; use Cwd; my $cwd = cwd(); print "# CWD: $cwd\n"; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { my $updir = File::Spec->updir; my $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't'); return File::Spec->catdir ($dir, $file); } else { return $file; } } my($here1, $here2, $here3); if( -e ($here1 = source_path( 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = source_path( 'testlib2')); die "But where's $here3?" unless -e ($here3 = source_path( 'testlib3')); } elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = File::Spec->catdir($cwd, 't', 'testlib2')); die "But where's $here3?" unless -e ($here3 = File::Spec->catdir($cwd, 't', 'testlib3')); } else { die "Can't find the test corpora"; } print "# OK, found the test corpora\n# as $here1\n# and $here2\n# and $here3\n#\n"; ok 1; print $x->_state_as_string; #$x->verbose(12); use Pod::Simple; *pretty = \&Pod::Simple::BlackBox::pretty; my $glob = 'squaa*'; print "# Limiting to $glob\n"; $x->limit_glob($glob); my($name2where, $where2name) = $x->survey($here1, $here2, $here3); my $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; { my $names = join "|", sort keys %$name2where; skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, $names, "squaa|squaa::Glunk|squaa::Vliff|squaa::Wowo"; } { my $names = join "|", sort values %$where2name; skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, $names, "squaa|squaa::Glunk|squaa::Vliff|squaa::Vliff|squaa::Vliff|squaa::Wowo"; my %count; for(values %$where2name) { ++$count{$_} }; #print pretty(\%count), "\n\n"; delete @count{ grep $count{$_} < 2, keys %count }; my $shadowed = join "|", sort keys %count; ok $shadowed, "squaa::Vliff"; sub thar { print "# Seen $_[0] :\n", map "# {$_}\n", sort grep $where2name->{$_} eq $_[0],keys %$where2name; return; } ok $count{'squaa::Vliff'}, 3; thar 'squaa::Vliff'; } ok $name2where->{'squaa'}; # because squaa.pm IS squaa* ok( ($name2where->{'squaa::Vliff'} || 'huh???'), '/[^\^]testlib1/' ); skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, ($name2where->{'squaa::Wowo'} || 'huh???'), '/testlib2/'; print "# OK, bye from ", __FILE__, "\n"; ok 1; __END__ Pod-Simple-3.43/t/accept01.t0000644000175000017500000000536414062242375013625 0ustar khwkhw# Testing accept_codes BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 13 }; #use Pod::Simple::Debug (6); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } my $x = 'Pod::Simple::XMLOutStream'; sub accept_N { $_[0]->accept_codes('N') } print "# Some sanity tests...\n"; ok( $x->_out( "=pod\n\nI like pie.\n"), # without acceptor 'I like pie.' ); ok( $x->_out( \&accept_N, "=pod\n\nI like pie.\n"), 'I like pie.' ); ok( $x->_out( "=pod\n\nB\n"), # without acceptor 'foo ' ); ok( $x->_out( \&accept_N, "=pod\n\nB\n"), 'foo ' ); print "# Some real tests...\n"; ok( $x->_out( \&accept_N, "=pod\n\nN\n"), 'foo ' ); ok( $x->_out( \&accept_N, "=pod\n\nB>\n"), 'foo ' ); ok( $x->_out( "=pod\n\nB>\n") # without the mutor ne 'foo ' # make sure it DOESN'T pass thru the N<...> when not accepted ); ok( $x->_out( \&accept_N, "=pod\n\nBNI>\n"), 'piezorchfoopling' ); print "# Tests of nonacceptance...\n"; sub starts_with { my($large, $small) = @_; print("# supahstring is undef\n"), return '' unless defined $large; print("# supahstring $large is smaller than target-starter $small\n"), return '' if length($large) < length($small); if( substr($large, 0, length($small)) eq $small ) { #print "# Supahstring $large\n# indeed starts with $small\n"; return 1; } else { print "# Supahstring $large\n# !starts w/ $small\n"; return ''; } } ok( starts_with( $x->_out( "=pod\n\nB>\n"), # without the mutor 'foo ' # make sure it DOESN'T pass thru the N<...>, when not accepted )); ok( starts_with( $x->_out( "=pod\n\nBNI>\n"), # !mutor 'piezorchfoopling' # make sure it DOESN'T pass thru the N<...>, when not accepted )); ok( starts_with( $x->_out( "=pod\n\nBN>I>\n"), # !mutor 'piezorchfoopling' # make sure it DOESN'T pass thru the N<...>, when not accepted )); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/perlvaro.txt0000644000175000017500000011422214062242376014426 0ustar khwkhwNAME perlvar - Perl predefined variables DESCRIPTION Predefined Names The following names have special meaning to Perl. Most punctuation names have reasonable mnemonics, or analogs in the shells. Nevertheless, if you wish to use long variable names, you need only say use English; at the top of your program. This will alias all the short names to the long names in the current package. Some even have medium names, generally borrowed from awk. If you don't mind the performance hit, variables that depend on the currently selected filehandle may instead be set by calling an appropriate object method on the IO::Handle object. (Summary lines below for this contain the word HANDLE.) First you must say use IO::Handle; after which you may use either method HANDLE EXPR or more safely, HANDLE->method(EXPR) Each method returns the old value of the IO::Handle attribute. The methods each take an optional EXPR, which if supplied specifies the new value for the IO::Handle attribute in question. If not supplied, most methods do nothing to the current value--except for autoflush(), which will assume a 1 for you, just to be different. Because loading in the IO::Handle class is an expensive operation, you should learn how to use the regular built-in variables. A few of these variables are considered "read-only". This means that if you try to assign to this variable, either directly or indirectly through a reference, you'll raise a run-time exception. The following list is ordered by scalar variables first, then the arrays, then the hashes. $ARG $_ The default input and pattern-searching space. The following pairs are equivalent: while (<>) {...} # equivalent only in while! while (defined($_ = <>)) {...} /^Subject:/ $_ =~ /^Subject:/ tr/a-z/A-Z/ $_ =~ tr/a-z/A-Z/ chomp chomp($_) Here are the places where Perl will assume $_ even if you don't use it: Various unary functions, including functions like ord() and int(), as well as the all file tests (-f, -d) except for -t, which defaults to STDIN. Various list functions like print() and unlink(). The pattern matching operations m//, s///, and tr/// when used without an =~ operator. The default iterator variable in a foreach loop if no other variable is supplied. The implicit iterator variable in the grep() and map() functions. The default place to put an input record when a operation's result is tested by itself as the sole criterion of a while test. Outside a while test, this will not happen. (Mnemonic: underline is understood in certain operations.) $ Contains the subpattern from the corresponding set of capturing parentheses from the last pattern match, not counting patterns matched in nested blocks that have been exited already. (Mnemonic: like \digits.) These variables are all read-only and dynamically scoped to the current BLOCK. $MATCH $& The string matched by the last successful pattern match (not counting any matches hidden within a BLOCK or eval() enclosed by the current BLOCK). (Mnemonic: like & in some editors.) This variable is read-only and dynamically scoped to the current BLOCK. The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches. See BUGS. $PREMATCH $` The string preceding whatever was matched by the last successful pattern match (not counting any matches hidden within a BLOCK or eval enclosed by the current BLOCK). (Mnemonic: ` often precedes a quoted string.) This variable is read-only. The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches. See BUGS. $POSTMATCH $' The string following whatever was matched by the last successful pattern match (not counting any matches hidden within a BLOCK or eval() enclosed by the current BLOCK). (Mnemonic: ' often follows a quoted string.) Example: $_ = 'abcdefghi'; /def/; print "$`:$&:$'\n"; # prints abc:def:ghi This variable is read-only and dynamically scoped to the current BLOCK. The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches. See BUGS. $LAST_PAREN_MATCH $+ The last bracket matched by the last search pattern. This is useful if you don't know which one of a set of alternative patterns matched. For example: /Version: (.*)|Revision: (.*)/ && ($rev = $+); (Mnemonic: be positive and forward looking.) This variable is read-only and dynamically scoped to the current BLOCK. @LAST_MATCH_END @+ This array holds the offsets of the ends of the last successful submatches in the currently active dynamic scope. $+[0] is the offset into the string of the end of the entire match. This is the same value as what the pos function returns when called on the variable that was matched against. The nth element of this array holds the offset of the nth submatch, so $+[1] is the offset past where $1 ends, $+[2] the offset past where $2 ends, and so on. You can use $#+ to determine how many subgroups were in the last successful match. See the examples given for the @- variable. $MULTILINE_MATCHING $* Set to a non-zero integer value to do multi-line matching within a string, 0 (or undefined) to tell Perl that it can assume that strings contain a single line, for the purpose of optimizing pattern matches. Pattern matches on strings containing multiple newlines can produce confusing results when $* is 0 or undefined. Default is undefined. (Mnemonic: * matches multiple things.) This variable influences the interpretation of only ^ and $. A literal newline can be searched for even when $* == 0. Use of $* is deprecated in modern Perl, supplanted by the /s and /m modifiers on pattern matching. Assigning a non-numerical value to $* triggers a warning (and makes $* act if $* == 0), while assigning a numerical value to $* makes that an implicit int is applied on the value. input_line_number HANDLE EXPR $INPUT_LINE_NUMBER $NR $. The current input record number for the last file handle from which you just read() (or called a seek or tell on). The value may be different from the actual physical line number in the file, depending on what notion of "line" is in effect--see $/ on how to change that. An explicit close on a filehandle resets the line number. Because <> never does an explicit close, line numbers increase across ARGV files (but see examples in "eof" in perlfunc). Consider this variable read-only: setting it does not reposition the seek pointer; you'll have to do that on your own. Localizing $. has the effect of also localizing Perl's notion of "the last read filehandle". (Mnemonic: many programs use "." to mean the current line number.) input_record_separator HANDLE EXPR $INPUT_RECORD_SEPARATOR $RS $/ The input record separator, newline by default. This influences Perl's idea of what a "line" is. Works like awk's RS variable, including treating empty lines as a terminator if set to the null string. (An empty line cannot contain any spaces or tabs.) You may set it to a multi-character string to match a multi-character terminator, or to undef to read through the end of file. Setting it to "\n\n" means something slightly different than setting to "", if the file contains consecutive empty lines. Setting to "" will treat two or more consecutive empty lines as a single empty line. Setting to "\n\n" will blindly assume that the next input character belongs to the next paragraph, even if it's a newline. (Mnemonic: / delimits line boundaries when quoting poetry.) undef $/; # enable "slurp" mode $_ = ; # whole file now here s/\n[ \t]+/ /g; Remember: the value of $/ is a string, not a regex. awk has to be better for something. :-) Setting $/ to a reference to an integer, scalar containing an integer, or scalar that's convertible to an integer will attempt to read records instead of lines, with the maximum record size being the referenced integer. So this: $/ = \32768; # or \"32768", or \$var_containing_32768 open(FILE, $myfile); $_ = ; will read a record of no more than 32768 bytes from FILE. If you're not reading from a record-oriented file (or your OS doesn't have record-oriented files), then you'll likely get a full chunk of data with every read. If a record is larger than the record size you've set, you'll get the record back in pieces. On VMS, record reads are done with the equivalent of sysread, so it's best not to mix record and non-record reads on the same file. (This is unlikely to be a problem, because any file you'd want to read in record mode is probably unusable in line mode.) Non-VMS systems do normal I/O, so it's safe to mix record and non-record reads of a file. See also "Newlines" in perlport. Also see $.. autoflush HANDLE EXPR $OUTPUT_AUTOFLUSH $| If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel. Default is 0 (regardless of whether the channel is really buffered by the system or not; $| tells you only whether you've asked Perl explicitly to flush after each write). STDOUT will typically be line buffered if output is to the terminal and block buffered otherwise. Setting this variable is useful primarily when you are outputting to a pipe or socket, such as when you are running a Perl program under rsh and want to see the output as it's happening. This has no effect on input buffering. See "getc" in perlfunc for that. (Mnemonic: when you want your pipes to be piping hot.) output_field_separator HANDLE EXPR $OUTPUT_FIELD_SEPARATOR $OFS $, The output field separator for the print operator. Ordinarily the print operator simply prints out its arguments without further adornment. To get behavior more like awk, set this variable as you would set awk's OFS variable to specify what is printed between fields. (Mnemonic: what is printed when there is a "," in your print statement.) output_record_separator HANDLE EXPR $OUTPUT_RECORD_SEPARATOR $ORS $\ The output record separator for the print operator. Ordinarily the print operator simply prints out its arguments as is, with no trailing newline or other end-of-record string added. To get behavior more like awk, set this variable as you would set awk's ORS variable to specify what is printed at the end of the print. (Mnemonic: you set $\ instead of adding "\n" at the end of the print. Also, it's just like $/, but it's what you get "back" from Perl.) $LIST_SEPARATOR $" This is like $, except that it applies to array and slice values interpolated into a double-quoted string (or similar interpreted string). Default is a space. (Mnemonic: obvious, I think.) $SUBSCRIPT_SEPARATOR $SUBSEP $; The subscript separator for multidimensional array emulation. If you refer to a hash element as $foo{$a,$b,$c} it really means $foo{join($;, $a, $b, $c)} But don't put @foo{$a,$b,$c} # a slice--note the @ which means ($foo{$a},$foo{$b},$foo{$c}) Default is "\034", the same as SUBSEP in awk. If your keys contain binary data there might not be any safe value for $;. (Mnemonic: comma (the syntactic subscript separator) is a semi-semicolon. Yeah, I know, it's pretty lame, but $, is already taken for something more important.) Consider using "real" multidimensional arrays as described in perllol. $OFMT $# The output format for printed numbers. This variable is a half-hearted attempt to emulate awk's OFMT variable. There are times, however, when awk and Perl have differing notions of what counts as numeric. The initial value is "%.ng", where n is the value of the macro DBL_DIG from your system's float.h. This is different from awk's default OFMT setting of "%.6g", so you need to set $# explicitly to get awk's value. (Mnemonic: # is the number sign.) Use of $# is deprecated. format_page_number HANDLE EXPR $FORMAT_PAGE_NUMBER $% The current page number of the currently selected output channel. Used with formats. (Mnemonic: % is page number in nroff.) format_lines_per_page HANDLE EXPR $FORMAT_LINES_PER_PAGE $= The current page length (printable lines) of the currently selected output channel. Default is 60. Used with formats. (Mnemonic: = has horizontal lines.) format_lines_left HANDLE EXPR $FORMAT_LINES_LEFT $- The number of lines left on the page of the currently selected output channel. Used with formats. (Mnemonic: lines_on_page - lines_printed.) @LAST_MATCH_START @- $-[0] is the offset of the start of the last successful match. $-[n] is the offset of the start of the substring matched by n-th subpattern, or undef if the subpattern did not match. Thus after a match against $_, $& coincides with substr $_, $-[0], $+[0] - $-[0]. Similarly, $n coincides with substr $_, $-[n], $+[n] - $-[n] if $-[n] is defined, and $+ coincides with substr $_, $-[$#-], $+[$#-]. One can use $#- to find the last matched subgroup in the last successful match. Contrast with $#+, the number of subgroups in the regular expression. Compare with @+. This array holds the offsets of the beginnings of the last successful submatches in the currently active dynamic scope. $-[0] is the offset into the string of the beginning of the entire match. The nth element of this array holds the offset of the nth submatch, so $+[1] is the offset where $1 begins, $+[2] the offset where $2 begins, and so on. You can use $#- to determine how many subgroups were in the last successful match. Compare with the @+ variable. After a match against some variable $var: $` is the same as substr($var, 0, $-[0]) $& is the same as substr($var, $-[0], $+[0] - $-[0]) $' is the same as substr($var, $+[0]) $1 is the same as substr($var, $-[1], $+[1] - $-[1]) $2 is the same as substr($var, $-[2], $+[2] - $-[2]) $3 is the same as substr $var, $-[3], $+[3] - $-[3]) format_name HANDLE EXPR $FORMAT_NAME $~ The name of the current report format for the currently selected output channel. Default is the name of the filehandle. (Mnemonic: brother to $^.) format_top_name HANDLE EXPR $FORMAT_TOP_NAME $^ The name of the current top-of-page format for the currently selected output channel. Default is the name of the filehandle with _TOP appended. (Mnemonic: points to top of page.) format_line_break_characters HANDLE EXPR $FORMAT_LINE_BREAK_CHARACTERS $: The current set of characters after which a string may be broken to fill continuation fields (starting with ^) in a format. Default is " \n-", to break on whitespace or hyphens. (Mnemonic: a "colon" in poetry is a part of a line.) format_formfeed HANDLE EXPR $FORMAT_FORMFEED $^L What formats output as a form feed. Default is \f. $ACCUMULATOR $^A The current value of the write() accumulator for format() lines. A format contains formline() calls that put their result into $^A. After calling its format, write() prints out the contents of $^A and empties. So you never really see the contents of $^A unless you call formline() yourself and then look at it. See perlform and "formline()" in perlfunc. $CHILD_ERROR $? The status returned by the last pipe close, backtick (``) command, successful call to wait() or waitpid(), or from the system() operator. This is just the 16-bit status word returned by the wait() system call (or else is made up to look like it). Thus, the exit value of the subprocess is really ($? >> 8), and $? & 127 gives which signal, if any, the process died from, and $? & 128 reports whether there was a core dump. (Mnemonic: similar to sh and ksh.) Additionally, if the h_errno variable is supported in C, its value is returned via $? if any gethost*() function fails. If you have installed a signal handler for SIGCHLD, the value of $? will usually be wrong outside that handler. Inside an END subroutine $? contains the value that is going to be given to exit(). You can modify $? in an END subroutine to change the exit status of your program. For example: END { $? = 1 if $? == 255; # die would make it 255 } Under VMS, the pragma use vmsish 'status' makes $? reflect the actual VMS exit status, instead of the default emulation of POSIX status. Also see "Error Indicators". $OS_ERROR $ERRNO $! If used numerically, yields the current value of the C errno variable, with all the usual caveats. (This means that you shouldn't depend on the value of $! to be anything in particular unless you've gotten a specific error return indicating a system error.) If used an a string, yields the corresponding system error string. You can assign a number to $! to set errno if, for instance, you want "$!" to return the string for error n, or you want to set the exit value for the die() operator. (Mnemonic: What just went bang?) Also see "Error Indicators". $EXTENDED_OS_ERROR $^E Error information specific to the current operating system. At the moment, this differs from $! under only VMS, OS/2, and Win32 (and for MacPerl). On all other platforms, $^E is always just the same as $!. Under VMS, $^E provides the VMS status value from the last system error. This is more specific information about the last system error than that provided by $!. This is particularly important when $! is set to EVMSERR. Under OS/2, $^E is set to the error code of the last call to OS/2 API either via CRT, or directly from perl. Under Win32, $^E always returns the last error information reported by the Win32 call GetLastError() which describes the last error from within the Win32 API. Most Win32-specific code will report errors via $^E. ANSI C and Unix-like calls set errno and so most portable Perl code will report errors via $!. Caveats mentioned in the description of $! generally apply to $^E, also. (Mnemonic: Extra error explanation.) Also see "Error Indicators". $EVAL_ERROR $@ The Perl syntax error message from the last eval() operator. If null, the last eval() parsed and executed correctly (although the operations you invoked may have failed in the normal fashion). (Mnemonic: Where was the syntax error "at"?) Warning messages are not collected in this variable. You can, however, set up a routine to process warnings by setting $SIG{__WARN__} as described below. Also see "Error Indicators". $PROCESS_ID $PID $$ The process number of the Perl running this script. You should consider this variable read-only, although it will be altered across fork() calls. (Mnemonic: same as shells.) $REAL_USER_ID $UID $< The real uid of this process. (Mnemonic: it's the uid you came from, if you're running setuid.) $EFFECTIVE_USER_ID $EUID $> The effective uid of this process. Example: $< = $>; # set real to effective uid ($<,$>) = ($>,$<); # swap real and effective uid (Mnemonic: it's the uid you went to, if you're running setuid.) $< and $> can be swapped only on machines supporting setreuid(). $REAL_GROUP_ID $GID $( The real gid of this process. If you are on a machine that supports membership in multiple groups simultaneously, gives a space separated list of groups you are in. The first number is the one returned by getgid(), and the subsequent ones by getgroups(), one of which may be the same as the first number. However, a value assigned to $( must be a single number used to set the real gid. So the value given by $( should not be assigned back to $( without being forced numeric, such as by adding zero. (Mnemonic: parentheses are used to group things. The real gid is the group you left, if you're running setgid.) $EFFECTIVE_GROUP_ID $EGID $) The effective gid of this process. If you are on a machine that supports membership in multiple groups simultaneously, gives a space separated list of groups you are in. The first number is the one returned by getegid(), and the subsequent ones by getgroups(), one of which may be the same as the first number. Similarly, a value assigned to $) must also be a space-separated list of numbers. The first number sets the effective gid, and the rest (if any) are passed to setgroups(). To get the effect of an empty list for setgroups(), just repeat the new effective gid; that is, to force an effective gid of 5 and an effectively empty setgroups() list, say $) = "5 5" . (Mnemonic: parentheses are used to group things. The effective gid is the group that's right for you, if you're running setgid.) $<, $>, $( and $) can be set only on machines that support the corresponding set[re][ug]id() routine. $( and $) can be swapped only on machines supporting setregid(). $PROGRAM_NAME $0 Contains the name of the program being executed. On some operating systems assigning to $0 modifies the argument area that the ps program sees. This is more useful as a way of indicating the current program state than it is for hiding the program you're running. (Mnemonic: same as sh and ksh.) Note for BSD users: setting $0 does not completely remove "perl" from the ps(1) output. For example, setting $0 to "foobar" will result in "perl: foobar (perl)". This is an operating system feature. $[ The index of the first element in an array, and of the first character in a substring. Default is 0, but you could theoretically set it to 1 to make Perl behave more like awk (or Fortran) when subscripting and when evaluating the index() and substr() functions. (Mnemonic: [ begins subscripts.) As of release 5 of Perl, assignment to $[ is treated as a compiler directive, and cannot influence the behavior of any other file. Its use is highly discouraged. $] The version + patchlevel / 1000 of the Perl interpreter. This variable can be used to determine whether the Perl interpreter executing a script is in the right range of versions. (Mnemonic: Is this version of perl in the right bracket?) Example: warn "No checksumming!\n" if $] < 3.019; See also the documentation of use VERSION and require VERSION for a convenient way to fail if the running Perl interpreter is too old. The use of this variable is deprecated. The floating point representation can sometimes lead to inaccurate numeric comparisons. See $^V for a more modern representation of the Perl version that allows accurate string comparisons. $COMPILING $^C The current value of the flag associated with the -c switch. Mainly of use with -MO=... to allow code to alter its behavior when being compiled, such as for example to AUTOLOAD at compile time rather than normal, deferred loading. See perlcc. Setting $^C = 1 is similar to calling B::minus_c. $DEBUGGING $^D The current value of the debugging flags. (Mnemonic: value of -D switch.) $SYSTEM_FD_MAX $^F The maximum system file descriptor, ordinarily 2. System file descriptors are passed to exec()ed processes, while higher file descriptors are not. Also, during an open(), system file descriptors are preserved even if the open() fails. (Ordinary file descriptors are closed before the open() is attempted.) The close-on-exec status of a file descriptor will be decided according to the value of $^F when the corresponding file, pipe, or socket was opened, not the time of the exec(). $^H WARNING: This variable is strictly for internal use only. Its availability, behavior, and contents are subject to change without notice. This variable contains compile-time hints for the Perl interpreter. At the end of compilation of a BLOCK the value of this variable is restored to the value when the interpreter started to compile the BLOCK. When perl begins to parse any block construct that provides a lexical scope (e.g., eval body, required file, subroutine body, loop body, or conditional block), the existing value of $^H is saved, but its value is left unchanged. When the compilation of the block is completed, it regains the saved value. Between the points where its value is saved and restored, code that executes within BEGIN blocks is free to change the value of $^H. This behavior provides the semantic of lexical scoping, and is used in, for instance, the use strict pragma. The contents should be an integer; different bits of it are used for different pragmatic flags. Here's an example: sub add_100 { $^H |= 0x100 } sub foo { BEGIN { add_100() } bar->baz($boon); } Consider what happens during execution of the BEGIN block. At this point the BEGIN block has already been compiled, but the body of foo() is still being compiled. The new value of $^H will therefore be visible only while the body of foo() is being compiled. Substitution of the above BEGIN block with: BEGIN { require strict; strict->import('vars') } demonstrates how use strict 'vars' is implemented. Here's a conditional version of the same lexical pragma: BEGIN { require strict; strict->import('vars') if $condition } %^H WARNING: This variable is strictly for internal use only. Its availability, behavior, and contents are subject to change without notice. The %^H hash provides the same scoping semantic as $^H. This makes it useful for implementation of lexically scoped pragmas. $INPLACE_EDIT $^I The current value of the inplace-edit extension. Use undef to disable inplace editing. (Mnemonic: value of -i switch.) $^M By default, running out of memory is an untrappable, fatal error. However, if suitably built, Perl can use the contents of $^M as an emergency memory pool after die()ing. Suppose that your Perl were compiled with -DPERL_EMERGENCY_SBRK and used Perl's malloc. Then $^M = 'a' x (1 << 16); would allocate a 64K buffer for use in an emergency. See the INSTALL file in the Perl distribution for information on how to enable this option. To discourage casual use of this advanced feature, there is no English long name for this variable. $OSNAME $^O The name of the operating system under which this copy of Perl was built, as determined during the configuration process. The value is identical to $Config{'osname'}. See also Config and the -V command-line switch documented in perlrun. $PERLDB $^P The internal variable for debugging support. The meanings of the various bits are subject to change, but currently indicate: 0x01 Debug subroutine enter/exit. 0x02 Line-by-line debugging. 0x04 Switch off optimizations. 0x08 Preserve more data for future interactive inspections. 0x10 Keep info about source lines on which a subroutine is defined. 0x20 Start with single-step on. 0x40 Use subroutine address instead of name when reporting. 0x80 Report goto &subroutine as well. 0x100 Provide informative "file" names for evals based on the place they were compiled. 0x200 Provide informative names to anonymous subroutines based on the place they were compiled. Some bits may be relevant at compile-time only, some at run-time only. This is a new mechanism and the details may change. $LAST_REGEXP_CODE_RESULT $^R The result of evaluation of the last successful (?{ code }) regular expression assertion (see perlre). May be written to. $EXCEPTIONS_BEING_CAUGHT $^S Current state of the interpreter. Undefined if parsing of the current module/eval is not finished (may happen in $SIG{__DIE__} and $SIG{__WARN__} handlers). True if inside an eval(), otherwise false. $BASETIME $^T The time at which the program began running, in seconds since the epoch (beginning of 1970). The values returned by the -M, -A, and -C filetests are based on this value. $PERL_VERSION $^V The revision, version, and subversion of the Perl interpreter, represented as a string composed of characters with those ordinals. Thus in Perl v5.6.0 it equals chr(5) . chr(6) . chr(0) and will return true for $^V eq v5.6.0. Note that the characters in this string value can potentially be in Unicode range. This can be used to determine whether the Perl interpreter executing a script is in the right range of versions. (Mnemonic: use ^V for Version Control.) Example: warn "No \"our\" declarations!\n" if $^V and $^V lt v5.6.0; See the documentation of use VERSION and require VERSION for a convenient way to fail if the running Perl interpreter is too old. See also $] for an older representation of the Perl version. $WARNING $^W The current value of the warning switch, initially true if -w was used, false otherwise, but directly modifiable. (Mnemonic: related to the -w switch.) See also warnings. ${^WARNING_BITS} The current set of warning checks enabled by the use warnings pragma. See the documentation of warnings for more details. ${^WIDE_SYSTEM_CALLS} Global flag that enables system calls made by Perl to use wide character APIs native to the system, if available. This is currently only implemented on the Windows platform. This can also be enabled from the command line using the -C switch. The initial value is typically 0 for compatibility with Perl versions earlier than 5.6, but may be automatically set to 1 by Perl if the system provides a user-settable default (e.g., $ENV{LC_CTYPE}). The bytes pragma always overrides the effect of this flag in the current lexical scope. See bytes. $EXECUTABLE_NAME $^X The name that the Perl binary itself was executed as, from C's argv[0]. This may not be a full pathname, nor even necessarily in your path. $ARGV contains the name of the current file when reading from <>. @ARGV The array @ARGV contains the command-line arguments intended for the script. $#ARGV is generally the number of arguments minus one, because $ARGV[0] is the first argument, not the program's command name itself. See $0 for the command name. @INC The array @INC contains the list of places that the do EXPR, require, or use constructs look for their library files. It initially consists of the arguments to any -I command-line switches, followed by the default Perl library, probably /usr/local/lib/perl, followed by ".", to represent the current directory. If you need to modify this at runtime, you should use the use lib pragma to get the machine-dependent library properly loaded also: use lib '/mypath/libdir/'; use SomeMod; @_ Within a subroutine the array @_ contains the parameters passed to that subroutine. See perlsub. %INC The hash %INC contains entries for each filename included via the do, require, or use operators. The key is the filename you specified (with module names converted to pathnames), and the value is the location of the file found. The require operator uses this hash to determine whether a particular file has already been included. %ENV $ENV{expr} The hash %ENV contains your current environment. Setting a value in ENV changes the environment for any child processes you subsequently fork() off. %SIG $SIG{expr} The hash %SIG contains signal handlers for signals. For example: sub handler { # 1st argument is signal name my($sig) = @_; print "Caught a SIG$sig--shutting down\n"; close(LOG); exit(0); } $SIG{'INT'} = \&handler; $SIG{'QUIT'} = \&handler; ... $SIG{'INT'} = 'DEFAULT'; # restore default action $SIG{'QUIT'} = 'IGNORE'; # ignore SIGQUIT Using a value of 'IGNORE' usually has the effect of ignoring the signal, except for the CHLD signal. See perlipc for more about this special case. Here are some other examples: $SIG{"PIPE"} = "Plumber"; # assumes main::Plumber (not recommended) $SIG{"PIPE"} = \&Plumber; # just fine; assume current Plumber $SIG{"PIPE"} = *Plumber; # somewhat esoteric $SIG{"PIPE"} = Plumber(); # oops, what did Plumber() return?? Be sure not to use a bareword as the name of a signal handler, lest you inadvertently call it. If your system has the sigaction() function then signal handlers are installed using it. This means you get reliable signal handling. If your system has the SA_RESTART flag it is used when signals handlers are installed. This means that system calls for which restarting is supported continue rather than returning when a signal arrives. If you want your system calls to be interrupted by signal delivery then do something like this: use POSIX ':signal_h'; my $alarm = 0; sigaction SIGALRM, new POSIX::SigAction sub { $alarm = 1 } or die "Error setting SIGALRM handler: $!\n"; See POSIX. Certain internal hooks can be also set using the %SIG hash. The routine indicated by $SIG{__WARN__} is called when a warning message is about to be printed. The warning message is passed as the first argument. The presence of a __WARN__ hook causes the ordinary printing of warnings to STDERR to be suppressed. You can use this to save warnings in a variable, or turn warnings into fatal errors, like this: local $SIG{__WARN__} = sub { die $_[0] }; eval $proggie; The routine indicated by $SIG{__DIE__} is called when a fatal exception is about to be thrown. The error message is passed as the first argument. When a __DIE__ hook routine returns, the exception processing continues as it would have in the absence of the hook, unless the hook routine itself exits via a goto, a loop exit, or a die(). The __DIE__ handler is explicitly disabled during the call, so that you can die from a __DIE__ handler. Similarly for __WARN__. Due to an implementation glitch, the $SIG{__DIE__} hook is called even inside an eval(). Do not use this to rewrite a pending exception in $@, or as a bizarre substitute for overriding CORE::GLOBAL::die(). This strange action at a distance may be fixed in a future release so that $SIG{__DIE__} is only called if your program is about to exit, as was the original intent. Any other use is deprecated. __DIE__/__WARN__ handlers are very special in one respect: they may be called to report (probable) errors found by the parser. In such a case the parser may be in inconsistent state, so any attempt to evaluate Perl code from such a handler will probably result in a segfault. This means that warnings or errors that result from parsing Perl should be used with extreme caution, like this: require Carp if defined $^S; Carp::confess("Something wrong") if defined &Carp::confess; die "Something wrong, but could not load Carp to give backtrace... To see backtrace try starting Perl with -MCarp switch"; Here the first line will load Carp unless it is the parser who called the handler. The second line will print backtrace and die if Carp was available. The third line will be executed only if Carp was not available. See "die" in perlfunc, "warn" in perlfunc, "eval" in perlfunc, and warnings for additional information. Error Indicators The variables $@, $!, $^E, and $? contain information about different types of error conditions that may appear during execution of a Perl program. The variables are shown ordered by the "distance" between the subsystem which reported the error and the Perl process. They correspond to errors detected by the Perl interpreter, C library, operating system, or an external program, respectively. To illustrate the differences between these variables, consider the following Perl expression, which uses a single-quoted string: eval q{ open PIPE, "/cdrom/install |"; @res = ; close PIPE or die "bad pipe: $?, $!"; }; After execution of this statement all 4 variables may have been set. $@ is set if the string to be eval-ed did not compile (this may happen if open or close were imported with bad prototypes), or if Perl code executed during evaluation die()d . In these cases the value of $@ is the compile error, or the argument to die (which will interpolate $! and $?!). (See also Fatal, though.) When the eval() expression above is executed, open(), , and close are translated to calls in the C run-time library and thence to the operating system kernel. $! is set to the C library's errno if one of these calls fails. Under a few operating systems, $^E may contain a more verbose error indicator, such as in this case, "CDROM tray not closed." Systems that do not support extended error messages leave $^E the same as $!. Finally, $? may be set to non-0 value if the external program /cdrom/install fails. The upper eight bits reflect specific error conditions encountered by the program (the program's exit() value). The lower eight bits reflect mode of failure, like signal death and core dump information See wait(2) for details. In contrast to $! and $^E, which are set only if error condition is detected, the variable $? is set on each wait or pipe close, overwriting the old value. This is more like $@, which on every eval() is always set on failure and cleared on success. For more details, see the individual descriptions at $@, $!, $^E, and $?. Technical Note on the Syntax of Variable Names Variable names in Perl can have several formats. Usually, they must begin with a letter or underscore, in which case they can be arbitrarily long (up to an internal limit of 251 characters) and may contain letters, digits, underscores, or the special sequence :: or '. In this case, the part before the last :: or ' is taken to be a package qualifier; see perlmod. Perl variable names may also be a sequence of digits or a single punctuation or control character. These names are all reserved for special uses by Perl; for example, the all-digits names are used to hold data captured by backreferences after a regular expression match. Perl has a special syntax for the single-control-character names: It understands ^X (caret X) to mean the control-X character. For example, the notation $^W (dollar-sign caret W) is the scalar variable whose name is the single character control-W. This is better than typing a literal control-W into your program. Finally, new in Perl 5.6, Perl variable names may be alphanumeric strings that begin with control characters (or better yet, a caret). These variables must be written in the form ${^Foo}; the braces are not optional. ${^Foo} denotes the scalar variable whose name is a control-F followed by two o's. These variables are reserved for future special uses by Perl, except for the ones that begin with ^_ (control-underscore or caret-underscore). No control-character name that begins with ^_ will acquire a special meaning in any future version of Perl; such names may therefore be used safely in programs. $^_ itself, however, is reserved. Perl identifiers that begin with digits, control characters, or punctuation characters are exempt from the effects of the package declaration and are always forced to be in package main. A few other names are also exempt: ENV STDIN INC STDOUT ARGV STDERR ARGVOUT SIG In particular, the new special ${^_XYZ} variables are always taken to be in package main, regardless of any package declarations presently in scope. BUGS Due to an unfortunate accident of Perl's implementation, use English imposes a considerable performance penalty on all regular expression matches in a program, regardless of whether they occur in the scope of use English. For that reason, saying use English in libraries is strongly discouraged. See the Devel::SawAmpersand module documentation from CPAN (http://www.perl.com/CPAN/modules/by-module/Devel/) for more information. Having to even think about the $^S variable in your exception handlers is simply wrong. $SIG{__DIE__} as currently implemented invites grievous and difficult to track down errors. Avoid it and use an END{} or CORE::GLOBAL::die override instead. Pod-Simple-3.43/t/pulltitl.t0000644000175000017500000002564514062242376014103 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 117 }; #use Pod::Simple::Debug (5); #sub Pod::Simple::MANY_LINES () {1} #sub Pod::Simple::PullParser::DEBUG () {3} use Pod::Simple::PullParser; ok 1; #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 NAME\n\nBzorch\n\n=pod\n\nLala\n\n\=cut\n} ); ok $p->get_title(), 'Bzorch'; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); ok( $t = $p->get_token); ok( $t && $t->type, 'text'); ok( $t && $t->type eq 'text' && $t->text, 'NAME' ); DIE: { # Make sure we die. local $@; eval { $p->set_source(\'=head1 foo') }; ok $@; ok $@ =~ /\QCannot assign new source to pull parser; create a new instance, instead/; } } ########################################################################### { print "# Testing a set with nocase, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 Name\n\nShazbot\n\n=pod\n\nLala\n\n\=cut\n} ); ok $p->get_title(nocase => 1), 'Shazbot'; ok( my $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); ok( $t = $p->get_token); ok( $t && $t->type, 'text'); ok( $t && $t->type eq 'text' && $t->text, 'Name' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 NE<65>ME\n\nBzorch\n\n=pod\n\nLala\n\n\=cut\n} ); ok $p->get_title(), 'Bzorch'; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); ok( $t = $p->get_token); ok( $t && $t->type, 'text'); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; { my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 NAME\n\nBzorch - I lala\n\n=pod\n\nLala\n\n\=cut\n} ); ok $p->get_title(), 'Bzorch - thing lala'; } my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 NAME\n\nBzorch - I lala\n\n=pod\n\nLala\n\n\=cut\n} ); ok $p->get_title(), 'Bzorch - thing lala'; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); ok( $t = $p->get_token); ok( $t && $t->type, 'text'); ok( $t && $t->type eq 'text' && $t->text, 'NAME' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 Bzorch lala\n\n=pod\n\nLala\n\n\=cut\n} ); ok $p->get_title(), 'Bzorch lala'; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); ok( $t = $p->get_token); ok( $t && $t->type, 'text'); ok( $t && $t->type eq 'text' && $t->text, 'Bzorch lala' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 Bzorch - I lala\n\n=pod\n\nLala\n\n\=cut\n} ); ok $p->get_title(), 'Bzorch - thing lala'; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'head1' ); ok( $t = $p->get_token); ok( $t && $t->type, 'text'); ok( $t && $t->type eq 'text' && $t->text, 'Bzorch - ' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 Nombre (NAME)\n\nBzorch - I lala\n\n=pod\n\nGrunk\n\n\=cut\n} ); ok $p->get_version || '', ''; ok $p->get_author || '', ''; ok $p->get_title(), 'Bzorch - thing lala'; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 (NAME)\n\n -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); ok $p->get_title(), q{ -- Fet's "When you were reading}; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 (NAME) \n\n -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); ok $p->get_title(), q{ -- Fet's "When you were reading}; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 (DESCRIPTION) \n\n -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); ok $p->get_title() || '', ''; ok $p->get_description(), q{ -- Fet's "When you were reading}; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 (DESCRIPTION) \n\n -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); ok $p->get_description(), q{ -- Fet's "When you were reading}; ok $p->get_title() || '', ''; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 NAME\n\nThingy\n\n=head1 (DESCRIPTION) \n\n -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); ok $p->get_description(), q{ -- Fet's "When you were reading}; ok $p->get_title(), "Thingy"; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 NAME\n\nThingy\n\n=head1 (DESCRIPTION) \n\n -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); ok $p->get_title(), "Thingy"; ok $p->get_description(), q{ -- Fet's "When you were reading}; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 (NAME) \n\nThingy\n\n=head1 (DESCRIPTION) \n\n -- Fet's I<"When you were> reading\n\n=pod\n\nGrunk\n\n\=cut\n} ); ok $p->get_title(), "Thingy"; ok $p->get_description(), q{ -- Fet's "When you were reading}; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \q{ =head1 (NAME) Thingy =head1 (DESCRIPTION) -- Fet's I<"When you were> reading =pod Grunk =cut } ); ok $p->get_title(), "Thingy"; ok $p->get_version() || '', ''; ok $p->get_description(), q{ -- Fet's "When you were reading}; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); } ########################################################################### { print "# Testing another set, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \q{ =head1 (NAME) Thingy =head1 (DESCRIPTION) -- Fet's I<"When you were> reading =head1 VERSION Stuff: Thing Whatever: Um. =head1 AUTHOR Jojoj E<65>arzarz =pod Grunk =cut } ); ok $p->get_title(), "Thingy"; my $v = $p->get_version || ''; $v =~ s/^ +//m; $v =~ s/^\s+//s; $v =~ s/\s+$//s; ok $v, "Stuff: Thing\nWhatever: Um."; ok $p->get_description(), q{ -- Fet's "When you were reading}; ok $p->get_author() || '', 'Jojoj Aarzarz'; my $t; ok( $t = $p->get_token); ok( $t && $t->type, 'start'); ok( $t && $t->type eq 'start' && $t->tagname, 'Document' ); } ########################################################################### { print "# Testing a title with an X<>, at line ", __LINE__, "\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\n=head1 NAME Foo Bar\nX\n} ); ok $p->get_title(), 'NAME Foo Bar'; } ########################################################################### print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; __END__ Pod-Simple-3.43/t/fcodes_l.t0000644000175000017500000006464414062242376014012 0ustar khwkhw# fcodes L BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 101 }; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } #use Pod::Simple::Debug (10); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; my $x = 'Pod::Simple::XMLOutStream'; print "##### Testing L codes via x class $x...\n"; $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output print "# Simple/moderate L tests...\n"; ok($x->_out(qq{=pod\n\nL\n}), 'Net::Ping' ); ok($x->_out(qq{=pod\n\nL\n}), 'crontab(5)' ); ok($x->_out(qq{=pod\n\nL\n}), 'login.conf(5)' ); ok($x->_out(qq{=pod\n\nL\n}), 'foo_bar(5)' ); ok( $x->_out(qq{=pod\n\nL\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nL\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nL\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nL\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nL<"Object Methods">\n}), '"Object Methods"' ); print "# Complex L tests...\n"; print "# Ents in the middle...\n"; ok($x->_out(qq{=pod\n\nL\n}), 'Net::Ping' ); ok( $x->_out(qq{=pod\n\nLong>\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLong">\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLethods">\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nLethods>\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nL<"Object E<77>ethods">\n}), '"Object Methods"' ); print "# Ents in the middle and at the start...\n"; ok($x->_out(qq{=pod\n\nLet::Ping>\n}), 'Net::Ping' ); ok( $x->_out(qq{=pod\n\nLet::Ping/Ping-E<112>ong>\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLet::Ping/"Ping-E<112>ong">\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLbject E<77>ethods">\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nLbject E<77>ethods>\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nL<"E<79>bject E<77>ethods">\n}), '"Object Methods"' ); print "# Ents in the middle and at the start and at the end...\n"; ok($x->_out(qq{=pod\n\nLet::PinE<103>>\n}), 'Net::Ping' ); ok( $x->_out(qq{=pod\n\nLet::PinE<103>/Ping-E<112>onE<103>>\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLet::PinE<103>/"Ping-E<112>onE<103>">\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLbject E<77>ethodE<115>">\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nLbject E<77>ethodE<115>>\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nL<"E<79>bject E<77>ethodE<115>">\n}), '"Object Methods"' ); print "# Even more complex L tests...\n"; print "# Ents in the middle...\n"; ok($x->_out(qq{=pod\n\nL\n}), 'Net::Ping' ); ok( $x->_out(qq{=pod\n\nLong>\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLong">\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLethods">\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nLethods>\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nL<"Object E<77>ethods">\n}), '"Object Methods"' ); ########################################################################### print "# VERY complex L sequences...\n"; print "# Ents in the middle and at the start...\n"; ok($x->_out(qq{=pod\n\nL\n}), 'Net::Ping' ); ok( $x->_out(qq{=pod\n\nLong>>\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLong>">\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nL E<77>ethods">\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nL E<77>ethods>\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nL<"B E<77>ethods">\n}), '"Object Methods"' ); print "# Ents in the middle and at the start...\n"; ok($x->_out(qq{=pod\n\nLet::Ping>\n}), 'Net::Ping' ); ok( $x->_out(qq{=pod\n\nLet::Ping/Ping-Bong>>\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLet::Ping/"Ping-Bong>">\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLbject> E<77>ethods">\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nLbject> E<77>ethods>\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nL<"Bbject> E<77>ethods">\n}), '"Object Methods"' ); print "# Ents in the middle and at the start and at the end...\n"; ok($x->_out(qq{=pod\n\nLet::PinE<103>>\n}), 'Net::Ping' ); ok( $x->_out(qq{=pod\n\nLet::PinE<103>/Ping-BonE<103>>>\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLet::PinE<103>/"Ping-BonE<103>>">\n}), '"Ping-pong" in Net::Ping' ); ok( $x->_out(qq{=pod\n\nLbject> E<77>ethodE<115>">\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nLbject> E<77>ethodE<115>>\n}), '"Object Methods"' ); ok( $x->_out(qq{=pod\n\nL<"Bbject> E<77>ethodE<115>">\n}), '"Object Methods"' ); ########################################################################### print "#\n# L tests...\n"; ok( $x->_out(qq{=pod\n\nL\n}), 'news:comp.lang.perl.misc' ); ok( $x->_out(qq{=pod\n\nL\n}), 'http://www.perl.com' ); ok( $x->_out(qq{=pod\n\nL\n}), 'http://www.perl.com/CPAN/authors/id/S/SB/SBURKE/' ); print "# L tests with entities...\n"; ok( $x->_out(qq{=pod\n\nLlang.perl.misc>\n}), 'news:comp.lang.perl.misc' ); ok( $x->_out(qq{=pod\n\nLperl.com>\n}), 'http://www.perl.com' ); ok( $x->_out(qq{=pod\n\nLperl.com/CPAN/authors/id/S/SB/SBURKE/>\n}), 'http://www.perl.com/CPAN/authors/id/S/SB/SBURKE/' ); ok( $x->_out(qq{=pod\n\nLperl.com/CPAN/authors/id/S/SB/SBURKEE<47>>\n}), 'http://www.perl.com/CPAN/authors/id/S/SB/SBURKE/' ); ########################################################################### print "# L tests...\n"; ok($x->_out(qq{=pod\n\nL\n}), 'things' ); ok($x->_out(qq{=pod\n\nL\n}), 'things' ); ok($x->_out(qq{=pod\n\nL\n}), 'things' ); ok( $x->_out(qq{=pod\n\nL\n}), 'Perl Error Messages' ); ok( $x->_out(qq{=pod\n\nL\n}), 'Perl Error Messages' ); ok( $x->_out(qq{=pod\n\nL\n}), 'Perl Error Messages' ); ok( $x->_out(qq{=pod\n\nL\n}), 'SWITCH statements' ); ok( $x->_out(qq{=pod\n\nL\n}), 'SWITCH statements' ); ok( $x->_out(qq{=pod\n\nL\n}), 'the various attributes' ); ok( $x->_out(qq{=pod\n\nL\n}), 'the various attributes' ); ok( $x->_out(qq{=pod\n\nL\n}), 'the various attributes' ); print "#\n# Now some very complex L tests...\n"; ok( $x->_out(qq{=pod\n\nLessages>|perldiag>\n}), 'Perl Error Messages' ); ok( $x->_out(qq{=pod\n\nLessages>|perldiag>\n}), 'Perl Error Messages' ); ok( $x->_out(qq{=pod\n\nLessages>|perldiag>\n}), 'Perl Error Messages' ); ok( $x->_out(qq{=pod\n\nLtatements>|perlsyn/"Basic I and Switch StatementE<115>">\n}), 'SWITCH statements' ); ok( $x->_out(qq{=pod\n\nLtatements>|perlsyn/Basic I and Switch StatementE<115>>\n}), 'SWITCH statements' ); ok( $x->_out(qq{=pod\n\nL attributes|/"Member Data">\n}), 'the various attributes' ); ok( $x->_out(qq{=pod\n\nL attributes|/Member Data>\n}), 'the various attributes' ); ok( $x->_out(qq{=pod\n\nL attributes|"Member Data">\n}), 'the various attributes' ); print "#\n# Now some very complex L tests with variant syntax...\n"; ok( $x->_out(qq{=pod\n\nL<< Perl B<<< Error E<77>essages >>>|perldiag >>\n}), 'Perl Error Messages' ); ok( $x->_out(qq{=pod\n\nL<< Perl\nB<<< Error\nE<77>essages >>>|perldiag >>\n}), 'Perl Error Messages' ); ok( $x->_out(qq{=pod\n\nL<< Perl\nB<<< Error\t E<77>essages >>>|perldiag >>\n}), 'Perl Error Messages' ); ok( $x->_out(qq{=pod\n\nL<< SWITCH B<<< E<115>tatements >>>|perlsyn/"Basic I<<<< BLOCKs >>>> and Switch StatementE<115>" >>\n}), 'SWITCH statements' ); ok( $x->_out(qq{=pod\n\nL<< SWITCH B<<< E<115>tatements >>>|perlsyn/Basic I<<<< BLOCKs >>>> and Switch StatementE<115> >>\n}), 'SWITCH statements' ); ok( $x->_out(qq{=pod\n\nL<<< the F<< various >> attributes|/"Member Data" >>>\n}), 'the various attributes' ); ok( $x->_out(qq{=pod\n\nL<<< the F<< various >> attributes|/Member Data >>>\n}), 'the various attributes' ); ok( $x->_out(qq{=pod\n\nL<<< the F<< various >> attributes|"Member Data" >>>\n}), 'the various attributes' ); ########################################################################### print "#\n# Now some very complex L tests with variant syntax and text around it...\n"; ok( $x->_out(qq{=pod\n\nI like L<< Perl B<<< Error E<77>essages >>>|perldiag >>.\n}), 'I like Perl Error Messages.' ); ok( $x->_out(qq{=pod\n\nI like L<< Perl\nB<<< Error\nE<77>essages >>>|perldiag >>.\n}), 'I like Perl Error Messages.' ); ok( $x->_out(qq{=pod\n\nI like L<< Perl\nB<<< Error\t E<77>essages >>>|perldiag >>.\n}), 'I like Perl Error Messages.' ); ok( $x->_out(qq{=pod\n\nI like L<< SWITCH B<<< E<115>tatements >>>|perlsyn/"Basic I<<<< BLOCKs >>>> and Switch StatementE<115>" >>.\n}), 'I like SWITCH statements.' ); ok( $x->_out(qq{=pod\n\nI like L<< SWITCH B<<< E<115>tatements >>>|perlsyn/Basic I<<<< BLOCKs >>>> and Switch StatementE<115> >>.\n}), 'I like SWITCH statements.' ); ok( $x->_out(qq{=pod\n\nI like L<<< the F<< various >> attributes|/"Member Data" >>>.\n}), 'I like the various attributes.' ); ok( $x->_out(qq{=pod\n\nI like L<<< the F<< various >> attributes|/Member Data >>>.\n}), 'I like the various attributes.' ); ok( $x->_out(qq{=pod\n\nI like L<<< the F<< various >> attributes|"Member Data" >>>.\n}), 'I like the various attributes.' ); ok( $x->_out(qq{=pod\n\nI like L<<< Bs|http://text.com >>>.\n}), 'I like texts.' ); ok( $x->_out(qq{=pod\n\nI like L<<< text|https://text.com/1/2 >>>.\n}), 'I like text.' ); ok( $x->_out(qq{=pod\n\nI like L<<< I|http://text.com >>>.\n}), 'I like text.' ); ok( $x->_out(qq{=pod\n\nI like L<<< C|http://text.com >>>.\n}), 'I like text.' ); ok( $x->_out(qq{=pod\n\nI like L<<< I>>>|mailto:earlE<64>text.com >>>.\n}), 'I like text.' ); ok( $x->_out(qq{=pod\n\nI like L<<< textZ<>|http://text.com >>>.\n}), 'I like text.' ); # # TODO: S testing. # ########################################################################### print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/search60/0000755000175000017500000000000014066435222013442 5ustar khwkhwPod-Simple-3.43/t/search60/B/0000755000175000017500000000000014066435222013623 5ustar khwkhwPod-Simple-3.43/t/search60/B/X.pod0000644000175000017500000000001214062242376014531 0ustar khwkhw=head1 X Pod-Simple-3.43/t/search60/A/0000755000175000017500000000000014066435222013622 5ustar khwkhwPod-Simple-3.43/t/search60/A/x.pod0000644000175000017500000000001214062242376014570 0ustar khwkhw=head1 x Pod-Simple-3.43/t/JustPod_corpus.t0000644000175000017500000001101114062242376015173 0ustar khwkhw# Testing Pod::Simple::JustPod against *.pod in /t use strict; use warnings; BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } use Config; if ($Config::Config{'extensions'} !~ /\bEncode\b/) { print "1..0 # Skip: Encode was not built\n"; exit 0; } } use File::Find; use File::Spec; use Test::More; use Pod::Simple::JustPod; my @test_files; BEGIN { sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { require File::Spec; my $updir = File::Spec->updir; my $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't'); return File::Spec->catdir($dir, $file); } else { return $file; } } my @test_dirs = ( File::Spec->catdir( source_path('t') ) , File::Spec->catdir( File::Spec->updir, 't') , ); my $test_dir; foreach( @test_dirs ) { $test_dir = $_ and last if -e; } die "Can't find the test dir" unless $test_dir; print "# TESTDIR: $test_dir\n"; sub wanted { push @test_files, $File::Find::name if $File::Find::name =~ /\.pod$/; } find(\&wanted , $test_dir ); plan tests => scalar @test_files; } @test_files = sort @test_files; my @skip_on_windows = qw{ t/corpus/8859_7.pod t/corpus/laozi38p.pod t/junk2.pod t/perlcyg.pod t/perlfaq.pod t/perlvar.pod t/search60/A/x.pod t/search60/B/X.pod t/testlib1/hinkhonk/Glunk.pod t/testlib1/pod/perlflif.pod t/testlib1/pod/perlthng.pod t/testlib1/squaa/Glunk.pod t/testlib1/zikzik.pod t/testlib2/hinkhonk/Glunk.pod t/testlib2/pod/perlthng.pod t/testlib2/pod/perlzuk.pod t/testlib2/pods/perlzoned.pod t/testlib2/squaa/Wowo.pod }; my $is_windows = $^O eq 'MSWin32'; foreach my $file (@test_files) { SKIP: { if ( $is_windows && grep { $_ eq $file } @skip_on_windows ) { skip "$file needs investigation on windows", 1; } my $parser = Pod::Simple::JustPod->new(); $parser->complain_stderr(0); my $input; open( IN , '<:raw' , $file ) or die "$file: $!"; $input .= $_ while (); close( IN ); my $output; $parser->output_string( \$output ); $parser->parse_string_document( $input ); if ($parser->any_errata_seen()) { pass("Skip '$file' because of pod errors"); next if "$]" lt '5.010.001'; # note() not found in earlier versions my $errata = $parser->errata_seen(); foreach my $line_number (sort { $a <=> $b } keys %$errata) { foreach my $err_msg (sort @{$errata->{$line_number}}) { note("$file: $line_number: $err_msg"); } } next; } my $encoding = $parser->encoding(); if (defined $encoding) { eval { require Encode; }; $input = Encode::decode($parser->encoding(), $input); } my @input = split "\n", $input; my $stripped_input = ""; while (defined ($_ = shift @input)) { if (/ ^ = [a-z]+ /x) { my $line = "$_\n"; if ($stripped_input eq "" || $_ !~ /^=pod/) { $stripped_input .= $line; } while (defined ($_ = shift @input)) { $stripped_input .= "$_\n"; last if / ^ =cut /x; } } } $stripped_input =~ s/ ^ =cut \n (.) /$1/mgx; $input = $stripped_input if $stripped_input ne ""; if ($input !~ / ^ =pod /x) { $input =~ s/ ^ \s+ //x; $input = "=pod\n\n$input"; } if ($input !~ / =cut $ /x) { $input =~ s/ \s+ $ //x; $input .= "\n\n=cut\n"; } my $msg = "got expected output for $file"; if ($output eq $input) { pass($msg); } elsif ($ENV{PERL_TEST_DIFF}) { fail($msg); require File::Temp; my $orig_file = File::Temp->new(); local $/ = "\n"; chomp $input; print $orig_file $input, "\n"; close $orig_file || die "Can't close orig_file: $!"; chomp $output; my $parsed_file = File::Temp->new(); print $parsed_file $output, "\n"; close $parsed_file || die "Can't close parsed_file"; my $diff = File::Temp->new(); system("$ENV{PERL_TEST_DIFF} $orig_file $parsed_file > $diff"); open my $fh, "<", $diff || die "Can't open $diff"; my @diffs = <$fh>; diag(@diffs); } else { eval { require Text::Diff; }; if ($@) { is($output, $input, $msg); diag("Set environment variable PERL_TEST_DIFF=diff_tool or install" . " Text::Diff to see just the differences."); } else { fail($msg); diag Text::Diff::diff(\$input, \$output, { STYLE => 'Unified' }); } } } } Pod-Simple-3.43/t/search60.t0000644000175000017500000000251014062242376013627 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Pod::Simple::Search; use Test; BEGIN { plan tests => 4 } print "# ", __FILE__, ": Testing forced case sensitivity ...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; $x->inc(0); $x->is_case_insensitive(0); use File::Spec; use Cwd; my $cwd = cwd(); print "# CWD: $cwd\n"; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { my $updir = File::Spec->updir; my $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't'); return File::Spec->catdir ($dir, $file); } else { return $file; } } my($A, $B); if( -e ($A = source_path( 'search60/A' ))) { die "But where's $B?" unless -e ($B = source_path( 'search60/B')); } elsif( -e ($A = File::Spec->catdir($cwd, 't', 'search60', 'A' ))) { die "But where's $B?" unless -e ($B = File::Spec->catdir($cwd, 't', 'search60', 'B')); } else { die "Can't find the test corpora"; } print "# OK, found the test corpora\n# as $A\n# and $B\n#\n"; ok 1; my($name2where, $where2name) = $x->survey($A, $B); ok ($name2where->{x} =~ m{^\Q$A\E[\\/]x\.pod$}); ok ($name2where->{X} =~ m{^\Q$B\E[\\/]X\.pod$}); Pod-Simple-3.43/t/output.t0000644000175000017500000000214414062242376013557 0ustar khwkhw#!/usr/bin/perl -w # t/output.t - Check output_string. BEGIN { chdir 't' if -d 't'; } use strict; use warnings; use lib '../lib'; use Test::More tests => 36; #use Test::More 'no_plan'; use File::Spec; for my $format (qw(XHTML HTML Text RTF)) { my $class = "Pod::Simple::$format"; use_ok $class or next; ok my $parser = $class->new, "Construct $format parser"; # Try parse_string_document(). my $output = ''; ok $parser->output_string(\$output), "Set $format output string"; ok $parser->parse_string_document( "=head1 Poit!" ), "Parse to $format via parse_string_document()"; like $output, qr{Poit!}, "Should have $format output from parse_string_document()"; # Try parse_file(). ok $parser = $class->new, "Construct another $format parser"; $output = ''; ok $parser->output_string(\$output), "Set $format output string again"; ok $parser->parse_file(File::Spec->catfile(qw(testlib1 zikzik.pod))), "Parse to $format via parse_file()"; like $output, qr{This is just a test file}, "Should have $format output from parse_file"; } Pod-Simple-3.43/t/perlfaqo.txt0000644000175000017500000007363114062242376014415 0ustar khwkhwNAME perlfaq3 - Programming Tools ($Revision: 1.38 $, $Date: 1999/05/23 16:08:30 $) DESCRIPTION This section of the FAQ answers questions related to programmer tools and programming support. How do I do (anything)? Have you looked at CPAN (see perlfaq2)? The chances are that someone has already written a module that can solve your problem. Have you read the appropriate man pages? Here's a brief index: Basics perldata, perlvar, perlsyn, perlop, perlsub Execution perlrun, perldebug Functions perlfunc Objects perlref, perlmod, perlobj, perltie Data Structures perlref, perllol, perldsc Modules perlmod, perlmodlib, perlsub Regexes perlre, perlfunc, perlop, perllocale Moving to perl5 perltrap, perl Linking w/C perlxstut, perlxs, perlcall, perlguts, perlembed Various http://www.perl.com/CPAN/doc/FMTEYEWTK/index.html (not a man-page but still useful) A crude table of contents for the Perl man page set is found in perltoc. How can I use Perl interactively? The typical approach uses the Perl debugger, described in the perldebug(1) man page, on an ``empty'' program, like this: perl -de 42 Now just type in any legal Perl code, and it will be immediately evaluated. You can also examine the symbol table, get stack backtraces, check variable values, set breakpoints, and other operations typically found in symbolic debuggers. Is there a Perl shell? In general, no. The Shell.pm module (distributed with Perl) makes Perl try commands which aren't part of the Perl language as shell commands. perlsh from the source distribution is simplistic and uninteresting, but may still be what you want. How do I debug my Perl programs? Have you tried use warnings or used -w? They enable warnings to detect dubious practices. Have you tried use strict? It prevents you from using symbolic references, makes you predeclare any subroutines that you call as bare words, and (probably most importantly) forces you to predeclare your variables with my, our, or use vars. Did you check the return values of each and every system call? The operating system (and thus Perl) tells you whether they worked, and if not why. open(FH, "> /etc/cantwrite") or die "Couldn't write to /etc/cantwrite: $!\n"; Did you read perltrap? It's full of gotchas for old and new Perl programmers and even has sections for those of you who are upgrading from languages like awk and C. Have you tried the Perl debugger, described in perldebug? You can step through your program and see what it's doing and thus work out why what it's doing isn't what it should be doing. How do I profile my Perl programs? You should get the Devel::DProf module from the standard distribution (or separately on CPAN) and also use Benchmark.pm from the standard distribution. The Benchmark module lets you time specific portions of your code, while Devel::DProf gives detailed breakdowns of where your code spends its time. Here's a sample use of Benchmark: use Benchmark; @junk = `cat /etc/motd`; $count = 10_000; timethese($count, { 'map' => sub { my @a = @junk; map { s/a/b/ } @a; return @a }, 'for' => sub { my @a = @junk; local $_; for (@a) { s/a/b/ }; return @a }, }); This is what it prints (on one machine--your results will be dependent on your hardware, operating system, and the load on your machine): Benchmark: timing 10000 iterations of for, map... for: 4 secs ( 3.97 usr 0.01 sys = 3.98 cpu) map: 6 secs ( 4.97 usr 0.00 sys = 4.97 cpu) Be aware that a good benchmark is very hard to write. It only tests the data you give it and proves little about the differing complexities of contrasting algorithms. How do I cross-reference my Perl programs? The B::Xref module, shipped with the new, alpha-release Perl compiler (not the general distribution prior to the 5.005 release), can be used to generate cross-reference reports for Perl programs. perl -MO=Xref[,OPTIONS] scriptname.plx Is there a pretty-printer (formatter) for Perl? There is no program that will reformat Perl as much as indent(1) does for C. The complex feedback between the scanner and the parser (this feedback is what confuses the vgrind and emacs programs) makes it challenging at best to write a stand-alone Perl parser. Of course, if you simply follow the guidelines in perlstyle, you shouldn't need to reformat. The habit of formatting your code as you write it will help prevent bugs. Your editor can and should help you with this. The perl-mode or newer cperl-mode for emacs can provide remarkable amounts of help with most (but not all) code, and even less programmable editors can provide significant assistance. Tom swears by the following settings in vi and its clones: set ai sw=4 map! ^O {^M}^[O^T Now put that in your .exrc file (replacing the caret characters with control characters) and away you go. In insert mode, ^T is for indenting, ^D is for undenting, and ^O is for blockdenting-- as it were. If you haven't used the last one, you're missing a lot. A more complete example, with comments, can be found at http://www.perl.com/CPAN-local/authors/id/TOMC/scripts/toms.exrc.gz If you are used to using the vgrind program for printing out nice code to a laser printer, you can take a stab at this using http://www.perl.com/CPAN/doc/misc/tips/working.vgrind.entry, but the results are not particularly satisfying for sophisticated code. The a2ps at http://www.infres.enst.fr/%7Edemaille/a2ps/ does lots of things related to generating nicely printed output of documents. Is there a ctags for Perl? There's a simple one at http://www.perl.com/CPAN/authors/id/TOMC/scripts/ptags.gz which may do the trick. And if not, it's easy to hack into what you want. Is there an IDE or Windows Perl Editor? Perl programs are just plain text, so any editor will do. If you're on Unix, you already have an IDE--Unix itself. The UNIX philosophy is the philosophy of several small tools that each do one thing and do it well. It's like a carpenter's toolbox. If you want a Windows IDE, check the following: CodeMagicCD http://www.codemagiccd.com/ Komodo ActiveState's cross-platform, multi-language IDE has Perl support, including a regular expression debugger and remote debugging (http://www.ActiveState.com/Products/Komodo/index.html). (Visual Perl, a Visual Studio.NET plug-in is currently (early 2001) in beta (http://www.ActiveState.com/Products/VisualPerl/index.html)). The Object System (http://www.castlelink.co.uk/object_system/) is a Perl web applications development IDE. PerlBuilder (http://www.solutionsoft.com/perl.htm) is an integrated development environment for Windows that supports Perl development. Perl code magic (http://www.petes-place.com/codemagic.html). visiPerl+ http://helpconsulting.net/visiperl/, from Help Consulting. For editors: if you're on Unix you probably have vi or a vi clone already, and possibly an emacs too, so you may not need to download anything. In any emacs the cperl-mode (M-x cperl-mode) gives you perhaps the best available Perl editing mode in any editor. For Windows editors: you can download an Emacs GNU Emacs http://www.gnu.org/software/emacs/windows/ntemacs.html MicroEMACS http://members.nbci.com/uemacs/ XEmacs http://www.xemacs.org/Download/index.html or a vi clone such as Elvis ftp://ftp.cs.pdx.edu/pub/elvis/ http://www.fh-wedel.de/elvis/ Vile http://vile.cx/ Vim http://www.vim.org/ win32: http://www.cs.vu.nl/%7Etmgil/vi.html For vi lovers in general, Windows or elsewhere: http://www.thomer.com/thomer/vi/vi.html. nvi (http://www.bostic.com/vi/, available from CPAN in src/misc/) is yet another vi clone, unfortunately not available for Windows, but in UNIX platforms you might be interested in trying it out, firstly because strictly speaking it is not a vi clone, it is the real vi, or the new incarnation of it, and secondly because you can embed Perl inside it to use Perl as the scripting language. nvi is not alone in this, though: at least also vim and vile offer an embedded Perl. The following are Win32 multilanguage editor/IDESs that support Perl: Codewright http://www.starbase.com/ MultiEdit http://www.MultiEdit.com/ SlickEdit http://www.slickedit.com/ There is also a toyedit Text widget based editor written in Perl that is distributed with the Tk module on CPAN. The ptkdb (http://world.std.com/~aep/ptkdb/) is a Perl/tk based debugger that acts as a development environment of sorts. Perl Composer (http://perlcomposer.sourceforge.net/vperl.html) is an IDE for Perl/Tk GUI creation. In addition to an editor/IDE you might be interested in a more powerful shell environment for Win32. Your options include Bash from the Cygwin package (http://sources.redhat.com/cygwin/) Ksh from the MKS Toolkit (http://www.mks.com/), or the Bourne shell of the U/WIN environment (http://www.research.att.com/sw/tools/uwin/) Tcsh ftp://ftp.astron.com/pub/tcsh/, see also http://www.primate.wisc.edu/software/csh-tcsh-book/ Zsh ftp://ftp.blarg.net/users/amol/zsh/, see also http://www.zsh.org/ MKS and U/WIN are commercial (U/WIN is free for educational and research purposes), Cygwin is covered by the GNU Public License (but that shouldn't matter for Perl use). The Cygwin, MKS, and U/WIN all contain (in addition to the shells) a comprehensive set of standard UNIX toolkit utilities. If you're transferring text files between Unix and Windows using FTP be sure to transfer them in ASCII mode so the ends of lines are appropriately converted. On Mac OS the MacPerl Application comes with a simple 32k text editor that behaves like a rudimentary IDE. In contrast to the MacPerl Application the MPW Perl tool can make use of the MPW Shell itself as an editor (with no 32k limit). BBEdit and BBEdit Lite are text editors for Mac OS that have a Perl sensitivity mode (http://web.barebones.com/). Alpha is an editor, written and extensible in Tcl, that nonetheless has built in support for several popular markup and programming languages including Perl and HTML (http://alpha.olm.net/). Pepper and Pe are programming language sensitive text editors for Mac OS X and BeOS respectively (http://www.hekkelman.com/). Where can I get Perl macros for vi? For a complete version of Tom Christiansen's vi configuration file, see http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/toms.exrc.gz , the standard benchmark file for vi emulators. The file runs best with nvi, the current version of vi out of Berkeley, which incidentally can be built with an embedded Perl interpreter--see http://www.perl.com/CPAN/src/misc. Where can I get perl-mode for emacs? Since Emacs version 19 patchlevel 22 or so, there have been both a perl-mode.el and support for the Perl debugger built in. These should come with the standard Emacs 19 distribution. In the Perl source directory, you'll find a directory called "emacs", which contains a cperl-mode that color-codes keywords, provides context-sensitive help, and other nifty things. Note that the perl-mode of emacs will have fits with "main'foo" (single quote), and mess up the indentation and highlighting. You are probably using "main::foo" in new Perl code anyway, so this shouldn't be an issue. How can I use curses with Perl? The Curses module from CPAN provides a dynamically loadable object module interface to a curses library. A small demo can be found at the directory http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/rep; this program repeats a command and updates the screen as needed, rendering rep ps axu similar to top. How can I use X or Tk with Perl? Tk is a completely Perl-based, object-oriented interface to the Tk toolkit that doesn't force you to use Tcl just to get at Tk. Sx is an interface to the Athena Widget set. Both are available from CPAN. See the directory http://www.perl.com/CPAN/modules/by-category/08_User_Interfaces/ Invaluable for Perl/Tk programming are the Perl/Tk FAQ at http://w4.lns.cornell.edu/%7Epvhp/ptk/ptkTOC.html , the Perl/Tk Reference Guide available at http://www.perl.com/CPAN-local/authors/Stephen_O_Lidie/ , and the online manpages at http://www-users.cs.umn.edu/%7Eamundson/perl/perltk/toc.html . How can I generate simple menus without using CGI or Tk? The http://www.perl.com/CPAN/authors/id/SKUNZ/perlmenu.v4.0.tar.gz module, which is curses-based, can help with this. What is undump? See the next question on ``How can I make my Perl program run faster?'' How can I make my Perl program run faster? The best way to do this is to come up with a better algorithm. This can often make a dramatic difference. Jon Bentley's book ``Programming Pearls'' (that's not a misspelling!) has some good tips on optimization, too. Advice on benchmarking boils down to: benchmark and profile to make sure you're optimizing the right part, look for better algorithms instead of microtuning your code, and when all else fails consider just buying faster hardware. A different approach is to autoload seldom-used Perl code. See the AutoSplit and AutoLoader modules in the standard distribution for that. Or you could locate the bottleneck and think about writing just that part in C, the way we used to take bottlenecks in C code and write them in assembler. Similar to rewriting in C, modules that have critical sections can be written in C (for instance, the PDL module from CPAN). In some cases, it may be worth it to use the backend compiler to produce byte code (saving compilation time) or compile into C, which will certainly save compilation time and sometimes a small amount (but not much) execution time. See the question about compiling your Perl programs for more on the compiler--the wins aren't as obvious as you'd hope. If you're currently linking your perl executable to a shared libc.so, you can often gain a 10-25% performance benefit by rebuilding it to link with a static libc.a instead. This will make a bigger perl executable, but your Perl programs (and programmers) may thank you for it. See the INSTALL file in the source distribution for more information. Unsubstantiated reports allege that Perl interpreters that use sfio outperform those that don't (for I/O intensive applications). To try this, see the INSTALL file in the source distribution, especially the ``Selecting File I/O mechanisms'' section. The undump program was an old attempt to speed up your Perl program by storing the already-compiled form to disk. This is no longer a viable option, as it only worked on a few architectures, and wasn't a good solution anyway. How can I make my Perl program take less memory? When it comes to time-space tradeoffs, Perl nearly always prefers to throw memory at a problem. Scalars in Perl use more memory than strings in C, arrays take more than that, and hashes use even more. While there's still a lot to be done, recent releases have been addressing these issues. For example, as of 5.004, duplicate hash keys are shared amongst all hashes using them, so require no reallocation. In some cases, using substr() or vec() to simulate arrays can be highly beneficial. For example, an array of a thousand booleans will take at least 20,000 bytes of space, but it can be turned into one 125-byte bit vector--a considerable memory savings. The standard Tie::SubstrHash module can also help for certain types of data structure. If you're working with specialist data structures (matrices, for instance) modules that implement these in C may use less memory than equivalent Perl modules. Another thing to try is learning whether your Perl was compiled with the system malloc or with Perl's builtin malloc. Whichever one it is, try using the other one and see whether this makes a difference. Information about malloc is in the INSTALL file in the source distribution. You can find out whether you are using perl's malloc by typing perl -V:usemymalloc. Is it unsafe to return a pointer to local data? No, Perl's garbage collection system takes care of this. sub makeone { my @a = ( 1 .. 10 ); return \@a; } for $i ( 1 .. 10 ) { push @many, makeone(); } print $many[4][5], "\n"; print "@many\n"; How can I free an array or hash so my program shrinks? You can't. On most operating systems, memory allocated to a program can never be returned to the system. That's why long-running programs sometimes re-exec themselves. Some operating systems (notably, FreeBSD and Linux) allegedly reclaim large chunks of memory that is no longer used, but it doesn't appear to happen with Perl (yet). The Mac appears to be the only platform that will reliably (albeit, slowly) return memory to the OS. We've had reports that on Linux (Redhat 5.1) on Intel, undef $scalar will return memory to the system, while on Solaris 2.6 it won't. In general, try it yourself and see. However, judicious use of my() on your variables will help make sure that they go out of scope so that Perl can free up that space for use in other parts of your program. A global variable, of course, never goes out of scope, so you can't get its space automatically reclaimed, although undef()ing and/or delete()ing it will achieve the same effect. In general, memory allocation and de-allocation isn't something you can or should be worrying about much in Perl, but even this capability (preallocation of data types) is in the works. How can I make my CGI script more efficient? Beyond the normal measures described to make general Perl programs faster or smaller, a CGI program has additional issues. It may be run several times per second. Given that each time it runs it will need to be re-compiled and will often allocate a megabyte or more of system memory, this can be a killer. Compiling into C isn't going to help you because the process start-up overhead is where the bottleneck is. There are two popular ways to avoid this overhead. One solution involves running the Apache HTTP server (available from http://www.apache.org/) with either of the mod_perl or mod_fastcgi plugin modules. With mod_perl and the Apache::Registry module (distributed with mod_perl), httpd will run with an embedded Perl interpreter which pre-compiles your script and then executes it within the same address space without forking. The Apache extension also gives Perl access to the internal server API, so modules written in Perl can do just about anything a module written in C can. For more on mod_perl, see http://perl.apache.org/ With the FCGI module (from CPAN) and the mod_fastcgi module (available from http://www.fastcgi.com/) each of your Perl programs becomes a permanent CGI daemon process. Both of these solutions can have far-reaching effects on your system and on the way you write your CGI programs, so investigate them with care. See http://www.perl.com/CPAN/modules/by-category/15_World_Wide_Web_HTML_HTTP_CGI/ . A non-free, commercial product, ``The Velocity Engine for Perl'', (http://www.binevolve.com/ or http://www.binevolve.com/velocigen/ ) might also be worth looking at. It will allow you to increase the performance of your Perl programs, running programs up to 25 times faster than normal CGI Perl when running in persistent Perl mode or 4 to 5 times faster without any modification to your existing CGI programs. Fully functional evaluation copies are available from the web site. How can I hide the source for my Perl program? Delete it. :-) Seriously, there are a number of (mostly unsatisfactory) solutions with varying levels of ``security''. First of all, however, you can't take away read permission, because the source code has to be readable in order to be compiled and interpreted. (That doesn't mean that a CGI script's source is readable by people on the web, though--only by people with access to the filesystem.) So you have to leave the permissions at the socially friendly 0755 level. Some people regard this as a security problem. If your program does insecure things and relies on people not knowing how to exploit those insecurities, it is not secure. It is often possible for someone to determine the insecure things and exploit them without viewing the source. Security through obscurity, the name for hiding your bugs instead of fixing them, is little security indeed. You can try using encryption via source filters (Filter::* from CPAN), but any decent programmer will be able to decrypt it. You can try using the byte code compiler and interpreter described below, but the curious might still be able to de-compile it. You can try using the native-code compiler described below, but crackers might be able to disassemble it. These pose varying degrees of difficulty to people wanting to get at your code, but none can definitively conceal it (true of every language, not just Perl). If you're concerned about people profiting from your code, then the bottom line is that nothing but a restrictive license will give you legal security. License your software and pepper it with threatening statements like ``This is unpublished proprietary software of XYZ Corp. Your access to it does not give you permission to use it blah blah blah.'' We are not lawyers, of course, so you should see a lawyer if you want to be sure your license's wording will stand up in court. How can I compile my Perl program into byte code or C? Malcolm Beattie has written a multifunction backend compiler, available from CPAN, that can do both these things. It is included in the perl5.005 release, but is still considered experimental. This means it's fun to play with if you're a programmer but not really for people looking for turn-key solutions. Merely compiling into C does not in and of itself guarantee that your code will run very much faster. That's because except for lucky cases where a lot of native type inferencing is possible, the normal Perl run-time system is still present and so your program will take just as long to run and be just as big. Most programs save little more than compilation time, leaving execution no more than 10-30% faster. A few rare programs actually benefit significantly (even running several times faster), but this takes some tweaking of your code. You'll probably be astonished to learn that the current version of the compiler generates a compiled form of your script whose executable is just as big as the original perl executable, and then some. That's because as currently written, all programs are prepared for a full eval() statement. You can tremendously reduce this cost by building a shared libperl.so library and linking against that. See the INSTALL podfile in the Perl source distribution for details. If you link your main perl binary with this, it will make it minuscule. For example, on one author's system, /usr/bin/perl is only 11k in size! In general, the compiler will do nothing to make a Perl program smaller, faster, more portable, or more secure. In fact, it can make your situation worse. The executable will be bigger, your VM system may take longer to load the whole thing, the binary is fragile and hard to fix, and compilation never stopped software piracy in the form of crackers, viruses, or bootleggers. The real advantage of the compiler is merely packaging, and once you see the size of what it makes (well, unless you use a shared libperl.so), you'll probably want a complete Perl install anyway. How can I compile Perl into Java? You can also integrate Java and Perl with the Perl Resource Kit from O'Reilly and Associates. See http://www.oreilly.com/catalog/prkunix/ . Perl 5.6 comes with Java Perl Lingo, or JPL. JPL, still in development, allows Perl code to be called from Java. See jpl/README in the Perl source tree. How can I get #!perl to work on [MS-DOS,NT,...]? For OS/2 just use extproc perl -S -your_switches as the first line in *.cmd file (-S due to a bug in cmd.exe's `extproc' handling). For DOS one should first invent a corresponding batch file and codify it in ALTERNATIVE_SHEBANG (see the INSTALL file in the source distribution for more information). The Win95/NT installation, when using the ActiveState port of Perl, will modify the Registry to associate the .pl extension with the perl interpreter. If you install another port, perhaps even building your own Win95/NT Perl from the standard sources by using a Windows port of gcc (e.g., with cygwin or mingw32), then you'll have to modify the Registry yourself. In addition to associating .pl with the interpreter, NT people can use: SET PATHEXT=%PATHEXT%;.PL to let them run the program install-linux.pl merely by typing install-linux. Macintosh Perl programs will have the appropriate Creator and Type, so that double-clicking them will invoke the Perl application. IMPORTANT!: Whatever you do, PLEASE don't get frustrated, and just throw the perl interpreter into your cgi-bin directory, in order to get your programs working for a web server. This is an EXTREMELY big security risk. Take the time to figure out how to do it correctly. Can I write useful Perl programs on the command line? Yes. Read perlrun for more information. Some examples follow. (These assume standard Unix shell quoting rules.) # sum first and last fields perl -lane 'print $F[0] + $F[-1]' * # identify text files perl -le 'for(@ARGV) {print if -f && -T _}' * # remove (most) comments from C program perl -0777 -pe 's{/\*.*?\*/}{}gs' foo.c # make file a month younger than today, defeating reaper daemons perl -e '$X=24*60*60; utime(time(),time() + 30 * $X,@ARGV)' * # find first unused uid perl -le '$i++ while getpwuid($i); print $i' # display reasonable manpath echo $PATH | perl -nl -072 -e ' s![^/+]*$!man!&&-d&&!$s{$_}++&&push@m,$_;END{print"@m"}' OK, the last one was actually an Obfuscated Perl Contest entry. :-) Why don't Perl one-liners work on my DOS/Mac/VMS system? The problem is usually that the command interpreters on those systems have rather different ideas about quoting than the Unix shells under which the one-liners were created. On some systems, you may have to change single-quotes to double ones, which you must NOT do on Unix or Plan9 systems. You might also have to change a single % to a %%. For example: # Unix perl -e 'print "Hello world\n"' # DOS, etc. perl -e "print \"Hello world\n\"" # Mac print "Hello world\n" (then Run "Myscript" or Shift-Command-R) # VMS perl -e "print ""Hello world\n""" The problem is that none of these examples are reliable: they depend on the command interpreter. Under Unix, the first two often work. Under DOS, it's entirely possible that neither works. If 4DOS was the command shell, you'd probably have better luck like this: perl -e "print "Hello world\n"" Under the Mac, it depends which environment you are using. The MacPerl shell, or MPW, is much like Unix shells in its support for several quoting variants, except that it makes free use of the Mac's non-ASCII characters as control characters. Using qq(), q(), and qx(), instead of "double quotes", 'single quotes', and `backticks`, may make one-liners easier to write. There is no general solution to all of this. It is a mess, pure and simple. Sucks to be away from Unix, huh? :-) [Some of this answer was contributed by Kenneth Albanowski.] Where can I learn about CGI or Web programming in Perl? For modules, get the CGI or LWP modules from CPAN. For textbooks, see the two especially dedicated to web stuff in the question on books. For problems and questions related to the web, like ``Why do I get 500 Errors'' or ``Why doesn't it run from the browser right when it runs fine on the command line'', see these sources: WWW Security FAQ http://www.w3.org/Security/Faq/ Web FAQ http://www.boutell.com/faq/ CGI FAQ http://www.webthing.com/tutorials/cgifaq.html HTTP Spec http://www.w3.org/pub/WWW/Protocols/HTTP/ HTML Spec http://www.w3.org/TR/REC-html40/ http://www.w3.org/pub/WWW/MarkUp/ CGI Spec http://www.w3.org/CGI/ CGI Security FAQ http://www.go2net.com/people/paulp/cgi-security/safe-cgi.txt Where can I learn about object-oriented Perl programming? A good place to start is perltoot, and you can use perlobj, perlboot, and perlbot for reference. Perltoot didn't come out until the 5.004 release; you can get a copy (in pod, html, or postscript) from http://www.perl.com/CPAN/doc/FMTEYEWTK/ . Where can I learn about linking C with Perl? [h2xs, xsubpp] If you want to call C from Perl, start with perlxstut, moving on to perlxs, xsubpp, and perlguts. If you want to call Perl from C, then read perlembed, perlcall, and perlguts. Don't forget that you can learn a lot from looking at how the authors of existing extension modules wrote their code and solved their problems. I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong? Download the ExtUtils::Embed kit from CPAN and run `make test'. If the tests pass, read the pods again and again and again. If they fail, see perlbug and send a bug report with the output of make test TEST_VERBOSE=1 along with perl -V. When I tried to run my script, I got this message. What does it mean? A complete list of Perl's error messages and warnings with explanatory text can be found in perldiag. You can also use the splain program (distributed with Perl) to explain the error messages: perl program 2>diag.out splain [-v] [-p] diag.out or change your program to explain the messages for you: use diagnostics; or use diagnostics -verbose; What's MakeMaker? This module (part of the standard Perl distribution) is designed to write a Makefile for an extension module from a Makefile.PL. For more information, see ExtUtils::MakeMaker. AUTHOR AND COPYRIGHT Copyright (c) 1997-1999 Tom Christiansen and Nathan Torkington. All rights reserved. When included as an integrated part of the Standard Distribution of Perl or of its documentation (printed or otherwise), this works is covered under Perl's Artistic License. For separate distributions of all or part of this FAQ outside of that, see perlfaq. Irrespective of its distribution, all code examples here are in the public domain. You are permitted and encouraged to use this code and any derivatives thereof in your own programs for fun or for profit as you see fit. A simple comment in the code giving credit to the FAQ would be courteous but is not required.Pod-Simple-3.43/t/search26.t0000644000175000017500000000423514062242376013637 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Pod::Simple::Search; use Test; BEGIN { plan tests => 5 } # # "kleene" rhymes with "zany". It's a fact! # print "# ", __FILE__, ": Testing limit_glob ...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; $x->inc(0); $x->shadows(1); use File::Spec; use Cwd; my $cwd = cwd(); print "# CWD: $cwd\n"; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { return "../lib/Pod/Simple/t/$file"; } else { return $file; } } my($here1, $here2, $here3); if( -e ($here1 = source_path( 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = source_path ( 'testlib2')); die "But where's $here3?" unless -e ($here3 = source_path( 'testlib3')); } elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = File::Spec->catdir($cwd, 't', 'testlib2')); die "But where's $here3?" unless -e ($here3 = File::Spec->catdir($cwd, 't', 'testlib3')); } else { die "Can't find the test corpora"; } print "# OK, found the test corpora\n# as $here1\n# and $here2\n# and $here3\n#\n"; ok 1; print $x->_state_as_string; #$x->verbose(12); use Pod::Simple; *pretty = \&Pod::Simple::BlackBox::pretty; my $glob = '*k'; print "# Limiting to $glob\n"; $x->limit_glob($glob); my($name2where, $where2name) = $x->survey($here1, $here2, $here3); my $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; my $ascii_order; if( -e ($ascii_order = source_path('ascii_order.pl'))) { # } elsif(-e ($ascii_order = File::Spec->catfile($cwd, 't', 'ascii_order.pl'))) { # } else { die "Can't find ascii_order.pl"; } require $ascii_order; { my $names = join "|", sort ascii_order keys %$name2where; ok $names, "Zonk::Pronk|hinkhonk::Glunk|perlzuk|squaa::Glunk|zikzik"; } { my $names = join "|", sort ascii_order values %$where2name; ok $names, "Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Glunk|perlzuk|squaa::Glunk|zikzik"; } print "# OK, bye from ", __FILE__, "\n"; ok 1; __END__ Pod-Simple-3.43/t/corpus/0000755000175000017500000000000014066435222013342 5ustar khwkhwPod-Simple-3.43/t/corpus/2202jpy.xml0000644000175000017500000001141514062242375015177 0ustar khwkhw NAME haiku-iso2022jp -- a test Japanese document in iso-2022-jp DESCRIPTION iso-2022-jp This is a test Pod document in ISO-2202-JP. Its content is some Japanese haiku by famous poets. MATSUO BASHO (松尾芭蕉 1644 - 1694) : 古池や蛙とび込む水の音 (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: 古池や蛙とび込む水の音 YOSA BUSON (与謝蕪村1716 - 1783) 方八里雨雲よせぬ牡丹かな (ho hachiri / amagumo yosenu / botan kana) As verbatim: 方八里雨雲よせぬ牡丹かな MASAOKA SHIKI (正岡子規 1867 - 1902) いちはつの一輪白し春の暮 (ichihatsu no / ichirin shiroshi / haruno kure) As verbatim: いちはつの一輪白し春の暮 余命いくばくかある夜短し (yomei / ikubakuka aru / yo mijikashi) 余命いくばくかある夜短し AS A LIST MATSUO BASHO (松尾芭蕉 1644 - 1694) : 古池や蛙とび込む水の音 (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: 古池や蛙とび込む水の音 YOSA BUSON (与謝蕪村1716 - 1783) 方八里雨雲よせぬ牡丹かな (ho hachiri / amagumo yosenu / botan kana) As verbatim: 方八里雨雲よせぬ牡丹かな MASAOKA SHIKI (正岡子規 1867 - 1902) いちはつの一輪白し春の暮 (ichihatsu no / ichirin shiroshi / haruno kure) As verbatim: いちはつの一輪白し春の暮 余命いくばくかある夜短し (yomei / ikubakuka aru / yo mijikashi) 余命いくばくかある夜短し "end" Pod-Simple-3.43/t/corpus/laozi38p.xml0000644000175000017500000000671414062242375015546 0ustar khwkhw big5 NAME 老子道德經 三十八章 -- Big5 (Chinese) encoding test DESCRIPTION This is a test Pod document in the Big5 encoding. Its content is the 38th canto from the Dao De Jing . 老子道德經 三十八章 上德不德,是以有德﹔ 下德不失德,是以無德。 上德無為而無以為﹔ 下德無為而有以為。 上仁為之而無以為﹔ 上義為之而有以為。 上禮為之而莫之應,則攘臂而扔之。 故失道而后德,失德而后仁,失仁而后義,失義而后禮。夫禮者,忠信之薄,而亂之首。 前識者,道之華,而愚之始。 是以大丈夫居其厚,不居其薄﹔居其實,不居其華。 故去彼取此。 And as a verbatim section: 上德不德,是以有德﹔ 下德不失德,是以無德。 上德無為而無以為﹔ 下德無為而有以為。 上仁為之而無以為﹔ 上義為之而有以為。 上禮為之而莫之應,則攘臂而扔之。 故失道而后德,失德而后仁,失仁而后義,失義而后禮。夫禮者,忠信之薄,而亂之首。 前識者,道之華,而愚之始。 是以大丈夫居其厚,不居其薄﹔居其實,不居其華。 故去彼取此。 [end] Pod-Simple-3.43/t/corpus/pasternak_cp1251.txt0000644000175000017500000000326414062242375017074 0ustar khwkhw =encoding cp1251 =head1 NAME -- Pasternak Russian test file (cp1251) =head1 TEXT (This is a test Pod pocument in cp1251.) . , / . / , / . / , / / . / . / , / . / , / , , / . / , / / . / . / , / . , / / , , / . / , / / , / . -- , 1946 =head2 As Preformatted And now as a preformatted section: . , . , . , . . , . , , , . , . . , . , , , . , , . -- , 1946 [end] =cut Pod-Simple-3.43/t/corpus/lat1fr.txt0000644000175000017500000000244414062242375015301 0ustar khwkhw =encoding iso-8859-1 =head1 NAME French-Latin-1 -- explicitly Latin-1 test document in French =head1 DESCRIPTION This is a test Pod document in Latin-1. Its content is the last two paragraphs of Baudelaire's I. A travers ces barreaux symboliques sparant deux mondes, la grande route et le chteau, l'enfant pauvre montrait l'enfant riche son propre joujou, que celui-ci examinait avidement comme un objet rare et inconnu. Or, ce joujou, que le petit souillon agaait, agitait et secouait dans une bote grille, c'tait un rat vivantE<160>! Les parents, par conomie sans doute, avaient tir le joujou de la vie elle-mme. Et les deux enfants se riaient l'un l'autre fraternellement, avec des dents d'une I blancheur. =head2 As Verbatim A travers ces barreaux symboliques sparant deux mondes, la grande route et le chteau, l'enfant pauvre montrait l'enfant riche son propre joujou, que celui-ci examinait avidement comme un objet rare et inconnu. Or, ce joujou, que le petit souillon agaait, agitait et secouait dans une bote grille, c'tait un rat vivant! Les parents, par conomie sans doute, avaient tir le joujou de la vie elle-mme. Et les deux enfants se riaient l'un l'autre fraternellement, avec des dents d'une gale blancheur. [end] =cut Pod-Simple-3.43/t/corpus/s2763_sjis.xml0000644000175000017500000000354414062242376015710 0ustar khwkhw shiftjis NAME 型番S2763 -- test document in Shift-JIS DESCRIPTION This is a test Pod document in Shift-JIS. Its content is some uninteresting product specs I found on the Net. It's an textitem list: 型番 S2763 光源 GZ4 ダイクロイックミラーランプ 12V 10W×1 寸法 高・295 幅・365 奥・76mm 質量 8.0kg 材質 樹脂 アルミ、アルマイト仕上 ガラス 価格 76,000円(ランプ・トランス込み) 2001年10月3日(水)発売開始 [end] Pod-Simple-3.43/t/corpus/koi8r.xml0000644000175000017500000001431714062242375015127 0ustar khwkhw koi8-r NAME Когда читала ты мучительные строки -- Fet's "When you were reading" TEXT (This is a test Pod pocument in KOI8-R.) Когда читала ты мучительные строки, / Где сердца звучный пыл сиянье льет кругом / И страсти роковой вздымаются потоки,- / Не вспомнила ль о чем? Я верить не хочу! Когда в степи, как диво, / В полночной темноте безвременно горя, / Вдали перед тобой прозрачно и красиво / Вставала вдругзаря. И в эту красоту невольно взор тянуло, / В тот величавый блеск за темный весь предел,- / Ужель ничто тебе в то время не шепнуло: / Там человек сгорел! 15 февраля 1887 And now, as a verbatim section: Когда читала ты мучительные строки, Где сердца звучный пыл сиянье льет кругом И страсти роковой вздымаются потоки,- Не вспомнила ль о чем? Я верить не хочу! Когда в степи, как диво, В полночной темноте безвременно горя, Вдали перед тобой прозрачно и красиво Вставала вдругзаря. И в эту красоту невольно взор тянуло, В тот величавый блеск за темный весь предел,- Ужель ничто тебе в то время не шепнуло: Там человек сгорел! 15 февраля 1887 [end] Pod-Simple-3.43/t/corpus/fet_dup.xml0000644000175000017500000001452214062242375015517 0ustar khwkhw koi8-r NAME Когда читала ты мучительные строки -- Fet's "When you were reading" TEXT (This is a test Pod pocument in KOI8-R.) Когда читала ты мучительные строки, / Где сердца звучный пыл сиянье льет кругом / И страсти роковой вздымаются потоки,- / Не вспомнила ль о чем? Я верить не хочу! Когда в степи, как диво, / В полночной темноте безвременно горя, / Вдали перед тобой прозрачно и красиво / Вставала вдругзаря. И в эту красоту невольно взор тянуло, / В тот величавый блеск за темный весь предел,- / Ужель ничто тебе в то время не шепнуло: / Там человек сгорел! 15 февраля 1887 And now, as a verbatim section: Когда читала ты мучительные строки, Где сердца звучный пыл сиянье льет кругом И страсти роковой вздымаются потоки,- Не вспомнила ль о чем? Я верить не хочу! Когда в степи, как диво, В полночной темноте безвременно горя, Вдали перед тобой прозрачно и красиво Вставала вдругзаря. koi8-r И в эту красоту невольно взор тянуло, В тот величавый блеск за темный весь предел,- Ужель ничто тебе в то время не шепнуло: Там человек сгорел! 15 февраля 1887 [end] Pod-Simple-3.43/t/corpus/iso6.xml0000644000175000017500000001202714062242375014747 0ustar khwkhw NAME buniya-iso-6 -- test document: a paragraph in Arabic as ISO-8859-6 DESCRIPTION This document is a paragraph in Arabic from "The Five Pillars of Islam" as ISO-8859-6. iso-8859-6 وعن عمارة بن حزم قال قال رسول الله صلى الله عليه وسلم: اربع فرضهن الله عز وجل في الاسلام فمن جاء بثلاث لم يغنين عنه شيئا حتى يأتي بهن جميعا الصلاة والزكاة وصيام رمضان وحج البيت. رواه احمد والطبراني في الكبير وفي اسناده ابن لهيعة. And now as a real single paragraph: وعن عمارة بن حزم قال قال رسول الله صلى الله عليه وسلم: اربع فرضهن الله عز وجل في الاسلام فمن جاء بثلاث لم يغنين عنه شيئا حتى يأتي بهن جميعا الصلاة والزكاة وصيام رمضان وحج البيت. رواه احمد والطبراني في الكبير وفي اسناده ابن لهيعة. And now as a verbatim paragraph: وعن عمارة بن حزم قال قال رسول الله صلى الله عليه وسلم: اربع فرضهن الله عز وجل في الاسلام فمن جاء بثلاث لم يغنين عنه شيئا حتى يأتي بهن جميعا الصلاة والزكاة وصيام رمضان وحج البيت. رواه احمد والطبراني في الكبير وفي اسناده ابن لهيعة. [end] Pod-Simple-3.43/t/corpus/laozi38.txt0000644000175000017500000000142114062242375015373 0ustar khwkhw=encoding big5 =head1 ѤlDwg@TQK -- Big5 (Chinese) encoding test WwwAOHwQ UwwAOHLwC WwLӵLHQ UwLӦHC WӵLHQ WqӦHC W§ӲAhcuӥC GDӦZwAwӦZAӦZqAqӦZ§C§̡AHAӶäC eѪ̡ADءAӷMlC OHjVҩ~pA~Q~A~ءC GhC And as a verbatim section: WwwAOHwQ UwwAOHLwC WwLӵLHQ UwLӦHC WӵLHQ WqӦHC W§ӲAhcuӥC GDӦZwAwӦZAӦZqAqӦZ§C§̡AHAӶäC eѪ̡ADءAӷMlC OHjVҩ~pA~Q~A~ءC GhC [end] =cut Pod-Simple-3.43/t/corpus/polish_utf8.txt0000644000175000017500000000402414062242375016350 0ustar khwkhw =encoding utf8 =head1 NAME WŚRÓD NOCNEJ CISZY -- explicitly utf8 test document in Polish =head1 DESCRIPTION This is a test Pod document in UTF8. Its content is the lyrics to the Polish Christmas carol "Wśród nocnej ciszy", except it includes a few lines to test RTF specially. ff is a character in the upper half of Plane 0, so should be negative in RTF 𝔸 is a character in Plane 1, so should be expressed as a surrogate pair in RTF All the ASCII printables !"#$%&\'()*+,-./0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_` abcdefghijklmnopqrstuvwxyz{|}~ Wśród nocnej ciszy głos się rozchodzi: / Wstańcie, pasterze, Bóg się nam rodzi! / Czym prędzej się wybierajcie, / Do Betlejem pospieszajcie / Przywitać Pana. Poszli, znaleźli Dzieciątko w żłobie / Z wszystkimi znaki danymi sobie. / Jako Bogu cześć Mu dali, / A witając zawołali / Z wielkiej radości: Ach, witaj Zbawco z dawno żądany, / Wiele tysięcy lat wyglądany / Na Ciebie króle, prorocy / Czekali, a Tyś tej nocy / Nam się objawił. I my czekamy na Ciebie, Pana, / A skoro przyjdziesz na głos kapłana, / Padniemy na twarz przed Tobą, / Wierząc, żeś jest pod osłoną / Chleba i wina. =head2 As Verbatim And now as verbatim text: ff upper half, Plane 0 𝔸 Plane 1 All the ASCII printables !"#$%&\'()*+,-./0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_` abcdefghijklmnopqrstuvwxyz{|}~ Wśród nocnej ciszy głos się rozchodzi: Wstańcie, pasterze, Bóg się nam rodzi! Czym prędzej się wybierajcie, Do Betlejem pospieszajcie Przywitać Pana. Poszli, znaleźli Dzieciątko w żłobie Z wszystkimi znaki danymi sobie. Jako Bogu cześć Mu dali, A witając zawołali Z wielkiej radości: Ach, witaj Zbawco z dawno żądany, Wiele tysięcy lat wyglądany Na Ciebie króle, prorocy Czekali, a Tyś tej nocy Nam się objawił. I my czekamy na Ciebie, Pana, A skoro przyjdziesz na głos kapłana, Padniemy na twarz przed Tobą, Wierząc, żeś jest pod osłoną Chleba i wina. [end] =cut Pod-Simple-3.43/t/corpus/plain_utf8.txt0000644000175000017500000000073314062242375016160 0ustar khwkhw #Doesn't actually use any of the utf8 bytes. =encoding utf8 =head1 NAME simple_text_document -- an explicitly UTF8 (ASCII subset) test document =head1 TEXT The quick brown fox jumps over the lazy dog. Military Intelligence Yukon rhosts penrep Weekly World News DSD Time Cohiba finks rail gun DF ~ Corporate Security NATOA CCS DEVGRP CONUS Khaddafi NATIA data havens Spetznaz afsatcom BOP Semtex garbage KGB ^? 737 1080H 1080H Satellite imagery smuggle [end] =cut Pod-Simple-3.43/t/corpus/lat1frim.txt0000644000175000017500000000241614062242375015626 0ustar khwkhw =head1 NAME French-Latin-1 -- implicitly Latin-1 test document in French =head1 DESCRIPTION This is a test Pod document in Latin-1. Its content is the last two paragraphs of Baudelaire's I. A travers ces barreaux symboliques sparant deux mondes, la grande route et le chteau, l'enfant pauvre montrait l'enfant riche son propre joujou, que celui-ci examinait avidement comme un objet rare et inconnu. Or, ce joujou, que le petit souillon agaait, agitait et secouait dans une bote grille, c'tait un rat vivantE<160>! Les parents, par conomie sans doute, avaient tir le joujou de la vie elle-mme. Et les deux enfants se riaient l'un l'autre fraternellement, avec des dents d'une I blancheur. =head2 As Verbatim A travers ces barreaux symboliques sparant deux mondes, la grande route et le chteau, l'enfant pauvre montrait l'enfant riche son propre joujou, que celui-ci examinait avidement comme un objet rare et inconnu. Or, ce joujou, que le petit souillon agaait, agitait et secouait dans une bote grille, c'tait un rat vivant! Les parents, par conomie sans doute, avaient tir le joujou de la vie elle-mme. Et les deux enfants se riaient l'un l'autre fraternellement, avec des dents d'une gale blancheur. [end] =cut Pod-Simple-3.43/t/corpus/polish_utf8.xml0000644000175000017500000000623714062242375016341 0ustar khwkhw utf8 NAME WŚRÓD NOCNEJ CISZY -- explicitly utf8 test document in Polish DESCRIPTION This is a test Pod document in UTF8. Its content is the lyrics to the Polish Christmas carol "Wśród nocnej ciszy", except it includes a few lines to test RTF specially. ff is a character in the upper half of Plane 0, so should be negative in RTF 𝔸 is a character in Plane 1, so should be expressed as a surrogate pair in RTF All the ASCII printables !"#$%&\'()*+,-./0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_` abcdefghijklmnopqrstuvwxyz{|}~ Wśród nocnej ciszy głos się rozchodzi: / Wstańcie, pasterze, Bóg się nam rodzi! / Czym prędzej się wybierajcie, / Do Betlejem pospieszajcie / Przywitać Pana. Poszli, znaleźli Dzieciątko w żłobie / Z wszystkimi znaki danymi sobie. / Jako Bogu cześć Mu dali, / A witając zawołali / Z wielkiej radości: Ach, witaj Zbawco z dawno żądany, / Wiele tysięcy lat wyglądany / Na Ciebie króle, prorocy / Czekali, a Tyś tej nocy / Nam się objawił. I my czekamy na Ciebie, Pana, / A skoro przyjdziesz na głos kapłana, / Padniemy na twarz przed Tobą, / Wierząc, żeś jest pod osłoną / Chleba i wina. As Verbatim And now as verbatim text: ff upper half, Plane 0 𝔸 Plane 1 All the ASCII printables !"#$%&\'()*+,-./0123456789:;<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_` abcdefghijklmnopqrstuvwxyz{|}~ Wśród nocnej ciszy głos się rozchodzi: Wstańcie, pasterze, Bóg się nam rodzi! Czym prędzej się wybierajcie, Do Betlejem pospieszajcie Przywitać Pana. Poszli, znaleźli Dzieciątko w żłobie Z wszystkimi znaki danymi sobie. Jako Bogu cześć Mu dali, A witając zawołali Z wielkiej radości: Ach, witaj Zbawco z dawno żądany, Wiele tysięcy lat wyglądany Na Ciebie króle, prorocy Czekali, a Tyś tej nocy Nam się objawił. I my czekamy na Ciebie, Pana, A skoro przyjdziesz na głos kapłana, Padniemy na twarz przed Tobą, Wierząc, żeś jest pod osłoną Chleba i wina. [end] Pod-Simple-3.43/t/corpus/encwarn03.txt0000644000175000017500000000033714062242375015707 0ustar khwkhwpackage MyPackage; use strict; # Comment here contains āccénted characters but should not generate any # parse warning since they do not occur in a POD section sub main { print "This file contains no POD\n"; } 1; Pod-Simple-3.43/t/corpus/nonesuch.txt0000644000175000017500000000013414062242375015724 0ustar khwkhw=encoding blorpy =head1 nonesuch -- Document in an unknown encoding Blorp. [end] =cut Pod-Simple-3.43/t/corpus/laozi38b.txt0000644000175000017500000000142614062242375015542 0ustar khwkhw=encoding big5-eten =head1 ѤlDwg@TQK -- Big5 (Chinese) encoding test WwwAOHwQ UwwAOHLwC WwLӵLHQ UwLӦHC WӵLHQ WqӦHC W§ӲAhcuӥC GDӦZwAwӦZAӦZqAqӦZ§C§̡AHAӶäC eѪ̡ADءAӷMlC OHjVҩ~pA~Q~A~ءC GhC And as a verbatim section: WwwAOHwQ UwwAOHLwC WwLӵLHQ UwLӦHC WӵLHQ WqӦHC W§ӲAhcuӥC GDӦZwAwӦZAӦZqAqӦZ§C§̡AHAӶäC eѪ̡ADءAӷMlC OHjVҩ~pA~Q~A~ءC GhC [end] =cut Pod-Simple-3.43/t/corpus/encwarn04.xml0000644000175000017500000000140214062242375015663 0ustar khwkhw TŨTORIAL The encoding warning should only fire when the parser is 'in_pod' but that should also be true on the first line of POD (above). POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 13: Non-ASCII character seen before =encoding in 'TŨTORIAL'. Assuming UTF-8 Pod-Simple-3.43/t/corpus/encwarn02.xml0000644000175000017500000000164314062242375015670 0ustar khwkhw NAME Encoding Warning 1 - implicitly UTF-8 DESCRIPTION This line should warn that the price €9.99 contains a non-ASCII character. But château should not generate a warning - once is enough. POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 8: Non-ASCII character seen before =encoding in '€9.99'. Assuming UTF-8 Pod-Simple-3.43/t/corpus/plain_latin1.txt0000644000175000017500000000074714062242375016467 0ustar khwkhw #Doesn't actually use any of the Latin-1 bytes. =encoding iso-8859-1 =head1 NAME simple_text_document -- an explicitly Latin-1 (ASCII subset) test document =head1 TEXT The quick brown fox jumps over the lazy dog. Military Intelligence Yukon rhosts penrep Weekly World News DSD Time Cohiba finks rail gun DF ~ Corporate Security NATOA CCS DEVGRP CONUS Khaddafi NATIA data havens Spetznaz afsatcom BOP Semtex garbage KGB ^? 737 1080H 1080H Satellite imagery smuggle [end] =cut Pod-Simple-3.43/t/corpus/plain_latin1.xml0000644000175000017500000000137514062242375016446 0ustar khwkhw iso-8859-1 NAME simple_text_document -- an explicitly Latin-1 (ASCII subset) test document TEXT The quick brown fox jumps over the lazy dog. Military Intelligence Yukon rhosts penrep Weekly World News DSD Time Cohiba finks rail gun DF ~ Corporate Security NATOA CCS DEVGRP CONUS Khaddafi NATIA data havens Spetznaz afsatcom BOP Semtex garbage KGB ^? 737 1080H 1080H Satellite imagery smuggle [end] Pod-Simple-3.43/t/corpus/2202jpx.xml0000644000175000017500000001140514062242375015175 0ustar khwkhw NAME haiku-iso2022jp -- a test Japanese document in iso-2022-jp DESCRIPTION iso-2022-jp This is a test Pod document in ISO-2202-JP. Its content is some Japanese haiku by famous poets. MATSUO BASHO (松尾芭蕉 1644 - 1694) : 古池や蛙とび込む水の音 (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: 古池や蛙とび込む水の音 YOSA BUSON (与謝蕪村1716 - 1783) 方八里雨雲よせぬ牡丹かな (ho hachiri / amagumo yosenu / botan kana) As verbatim: 方八里雨雲よせぬ牡丹かな MASAOKA SHIKI (正岡子規 1867 - 1902) いちはつの一輪白し春の暮 (ichihatsu no / ichirin shiroshi / haruno kure) As verbatim: いちはつの一輪白し春の暮 余命いくばくかある夜短し (yomei / ikubakuka aru / yo mijikashi) 余命いくばくかある夜短し AS A LIST MATSUO BASHO (松尾芭蕉 1644 - 1694) : 古池や蛙とび込む水の音 (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: 古池や蛙とび込む水の音 YOSA BUSON (与謝蕪村1716 - 1783) 方八里雨雲よせぬ牡丹かな (ho hachiri / amagumo yosenu / botan kana) As verbatim: 方八里雨雲よせぬ牡丹かな MASAOKA SHIKI (正岡子規 1867 - 1902) いちはつの一輪白し春の暮 (ichihatsu no / ichirin shiroshi / haruno kure) As verbatim: いちはつの一輪白し春の暮 余命いくばくかある夜短し (yomei / ikubakuka aru / yo mijikashi) 余命いくばくかある夜短し .end. Pod-Simple-3.43/t/corpus/enc_char_directive.xml0000644000175000017500000000173714062242375017675 0ustar khwkhw NAME Implicit Encoding with Warning and encoding directive in UTF-8 DESCRIPTION This line should warn that the price €9.99 contains a non-ASCII character. utf8 And château should not generate a warning. POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 8: Non-ASCII character seen before =encoding in '€9.99'. Assuming UTF-8 Pod-Simple-3.43/t/corpus/plain_explicit.txt0000644000175000017500000000064414062242375017114 0ustar khwkhw =encoding ascii =head1 NAME simple_text_document -- an explicitly US-ASCII test document. =head1 TEXT The quick brown fox jumps over the lazy dog. Military Intelligence Yukon rhosts penrep Weekly World News DSD Time Cohiba finks rail gun DF ~ Corporate Security NATOA CCS DEVGRP CONUS Khaddafi NATIA data havens Spetznaz afsatcom BOP Semtex garbage KGB ^? 737 1080H 1080H Satellite imagery smuggle [end] =cut Pod-Simple-3.43/t/corpus/laozi38p.pod0000644000175000017500000000166514062242375015530 0ustar khwkhw =encoding big5 =head1 NAME ѤlDwg@TQK -- Big5 (Chinese) encoding test =head1 DESCRIPTION This is a test Pod document in the Big5 encoding. Its content is the 38th canto from the I. =head2 ѤlDwg@TQK WwwAOHwQ UwwAOHLwC WwLӵLHQ UwLӦHC WӵLHQ WqӦHC W§ӲAhcuӥC GDӦZwAwӦZAӦZqAqӦZ§C§̡AHAӶäC eѪ̡ADءAӷMlC OHjVҩ~pA~Q~A~ءC GhC And as a verbatim section: WwwAOHwQ UwwAOHLwC WwLӵLHQ UwLӦHC WӵLHQ WqӦHC W§ӲAhcuӥC GDӦZwAwӦZAӦZqAqӦZ§C§̡AHAӶäC eѪ̡ADءAӷMlC OHjVҩ~pA~Q~A~ءC GhC [end] =cut Pod-Simple-3.43/t/corpus/plain_explicit.xml0000644000175000017500000000135214062242375017072 0ustar khwkhw ascii NAME simple_text_document -- an explicitly US-ASCII test document. TEXT The quick brown fox jumps over the lazy dog. Military Intelligence Yukon rhosts penrep Weekly World News DSD Time Cohiba finks rail gun DF ~ Corporate Security NATOA CCS DEVGRP CONUS Khaddafi NATIA data havens Spetznaz afsatcom BOP Semtex garbage KGB ^? 737 1080H 1080H Satellite imagery smuggle [end] Pod-Simple-3.43/t/corpus/laozi38b.xml0000644000175000017500000000611514062242375015523 0ustar khwkhw big5-eten 老子道德經 三十八章 -- Big5 (Chinese) encoding test 上德不德,是以有德﹔ 下德不失德,是以無德。 上德無為而無以為﹔ 下德無為而有以為。 上仁為之而無以為﹔ 上義為之而有以為。 上禮為之而莫之應,則攘臂而扔之。 故失道而后德,失德而后仁,失仁而后義,失義而后禮。夫禮者,忠信之薄,而亂之首。 前識者,道之華,而愚之始。 是以大丈夫居其厚,不居其薄﹔居其實,不居其華。 故去彼取此。 And as a verbatim section: 上德不德,是以有德﹔ 下德不失德,是以無德。 上德無為而無以為﹔ 下德無為而有以為。 上仁為之而無以為﹔ 上義為之而有以為。 上禮為之而莫之應,則攘臂而扔之。 故失道而后德,失德而后仁,失仁而后義,失義而后禮。夫禮者,忠信之薄,而亂之首。 前識者,道之華,而愚之始。 是以大丈夫居其厚,不居其薄﹔居其實,不居其華。 故去彼取此。 [end] Pod-Simple-3.43/t/corpus/fet_dup.txt0000644000175000017500000000242114062242375015531 0ustar khwkhw We have deliberately redundant =encoding statements here. This should generate no errata. =encoding koi8-r =head1 NAME -- Fet's "When you were reading" =head1 TEXT (This is a test Pod pocument in KOI8-R.) , / / ,- / ? ! , , / , / / . , / ,- / : / ! 15 1887 And now, as a verbatim section: , ,- ? ! , , , . =encoding koi8-r , ,- : ! 15 1887 [end] =cut Pod-Simple-3.43/t/corpus/encwarn03.xml0000644000175000017500000000006714062242375015670 0ustar khwkhw Pod-Simple-3.43/t/corpus/lat1frim.xml0000644000175000017500000000471414062242375015612 0ustar khwkhw NAME French-Latin-1 -- implicitly Latin-1 test document in French DESCRIPTION This is a test Pod document in Latin-1. Its content is the last two paragraphs of Baudelaire's Le Joujou du pauvre . A travers ces barreaux symboliques séparant deux mondes, la grande route et le château, l'enfant pauvre montrait à l'enfant riche son propre joujou, que celui-ci examinait avidement comme un objet rare et inconnu. Or, ce joujou, que le petit souillon agaçait, agitait et secouait dans une boîte grillée, c'était un rat vivant ! Les parents, par économie sans doute, avaient tiré le joujou de la vie elle-même. Et les deux enfants se riaient l'un à l'autre fraternellement, avec des dents d'une égale blancheur. As Verbatim A travers ces barreaux symboliques séparant deux mondes, la grande route et le château, l'enfant pauvre montrait à l'enfant riche son propre joujou, que celui-ci examinait avidement comme un objet rare et inconnu. Or, ce joujou, que le petit souillon agaçait, agitait et secouait dans une boîte grillée, c'était un rat vivant ! Les parents, par économie sans doute, avaient tiré le joujou de la vie elle-même. Et les deux enfants se riaient l'un à l'autre fraternellement, avec des dents d'une égale blancheur. [end] POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 11: Non-ASCII character seen before =encoding in 'séparant'. Assuming CP1252 Pod-Simple-3.43/t/corpus/2202jpy.txt0000644000175000017500000000276614062242375015227 0ustar khwkhw =head1 NAME haiku-iso2022jp -- a test Japanese document in iso-2022-jp =head1 DESCRIPTION =encoding iso-2022-jp This is a test Pod document in ISO-2202-JP. Its content is some Japanese haiku by famous poets. =head2 MATSUO BASHO ($B>>HxGN>V(B 1644 - 1694) : $B8ECS$d3?$H$S9~$`?e$N2;(B (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: $B8ECS$d3?$H$S9~$`?e$N2;(B =head2 YOSA BUSON ($BM?L?$$$/$P$/$+$"$kLkC;$7(B (yomei / ikubakuka aru / yo mijikashi) $BM>L?$$$/$P$/$+$"$kLkC;$7(B =head1 AS A LIST =over =item MATSUO BASHO ($B>>HxGN>V(B 1644 - 1694) : $B8ECS$d3?$H$S9~$`?e$N2;(B (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: $B8ECS$d3?$H$S9~$`?e$N2;(B =item YOSA BUSON ($BM?L?$$$/$P$/$+$"$kLkC;$7(B (yomei / ikubakuka aru / yo mijikashi) $BM>L?$$$/$P$/$+$"$kLkC;$7(B =back "end" =cut Pod-Simple-3.43/t/corpus/enc_char_wrong_directive.txt0000644000175000017500000000040314062242375021115 0ustar khwkhw =head1 NAME Implicit Encoding with Warning in UTF8 and wrong encoding directive iso-8859-1 =head2 DESCRIPTION This line should warn that the price €9.99 contains a non-ASCII character. =encoding iso-8859-1 And château should not generate a warning. Pod-Simple-3.43/t/corpus/encwarn01.xml0000644000175000017500000000164114062242375015665 0ustar khwkhw NAME Encoding Warning 1 - implicitly Latin-1 DESCRIPTION This line should warn that the word café contains a non-ASCII character. But château should not generate a warning - once is enough. POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 8: Non-ASCII character seen before =encoding in 'café'. Assuming CP1252 Pod-Simple-3.43/t/corpus/plain_utf8.xml0000644000175000017500000000136414062242375016142 0ustar khwkhw utf8 NAME simple_text_document -- an explicitly UTF8 (ASCII subset) test document TEXT The quick brown fox jumps over the lazy dog. Military Intelligence Yukon rhosts penrep Weekly World News DSD Time Cohiba finks rail gun DF ~ Corporate Security NATOA CCS DEVGRP CONUS Khaddafi NATIA data havens Spetznaz afsatcom BOP Semtex garbage KGB ^? 737 1080H 1080H Satellite imagery smuggle [end] Pod-Simple-3.43/t/corpus/thai_iso11.txt0000644000175000017500000000260214062242376016046 0ustar khwkhw =head1 NAME Khun::Thong::Dang -- a test Thai document in ISO-8859-11 =head1 DESCRIPTION =encoding iso-8859-11 This is a test Pod document in ISO-8859-11. Its content is a poem to (by?) Khun Thong Dang (Ҿ), the pet of Bhumibol, the King of Thailand. As four flowed paragraphs: Ѻ伷 / з§...ͧҾԶ¶͹ / §༴§͹ / з͹Сس蹴ǧҹ ءҾ / ͡Ӥ / ҡ繤سͧᴧѡѡҹ / ҤºԾ ѵحçԡҾԡ / ɰǵʧ / з ʼͧͧʡ / ؤźҷҧ׺ҧ ԴͧҪѹѹ / 蹤褧ʧ / ôҪɮҡͧ / зѺǹء =head2 Verbatim Section And as a verbatim section: Ѻ伷 з§...ͧҾԶ¶͹ §༴§͹ з͹Сس蹴ǧҹ ءҾ ͡Ӥ ҡ繤سͧᴧѡѡҹ ҤºԾ ѵحçԡҾԡ ɰǵʧ з ʼͧͧʡ ؤźҷҧ׺ҧ ԴͧҪѹѹ 蹤褧ʧ ôҪɮҡͧ зѺǹء [end] =cut Pod-Simple-3.43/t/corpus/laozi38.xml0000644000175000017500000000611014062242375015354 0ustar khwkhw big5 老子道德經 三十八章 -- Big5 (Chinese) encoding test 上德不德,是以有德﹔ 下德不失德,是以無德。 上德無為而無以為﹔ 下德無為而有以為。 上仁為之而無以為﹔ 上義為之而有以為。 上禮為之而莫之應,則攘臂而扔之。 故失道而后德,失德而后仁,失仁而后義,失義而后禮。夫禮者,忠信之薄,而亂之首。 前識者,道之華,而愚之始。 是以大丈夫居其厚,不居其薄﹔居其實,不居其華。 故去彼取此。 And as a verbatim section: 上德不德,是以有德﹔ 下德不失德,是以無德。 上德無為而無以為﹔ 下德無為而有以為。 上仁為之而無以為﹔ 上義為之而有以為。 上禮為之而莫之應,則攘臂而扔之。 故失道而后德,失德而后仁,失仁而后義,失義而后禮。夫禮者,忠信之薄,而亂之首。 前識者,道之華,而愚之始。 是以大丈夫居其厚,不居其薄﹔居其實,不居其華。 故去彼取此。 [end] Pod-Simple-3.43/t/corpus/plain.xml0000644000175000017500000000126514062242375015174 0ustar khwkhw NAME simple_text_document -- an implicitly US-ASCII test document. TEXT The quick brown fox jumps over the lazy dog. Military Intelligence Yukon rhosts penrep Weekly World News DSD Time Cohiba finks rail gun DF ~ Corporate Security NATOA CCS DEVGRP CONUS Khaddafi NATIA data havens Spetznaz afsatcom BOP Semtex garbage KGB ^? 737 1080H 1080H Satellite imagery smuggle [end] Pod-Simple-3.43/t/corpus/2202jpz.xml0000644000175000017500000000056514062242375015204 0ustar khwkhw NAME haiku-iso2022jp -- a test Japanese document in iso-2022-jp DESCRIPTION iso-2022-jp This is a test Pod document in ISO-2202-JP. Pod-Simple-3.43/t/corpus/plain.txt0000644000175000017500000000062314062242375015210 0ustar khwkhw =head1 NAME simple_text_document -- an implicitly US-ASCII test document. =head1 TEXT The quick brown fox jumps over the lazy dog. Military Intelligence Yukon rhosts penrep Weekly World News DSD Time Cohiba finks rail gun DF ~ Corporate Security NATOA CCS DEVGRP CONUS Khaddafi NATIA data havens Spetznaz afsatcom BOP Semtex garbage KGB ^? 737 1080H 1080H Satellite imagery smuggle [end] =cut Pod-Simple-3.43/t/corpus/2202jp.txt0000644000175000017500000000276614062242375015036 0ustar khwkhw =head1 NAME haiku-iso2022jp -- a test Japanese document in iso-2022-jp =head1 DESCRIPTION =encoding iso-2022-jp This is a test Pod document in ISO-2202-JP. Its content is some Japanese haiku by famous poets. =head2 MATSUO BASHO ($B>>HxGN>V(B 1644 - 1694) : $B8ECS$d3?$H$S9~$`?e$N2;(B (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: $B8ECS$d3?$H$S9~$`?e$N2;(B =head2 YOSA BUSON ($BM?L?$$$/$P$/$+$"$kLkC;$7(B (yomei / ikubakuka aru / yo mijikashi) $BM>L?$$$/$P$/$+$"$kLkC;$7(B =head1 AS A LIST =over =item MATSUO BASHO ($B>>HxGN>V(B 1644 - 1694) : $B8ECS$d3?$H$S9~$`?e$N2;(B (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: $B8ECS$d3?$H$S9~$`?e$N2;(B =item YOSA BUSON ($BM?L?$$$/$P$/$+$"$kLkC;$7(B (yomei / ikubakuka aru / yo mijikashi) $BM>L?$$$/$P$/$+$"$kLkC;$7(B =back [end] =cut Pod-Simple-3.43/t/corpus/fet_cont.xml0000644000175000017500000000234314062242375015670 0ustar khwkhw koi8-r NAME Когда читала ты мучительные строки -- Fet's "When you were reading" TEXT Shift-JIS (This is a test Pod pocument in KOI8-R.) 15 февраля 1887 [end] POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 13: Couldn't do =encoding Shift-JIS: Encoding is already set to koi8-r Pod-Simple-3.43/t/corpus/fet_cont.txt0000644000175000017500000000045314062242375015707 0ustar khwkhw We have deliberately contradictory =encoding statements here. This should generate errata. =encoding koi8-r =head1 NAME -- Fet's "When you were reading" =head1 TEXT =encoding Shift-JIS (This is a test Pod pocument in KOI8-R.) 15 1887 [end] =cut Pod-Simple-3.43/t/corpus/s2763_sjis.txt0000644000175000017500000000100314062242375015712 0ustar khwkhw =encoding shiftjis =head1 NAME ^S2763 -- test document in Shift-JIS =head1 DESCRIPTION This is a test Pod document in Shift-JIS. Its content is some uninteresting product specs I found on the Net. It's an textitem list: =over =item ^ S2763 =item GZ4 _CNCbN~[v 12V 10W~1 =item @ E295 E365 E76mm =item 8.0kg =item ގ @A~AA}Cgd@KX =item i 76,000~ivEgX݁j =back 2001N103ijJn [end] =cut Pod-Simple-3.43/t/corpus/enc_char_directive.txt0000644000175000017500000000035514062242375017707 0ustar khwkhw =head1 NAME Implicit Encoding with Warning and encoding directive in UTF-8 =head2 DESCRIPTION This line should warn that the price €9.99 contains a non-ASCII character. =encoding utf8 And château should not generate a warning. Pod-Simple-3.43/t/corpus/thai_iso11.xml0000644000175000017500000001702114062242376016030 0ustar khwkhw NAME Khun::Thong::Dang -- a test Thai document in ISO-8859-11 DESCRIPTION iso-8859-11 This is a test Pod document in ISO-8859-11. Its content is a poem to (by?) Khun Thong Dang (ภาพมิ่งมงคล), the pet of Bhumibol, the King of Thailand. As four flowed paragraphs: ๏ พระเมตตาแจ่มจับใจไผทสยาม / พระทัยงาม...มองภาพถ่ายมิถ่ายถอน / เกล้าฯ น้อมเกล้าฯ พจน์เรียงเผดียงกลอน / สื่อสะท้อนพระการุณย์อุ่นดวงมาน๚ ๏ ทุกภาพมิ่งมงคลยลแล้วยิ้ม / เอื้ออกอิ่มล้ำค่ามหาศาล / อยากเป็นคุณทองแดงนักจักอยู่งาน / เฝ้าคลอเคลียบทมาลย์พระภูมิพล๚ ๏ พระหัตถ์บุญทรงเบิกหล้าพลิกหล้าเขียว / พระโอษฐ์เรียวตรัสห้ามสงครามฉล / พระทัย ธ โอภาสผ่องถ่องสกล / พระยุคลบาทย่างสืบสร้างไทย๚ ๏ น้อมเกล้าเทิดองค์ราชันศรันย์ศรี / บารมีหมื่นคู่คงอสงไขย / กรรดิราชกฤษฎาก้องหล้าไกล / ปลื้มประทับถ้วนทุกใจแห่งไท้เอย๚ะ๛ Verbatim Section And as a verbatim section: ๏ พระเมตตาแจ่มจับใจไผทสยาม พระทัยงาม...มองภาพถ่ายมิถ่ายถอน เกล้าฯ น้อมเกล้าฯ พจน์เรียงเผดียงกลอน สื่อสะท้อนพระการุณย์อุ่นดวงมาน๚ ๏ ทุกภาพมิ่งมงคลยลแล้วยิ้ม เอื้ออกอิ่มล้ำค่ามหาศาล อยากเป็นคุณทองแดงนักจักอยู่งาน เฝ้าคลอเคลียบทมาลย์พระภูมิพล๚ ๏ พระหัตถ์บุญทรงเบิกหล้าพลิกหล้าเขียว พระโอษฐ์เรียวตรัสห้ามสงครามฉล พระทัย ธ โอภาสผ่องถ่องสกล พระยุคลบาทย่างสืบสร้างไทย๚ ๏ น้อมเกล้าเทิดองค์ราชันศรันย์ศรี บารมีหมื่นคู่คงอสงไขย กรรดิราชกฤษฎาก้องหล้าไกล ปลื้มประทับถ้วนทุกใจแห่งไท้เอย๚ะ๛ [end] Pod-Simple-3.43/t/corpus/cp1256.xml0000644000175000017500000001201614062242375015005 0ustar khwkhw NAME buniya1256 -- test document: a paragraph in Arabic as CP-1256 DESCRIPTION This Pod document is a paragraph in Arabic from "The Five Pillars of Islam" as CP-1256. cp1256 وعن عمارة بن حزم قال قال رسول الله صلى الله عليه وسلم: اربع فرضهن الله عز وجل في الاسلام فمن جاء بثلاث لم يغنين عنه شيئا حتى يأتي بهن جميعا الصلاة والزكاة وصيام رمضان وحج البيت. رواه احمد والطبراني في الكبير وفي اسناده ابن لهيعة. And now as a real single paragraph: وعن عمارة بن حزم قال قال رسول الله صلى الله عليه وسلم: اربع فرضهن الله عز وجل في الاسلام فمن جاء بثلاث لم يغنين عنه شيئا حتى يأتي بهن جميعا الصلاة والزكاة وصيام رمضان وحج البيت. رواه احمد والطبراني في الكبير وفي اسناده ابن لهيعة. And now as a verbatim paragraph: وعن عمارة بن حزم قال قال رسول الله صلى الله عليه وسلم: اربع فرضهن الله عز وجل في الاسلام فمن جاء بثلاث لم يغنين عنه شيئا حتى يأتي بهن جميعا الصلاة والزكاة وصيام رمضان وحج البيت. رواه احمد والطبراني في الكبير وفي اسناده ابن لهيعة. [end] Pod-Simple-3.43/t/corpus/iso6.txt0000644000175000017500000000175414062242375014773 0ustar khwkhw =head1 NAME buniya-iso-6 -- test document: a paragraph in Arabic as ISO-8859-6 =head1 DESCRIPTION This document is a paragraph in Arabic from "The Five Pillars of Islam" as ISO-8859-6. =encoding iso-8859-6 : . . And now as a real single paragraph: : . . And now as a verbatim paragraph: : . . [end] =cut Pod-Simple-3.43/t/corpus/lat1fr.xml0000644000175000017500000000402514062242375015257 0ustar khwkhw iso-8859-1 NAME French-Latin-1 -- explicitly Latin-1 test document in French DESCRIPTION This is a test Pod document in Latin-1. Its content is the last two paragraphs of Baudelaire's Le Joujou du pauvre . A travers ces barreaux symboliques séparant deux mondes, la grande route et le château, l'enfant pauvre montrait à l'enfant riche son propre joujou, que celui-ci examinait avidement comme un objet rare et inconnu. Or, ce joujou, que le petit souillon agaçait, agitait et secouait dans une boîte grillée, c'était un rat vivant ! Les parents, par économie sans doute, avaient tiré le joujou de la vie elle-même. Et les deux enfants se riaient l'un à l'autre fraternellement, avec des dents d'une égale blancheur. As Verbatim A travers ces barreaux symboliques séparant deux mondes, la grande route et le château, l'enfant pauvre montrait à l'enfant riche son propre joujou, que celui-ci examinait avidement comme un objet rare et inconnu. Or, ce joujou, que le petit souillon agaçait, agitait et secouait dans une boîte grillée, c'était un rat vivant ! Les parents, par économie sans doute, avaient tiré le joujou de la vie elle-même. Et les deux enfants se riaient l'un à l'autre fraternellement, avec des dents d'une égale blancheur. [end] Pod-Simple-3.43/t/corpus/encwarn01.txt0000644000175000017500000000032214062242375015677 0ustar khwkhw =head1 NAME Encoding Warning 1 - implicitly Latin-1 =head2 DESCRIPTION This line should warn that the word caf contains a non-ASCII character. But chteau should not generate a warning - once is enough. Pod-Simple-3.43/t/corpus/2202jpx.txt0000644000175000017500000000276614062242375015226 0ustar khwkhw =head1 NAME haiku-iso2022jp -- a test Japanese document in iso-2022-jp =head1 DESCRIPTION =encoding iso-2022-jp This is a test Pod document in ISO-2202-JP. Its content is some Japanese haiku by famous poets. =head2 MATSUO BASHO ($B>>HxGN>V(B 1644 - 1694) : $B8ECS$d3?$H$S9~$`?e$N2;(B (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: $B8ECS$d3?$H$S9~$`?e$N2;(B =head2 YOSA BUSON ($BM?L?$$$/$P$/$+$"$kLkC;$7(B (yomei / ikubakuka aru / yo mijikashi) $BM>L?$$$/$P$/$+$"$kLkC;$7(B =head1 AS A LIST =over =item MATSUO BASHO ($B>>HxGN>V(B 1644 - 1694) : $B8ECS$d3?$H$S9~$`?e$N2;(B (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: $B8ECS$d3?$H$S9~$`?e$N2;(B =item YOSA BUSON ($BM?L?$$$/$P$/$+$"$kLkC;$7(B (yomei / ikubakuka aru / yo mijikashi) $BM>L?$$$/$P$/$+$"$kLkC;$7(B =back .end. =cut Pod-Simple-3.43/t/corpus/enc_char_wrong_directive.xml0000644000175000017500000000227014062242375021102 0ustar khwkhw NAME Implicit Encoding with Warning in UTF8 and wrong encoding directive iso-8859-1 DESCRIPTION This line should warn that the price €9.99 contains a non-ASCII character. iso-8859-1 And château should not generate a warning. POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 8: Non-ASCII character seen before =encoding in '€9.99'. Assuming UTF-8 Around line 10: Couldn't do =encoding iso-8859-1: Encoding is already set to UTF-8 Pod-Simple-3.43/t/corpus/cp1256.txt0000644000175000017500000000174114062242375015027 0ustar khwkhw =head1 NAME buniya1256 -- test document: a paragraph in Arabic as CP-1256 =head1 DESCRIPTION This Pod document is a paragraph in Arabic from "The Five Pillars of Islam" as CP-1256. =encoding cp1256 : . . And now as a real single paragraph: : . . And now as a verbatim paragraph: : . . [end] =cut Pod-Simple-3.43/t/corpus/encwarn04.txt0000644000175000017500000000046414062242375015711 0ustar khwkhwpackage MyPackage; use strict; # Checking encoding warning is generated even on first line of POD sub main { print "This file contains no POD\n"; } 1; =head1 TŨTORIAL The encoding warning should only fire when the parser is 'in_pod' but that should also be true on the first line of POD (above). Pod-Simple-3.43/t/corpus/pasternak_cp1251.xml0000644000175000017500000002254714062242375017062 0ustar khwkhw cp1251 NAME Зимняя ночь -- Pasternak Russian test file (cp1251) TEXT (This is a test Pod pocument in cp1251.) Зимняя ночь. Мело, мело по всей земле / Во все пределы. / Свеча горела на столе, / Свеча горела. Как летом роем мошкора / Летит на пламя, / Слетались хлопья со двора / К оконной раме. Метель лепила на столе / Кружки и стрелы. / Свеча горела на столе, / Свеча горела. На озаренный потолок / Ложились тени, / Скрещенья рук, скркщенья ног, / Судьбы скрещенья. И падали два башмачка / Со стуком на пол, / И воск слезами с ночника / На платье капал. И все терялось в снежной мгле / Седой и белой. / Свеча горела на столе, / Свеча горела. На свечку дуло из угла, / И жар соблазна / Вздымал, как ангел, два крыла / Крестообразно. / Мело весь месяц в феврале, / И то и дело / Свеча горела на столе, / Свеча горела. -- Борис Пастернак, 1946 As Preformatted And now as a preformatted section: Зимняя ночь. Мело, мело по всей земле Во все пределы. Свеча горела на столе, Свеча горела. Как летом роем мошкора Летит на пламя, Слетались хлопья со двора К оконной раме. Метель лепила на столе Кружки и стрелы. Свеча горела на столе, Свеча горела. На озаренный потолок Ложились тени, Скрещенья рук, скркщенья ног, Судьбы скрещенья. И падали два башмачка Со стуком на пол, И воск слезами с ночника На платье капал. И все терялось в снежной мгле Седой и белой. Свеча горела на столе, Свеча горела. На свечку дуло из угла, И жар соблазна Вздымал, как ангел, два крыла Крестообразно. Мело весь месяц в феврале, И то и дело Свеча горела на столе, Свеча горела. -- Борис Пастернак, 1946 [end] Pod-Simple-3.43/t/corpus/koi8r.txt0000644000175000017500000000225414062242375015143 0ustar khwkhw =encoding koi8-r =head1 NAME -- Fet's "When you were reading" =head1 TEXT (This is a test Pod pocument in KOI8-R.) , / / ,- / ? ! , , / , / / . , / ,- / : / ! 15 1887 And now, as a verbatim section: , ,- ? ! , , , . , ,- : ! 15 1887 [end] =cut Pod-Simple-3.43/t/corpus/2202jp.xml0000644000175000017500000001140514062242375015005 0ustar khwkhw NAME haiku-iso2022jp -- a test Japanese document in iso-2022-jp DESCRIPTION iso-2022-jp This is a test Pod document in ISO-2202-JP. Its content is some Japanese haiku by famous poets. MATSUO BASHO (松尾芭蕉 1644 - 1694) : 古池や蛙とび込む水の音 (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: 古池や蛙とび込む水の音 YOSA BUSON (与謝蕪村1716 - 1783) 方八里雨雲よせぬ牡丹かな (ho hachiri / amagumo yosenu / botan kana) As verbatim: 方八里雨雲よせぬ牡丹かな MASAOKA SHIKI (正岡子規 1867 - 1902) いちはつの一輪白し春の暮 (ichihatsu no / ichirin shiroshi / haruno kure) As verbatim: いちはつの一輪白し春の暮 余命いくばくかある夜短し (yomei / ikubakuka aru / yo mijikashi) 余命いくばくかある夜短し AS A LIST MATSUO BASHO (松尾芭蕉 1644 - 1694) : 古池や蛙とび込む水の音 (furuike ya / kawazu tobikomu / mizu no oto) As verbatim: 古池や蛙とび込む水の音 YOSA BUSON (与謝蕪村1716 - 1783) 方八里雨雲よせぬ牡丹かな (ho hachiri / amagumo yosenu / botan kana) As verbatim: 方八里雨雲よせぬ牡丹かな MASAOKA SHIKI (正岡子規 1867 - 1902) いちはつの一輪白し春の暮 (ichihatsu no / ichirin shiroshi / haruno kure) As verbatim: いちはつの一輪白し春の暮 余命いくばくかある夜短し (yomei / ikubakuka aru / yo mijikashi) 余命いくばくかある夜短し [end] Pod-Simple-3.43/t/corpus/8859_7.xml0000644000175000017500000000602414062242375014732 0ustar khwkhw iso-8859-7 NAME Ολυμπιακός Ύμνος -- Κωστής Παλαμάς DESCRIPTION Αρχαίο Πνεύμ' αθάνατον, αγνέ πατέρα του ωραίου, του μεγάλου και τ' αληθινού, κατέβα, φανερώσου κι άστραψ' εδώ πέρα στη δόξα της δικής σου γης και τ' ουρανού. Στο δρόμο και στο πάλεμα και στο λιθάρι, στων ευγενών Αγώνων λάμψε την ορμή, και με τ' αμάραντο στεφάνωσε κλωνάρι και σιδερένιο πλάσε κι άξιο το κορμί. Κάμποι, βουνά και πέλαγα φέγγουν μαζί σου σαν ένας λευκοπόρφυρος μέγας ναός, και τρέχει στο ναό εδώ προσκυνητής σου. Αρχαίο Πνεύμ' αθάνατο, κάθε λαός. Pod-Simple-3.43/t/corpus/8859_7.pod0000644000175000017500000000117514062242375014716 0ustar khwkhw =encoding iso-8859-7 =head1 NAME -- =head1 DESCRIPTION ' , , ' , , ' ' . , , ' . , , . ' , . =cut The above is the Olympic Hymn, by Kostis Palamas. Yup, it's in Greek. Pod-Simple-3.43/t/corpus/2202jpz.txt0000644000175000017500000000025114062242375015213 0ustar khwkhw =head1 NAME haiku-iso2022jp -- a test Japanese document in iso-2022-jp =head1 DESCRIPTION =encoding iso-2022-jp This is a test Pod document in ISO-2202-JP. =cut Pod-Simple-3.43/t/corpus/nonesuch.xml0000644000175000017500000000373214062242375015714 0ustar khwkhw nonesuch -- Document in an unknown encoding Blorp. [end] POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 1: This document probably does not appear as it should, because its "=encoding blorpy" line calls for an unsupported encoding. [Encode.pm v1.98's supported encodings are: 7bit-jis AdobeStandardEncoding AdobeSymbol AdobeZdingbat ascii ascii-ctrl big5-eten big5-hkscs cp1006 cp1026 cp1047 cp1250 cp1251 cp1252 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 cp37 cp424 cp437 cp500 cp737 cp775 cp850 cp852 cp855 cp856 cp857 cp860 cp861 cp862 cp863 cp864 cp865 cp866 cp869 cp874 cp875 cp932 cp936 cp949 cp950 dingbats euc-cn euc-jp euc-kr gb12345-raw gb2312-raw gsm0338 hp-roman8 hz iso-2022-jp iso-2022-jp-1 iso-2022-kr iso-8859-1 iso-8859-10 iso-8859-11 iso-8859-13 iso-8859-14 iso-8859-15 iso-8859-16 iso-8859-2 iso-8859-3 iso-8859-4 iso-8859-5 iso-8859-6 iso-8859-7 iso-8859-8 iso-8859-9 iso-ir-165 jis0201-raw jis0208-raw jis0212-raw johab koi8-f koi8-r koi8-u ksc5601-raw MacArabic MacCentralEurRoman MacChineseSimp MacChineseTrad MacCroatian MacCyrillic MacDingbats MacFarsi MacGreek MacHebrew MacIcelandic MacJapanese MacKorean MacRoman MacRomanian MacRumanian MacSami MacSymbol MacThai MacTurkish MacUkrainian MIME-B MIME-Header MIME-Q nextstep null posix-bc shiftjis symbol UCS-2BE UCS-2LE UTF-16 UTF-16BE UTF-16LE UTF-32 UTF-32BE UTF-32LE UTF-7 utf8 viscii] Pod-Simple-3.43/t/corpus/encwarn02.txt0000644000175000017500000000032514062242375015703 0ustar khwkhw =head1 NAME Encoding Warning 1 - implicitly UTF-8 =head2 DESCRIPTION This line should warn that the price €9.99 contains a non-ASCII character. But château should not generate a warning - once is enough. Pod-Simple-3.43/t/whine.t0000644000175000017500000000333414062242377013334 0ustar khwkhwuse strict; use warnings; use Test::More tests => 6; { package Pod::Simple::ErrorFinder; use base 'Pod::Simple::DumpAsXML'; # arbitrary choice -- rjbs, 2013-04-16 sub errors_for_input { my ($class, $input, $mutor) = @_; my $parser = $class->new; my $output = ''; $parser->output_string( \$output ); $parser->no_errata_section(1); $parser->parse_string_document( $input ); return $parser->errata_seen(); } } sub errors { Pod::Simple::ErrorFinder->errors_for_input(@_) } { my $errors = errors("=over 4\n\n=item 1\n\nHey\n\n"); is_deeply( $errors, { 1 => [ "=over without closing =back" ] }, "no closing =back", ); } { for my $l_code ('L< foo>', 'L< bar>') { my $input = "=pod\n\nAmbiguous space: $l_code\n"; my $errors = errors("$input"); is_deeply( $errors, { 3 => [ "L<> starts or ends with whitespace" ] }, "warning for space in $l_code", ); } } { my $input = "=pod\n\nAmbiguous slash: L\n"; my $errors = errors("$input"); is_deeply( $errors, { 3 => [ "alternative text 'I/O Operators' contains non-escaped | or /" ] }, "warning for / in text part of L<>", ); } { my $input = "=pod\n\nnested LEEE: L|http://baz>\n"; my $errors = errors("$input"); is_deeply( $errors, { 3 => [ "Nested L<> are illegal. Pretending inner one is X<...> so can continue looking for other errors." ] }, "warning for nested L<>", ); } { my $input = "=pod\n\nLEEE containing only slash: L< / >\n"; my $errors = errors("$input"); is_deeply( $errors, { 3 => [ "L<> contains only '/'" ] }, "warning for L< / > containing only a slash", ); } Pod-Simple-3.43/t/eol2.t0000644000175000017500000000413514062242376013062 0ustar khwkhw#!/usr/bin/perl # t/eol2.t - check handling of \r, \n, and \r\n as line separators (again) BEGIN { chdir 't' if -d 't'; } use warnings; use strict; use lib '../lib'; use Test::More tests => 7; use_ok('Pod::Simple::XHTML') or exit; open(POD, ">$$.pod") or die "$$.pod: $!"; print POD <<__EOF__; =pod =head1 NAME crlf =head1 DESCRIPTION crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf =cut __EOF__ close(POD); # --- CR --- my $p1 = Pod::Simple::XHTML->new (); isa_ok ($p1, 'Pod::Simple::XHTML'); open(POD, "<$$.pod") or die "$$.pod: $!"; my $i1 = ''; while () { s/[\r\n]+/\r/g; $i1 .= $_; } close(POD); $p1->output_string(\my $o1); $p1->parse_string_document($i1); # --- LF --- my $p2 = Pod::Simple::XHTML->new (); isa_ok ($p2, 'Pod::Simple::XHTML'); open(POD, "<$$.pod") or die "$$.pod: $!"; my $i2 = ''; while () { s/[\r\n]+/\n/g; $i2 .= $_; } close(POD); $p2->output_string(\my $o2); $p2->parse_string_document($i2); # --- CRLF --- my $p3 = Pod::Simple::XHTML->new (); isa_ok ($p3, 'Pod::Simple::XHTML'); open(POD, "<$$.pod") or die "$$.pod: $!"; my $i3 = ''; while () { s/[\r\n]+/\r\n/g; $i3 .= $_; } close(POD); $p3->output_string(\my $o3); $p3->parse_string_document($i3); # --- now test --- my $cksum1 = unpack("%32C*", $o1); my $cksum2 = unpack("%32C*", $o2); my $cksum3 = unpack("%32C*", $o3); ok($cksum1 == $cksum2, "CR vs LF"); ok($cksum1 == $cksum3, "CR vs CRLF"); ok($cksum2 == $cksum3, "LF vs CRLF"); END { 1 while unlink("$$.pod", "$$.in"); } Pod-Simple-3.43/t/accept05.t0000644000175000017500000001144214062242375013623 0ustar khwkhw# Testing extend and accept_codes BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 24 }; #use Pod::Simple::Debug (2); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } my $x = 'Pod::Simple::XMLOutStream'; sub accept_Q { $_[0]->accept_codes('Q') } sub accept_prok { $_[0]->accept_codes('prok') } sub accept_zing_prok { $_[0]->accept_codes('zing:prok') } sub accept_zing_superprok { $_[0]->accept_codes('z.i_ng:Prok-12') } sub accept_zing_superduperprok { $_[0]->accept_codes('A'); $_[0]->accept_codes('z.i_ng:Prok-12'); } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Some sanity tests...\n"; ok( $x->_out( "=pod\n\nI like pie.\n"), 'I like pie.' ); ok( $x->_out( "=extend N C Y,W\n\nI like pie.\n"), 'I like pie.' ); ok( $x->_out( "=extend N C,F Y,W\n\nI like pie.\n"), 'I like pie.' ); ok( $x->_out( "=extend N C,F,I Y,W\n\nI like pie.\n"), 'I like pie.' ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "## OK, actually trying to use an extended code...\n"; print "# extending but not accepted (so hitting fallback)\n"; ok( $x->_out( "=extend N B Y,W\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( "=extend N B,I Y,W\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( "=extend N C,B,I Y,W\n\nI N pie.\n"), 'I like pie.' ); print "# extending to one-letter accepted (not hitting fallback)\n"; ok( $x->_out( \&accept_Q, "=extend N B Y,Q,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( \&accept_Q, "=extend N B,I Y,Q,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( \&accept_Q, "=extend N C,B,I Y,Q,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); print "# extending to many-letter accepted (not hitting fallback)\n"; ok( $x->_out( \&accept_prok, "=extend N B Y,prok,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( \&accept_prok, "=extend N B,I Y,prok,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( \&accept_prok, "=extend N C,B,I Y,prok,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); print "# extending to :-containing, many-letter accepted (not hitting fallback)\n"; ok( $x->_out( \&accept_zing_prok, "=extend N B Y,zing:prok,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( \&accept_zing_prok, "=extend N B,I Y,zing:prok,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( \&accept_zing_prok, "=extend N C,B,I Y,zing:prok,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); print "# extending to _:-0-9-containing, many-letter accepted (not hitting fallback)\n"; ok( $x->_out( \&accept_zing_superprok, "=extend N B Y,z.i_ng:Prok-12,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( \&accept_zing_superprok, "=extend N B,I Y,z.i_ng:Prok-12,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( \&accept_zing_superprok, "=extend N C,B,I Y,z.i_ng:Prok-12,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); print "#\n# Testing acceptance order\n"; ok( $x->_out( \&accept_zing_superduperprok, "=extend N B Y,z.i_ng:Prok-12,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( \&accept_zing_superduperprok, "=extend N B,I Y,z.i_ng:Prok-12,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); ok( $x->_out( \&accept_zing_superduperprok, "=extend N C,B,I Y,z.i_ng:Prok-12,A,bzroch\n\nI N pie.\n"), 'I like pie.' ); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/strpvbtm.t0000644000175000017500000001257514062242376014111 0ustar khwkhw#!/usr/bin/perl -w # t/strip_verbatim_indent.t.t - check verbatim indent stripping feature BEGIN { chdir 't' if -d 't'; } use strict; use warnings; use lib '../lib'; use Test::More tests => 103; #use Test::More 'no_plan'; use_ok('Pod::Simple::XHTML') or exit; use_ok('Pod::Simple::XMLOutStream') or exit; isa_ok my $parser = Pod::Simple::XHTML->new, 'Pod::Simple::XHTML'; ok $parser->strip_verbatim_indent(' '), 'Should be able to set striper to " "'; ok $parser->strip_verbatim_indent(' '), 'Should be able to set striper to " "'; ok $parser->strip_verbatim_indent("t"), 'Should be able to set striper to "\\t"'; ok $parser->strip_verbatim_indent(sub { ' ' }), 'Should be able to set striper to coderef'; for my $spec ( [ "\n=pod\n\n foo bar baz\n", undef, qq{ foo bar baz}, "
 foo bar baz
\n\n", 'undefined indent' ], [ "\n=pod\n\n foo bar baz\n", ' ', qq{foo bar baz}, "
foo bar baz
\n\n", 'single space indent' ], [ "\n=pod\n\n foo bar baz\n", ' ', qq{ foo bar baz}, "
 foo bar baz
\n\n", 'too large indent' ], [ "\n=pod\n\n foo bar baz\n", ' ', qq{foo bar baz}, "
foo bar baz
\n\n", 'double space indent' ], [ "\n=pod\n\n foo bar baz\n", sub { ' ' }, qq{foo bar baz}, "
foo bar baz
\n\n", 'code ref stripper' ], [ "\n=pod\n\n foo bar\n\n baz blez\n", ' ', qq{foo bar\n\nbaz blez}, "
foo bar\n\nbaz blez
\n\n", 'single space indent and empty line' ], [ "\n=pod\n\n foo bar\n\n baz blez\n", sub { ' ' }, qq{foo bar\n\nbaz blez}, "
foo bar\n\nbaz blez
\n\n", 'code ref indent and empty line' ], [ "\n=pod\n\n foo bar\n\n baz blez\n", sub { (my $s = shift->[0]) =~ s/\S.*//; $s }, qq{foo bar\n\nbaz blez}, "
foo bar\n\nbaz blez
\n\n", 'heuristic code ref indent' ], [ "\n=pod\n\n foo bar\n baz blez\n", sub { s/^\s+// for @{ $_[0] } }, qq{foo bar\nbaz blez}, "
foo bar\nbaz blez
\n\n", 'militant code ref' ], [ "\n=pod\n\n foo (bar\n baz blez\n", sub { (my $i = $_[0]->[0]) =~ s/S.*//; $i }, qq{\n baz blez}, "
\n   baz blez
\n\n", 'code ref and paren' ], ) { my ($pod, $indent, $xml, $xhtml, $desc) = @$spec; # Test XML output. ok my $p = Pod::Simple::XMLOutStream->new, "Construct XML parser to test $desc"; $p->hide_line_numbers(1); my $output = ''; $p->output_string( \$output ); is $indent, $p->strip_verbatim_indent($indent), 'Set stripper for XML to ' . (defined $indent ? qq{"$indent"} : 'undef'); ok $p->parse_string_document( $pod ), "Parse POD to XML for $desc"; is $output, $xml, "Should have expected XML output for $desc"; # Test XHTML output. ok $p = Pod::Simple::XHTML->new, "Construct XHMTL parser to test $desc"; $p->html_header(''); $p->html_footer(''); $output = ''; $p->output_string( \$output ); is $indent, $p->strip_verbatim_indent($indent), 'Set stripper for XHTML to ' . (defined $indent ? qq{"$indent"} : 'undef'); ok $p->parse_string_document( $pod ), "Parse POD to XHTML for $desc"; is $output, $xhtml, "Should have expected XHTML output for $desc"; } for my $spec ( [ "\n=pod\n\n\t\tfoo bar baz\n", 0, "
\t\tfoo bar baz
\n\n", 'preserve tabs' ], [ "\n=pod\n\n\t\tfoo bar baz\n", undef, "
                foo bar baz
\n\n", 'preserve tabs' ], [ "\n=pod\n\n\t\tfoo bar baz\n", -1, "
                foo bar baz
\n\n", 'preserve tabs' ], [ "\n=pod\n\n\t\tfoo bar baz\n", 1, "
  foo bar baz
\n\n", 'tabs are xlate to one space each' ], ) { my ($pod, $tabs, $xhtml, $desc) = @$spec; # Test XHTML output. ok my $p = Pod::Simple::XHTML->new, "Construct XHMTL parser to test $desc"; $p->html_header(''); $p->html_footer(''); my $output = ''; $p->output_string( \$output ); is $tabs, $p->expand_verbatim_tabs($tabs), 'Set tab for XHTML to ' . (defined $tabs ? qq{"$tabs"} : 'undef'); ok $p->parse_string_document( $pod ), "Parse POD to XHTML for $desc"; is $output, $xhtml, "Should have expected XHTML output for $desc"; } Pod-Simple-3.43/t/heads.t0000644000175000017500000000617014062242376013306 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 23 }; #use Pod::Simple::Debug (6); BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; print "# Simple tests for head1 - head6...\n"; ok( Pod::Simple::XMLOutStream->_out("\n=head1 Chacha\n\n"), 'Chacha' ); ok( Pod::Simple::XMLOutStream->_out("\n=head2 Chacha\n\n"), 'Chacha' ); ok( Pod::Simple::XMLOutStream->_out("\n=head3 Chacha\n\n"), 'Chacha' ); ok( Pod::Simple::XMLOutStream->_out("\n=head4 Chacha\n\n"), 'Chacha' ); ok( Pod::Simple::XMLOutStream->_out("\n=head5 Chacha\n\n"), 'Chacha' ); ok( Pod::Simple::XMLOutStream->_out("\n=head6 Chacha\n\n"), 'Chacha' ); print "# Testing whitespace equivalence...\n"; &ok(e "\n=head1 Chacha\n\n", "\n=head1 Chacha\n\n"); &ok(e "\n=head1 Chacha\n\n", "\n=head1\tChacha\n\n"); &ok(e "\n=head1 Chacha\n\n", "\n=head1\tChacha \n\n"); ok( Pod::Simple::XMLOutStream->_out("=head1 Chachacha"), 'Chachacha' ); print "# Testing whitespace variance ...\n"; ok( Pod::Simple::XMLOutStream->_out("=head1 Cha cha cha \n"), 'Cha cha cha' ); ok( Pod::Simple::XMLOutStream->_out("=head1 Cha cha\tcha \n"), 'Cha cha cha' ); print "# Testing head2 ... head6 more...\n"; ok( Pod::Simple::XMLOutStream->_out("=head2 Cha cha\tcha \n"), 'Cha cha cha' ); ok( Pod::Simple::XMLOutStream->_out("=head3 Cha cha\tcha \n"), 'Cha cha cha' ); ok( Pod::Simple::XMLOutStream->_out("=head4 Cha cha\tcha \n"), 'Cha cha cha' ); ok( Pod::Simple::XMLOutStream->_out("=head5 Cha cha\tcha \n"), 'Cha cha cha' ); ok( Pod::Simple::XMLOutStream->_out("=head6 Cha cha\tcha \n"), 'Cha cha cha' ); print "# Testing entity expansion...\n"; ok( Pod::Simple::XMLOutStream->_out("=head4 fooE<64>bar!\n"), Pod::Simple::XMLOutStream->_out("\n=head4 foo\@bar!\n\n"), ); # TODO: a mode so that DumpAsXML can ask for all contiguous string # sequences to be fused? # &ok( e "=head4 fooE<64>bar!\n", "\n=head4 foo\@bar!\n\n"); print "# Testing formatting sequences...\n"; # True only if the sequences resolve, as they should... &ok( e "=head4 C\n", "\n=head4 C<< foobar! >>\n\n"); &ok( e "=head4 C\n", "\n\n=head4 C<<< foobar! >>>\n"); &ok( e "=head4 C\n", "\n=head4 C<< foobar!\n\t>>\n\n"); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/xhtml05.t0000644000175000017500000000230014062242377013513 0ustar khwkhw#!/usr/bin/perl -w # t/xhtml05.t - check block output from Pod::Simple::XHTML BEGIN { chdir 't' if -d 't'; } use strict; use warnings; use lib '../lib'; use Test::More tests => 6; use_ok('Pod::Simple::XHTML') or exit; my $parser = Pod::Simple::XHTML->new (); isa_ok ($parser, 'Pod::Simple::XHTML'); my $results; initialize($parser, $results); $parser->accept_targets_as_text( 'comment' ); $parser->parse_string_document(<<'EOPOD'); =for comment This is an ordinary for block. EOPOD is($results, <<'EOHTML', "a for block");

This is an ordinary for block.

EOHTML foreach my $target (qw(note tip warning)) { initialize($parser, $results); $parser->accept_targets_as_text( $target ); $parser->parse_string_document(<<"EOPOD"); =begin $target This is a $target. =end $target EOPOD is($results, <<"EOHTML", "allow $target blocks");

This is a $target.

EOHTML } ###################################### sub initialize { $_[0] = Pod::Simple::XHTML->new (); $_[0]->html_header(""); $_[0]->html_footer(""); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-Simple-3.43/t/github_issue_79.t0000644000175000017500000000341714062242376015234 0ustar khwkhw#!/usr/bin/perl use strict; use warnings; use Test::More; BEGIN { eval { require Test::Deep; }; plan skip_all => 'Fails with Can\'t locate object method "print" via package "IO::File" at t/github_issue_79.t line 33' if $] le 5.012005; plan skip_all => 'Need Test::Deep to test' if $@; Test::Deep->import('cmp_deeply'); } { package DumpAsXML::Enh; use parent 'Pod::Simple::DumpAsXML'; sub new { my ( $class ) = @_; my $self = $class->SUPER::new(); $self->code_handler( sub { pop( @_ )->_handle_line( 'code', @_ ); } ); $self->cut_handler( sub { pop( @_ )->_handle_line( 'cut', @_ ); } ); $self->pod_handler( sub { pop( @_ )->_handle_line( 'pod', @_ ); } ); $self->whiteline_handler( sub { pop( @_ )->_handle_line( 'white', @_ ); } ); return $self; }; sub _handle_line { my ( $self, $elem, $text, $line ) = @_; my $fh = $self->{ output_fh }; $fh->print( ' ' x $self->{ indent }, "<$elem start_line=\"$line\"/>\n" ); }; } my $output = ''; my $parser = DumpAsXML::Enh->new(); $parser->output_string( \$output ); my $input = [ '=head1 DESCRIPTION', '', ' Verbatim paragraph.', '', '=cut', ]; my $expected_output = [ '', ' ', ' DESCRIPTION', ' ', ' ', ' Verbatim paragraph.', ' ', ' ', '', ]; $parser->parse_lines( @$input, undef ); my $actual_output = [ split( "\n", $output ) ]; cmp_deeply( $actual_output, $expected_output ) or do { diag( 'actual output:' ); diag( "|$_" ) for @$actual_output; diag( 'expected output:' ); diag( "|$_" ) for @$expected_output; }; done_testing; exit( 0 ); Pod-Simple-3.43/t/html01.t0000644000175000017500000000570714062242376013334 0ustar khwkhw# Testing HTML paragraphs BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 16 }; #use Pod::Simple::Debug (10); use Pod::Simple::HTML; sub x { my $code = $_[1]; Pod::Simple::HTML->_out( sub{ $_[0]->bare_output(1); $code->($_[0]) if $code }, "=pod\n\n$_[0]", ) } ok( x( q{ =pod This is a paragraph =cut }), qq{\n

This is a paragraph

\n}, "paragraph building" ); ok( x(qq{=pod\n\nThis is a paragraph}), qq{\n

This is a paragraph

\n}, "paragraph building" ); ok( x(qq{This is a paragraph}), qq{\n

This is a paragraph

\n}, "paragraph building" ); ok(x( '=head1 This is a heading') => q{/\s*

]+>This\s+is\s+a\s+heading

\s*$/}, "heading building" ); ok(x('=head1 This is a heading', sub { $_[0]->html_h_level(2) }) => q{/\s*

]+>This\s+is\s+a\s+heading

\s*$/}, "heading building" ); ok(x( '=head2 This is a heading too') => q{/\s*

]+>This\s+is\s+a\s+heading\s+too

\s*$/}, "heading building" ); ok(x( '=head3 Also, this is a heading') => q{/\s*

]+>Also,\s+this\s+is\s+a\s+heading

\s*$/}, "heading building" ); ok(x( '=head4 This, too, is a heading') => q{/\s*

]+>This,\s+too,\s+is\s+a\s+heading

\s*$/}, "heading building" ); ok(x( '=head5 The number of the heading shall be five') => q{/\s*
]+>The\s+number\s+of\s+the\s+heading\s+shall\s+be\s+five
\s*$/}, "heading building" ); ok(x( '=head6 The sixth a heading is the perfect heading') => q{/\s*
]+>The\s+sixth\s+a\s+heading\s+is\s+the\s+perfect\s+heading
\s*$/}, "heading building" ); ok(x( '=head2 Yada Yada Operator X<...> X<... operator> X') => q{/name="Yada_Yada_Operator"/}, "heading anchor name" ); ok( x("=over 4\n\n=item one\n\n=item two\n\nHello\n\n=back\n"), q{
one
two

Hello

} ); my $html = q{
#include <stdio.h>

int main(int argc,char *argv[]) {

        printf("Hellow World\n");
        return 0;

}
}; ok( x("=begin html\n\n$html\n\n=end html\n"), "$html\n\n" ); # Check subclass. SUBCLASS: { package My::Pod::HTML; use vars '@ISA', '$VERSION'; @ISA = ('Pod::Simple::HTML'); $VERSION = '0.01'; sub do_section { 'howdy' } } ok( My::Pod::HTML->_out( sub{ $_[0]->bare_output(1) }, "=pod\n\n=over\n\n=item Foo\n\n=back\n", ), "\n
\n
Foo
\n
\n", ); { # Test that strip_verbatim_indent() works. github issue #i5 my $output; my $obj = Pod::Simple::HTML->new; $obj->strip_verbatim_indent(" "); $obj->output_string(\$output); $obj->parse_string_document("=pod\n\n First line\n 2nd line\n"); ok($output, qr!
First line\n2nd line
!s); } print "# And one for the road...\n"; ok 1; Pod-Simple-3.43/t/puller.t0000644000175000017500000001770114062242376013527 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 136 }; #use Pod::Simple::Debug (5); #sub Pod::Simple::MANY_LINES () {1} #sub Pod::Simple::PullParser::DEBUG () {1} use Pod::Simple::PullParser; sub pump_it_up { my $p = Pod::Simple::PullParser->new; $p->set_source( \( $_[0] ) ); my(@t, $t); while($t = $p->get_token) { push @t, $t } print "# Count of tokens: ", scalar(@t), "\n"; print "# I.e., {", join("\n# + ", map ref($_) . ": " . $_->dump, @t), "} \n"; return @t; } my @t; #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @t = pump_it_up(qq{\n\nProk\n\n=head1 Things\n\n=cut\n\nBzorch\n\n}); if(not( ok scalar( grep { ref $_ and $_->can('type') } @t), 5 )) { ok 0,1, "Wrong token count. Failing subsequent tests.\n"; for ( 1 .. 12 ) {ok 0} } else { ok $t[0]->type, 'start'; ok $t[1]->type, 'start'; ok $t[2]->type, 'text'; ok $t[3]->type, 'end'; ok $t[4]->type, 'end'; ok $t[0]->tagname, 'Document'; ok $t[1]->tagname, 'head1'; ok $t[2]->text, 'Things'; ok $t[3]->tagname, 'head1'; ok $t[4]->tagname, 'Document'; ok $t[0]->attr('start_line'), '5'; ok $t[1]->attr('start_line'), '5'; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @t = pump_it_up( qq{Woowoo\n\n=over\n\n=item *\n\nStuff L\n\n} . qq{=item *\n\nThings I\n\n=back\n\n=cut\n\n} ); if( not( ok scalar( grep { ref $_ and $_->can('type') } @t) => 16 ) ) { ok 0,1, "Wrong token count. Failing subsequent tests.\n"; for ( 1 .. 32 ) {ok 0} } else { ok $t[ 0]->type, 'start'; ok $t[ 1]->type, 'start'; ok $t[ 2]->type, 'start'; ok $t[ 3]->type, 'text'; ok $t[ 4]->type, 'start'; ok $t[ 5]->type, 'text'; ok $t[ 6]->type, 'end'; ok $t[ 7]->type, 'end'; ok $t[ 8]->type, 'start'; ok $t[ 9]->type, 'text'; ok $t[10]->type, 'start'; ok $t[11]->type, 'text'; ok $t[12]->type, 'end'; ok $t[13]->type, 'end'; ok $t[14]->type, 'end'; ok $t[15]->type, 'end'; ok $t[ 0]->tagname, 'Document'; ok $t[ 1]->tagname, 'over-bullet'; ok $t[ 2]->tagname, 'item-bullet'; ok $t[ 3]->text, 'Stuff '; ok $t[ 4]->tagname, 'L'; ok $t[ 5]->text, 'HTML::TokeParser'; ok $t[ 6]->tagname, 'L'; ok $t[ 7]->tagname, 'item-bullet'; ok $t[ 8]->tagname, 'item-bullet'; ok $t[ 9]->text, 'Things '; ok $t[10]->tagname, 'I'; ok $t[11]->text, 'like that'; ok $t[12]->tagname, 'I'; ok $t[13]->tagname, 'item-bullet'; ok $t[14]->tagname, 'over-bullet'; ok $t[15]->tagname, 'Document'; ok $t[4]->attr("type"), "pod"; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { print "# Testing unget_token\n"; my $p = Pod::Simple::PullParser->new; $p->set_source( \qq{\nBzorch\n\n=pod\n\nLala\n\n\=cut\n} ); ok 1; my $t; $t = $p->get_token; ok $t && $t->type, 'start'; ok $t && $t->tagname, 'Document'; print "# ungetting ($t).\n"; $p->unget_token($t); ok 1; $t = $p->get_token; ok $t && $t->type, 'start'; ok $t && $t->tagname, 'Document'; my @to_save = ($t); $t = $p->get_token; ok $t && $t->type, 'start'; ok $t && $t->tagname, 'Para'; push @to_save, $t; print "# ungetting (@to_save).\n"; $p->unget_token(@to_save); splice @to_save; $t = $p->get_token; ok $t && $t->type, 'start'; ok $t && $t->tagname, 'Document'; $t = $p->get_token; ok $t && $t->type, 'start'; ok $t && $t->tagname, 'Para'; ok 1; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { print "# Testing pullparsing from an arrayref\n"; my $p = Pod::Simple::PullParser->new; ok 1; $p->set_source( ['','Bzorch', '','=pod', '', 'Lala', 'zaza', '', '=cut'] ); ok 1; my( @t, $t ); while($t = $p->get_token) { print "# Got a token: ", $t->dump, "\n#\n"; push @t, $t; } ok scalar(@t), 5; # count of tokens ok $t[0]->type, 'start'; ok $t[1]->type, 'start'; ok $t[2]->type, 'text'; ok $t[3]->type, 'end'; ok $t[4]->type, 'end'; ok $t[0]->tagname, 'Document'; ok $t[1]->tagname, 'Para'; ok $t[2]->text, 'Lala zaza'; ok $t[3]->tagname, 'Para'; ok $t[4]->tagname, 'Document'; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { print "# Testing pullparsing from an arrayref with terminal newlines\n"; my $p = Pod::Simple::PullParser->new; ok 1; $p->set_source( [ map "$_\n", '','Bzorch', '','=pod', '', 'Lala', 'zaza', '', '=cut'] ); ok 1; my( @t, $t ); while($t = $p->get_token) { print "# Got a token: ", $t->dump, "\n#\n"; push @t, $t; } ok scalar(@t), 5; # count of tokens ok $t[0]->type, 'start'; ok $t[1]->type, 'start'; ok $t[2]->type, 'text'; ok $t[3]->type, 'end'; ok $t[4]->type, 'end'; ok $t[0]->tagname, 'Document'; ok $t[1]->tagname, 'Para'; ok $t[2]->text, 'Lala zaza'; ok $t[3]->tagname, 'Para'; ok $t[4]->tagname, 'Document'; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ END { unlink "temp.pod" } { print "# Testing pullparsing from a file\n"; my $p = Pod::Simple::PullParser->new; ok 1; open(OUT, ">temp.pod") || die "Can't write-open temp.pod: $!"; print OUT map "$_\n", '','Bzorch', '','=pod', '', 'Lala', 'zaza', '', '=cut' ; close(OUT); ok 1; sleep 1; $p->set_source("temp.pod"); my( @t, $t ); while($t = $p->get_token) { print "# Got a token: ", $t->dump, "\n#\n"; push @t, $t; print "# That's token number ", scalar(@t), "\n"; } ok scalar(@t), 5; # count of tokens ok $t[0]->type, 'start'; ok $t[1]->type, 'start'; ok $t[2]->type, 'text'; ok $t[3]->type, 'end'; ok $t[4]->type, 'end'; ok $t[0]->tagname, 'Document'; ok $t[1]->tagname, 'Para'; ok $t[2]->text, 'Lala zaza'; ok $t[3]->tagname, 'Para'; ok $t[4]->tagname, 'Document'; } # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { print "# Testing pullparsing from a glob\n"; my $p = Pod::Simple::PullParser->new; ok 1; open(IN, "set_source(*IN); my( @t, $t ); while($t = $p->get_token) { print "# Got a token: ", $t->dump, "\n#\n"; push @t, $t; print "# That's token number ", scalar(@t), "\n"; } ok scalar(@t), 5; # count of tokens ok $t[0]->type, 'start'; ok $t[1]->type, 'start'; ok $t[2]->type, 'text'; ok $t[3]->type, 'end'; ok $t[4]->type, 'end'; ok $t[0]->tagname, 'Document'; ok $t[1]->tagname, 'Para'; ok $t[2]->text, 'Lala zaza'; ok $t[3]->tagname, 'Para'; ok $t[4]->tagname, 'Document'; close(IN); } # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { print "# Testing pullparsing from a globref\n"; my $p = Pod::Simple::PullParser->new; ok 1; open(IN, "set_source(\*IN); my( @t, $t ); while($t = $p->get_token) { print "# Got a token: ", $t->dump, "\n#\n"; push @t, $t; print "# That's token number ", scalar(@t), "\n"; } ok scalar(@t), 5; # count of tokens ok $t[0]->type, 'start'; ok $t[1]->type, 'start'; ok $t[2]->type, 'text'; ok $t[3]->type, 'end'; ok $t[4]->type, 'end'; ok $t[0]->tagname, 'Document'; ok $t[1]->tagname, 'Para'; ok $t[2]->text, 'Lala zaza'; ok $t[3]->tagname, 'Para'; ok $t[4]->tagname, 'Document'; close(IN); } # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { print "# Testing pullparsing from a filehandle\n"; my $p = Pod::Simple::PullParser->new; ok 1; open(IN, "set_source(*IN{IO}); my( @t, $t ); while($t = $p->get_token) { print "# Got a token: ", $t->dump, "\n#\n"; push @t, $t; print "# That's token number ", scalar(@t), "\n"; } ok scalar(@t), 5; # count of tokens ok $t[0]->type, 'start'; ok $t[1]->type, 'start'; ok $t[2]->type, 'text'; ok $t[3]->type, 'end'; ok $t[4]->type, 'end'; ok $t[0]->tagname, 'Document'; ok $t[1]->tagname, 'Para'; ok $t[2]->text, 'Lala zaza'; ok $t[3]->tagname, 'Para'; ok $t[4]->tagname, 'Document'; close(IN); } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; __END__ Pod-Simple-3.43/t/search29.t0000644000175000017500000000345514062242376013645 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Pod::Simple::Search; use Test; BEGIN { plan tests => 4 } print "# ", __FILE__, ": Testing limit_glob ...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; $x->inc(0); $x->shadows(1); use File::Spec; use Cwd; my $cwd = cwd(); print "# CWD: $cwd\n"; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { my $updir = File::Spec->updir; my $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't'); return File::Spec->catdir ($dir, $file); } else { return $file; } } my($here1, $here2, $here3); if( -e ($here1 = source_path( 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = source_path( 'testlib2')); die "But where's $here3?" unless -e ($here3 = source_path( 'testlib3')); } elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = File::Spec->catdir($cwd, 't', 'testlib2')); die "But where's $here3?" unless -e ($here3 = File::Spec->catdir($cwd, 't', 'testlib3')); } else { die "Can't find the test corpora"; } print "# OK, found the test corpora\n# as $here1\n# and $here2\n# and $here3\n#\n"; ok 1; print $x->_state_as_string; #$x->verbose(12); use Pod::Simple; *pretty = \&Pod::Simple::BlackBox::pretty; my $glob = '*z?k*'; print "# Limiting to $glob\n"; $x->limit_glob($glob); my($name2where, $where2name) = $x->survey($here1, $here2, $here3); my $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; { my $names = join "|", sort values %$where2name; ok $names, "perlzuk|zikzik"; } print "# OK, bye from ", __FILE__, "\n"; ok 1; __END__ Pod-Simple-3.43/t/perlvar.pod0000644000175000017500000012111214062242376014206 0ustar khwkhw=head1 NAME perlvar - Perl predefined variables =head1 DESCRIPTION =head2 Predefined Names The following names have special meaning to Perl. Most punctuation names have reasonable mnemonics, or analogs in the shells. Nevertheless, if you wish to use long variable names, you need only say use English; at the top of your program. This will alias all the short names to the long names in the current package. Some even have medium names, generally borrowed from B. If you don't mind the performance hit, variables that depend on the currently selected filehandle may instead be set by calling an appropriate object method on the IO::Handle object. (Summary lines below for this contain the word HANDLE.) First you must say use IO::Handle; after which you may use either method HANDLE EXPR or more safely, HANDLE->method(EXPR) Each method returns the old value of the IO::Handle attribute. The methods each take an optional EXPR, which if supplied specifies the new value for the IO::Handle attribute in question. If not supplied, most methods do nothing to the current value--except for autoflush(), which will assume a 1 for you, just to be different. Because loading in the IO::Handle class is an expensive operation, you should learn how to use the regular built-in variables. A few of these variables are considered "read-only". This means that if you try to assign to this variable, either directly or indirectly through a reference, you'll raise a run-time exception. The following list is ordered by scalar variables first, then the arrays, then the hashes. =over 8 =item $ARG =item $_ The default input and pattern-searching space. The following pairs are equivalent: while (<>) {...} # equivalent only in while! while (defined($_ = <>)) {...} /^Subject:/ $_ =~ /^Subject:/ tr/a-z/A-Z/ $_ =~ tr/a-z/A-Z/ chomp chomp($_) Here are the places where Perl will assume $_ even if you don't use it: =over 3 =item * Various unary functions, including functions like ord() and int(), as well as the all file tests (C<-f>, C<-d>) except for C<-t>, which defaults to STDIN. =item * Various list functions like print() and unlink(). =item * The pattern matching operations C, C, and C when used without an C<=~> operator. =item * The default iterator variable in a C loop if no other variable is supplied. =item * The implicit iterator variable in the grep() and map() functions. =item * The default place to put an input record when a C<< >> operation's result is tested by itself as the sole criterion of a C test. Outside a C test, this will not happen. =back (Mnemonic: underline is understood in certain operations.) =back =over 8 =item $> Contains the subpattern from the corresponding set of capturing parentheses from the last pattern match, not counting patterns matched in nested blocks that have been exited already. (Mnemonic: like \digits.) These variables are all read-only and dynamically scoped to the current BLOCK. =item $MATCH =item $& The string matched by the last successful pattern match (not counting any matches hidden within a BLOCK or eval() enclosed by the current BLOCK). (Mnemonic: like & in some editors.) This variable is read-only and dynamically scoped to the current BLOCK. The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches. See L. =item $PREMATCH =item $` The string preceding whatever was matched by the last successful pattern match (not counting any matches hidden within a BLOCK or eval enclosed by the current BLOCK). (Mnemonic: C<`> often precedes a quoted string.) This variable is read-only. The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches. See L. =item $POSTMATCH =item $' The string following whatever was matched by the last successful pattern match (not counting any matches hidden within a BLOCK or eval() enclosed by the current BLOCK). (Mnemonic: C<'> often follows a quoted string.) Example: $_ = 'abcdefghi'; /def/; print "$`:$&:$'\n"; # prints abc:def:ghi This variable is read-only and dynamically scoped to the current BLOCK. The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches. See L. =item $LAST_PAREN_MATCH =item $+ The last bracket matched by the last search pattern. This is useful if you don't know which one of a set of alternative patterns matched. For example: /Version: (.*)|Revision: (.*)/ && ($rev = $+); (Mnemonic: be positive and forward looking.) This variable is read-only and dynamically scoped to the current BLOCK. =item @LAST_MATCH_END =item @+ This array holds the offsets of the ends of the last successful submatches in the currently active dynamic scope. C<$+[0]> is the offset into the string of the end of the entire match. This is the same value as what the C function returns when called on the variable that was matched against. The Ith element of this array holds the offset of the Ith submatch, so C<$+[1]> is the offset past where $1 ends, C<$+[2]> the offset past where $2 ends, and so on. You can use C<$#+> to determine how many subgroups were in the last successful match. See the examples given for the C<@-> variable. =item $MULTILINE_MATCHING =item $* Set to a non-zero integer value to do multi-line matching within a string, 0 (or undefined) to tell Perl that it can assume that strings contain a single line, for the purpose of optimizing pattern matches. Pattern matches on strings containing multiple newlines can produce confusing results when C<$*> is 0 or undefined. Default is undefined. (Mnemonic: * matches multiple things.) This variable influences the interpretation of only C<^> and C<$>. A literal newline can be searched for even when C<$* == 0>. Use of C<$*> is deprecated in modern Perl, supplanted by the C and C modifiers on pattern matching. Assigning a non-numerical value to C<$*> triggers a warning (and makes C<$*> act if C<$* == 0>), while assigning a numerical value to C<$*> makes that an implicit C is applied on the value. =item input_line_number HANDLE EXPR =item $INPUT_LINE_NUMBER =item $NR =item $. The current input record number for the last file handle from which you just read() (or called a C or C on). The value may be different from the actual physical line number in the file, depending on what notion of "line" is in effect--see C<$/> on how to change that. An explicit close on a filehandle resets the line number. Because C<< <> >> never does an explicit close, line numbers increase across ARGV files (but see examples in L). Consider this variable read-only: setting it does not reposition the seek pointer; you'll have to do that on your own. Localizing C<$.> has the effect of also localizing Perl's notion of "the last read filehandle". (Mnemonic: many programs use "." to mean the current line number.) =item input_record_separator HANDLE EXPR =item $INPUT_RECORD_SEPARATOR =item $RS =item $/ The input record separator, newline by default. This influences Perl's idea of what a "line" is. Works like B's RS variable, including treating empty lines as a terminator if set to the null string. (An empty line cannot contain any spaces or tabs.) You may set it to a multi-character string to match a multi-character terminator, or to C to read through the end of file. Setting it to C<"\n\n"> means something slightly different than setting to C<"">, if the file contains consecutive empty lines. Setting to C<""> will treat two or more consecutive empty lines as a single empty line. Setting to C<"\n\n"> will blindly assume that the next input character belongs to the next paragraph, even if it's a newline. (Mnemonic: / delimits line boundaries when quoting poetry.) undef $/; # enable "slurp" mode $_ = ; # whole file now here s/\n[ \t]+/ /g; Remember: the value of C<$/> is a string, not a regex. B has to be better for something. :-) Setting C<$/> to a reference to an integer, scalar containing an integer, or scalar that's convertible to an integer will attempt to read records instead of lines, with the maximum record size being the referenced integer. So this: $/ = \32768; # or \"32768", or \$var_containing_32768 open(FILE, $myfile); $_ = ; will read a record of no more than 32768 bytes from FILE. If you're not reading from a record-oriented file (or your OS doesn't have record-oriented files), then you'll likely get a full chunk of data with every read. If a record is larger than the record size you've set, you'll get the record back in pieces. On VMS, record reads are done with the equivalent of C, so it's best not to mix record and non-record reads on the same file. (This is unlikely to be a problem, because any file you'd want to read in record mode is probably unusable in line mode.) Non-VMS systems do normal I/O, so it's safe to mix record and non-record reads of a file. See also L. Also see C<$.>. =item autoflush HANDLE EXPR =item $OUTPUT_AUTOFLUSH =item $| If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel. Default is 0 (regardless of whether the channel is really buffered by the system or not; C<$|> tells you only whether you've asked Perl explicitly to flush after each write). STDOUT will typically be line buffered if output is to the terminal and block buffered otherwise. Setting this variable is useful primarily when you are outputting to a pipe or socket, such as when you are running a Perl program under B and want to see the output as it's happening. This has no effect on input buffering. See L for that. (Mnemonic: when you want your pipes to be piping hot.) =item output_field_separator HANDLE EXPR =item $OUTPUT_FIELD_SEPARATOR =item $OFS =item $, The output field separator for the print operator. Ordinarily the print operator simply prints out its arguments without further adornment. To get behavior more like B, set this variable as you would set B's OFS variable to specify what is printed between fields. (Mnemonic: what is printed when there is a "," in your print statement.) =item output_record_separator HANDLE EXPR =item $OUTPUT_RECORD_SEPARATOR =item $ORS =item $\ The output record separator for the print operator. Ordinarily the print operator simply prints out its arguments as is, with no trailing newline or other end-of-record string added. To get behavior more like B, set this variable as you would set B's ORS variable to specify what is printed at the end of the print. (Mnemonic: you set C<$\> instead of adding "\n" at the end of the print. Also, it's just like C<$/>, but it's what you get "back" from Perl.) =item $LIST_SEPARATOR =item $" This is like C<$,> except that it applies to array and slice values interpolated into a double-quoted string (or similar interpreted string). Default is a space. (Mnemonic: obvious, I think.) =item $SUBSCRIPT_SEPARATOR =item $SUBSEP =item $; The subscript separator for multidimensional array emulation. If you refer to a hash element as $foo{$a,$b,$c} it really means $foo{join($;, $a, $b, $c)} But don't put @foo{$a,$b,$c} # a slice--note the @ which means ($foo{$a},$foo{$b},$foo{$c}) Default is "\034", the same as SUBSEP in B. If your keys contain binary data there might not be any safe value for C<$;>. (Mnemonic: comma (the syntactic subscript separator) is a semi-semicolon. Yeah, I know, it's pretty lame, but C<$,> is already taken for something more important.) Consider using "real" multidimensional arrays as described in L. =item $OFMT =item $# The output format for printed numbers. This variable is a half-hearted attempt to emulate B's OFMT variable. There are times, however, when B and Perl have differing notions of what counts as numeric. The initial value is "%.Ig", where I is the value of the macro DBL_DIG from your system's F. This is different from B's default OFMT setting of "%.6g", so you need to set C<$#> explicitly to get B's value. (Mnemonic: # is the number sign.) Use of C<$#> is deprecated. =item format_page_number HANDLE EXPR =item $FORMAT_PAGE_NUMBER =item $% The current page number of the currently selected output channel. Used with formats. (Mnemonic: % is page number in B.) =item format_lines_per_page HANDLE EXPR =item $FORMAT_LINES_PER_PAGE =item $= The current page length (printable lines) of the currently selected output channel. Default is 60. Used with formats. (Mnemonic: = has horizontal lines.) =item format_lines_left HANDLE EXPR =item $FORMAT_LINES_LEFT =item $- The number of lines left on the page of the currently selected output channel. Used with formats. (Mnemonic: lines_on_page - lines_printed.) =item @LAST_MATCH_START =item @- $-[0] is the offset of the start of the last successful match. C<$-[>IC<]> is the offset of the start of the substring matched by I-th subpattern, or undef if the subpattern did not match. Thus after a match against $_, $& coincides with C. Similarly, C<$>I coincides with CIC<], $+[>IC<] - $-[>IC<]> if C<$-[>IC<]> is defined, and $+ coincides with C. One can use C<$#-> to find the last matched subgroup in the last successful match. Contrast with C<$#+>, the number of subgroups in the regular expression. Compare with C<@+>. This array holds the offsets of the beginnings of the last successful submatches in the currently active dynamic scope. C<$-[0]> is the offset into the string of the beginning of the entire match. The Ith element of this array holds the offset of the Ith submatch, so C<$+[1]> is the offset where $1 begins, C<$+[2]> the offset where $2 begins, and so on. You can use C<$#-> to determine how many subgroups were in the last successful match. Compare with the C<@+> variable. After a match against some variable $var: =over 5 =item C<$`> is the same as C =item C<$&> is the same as C =item C<$'> is the same as C =item C<$1> is the same as C =item C<$2> is the same as C =item C<$3> is the same as C =back =item format_name HANDLE EXPR =item $FORMAT_NAME =item $~ The name of the current report format for the currently selected output channel. Default is the name of the filehandle. (Mnemonic: brother to C<$^>.) =item format_top_name HANDLE EXPR =item $FORMAT_TOP_NAME =item $^ The name of the current top-of-page format for the currently selected output channel. Default is the name of the filehandle with _TOP appended. (Mnemonic: points to top of page.) =item format_line_break_characters HANDLE EXPR =item $FORMAT_LINE_BREAK_CHARACTERS =item $: The current set of characters after which a string may be broken to fill continuation fields (starting with ^) in a format. Default is S<" \n-">, to break on whitespace or hyphens. (Mnemonic: a "colon" in poetry is a part of a line.) =item format_formfeed HANDLE EXPR =item $FORMAT_FORMFEED =item $^L What formats output as a form feed. Default is \f. =item $ACCUMULATOR =item $^A The current value of the write() accumulator for format() lines. A format contains formline() calls that put their result into C<$^A>. After calling its format, write() prints out the contents of C<$^A> and empties. So you never really see the contents of C<$^A> unless you call formline() yourself and then look at it. See L and L. =item $CHILD_ERROR =item $? The status returned by the last pipe close, backtick (C<``>) command, successful call to wait() or waitpid(), or from the system() operator. This is just the 16-bit status word returned by the wait() system call (or else is made up to look like it). Thus, the exit value of the subprocess is really (C<<< $? >> 8 >>>), and C<$? & 127> gives which signal, if any, the process died from, and C<$? & 128> reports whether there was a core dump. (Mnemonic: similar to B and B.) Additionally, if the C variable is supported in C, its value is returned via $? if any C function fails. If you have installed a signal handler for C, the value of C<$?> will usually be wrong outside that handler. Inside an C subroutine C<$?> contains the value that is going to be given to C. You can modify C<$?> in an C subroutine to change the exit status of your program. For example: END { $? = 1 if $? == 255; # die would make it 255 } Under VMS, the pragma C makes C<$?> reflect the actual VMS exit status, instead of the default emulation of POSIX status. Also see L. =item $OS_ERROR =item $ERRNO =item $! If used numerically, yields the current value of the C C variable, with all the usual caveats. (This means that you shouldn't depend on the value of C<$!> to be anything in particular unless you've gotten a specific error return indicating a system error.) If used an a string, yields the corresponding system error string. You can assign a number to C<$!> to set I if, for instance, you want C<"$!"> to return the string for error I, or you want to set the exit value for the die() operator. (Mnemonic: What just went bang?) Also see L. =item $EXTENDED_OS_ERROR =item $^E Error information specific to the current operating system. At the moment, this differs from C<$!> under only VMS, OS/2, and Win32 (and for MacPerl). On all other platforms, C<$^E> is always just the same as C<$!>. Under VMS, C<$^E> provides the VMS status value from the last system error. This is more specific information about the last system error than that provided by C<$!>. This is particularly important when C<$!> is set to B. Under OS/2, C<$^E> is set to the error code of the last call to OS/2 API either via CRT, or directly from perl. Under Win32, C<$^E> always returns the last error information reported by the Win32 call C which describes the last error from within the Win32 API. Most Win32-specific code will report errors via C<$^E>. ANSI C and Unix-like calls set C and so most portable Perl code will report errors via C<$!>. Caveats mentioned in the description of C<$!> generally apply to C<$^E>, also. (Mnemonic: Extra error explanation.) Also see L. =item $EVAL_ERROR =item $@ The Perl syntax error message from the last eval() operator. If null, the last eval() parsed and executed correctly (although the operations you invoked may have failed in the normal fashion). (Mnemonic: Where was the syntax error "at"?) Warning messages are not collected in this variable. You can, however, set up a routine to process warnings by setting C<$SIG{__WARN__}> as described below. Also see L. =item $PROCESS_ID =item $PID =item $$ The process number of the Perl running this script. You should consider this variable read-only, although it will be altered across fork() calls. (Mnemonic: same as shells.) =item $REAL_USER_ID =item $UID =item $< The real uid of this process. (Mnemonic: it's the uid you came I, if you're running setuid.) =item $EFFECTIVE_USER_ID =item $EUID =item $> The effective uid of this process. Example: $< = $>; # set real to effective uid ($<,$>) = ($>,$<); # swap real and effective uid (Mnemonic: it's the uid you went I, if you're running setuid.) C<< $< >> and C<< $> >> can be swapped only on machines supporting setreuid(). =item $REAL_GROUP_ID =item $GID =item $( The real gid of this process. If you are on a machine that supports membership in multiple groups simultaneously, gives a space separated list of groups you are in. The first number is the one returned by getgid(), and the subsequent ones by getgroups(), one of which may be the same as the first number. However, a value assigned to C<$(> must be a single number used to set the real gid. So the value given by C<$(> should I be assigned back to C<$(> without being forced numeric, such as by adding zero. (Mnemonic: parentheses are used to I things. The real gid is the group you I, if you're running setgid.) =item $EFFECTIVE_GROUP_ID =item $EGID =item $) The effective gid of this process. If you are on a machine that supports membership in multiple groups simultaneously, gives a space separated list of groups you are in. The first number is the one returned by getegid(), and the subsequent ones by getgroups(), one of which may be the same as the first number. Similarly, a value assigned to C<$)> must also be a space-separated list of numbers. The first number sets the effective gid, and the rest (if any) are passed to setgroups(). To get the effect of an empty list for setgroups(), just repeat the new effective gid; that is, to force an effective gid of 5 and an effectively empty setgroups() list, say C< $) = "5 5" >. (Mnemonic: parentheses are used to I things. The effective gid is the group that's I for you, if you're running setgid.) C<< $< >>, C<< $> >>, C<$(> and C<$)> can be set only on machines that support the corresponding I routine. C<$(> and C<$)> can be swapped only on machines supporting setregid(). =item $PROGRAM_NAME =item $0 Contains the name of the program being executed. On some operating systems assigning to C<$0> modifies the argument area that the B program sees. This is more useful as a way of indicating the current program state than it is for hiding the program you're running. (Mnemonic: same as B and B.) Note for BSD users: setting C<$0> does not completely remove "perl" from the ps(1) output. For example, setting C<$0> to C<"foobar"> will result in C<"perl: foobar (perl)">. This is an operating system feature. =item $[ The index of the first element in an array, and of the first character in a substring. Default is 0, but you could theoretically set it to 1 to make Perl behave more like B (or Fortran) when subscripting and when evaluating the index() and substr() functions. (Mnemonic: [ begins subscripts.) As of release 5 of Perl, assignment to C<$[> is treated as a compiler directive, and cannot influence the behavior of any other file. Its use is highly discouraged. =item $] The version + patchlevel / 1000 of the Perl interpreter. This variable can be used to determine whether the Perl interpreter executing a script is in the right range of versions. (Mnemonic: Is this version of perl in the right bracket?) Example: warn "No checksumming!\n" if $] < 3.019; See also the documentation of C and C for a convenient way to fail if the running Perl interpreter is too old. The use of this variable is deprecated. The floating point representation can sometimes lead to inaccurate numeric comparisons. See C<$^V> for a more modern representation of the Perl version that allows accurate string comparisons. =item $COMPILING =item $^C The current value of the flag associated with the B<-c> switch. Mainly of use with B<-MO=...> to allow code to alter its behavior when being compiled, such as for example to AUTOLOAD at compile time rather than normal, deferred loading. See L. Setting C<$^C = 1> is similar to calling C. =item $DEBUGGING =item $^D The current value of the debugging flags. (Mnemonic: value of B<-D> switch.) =item $SYSTEM_FD_MAX =item $^F The maximum system file descriptor, ordinarily 2. System file descriptors are passed to exec()ed processes, while higher file descriptors are not. Also, during an open(), system file descriptors are preserved even if the open() fails. (Ordinary file descriptors are closed before the open() is attempted.) The close-on-exec status of a file descriptor will be decided according to the value of C<$^F> when the corresponding file, pipe, or socket was opened, not the time of the exec(). =item $^H WARNING: This variable is strictly for internal use only. Its availability, behavior, and contents are subject to change without notice. This variable contains compile-time hints for the Perl interpreter. At the end of compilation of a BLOCK the value of this variable is restored to the value when the interpreter started to compile the BLOCK. When perl begins to parse any block construct that provides a lexical scope (e.g., eval body, required file, subroutine body, loop body, or conditional block), the existing value of $^H is saved, but its value is left unchanged. When the compilation of the block is completed, it regains the saved value. Between the points where its value is saved and restored, code that executes within BEGIN blocks is free to change the value of $^H. This behavior provides the semantic of lexical scoping, and is used in, for instance, the C pragma. The contents should be an integer; different bits of it are used for different pragmatic flags. Here's an example: sub add_100 { $^H |= 0x100 } sub foo { BEGIN { add_100() } bar->baz($boon); } Consider what happens during execution of the BEGIN block. At this point the BEGIN block has already been compiled, but the body of foo() is still being compiled. The new value of $^H will therefore be visible only while the body of foo() is being compiled. Substitution of the above BEGIN block with: BEGIN { require strict; strict->import('vars') } demonstrates how C is implemented. Here's a conditional version of the same lexical pragma: BEGIN { require strict; strict->import('vars') if $condition } =item %^H WARNING: This variable is strictly for internal use only. Its availability, behavior, and contents are subject to change without notice. The %^H hash provides the same scoping semantic as $^H. This makes it useful for implementation of lexically scoped pragmas. =item $INPLACE_EDIT =item $^I The current value of the inplace-edit extension. Use C to disable inplace editing. (Mnemonic: value of B<-i> switch.) =item $^M By default, running out of memory is an untrappable, fatal error. However, if suitably built, Perl can use the contents of C<$^M> as an emergency memory pool after die()ing. Suppose that your Perl were compiled with -DPERL_EMERGENCY_SBRK and used Perl's malloc. Then $^M = 'a' x (1 << 16); would allocate a 64K buffer for use in an emergency. See the F file in the Perl distribution for information on how to enable this option. To discourage casual use of this advanced feature, there is no L long name for this variable. =item $OSNAME =item $^O The name of the operating system under which this copy of Perl was built, as determined during the configuration process. The value is identical to C<$Config{'osname'}>. See also L and the B<-V> command-line switch documented in L. =item $PERLDB =item $^P The internal variable for debugging support. The meanings of the various bits are subject to change, but currently indicate: =over 6 =item 0x01 Debug subroutine enter/exit. =item 0x02 Line-by-line debugging. =item 0x04 Switch off optimizations. =item 0x08 Preserve more data for future interactive inspections. =item 0x10 Keep info about source lines on which a subroutine is defined. =item 0x20 Start with single-step on. =item 0x40 Use subroutine address instead of name when reporting. =item 0x80 Report C as well. =item 0x100 Provide informative "file" names for evals based on the place they were compiled. =item 0x200 Provide informative names to anonymous subroutines based on the place they were compiled. =back Some bits may be relevant at compile-time only, some at run-time only. This is a new mechanism and the details may change. =item $LAST_REGEXP_CODE_RESULT =item $^R The result of evaluation of the last successful C<(?{ code })> regular expression assertion (see L). May be written to. =item $EXCEPTIONS_BEING_CAUGHT =item $^S Current state of the interpreter. Undefined if parsing of the current module/eval is not finished (may happen in $SIG{__DIE__} and $SIG{__WARN__} handlers). True if inside an eval(), otherwise false. =item $BASETIME =item $^T The time at which the program began running, in seconds since the epoch (beginning of 1970). The values returned by the B<-M>, B<-A>, and B<-C> filetests are based on this value. =item $PERL_VERSION =item $^V The revision, version, and subversion of the Perl interpreter, represented as a string composed of characters with those ordinals. Thus in Perl v5.6.0 it equals C and will return true for C<$^V eq v5.6.0>. Note that the characters in this string value can potentially be in Unicode range. This can be used to determine whether the Perl interpreter executing a script is in the right range of versions. (Mnemonic: use ^V for Version Control.) Example: warn "No \"our\" declarations!\n" if $^V and $^V lt v5.6.0; See the documentation of C and C for a convenient way to fail if the running Perl interpreter is too old. See also C<$]> for an older representation of the Perl version. =item $WARNING =item $^W The current value of the warning switch, initially true if B<-w> was used, false otherwise, but directly modifiable. (Mnemonic: related to the B<-w> switch.) See also L. =item ${^WARNING_BITS} The current set of warning checks enabled by the C pragma. See the documentation of C for more details. =item ${^WIDE_SYSTEM_CALLS} Global flag that enables system calls made by Perl to use wide character APIs native to the system, if available. This is currently only implemented on the Windows platform. This can also be enabled from the command line using the C<-C> switch. The initial value is typically C<0> for compatibility with Perl versions earlier than 5.6, but may be automatically set to C<1> by Perl if the system provides a user-settable default (e.g., C<$ENV{LC_CTYPE}>). The C pragma always overrides the effect of this flag in the current lexical scope. See L. =item $EXECUTABLE_NAME =item $^X The name that the Perl binary itself was executed as, from C's C. This may not be a full pathname, nor even necessarily in your path. =item $ARGV contains the name of the current file when reading from <>. =item @ARGV The array @ARGV contains the command-line arguments intended for the script. C<$#ARGV> is generally the number of arguments minus one, because C<$ARGV[0]> is the first argument, I the program's command name itself. See C<$0> for the command name. =item @INC The array @INC contains the list of places that the C, C, or C constructs look for their library files. It initially consists of the arguments to any B<-I> command-line switches, followed by the default Perl library, probably F, followed by ".", to represent the current directory. If you need to modify this at runtime, you should use the C pragma to get the machine-dependent library properly loaded also: use lib '/mypath/libdir/'; use SomeMod; =item @_ Within a subroutine the array @_ contains the parameters passed to that subroutine. See L. =item %INC The hash %INC contains entries for each filename included via the C, C, or C operators. The key is the filename you specified (with module names converted to pathnames), and the value is the location of the file found. The C operator uses this hash to determine whether a particular file has already been included. =item %ENV =item $ENV{expr} The hash %ENV contains your current environment. Setting a value in C changes the environment for any child processes you subsequently fork() off. =item %SIG =item $SIG{expr} The hash %SIG contains signal handlers for signals. For example: sub handler { # 1st argument is signal name my($sig) = @_; print "Caught a SIG$sig--shutting down\n"; close(LOG); exit(0); } $SIG{'INT'} = \&handler; $SIG{'QUIT'} = \&handler; ... $SIG{'INT'} = 'DEFAULT'; # restore default action $SIG{'QUIT'} = 'IGNORE'; # ignore SIGQUIT Using a value of C<'IGNORE'> usually has the effect of ignoring the signal, except for the C signal. See L for more about this special case. Here are some other examples: $SIG{"PIPE"} = "Plumber"; # assumes main::Plumber (not recommended) $SIG{"PIPE"} = \&Plumber; # just fine; assume current Plumber $SIG{"PIPE"} = *Plumber; # somewhat esoteric $SIG{"PIPE"} = Plumber(); # oops, what did Plumber() return?? Be sure not to use a bareword as the name of a signal handler, lest you inadvertently call it. If your system has the sigaction() function then signal handlers are installed using it. This means you get reliable signal handling. If your system has the SA_RESTART flag it is used when signals handlers are installed. This means that system calls for which restarting is supported continue rather than returning when a signal arrives. If you want your system calls to be interrupted by signal delivery then do something like this: use POSIX ':signal_h'; my $alarm = 0; sigaction SIGALRM, new POSIX::SigAction sub { $alarm = 1 } or die "Error setting SIGALRM handler: $!\n"; See L. Certain internal hooks can be also set using the %SIG hash. The routine indicated by C<$SIG{__WARN__}> is called when a warning message is about to be printed. The warning message is passed as the first argument. The presence of a __WARN__ hook causes the ordinary printing of warnings to STDERR to be suppressed. You can use this to save warnings in a variable, or turn warnings into fatal errors, like this: local $SIG{__WARN__} = sub { die $_[0] }; eval $proggie; The routine indicated by C<$SIG{__DIE__}> is called when a fatal exception is about to be thrown. The error message is passed as the first argument. When a __DIE__ hook routine returns, the exception processing continues as it would have in the absence of the hook, unless the hook routine itself exits via a C, a loop exit, or a die(). The C<__DIE__> handler is explicitly disabled during the call, so that you can die from a C<__DIE__> handler. Similarly for C<__WARN__>. Due to an implementation glitch, the C<$SIG{__DIE__}> hook is called even inside an eval(). Do not use this to rewrite a pending exception in C<$@>, or as a bizarre substitute for overriding CORE::GLOBAL::die(). This strange action at a distance may be fixed in a future release so that C<$SIG{__DIE__}> is only called if your program is about to exit, as was the original intent. Any other use is deprecated. C<__DIE__>/C<__WARN__> handlers are very special in one respect: they may be called to report (probable) errors found by the parser. In such a case the parser may be in inconsistent state, so any attempt to evaluate Perl code from such a handler will probably result in a segfault. This means that warnings or errors that result from parsing Perl should be used with extreme caution, like this: require Carp if defined $^S; Carp::confess("Something wrong") if defined &Carp::confess; die "Something wrong, but could not load Carp to give backtrace... To see backtrace try starting Perl with -MCarp switch"; Here the first line will load Carp I it is the parser who called the handler. The second line will print backtrace and die if Carp was available. The third line will be executed only if Carp was not available. See L, L, L, and L for additional information. =back =head2 Error Indicators The variables C<$@>, C<$!>, C<$^E>, and C<$?> contain information about different types of error conditions that may appear during execution of a Perl program. The variables are shown ordered by the "distance" between the subsystem which reported the error and the Perl process. They correspond to errors detected by the Perl interpreter, C library, operating system, or an external program, respectively. To illustrate the differences between these variables, consider the following Perl expression, which uses a single-quoted string: eval q{ open PIPE, "/cdrom/install |"; @res = ; close PIPE or die "bad pipe: $?, $!"; }; After execution of this statement all 4 variables may have been set. C<$@> is set if the string to be C-ed did not compile (this may happen if C or C were imported with bad prototypes), or if Perl code executed during evaluation die()d . In these cases the value of $@ is the compile error, or the argument to C (which will interpolate C<$!> and C<$?>!). (See also L, though.) When the eval() expression above is executed, open(), C<< >>, and C are translated to calls in the C run-time library and thence to the operating system kernel. C<$!> is set to the C library's C if one of these calls fails. Under a few operating systems, C<$^E> may contain a more verbose error indicator, such as in this case, "CDROM tray not closed." Systems that do not support extended error messages leave C<$^E> the same as C<$!>. Finally, C<$?> may be set to non-0 value if the external program F fails. The upper eight bits reflect specific error conditions encountered by the program (the program's exit() value). The lower eight bits reflect mode of failure, like signal death and core dump information See wait(2) for details. In contrast to C<$!> and C<$^E>, which are set only if error condition is detected, the variable C<$?> is set on each C or pipe C, overwriting the old value. This is more like C<$@>, which on every eval() is always set on failure and cleared on success. For more details, see the individual descriptions at C<$@>, C<$!>, C<$^E>, and C<$?>. =head2 Technical Note on the Syntax of Variable Names Variable names in Perl can have several formats. Usually, they must begin with a letter or underscore, in which case they can be arbitrarily long (up to an internal limit of 251 characters) and may contain letters, digits, underscores, or the special sequence C<::> or C<'>. In this case, the part before the last C<::> or C<'> is taken to be a I; see L. Perl variable names may also be a sequence of digits or a single punctuation or control character. These names are all reserved for special uses by Perl; for example, the all-digits names are used to hold data captured by backreferences after a regular expression match. Perl has a special syntax for the single-control-character names: It understands C<^X> (caret C) to mean the control-C character. For example, the notation C<$^W> (dollar-sign caret C) is the scalar variable whose name is the single character control-C. This is better than typing a literal control-C into your program. Finally, new in Perl 5.6, Perl variable names may be alphanumeric strings that begin with control characters (or better yet, a caret). These variables must be written in the form C<${^Foo}>; the braces are not optional. C<${^Foo}> denotes the scalar variable whose name is a control-C followed by two C's. These variables are reserved for future special uses by Perl, except for the ones that begin with C<^_> (control-underscore or caret-underscore). No control-character name that begins with C<^_> will acquire a special meaning in any future version of Perl; such names may therefore be used safely in programs. C<$^_> itself, however, I reserved. Perl identifiers that begin with digits, control characters, or punctuation characters are exempt from the effects of the C declaration and are always forced to be in package C
. A few other names are also exempt: ENV STDIN INC STDOUT ARGV STDERR ARGVOUT SIG In particular, the new special C<${^_XYZ}> variables are always taken to be in package C
, regardless of any C declarations presently in scope. =head1 BUGS Due to an unfortunate accident of Perl's implementation, C imposes a considerable performance penalty on all regular expression matches in a program, regardless of whether they occur in the scope of C. For that reason, saying C in libraries is strongly discouraged. See the Devel::SawAmpersand module documentation from CPAN (http://www.perl.com/CPAN/modules/by-module/Devel/) for more information. Having to even think about the C<$^S> variable in your exception handlers is simply wrong. C<$SIG{__DIE__}> as currently implemented invites grievous and difficult to track down errors. Avoid it and use an C or CORE::GLOBAL::die override instead. Pod-Simple-3.43/t/rtf_utf8.t0000644000175000017500000001526714062242376013772 0ustar khwkhw#!/usr/bin/perl -w # t/rtf_utf8.t - Check that RTF works with UTF-8 input BEGIN { chdir 't' if -d 't'; } my $expected = join "", ; use strict; use warnings; use lib '../lib'; use Test::More; use File::Spec; if ($] < 5.008) { plan skip_all => "Doesn't work before 5.8"; } else { plan tests => 5; } for my $format (qw(RTF)) { my $class = "Pod::Simple::RTF"; use_ok $class or next; ok my $parser = $class->new, "Construct RTF parser"; my $output = ''; ok $parser->output_string(\$output), "Set RTF output string"; ok $parser->parse_file(File::Spec->catfile(qw(corpus polish_utf8.txt))), "Parse to RTF via parse_file()"; $output =~ s/\\info.*?author \[see doc\]\}/VARIANT TEXT DELETED/s; $output =~ s/$/\n/; my $msg = "got expected output"; if ($output eq $expected) { pass($msg); } elsif ($ENV{PERL_TEST_DIFF}) { fail($msg); require File::Temp; my $orig_file = File::Temp->new(); local $/ = "\n"; chomp $expected; print $orig_file $expected, "\n"; close $orig_file || die "Can't close orig_file: $!"; chomp $output; my $parsed_file = File::Temp->new(); print $parsed_file $output, "\n"; close $parsed_file || die "Can't close parsed_file"; my $diff = File::Temp->new(); system("$ENV{PERL_TEST_DIFF} $orig_file $parsed_file > $diff"); open my $fh, "<", $diff || die "Can't open $diff"; my @diffs = <$fh>; diag(@diffs); } else { eval { require Text::Diff; }; if ($@) { is($output, $expected, $msg); diag("Set environment variable PERL_TEST_DIFF=diff_tool or install" . " Text::Diff to see just the differences."); } else { fail($msg); diag Text::Diff::diff(\$expected, \$output, { STYLE => 'Unified' }); } } } __DATA__ {\rtf1\ansi\deff0 {\fonttbl {\f0\froman Times New Roman;} {\f1\fmodern Courier New;} {\f2\fswiss Arial;} } {\stylesheet {\snext0 Normal;} {\*\cs10 \additive Default Paragraph Font;} {\*\cs16 \additive \i \sbasedon10 pod-I;} {\*\cs17 \additive \i\lang1024\noproof \sbasedon10 pod-F;} {\*\cs18 \additive \b \sbasedon10 pod-B;} {\*\cs19 \additive \f1\lang1024\noproof\sbasedon10 pod-C;} {\s20\ql \li0\ri0\sa180\widctlpar\f1\fs18\lang1024\noproof\sbasedon0 \snext0 pod-codeblock;} {\*\cs21 \additive \lang1024\noproof \sbasedon10 pod-computerese;} {\*\cs22 \additive \i\lang1024\noproof\sbasedon10 pod-L-pod;} {\*\cs23 \additive \i\lang1024\noproof\sbasedon10 pod-L-url;} {\*\cs24 \additive \i\lang1024\noproof\sbasedon10 pod-L-man;} {\*\cs25 \additive \f1\lang1024\noproof\sbasedon0 pod-codelbock-plain;} {\*\cs26 \additive \f1\lang1024\noproof\sbasedon25 pod-codelbock-ital;} {\*\cs27 \additive \f1\lang1024\noproof\sbasedon25 pod-codelbock-bold;} {\*\cs28 \additive \f1\lang1024\noproof\sbasedon25 pod-codelbock-bold-ital;} {\s31\ql \keepn\sb90\sa180\f2\fs32\ul\sbasedon0 \snext0 pod-head1;} {\s32\ql \keepn\sb90\sa180\f2\fs28\ul\sbasedon0 \snext0 pod-head2;} {\s33\ql \keepn\sb90\sa180\f2\fs25\ul\sbasedon0 \snext0 pod-head3;} {\s34\ql \keepn\sb90\sa180\f2\fs22\ul\sbasedon0 \snext0 pod-head4;} } {\colortbl;\red255\green0\blue0;\red0\green0\blue255;} {VARIANT TEXT DELETED{\company [see doc]}{\operator [see doc]} } \deflang1033\plain\lang1033\widowctrl {\header\pard\qr\plain\f2\fs17 W\uc1\u346?R\'d3D NOCNEJ CISZY \_\_ explicitly utf8 test document in Polish, p.\chpgn\par} \fs25 {\pard\li0\s31\keepn\sb90\sa180\f2\fs32\ul{ NAME }\par} {\pard\li0\sa180 W\uc1\u346?R\'d3D NOCNEJ CISZY \_\_ explicitly utf8 test document in Polish \par} {\pard\li0\s31\keepn\sb90\sa180\f2\fs32\ul{ DESCRIPTION }\par} {\pard\li0\sa180 This is a test Pod document in UT\'468. Its content is the lyrics to the Polish Christmas carol "W\uc1\u347?r\'f3d nocnej ciszy", except it includes a few lines to test RT\'46 specially. \par} {\pard\li0\sa180 \uc1\u-1280? is a character in the upper half of Plane 0, so should be negative in RT\'46 \uc1\u-10187\u-8904? is a character in Plane 1, so should be expressed as a surrogate pair in RT\'46 \par} {\pard\li0\sa180 All the ASCII printables !"#$%&\'5c'()*+,\_./0123456789:;<=>?@ ABCDE\'46GHIJKLMNOPQRSTUVWXYZ[{ \cs21\lang1024\noproof \'5c]^\'5f`} abcdefghijklmnopqrstuvwxyz\'7b|\'7d~ \par} {\pard\li0\sa180 W\uc1\u347?r\'f3d nocnej ciszy g\uc1\u322?os si\uc1\u281? rozchodzi: / Wsta\uc1\u324?cie, pasterze, B\'f3g si\uc1\u281? nam rodzi! / Czym pr\uc1\u281?dzej si\uc1\u281? wybierajcie, / Do Betlejem pospieszajcie / Przywita\uc1\u263? Pana. \par} {\pard\li0\sa180 Poszli, znale\uc1\u378?li Dzieci\uc1\u261?tko w \uc1\u380?\uc1\u322?obie / Z wszystkimi znaki danymi sobie. / Jako Bogu cze\uc1\u347?\uc1\u263? Mu dali, / A witaj\uc1\u261?c zawo\uc1\u322?ali / Z wielkiej rado\uc1\u347?ci: \par} {\pard\li0\sa180 Ach, witaj Zbawco z dawno \uc1\u380?\uc1\u261?dany, / Wiele tysi\uc1\u281?cy lat wygl\uc1\u261?dany / Na Ciebie kr\'f3le, prorocy / Czekali, a Ty\uc1\u347? tej nocy / Nam si\uc1\u281? objawi\uc1\u322?. \par} {\pard\li0\sa180 I my czekamy na Ciebie, Pana, / A skoro przyjdziesz na g\uc1\u322?os kap\uc1\u322?ana, / Padniemy na twarz przed Tob\uc1\u261?, / Wierz\uc1\u261?c, \uc1\u380?e\uc1\u347? jest pod os\uc1\u322?on\uc1\u261? / Chleba i wina. \par} {\pard\li0\s32\keepn\sb90\sa180\f2\fs28\ul{ As Verbatim }\par} {\pard\li0\sa180 And now as verbatim text: \par} {\pard\li0\plain\s20\sa180\f1\fs18\lang1024\noproof \uc1\u-1280? upper half, Plane 0\line \uc1\u-10187\u-8904? Plane 1\line \line All the ASCII printables\line !"#$%&\'5c'()*+,-./0123456789:;<=>?@\line ABCDE\'46GHIJKLMNOPQRSTUVWXYZ[\'5c]^\'5f`\line abcdefghijklmnopqrstuvwxyz\'7b|\'7d~\line \line W\uc1\u347?r\'f3d nocnej ciszy g\uc1\u322?os si\uc1\u281? rozchodzi:\line Wsta\uc1\u324?cie, pasterze, B\'f3g si\uc1\u281? nam rodzi!\line Czym pr\uc1\u281?dzej si\uc1\u281? wybierajcie,\line Do Betlejem pospieszajcie\line Przywita\uc1\u263? Pana.\line \line Poszli, znale\uc1\u378?li Dzieci\uc1\u261?tko w \uc1\u380?\uc1\u322?obie\line Z wszystkimi znaki danymi sobie.\line Jako Bogu cze\uc1\u347?\uc1\u263? Mu dali,\line A witaj\uc1\u261?c zawo\uc1\u322?ali\line Z wielkiej rado\uc1\u347?ci:\line \line Ach, witaj Zbawco z dawno \uc1\u380?\uc1\u261?dany,\line Wiele tysi\uc1\u281?cy lat wygl\uc1\u261?dany\line Na Ciebie kr\'f3le, prorocy\line Czekali, a Ty\uc1\u347? tej nocy\line Nam si\uc1\u281? objawi\uc1\u322?.\line \line I my czekamy na Ciebie, Pana,\line A skoro przyjdziesz na g\uc1\u322?os kap\uc1\u322?ana,\line Padniemy na twarz przed Tob\uc1\u261?,\line Wierz\uc1\u261?c, \uc1\u380?e\uc1\u347? jest pod os\uc1\u322?on\uc1\u261?\line Chleba i wina. \par} {\pard\li0\sa180 [end] \par} } Pod-Simple-3.43/t/junk1.pod0000644000175000017500000000006414062242376013565 0ustar khwkhw =cut =head9 I like pie B Pod-Simple-3.43/t/items.t0000644000175000017500000002104314062242376013337 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 24 }; my $d; #use Pod::Simple::Debug (\$d,0); BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; my $x = 'Pod::Simple::XMLOutStream'; print "##### Tests for =item directives via class $x\n"; $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output print "#\n# Tests for simple =item *'s\n"; ok( $x->_out("\n=over\n\n=item *\n\nStuff\n\n=item *\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over\n\n=item *\n\nStuff\n\n=cut\n\nStuff\n\n=item *\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over 10\n\n=item *\n\nStuff\n\n=cut\n\nStuff\n\n=item *\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over\n\n=item *\n\nStuff\n=cut\nStuff\n\n=item *\n\nBar I!\n\n=back"), 'StuffBar baz!' ); print "#\n# Tests for simple =item 1.'s\n"; ok( $x->_out("\n=over\n\n=item 1.\n\nStuff\n\n=item 2.\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over\n\n=item 1.\n\nStuff\n\n=cut\n\nStuff\n\n=item 2.\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); # Now without a dot ok( $x->_out("\n=over\n\n=item 1\n\nStuff\n\n=cut\n\nStuff\n\n=item 2\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over\n\n=item 1\n\nStuff\n=cut\nStuff\n\n=item 2\n\nBar I!\n\n=back"), 'StuffBar baz!' ); print "#\n# Tests for =over blocks (without =items)\n"; ok( $x->_out("\n=over\n\nStuff\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over\n\n Stuff\n\nBar I!\n\n=back\n\n"), ' StuffBar baz!' ); ok( $x->_out("\n=over\n\nBar I!\n\n Stuff\n\n=back\n\n"), 'Bar baz! Stuff' ); print "#\n# Tests for =item Text blocks...\n"; ok( $x->_out("\n=over\n\n=item Foo\n\nStuff\n\n=cut\n\nCrunk\nZorp\n\n=item Bar I!\n\nQuux\n\n=back\n\n"), 'FooStuffBar baz!Quux' ); ok( $x->_out("\n=over\n\n=item Foo\n\n Stuff\n\tSnork\n\n=cut\n\nCrunk\nZorp\n\n=item Bar I!\n\nQuux\n\n=back\n\n"), qq{Foo Stuff\n Snork} . qq{Bar baz!Quux} ); ok( $x->_out("\n=over\n\n=item Foo\n\n Stuff\n\tSnork\n=cut\n\nCrunk\nZorp\n\n=item Bar I!\n\nQuux\n\n=back\n\n"), qq{Foo Stuff\n Snork} . qq{Bar baz!Quux} ); print "#\n# Test for mixed =item blocks...\n"; ok( $x->_out( sub { $_[0]->no_errata_section(1) }, # We know this will complain "\n=over\n\n=item Foo\n\nStuff\n\n=item 2.\n\nBar I!\n\nQuux\n\n=item *\n\nThwoong\n\n=back\n\n"), qq{FooStuff} . qq{2.Bar baz!Quux} . qq{*Thwoong} ); # ok( $x->_out("\n=over\n\n=item *\n\nStuff\n\n=item 2.\n\nBar I!\n\nQuux\n\n=item *\n\nThwoong\n\n=back\n\n"), # ok( $x->_out("\n=over\n\n=item 1.\n\nStuff\n\n=item 2.\n\nBar I!\n\nQuux\n\n=item *\n\nThwoong\n\n=back\n\n"), print "#\n# Tests for indenting\n"; ok( $x->_out("\n=over 19\n\n=item *\n\nStuff\n\n=item *\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over 19\n\n=item 1.\n\nStuff\n\n=item 2.\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over 19\n\nStuff\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over 19\n\n=item Foo\n\nStuff\n\n=cut\n\nCrunk\nZorp\n\n=item Bar I!\n\nQuux\n\n=back\n\n"), 'FooStuffBar baz!Quux' ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Now testing nesting...\n"; ok( $x->_out(join "\n\n", '', '=over', '=item *', 'Stuff', '=cut', 'Stuff', '=over', '=item 1.', '=item 2.', 'Bar I!', '=back', '=item *', 'Bar I!', '=back', '' ), join '', '', '', 'Stuff', '', '', 'Bar baz!', '', 'Bar baz!', '' ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ok( $x->_out( join "\n\n", '', '', '=over', '=item *', 'Stuff', '=cut', 'Stuff', '=over', '=item 1.', '=over 19', 'Gleiven', 'Squim F<.thingrc>!', '=back', '=item 2.', 'Bar I!', '=back', '=item *', 'Bar I!', '=back', '', '' ), join '', '', '', 'Stuff', '', '', '', 'Gleiven', 'Squim .thingrc!', '', 'Bar baz!', '', 'Bar baz!', '' ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $d = 11; print "# Now checking that document-end closes things right...\n"; ok( $x->_out( # We know there'd be a warning about implicit =back; disable it! sub { $_[0]->no_whining(1); }, join( "\n\n", '', '', '=over', '=item *', 'Stuff', '=cut', 'Stuff', '=over', '=item 1.', '=over 19', 'Gleiven', 'Squim F<.thingrc>!', '', '', ), ), join '', '', '', 'Stuff', '', '', '', 'Gleiven', 'Squim .thingrc!', '', '', '' ); # TODO: more checking of coercion in nesting? print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/x_nixer.t0000644000175000017500000001136214062242377013676 0ustar khwkhw use strict; use warnings; use Test; BEGIN { plan tests => 11 }; my $d; #use Pod::Simple::Debug (\$d, 0); ok 1; use Pod::Simple::XMLOutStream; use Pod::Simple::DumpAsXML; $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output print "# A simple sanity test...\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), 'foo bar stuff thingbaz' ); print "# With lots of nesting, and Z's...\n"; ok( Pod::Simple::XMLOutStream->_out("=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), 'foo bar stuff thingbaz' ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub mergy {$_[0]->merge_text(1)} sub nixy {$_[0]->nix_X_codes(1)} sub nixy_mergy {$_[0]->merge_text(1); $_[0]->nix_X_codes(1);} #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# With no F/X\n"; ok( Pod::Simple::DumpAsXML->_out( "=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), join "\n", '', ' ', ' ', ' ', ' foo', ' ', ' ', ' ', ' bar', ' ', ' ', ' ', ' ', ' stuff ', ' ', ' thing', ' ', ' baz', ' ', ' ', '', '', ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# with just X-nixing...\n"; ok( Pod::Simple::DumpAsXML->_out( \&nixy, "=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), join "\n", '', ' ', ' ', ' ', ' foo', ' ', ' ', ' ', ' bar', ' ', ' ', ' ', ' ', ' stuff baz', ' ', ' ', '', '', ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# With merging...\n"; ok( Pod::Simple::DumpAsXML->_out( \&mergy, "=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), join "\n", '', ' ', ' ', ' ', ' foo', ' ', ' ', ' ', ' bar', ' ', ' ', ' ', ' ', ' stuff ', ' ', ' thing', ' ', ' baz', ' ', ' ', '', '', ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# With nixing and merging...\n"; #$d = 10; ok( Pod::Simple::DumpAsXML->_out( \&nixy_mergy, "=pod\n\nZ<>FfE<111>o> I> B>baz>\n"), join "\n", '', ' ', ' ', ' ', ' foo', ' ', ' ', ' ', ' bar', ' ', ' ', ' ', ' ', ' stuff baz', ' ', ' ', '', '', ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Now the scary bits... with L's! print "# A wee L<...> sanity test...\n"; ok( Pod::Simple::XMLOutStream->_out(qq{=pod\n\nLet::Ping/Ping-E<112>ong>\n}), '"Ping-pong" in Net::Ping' ); print "# Now a wee L<...> with mergy...\n"; $d = 10; ok( Pod::Simple::DumpAsXML->_out(\&mergy, qq{=pod\n\nLet::Ping/Ping-E<112>ong>\n}), join "\n", '', ' ', ' ', ' "Ping-pong" in Net::Ping', ' ', ' ', '', '' ); print "# Now a complex tree with L's, with nixy+mergy...\n"; ok( Pod::Simple::DumpAsXML->_out( \&nixy_mergy, "=pod\n\nZ<>FfE<111>Let::Ping/Ping-E<112>ong>o> I> B>baz>\n"), join "\n", '', ' ', ' ', ' ', ' fo', ' ', ' "Ping-pong" in Net::Ping', ' ', ' o', ' ', ' ', ' ', ' bar', ' ', ' ', ' ', ' ', ' stuff baz', ' ', ' ', '', '', ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/end_over.t0000644000175000017500000000342114062242376014017 0ustar khwkhw# head ends over BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 7 }; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import('f'); } my $d; #use Pod::Simple::Debug (\$d,0); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; sub nowhine { $_[0]->{'no_whining'} = 1; } &ok(f( \&nowhine, "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=head1 SVUP\n\nMyup.", "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=back\n\n=head1 SVUP\n\nMyup.", )); &ok(f( \&nowhine, "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=head2 SVUP\n\nMyup.", "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=back\n\n=head2 SVUP\n\nMyup.", )); &ok(f( \&nowhine, "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=head3 SVUP\n\nMyup.", "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=back\n\n=head3 SVUP\n\nMyup.", )); &ok(f( \&nowhine, "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=head4 SVUP\n\nMyup.", "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=back\n\n=head4 SVUP\n\nMyup.", )); &ok(f( \&nowhine, "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=head5 SVUP\n\nMyup.", "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=back\n\n=head5 SVUP\n\nMyup.", )); &ok(f( \&nowhine, "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=head6 SVUP\n\nMyup.", "=head2 BLOOP\n\nHoopbehwo!\n\n=over\n\n=item Stuff. Um.\n\nBrop.\n\n=back\n\n=head6 SVUP\n\nMyup.", )); __END__ Pod-Simple-3.43/t/fake-closers.t0000644000175000017500000000272014062242376014575 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use Test::More; use Data::Dumper; BEGIN { plan tests => 9 }; ok 1; my $i = 0; print "# Real closers ...\n"; for my $pod ( "=over\n\nblock\n\n=back", "=over\n\nblock\n\n=cut\n\ncode\n\n=pod\n\n=back", "=begin html\n\ntag\n\n=end html", ) { my $parser = Pod::Simple::Blurb->new(); $parser->parse_string_document($pod); is($parser->{'closer-flag'}, -1, "real closer ". ++$i); } $i = 0; print "# Fake closers ...\n"; for my $pod ("=begin html\n\ntag=cut", "=begin html\n\ntag\n\n=begin xml tag =end xml", "=over\n\nblock=cut", "=over\n\nanother block", ) { my $parser = Pod::Simple::Blurb->new(); $parser->parse_string_document($pod); is($parser->{'closer-flag'}, 1, "fake closer ". ++$i); } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; 1; package Pod::Simple::Blurb; use warnings; use strict; use base qw/Pod::Simple::Methody/; sub new { my $new = shift->SUPER::new(@_); $new->output_string(\my $doesnotmatter); $new->accept_targets('*'); return $new; } sub end_over_block { shift->set(@_); } sub end_for { shift->set(@_); } sub set { $_[0]{'closer-flag'} = defined $_[1]{'fake-closer'} ? 1 : -1; } Pod-Simple-3.43/t/xhtml15.t0000644000175000017500000000170614062242377013525 0ustar khwkhw#!/usr/bin/perl -w # t/xhtml15.t - test compatibility between Pod::Simple::XHTML and # Pod::Simple::HtmlBatch use strict; use warnings; use Test::More tests => 4; use_ok('Pod::Simple::XHTML') or exit; my ($parser, $results); initialize(); my $style = 'http://amazingpants.com/style.css'; $parser->html_css($style); $parser->parse_string_document( '=head1 Foo' ); like $results, qr/ href="$style" /, 'CSS is correct when link is passed in'; initialize(); my $link = qq{}; $parser->html_css($link); $parser->parse_string_document( '=head1 Foo' ); like $results, qr/ href="$style" /, 'CSS is correct when is passed in'; #note('These methods are called when XHTML is used by HtmlBatch'); can_ok $parser, qw/batch_mode_page_object_init html_header_after_title/; sub initialize { $parser = Pod::Simple::XHTML->new; $parser->index(1); $parser->output_string( \$results ); $results = ''; } Pod-Simple-3.43/t/itemstar.t0000644000175000017500000000336214062242376014052 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 6 }; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } #my $d; #use Pod::Simple::Debug (3); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; my $x = 'Pod::Simple::XMLOutStream'; print "##### Tests for '=item * Foo' tolerance via class $x\n"; $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output print "#\n# Tests for simple =item *'s\n"; ok( $x->_out("\n=over\n\n=item * Stuff\n\n=item * Bar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over\n\n=item * Stuff\n\n=cut\n\nStuff\n\n=item *\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over 10\n\n=item * Stuff\n\n=cut\n\nStuff\n\n=item *\n\nBar I!\n\n=back\n\n"), 'StuffBar baz!' ); ok( $x->_out("\n=over\n\n=item * Stuff I hoo!\n=cut\nStuff\n\n=item *\n\nBar I!\n\n=back"), 'Stuff things um hoo!Bar baz!' ); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/xhtml10.t0000644000175000017500000003243614062242377013524 0ustar khwkhw#!/usr/bin/perl -w # t/xhtml01.t - check basic output from Pod::Simple::XHTML BEGIN { chdir 't' if -d 't'; } use strict; use warnings; use lib '../lib'; use Test::More tests => 62; #use Test::More 'no_plan'; use_ok('Pod::Simple::XHTML') or exit; isa_ok my $parser = Pod::Simple::XHTML->new, 'Pod::Simple::XHTML'; my $header = $parser->html_header; my $footer = $parser->html_footer; for my $spec ( [ 'foo' => 'foo', 'foo' ], [ '12foo' => 'foo1', 'foo' ], [ 'fo$bar' => 'fo-bar', 'fo-bar' ], [ 'f12' => 'f12', 'f12' ], [ '13' => 'pod13', 'pod13' ], [ '**.:' => 'pod', 'pod' ], ) { is $parser->idify( $spec->[0] ), $spec->[1], qq{ID for "$spec->[0]" should be "$spec->[1]"}; is $parser->idify( $spec->[0], 1 ), $spec->[2], qq{Non-unique ID for "$spec->[0]" should be "$spec->[2]"}; } my $results; initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); ok $parser->parse_string_document( '=head1 Foo' ), 'Parse one header'; is $results, <<'EOF', 'Should have the index';

Foo

EOF initialize($parser, $results); ok $parser->parse_string_document( '=head1 Foo Bar' ), 'Parse multiword header'; is $results, <<'EOF', 'Should have the index';

Foo Bar

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head1 Foo B\n\n=head1 Foo B" ), 'Parse two multiword headers'; is $results, <<'EOF', 'Should have the index';

Foo Bar

Foo Baz

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head1 Foo\n\n=head1 Bar" ), 'Parse two headers'; is $results, <<'EOF', 'Should have both and the index';

Foo

Bar

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head1 Foo C\n\n=head1 C" ), 'Parse two headers with C<> formatting'; is $results, <<'EOF', 'Should have the index';

Foo Bar

Baz

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head1 Foo\n\n=head1 Bar\n\n=head1 Baz" ), 'Parse three headers'; is $results, <<'EOF', 'Should have all three and the index';

Foo

Bar

Baz

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head1 Foo\n\n=head2 Bar" ), 'Parse two levels'; is $results, <<'EOF', 'Should have the dual-level index';

Foo

Bar

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head1 Foo\n\n=head2 Bar\n\n=head3 Baz" ), 'Parse three levels'; is $results, <<'EOF', 'Should have the three-level index';

Foo

Bar

Baz

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head1 Foo\n\n=head2 Bar\n\n=head3 Baz\n\n=head4 Howdy" ), 'Parse four levels'; is $results, <<'EOF', 'Should have the four-level index';

Foo

Bar

Baz

Howdy

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head1 Foo\n\n=head2 Bar\n\n=head3 Baz\n\n=head4 Howdy\n\n=head5 Deep\n\n=head6 Thought" ), 'Parse six levels'; is $results, <<'EOF', 'Should have the six-level index';

Foo

Bar

Baz

Howdy

Deep
Thought
EOF initialize($parser, $results); ok $parser->parse_string_document( "=head1 Foo\n\n=head2 Bar\n\n=head2 Baz" ), 'Parse 1/2'; is $results, <<'EOF', 'Should have the 1/s index';

Foo

Bar

Baz

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head1 Foo\n\n=head3 Bar" ), 'Parse jump from one to three'; is $results, <<'EOF', 'Should have the 1-3 index';

Foo

Bar

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head1 Foo\n\n=head4 Bar" ), 'Parse jump from one to four'; is $results, <<'EOF', 'Should have the 1-4 index';

Foo

Bar

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head2 Foo\n\n=head1 Bar" ), 'Parse two down to 1'; is $results, <<'EOF', 'Should have the 2-1 index';

Foo

Bar

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head2 Foo\n\n=head1 Bar\n\n=head4 Four\n\n=head4 Four2" ), 'Parse two down to 1'; is $results, <<'EOF', 'Should have the 2-1 index';

Foo

Bar

Four

Four2

EOF initialize($parser, $results); ok $parser->parse_string_document( "=head4 Foo" ), 'Parse just a four'; is $results, <<'EOF', 'Should have the 2-1 index';

Foo

EOF initialize($parser, $results); ok $parser->parse_string_document( <<'EOF' ), 'Parse a mixture'; =head2 Foo =head3 Bar =head1 Baz =head4 Drink =head3 Sip =head4 Ouch =head1 Drip EOF is $results, <<'EOF', 'And it should work!';

Foo

Bar

Baz

Drink

Sip

Ouch

Drip

EOF initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->backlink(1); ok $parser->parse_string_document( '=head1 Foo' ), 'Parse a header'; is $results, <<'EOF', 'Should have the index and a backlink';

Foo

EOF initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->backlink(1); ok $parser->parse_string_document( "=head1 Foo \n\n=head2 Bar \n\n=head1 Baz" ), 'Parse headers'; is $results, <<'EOF', 'Should have the index and backlinks';

Foo

Bar

Baz

EOF initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->index(0); $parser->backlink(1); ok $parser->parse_string_document( "=head1 Foo \n\n=head1 Bar" ), 'Parse headers'; is $results, <<'EOF', 'Should have backlinks but no index';

Foo

Bar

EOF initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->backlink(1); $parser->html_h_level(2); ok $parser->parse_string_document( "=head1 Foo \n\n=head1 Bar" ), 'Parse headers'; is $results, <<'EOF', 'Should have index and backlinks around h2 elements';

Foo

Bar

EOF initialize($parser, $results); $parser->anchor_items(1); ok $parser->parse_string_document( <<'EOPOD' ), 'Parse POD'; =head1 Foo =over =item test =item Test 2 body of item =back =over =item * not anchored =back =over =item 1 still not anchored =back EOPOD is $results, <<'EOF', 'Anchor =item directives';

Foo

test
Test 2

body of item

  • not anchored

  1. still not anchored

EOF initialize($parser, $results); $parser->anchor_items(0); ok $parser->parse_string_document( <<'EOPOD' ), 'Parse POD'; =head1 Foo =over =item test =item Test 2 body of item =back =over =item * not anchored =back =over =item 1 still not anchored =back EOPOD is $results, <<'EOF', 'Do not anchor =item directives';

Foo

test
Test 2

body of item

  • not anchored

  1. still not anchored

EOF $ENV{FOO}= 1; initialize($parser, $results); ok $parser->parse_string_document( <<'EOPOD' ), 'Parse POD'; =head1 Foo Test links from perlpodspec: L...E Codes"> =head1 About LE...E Codes Here it is EOPOD my $id = 'About-L...-Codes'; # what should this be? is $results, <
  • Foo
  • About L<...> Codes
  • Foo

    Test links from perlpodspec: "About L<...> Codes"

    About L<...> Codes

    Here it is

    EOF sub initialize { $_[0] = Pod::Simple::XHTML->new; $_[0]->html_header(''); $_[0]->html_footer(''); $_[0]->index(1); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-Simple-3.43/t/xhtml01.t0000644000175000017500000004023114062242377013514 0ustar khwkhw#!/usr/bin/perl -w # t/xhtml01.t - check basic output from Pod::Simple::XHTML BEGIN { chdir 't' if -d 't'; } use strict; use warnings; use lib '../lib'; use Test::More tests => 64; #use Test::More 'no_plan'; use_ok('Pod::Simple::XHTML') or exit; my $parser = Pod::Simple::XHTML->new (); isa_ok ($parser, 'Pod::Simple::XHTML'); my $results; my $PERLDOC = "https://metacpan.org/pod"; my $MANURL = "http://man.he.net/man"; initialize($parser, $results); $parser->parse_string_document( "=head1 Poit!" ); is($results, qq{

    Poit!

    \n\n}, "head1 level output"); initialize($parser, $results); $parser->parse_string_document( "=head2 Yada Yada Operator X<...> X<... operator> X" ); is($results, qq{

    Yada Yada Operator

    \n\n}, "head ID with X<>"); initialize($parser, $results); $parser->parse_string_document( "=head2 Platforms with no supporting programmers:"); is($results, qq{

    Platforms with no supporting programmers:

    \n\n}, "head ID ending in colon"); initialize($parser, $results); $parser->html_h_level(2); $parser->parse_string_document( "=head1 Poit!" ); is($results, qq{

    Poit!

    \n\n}, "head1 level output h_level 2"); initialize($parser, $results); $parser->parse_string_document( "=head2 I think so Brain." ); is($results, qq{

    I think so Brain.

    \n\n}, "head2 level output"); initialize($parser, $results); $parser->parse_string_document( "=head3 I say, Brain..." ); is($results, qq{

    I say, Brain...

    \n\n}, "head3 level output"); initialize($parser, $results); $parser->parse_string_document( "=head4 Zort & Zog!" ); is($results, qq{

    Zort & Zog!

    \n\n}, "head4 level output"); initialize($parser, $results); $parser->parse_string_document( "=head5 I think so Brain, but..." ); is($results, qq{
    I think so Brain, but...
    \n\n}, "head5 level output"); initialize($parser, $results); $parser->parse_string_document( "=head6 Narf!" ); is($results, qq{
    Narf!
    \n\n}, "head6 level output"); sub x { my $code = $_[1]; Pod::Simple::XHTML->_out( sub { $code->($_[0]) if $code }, "=pod\n\n$_[0]", ) } like( x("=head1 Header\n\n=for html
    RAW!
    \n\nDone."), qr/.+<\/h1>\s+
    RAW!<\/span><\/div>\s+.*/sm, "heading building" ) or exit; initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod Gee, Brain, what do you want to do tonight? EOPOD is($results, <<'EOHTML', "simple paragraph");

    Gee, Brain, what do you want to do tonight?

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod B: Now, Pinky, if by any chance you are captured during this mission, remember you are Gunther Heindriksen from Appenzell. You moved to Grindelwald to drive the cog train to Murren. Can you repeat that? P: Mmmm, no, Brain, dont think I can. EOPOD is($results, <<'EOHTML', "multiple paragraphs");

    B: Now, Pinky, if by any chance you are captured during this mission, remember you are Gunther Heindriksen from Appenzell. You moved to Grindelwald to drive the cog train to Murren. Can you repeat that?

    P: Mmmm, no, Brain, dont think I can.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item * P: Gee, Brain, what do you want to do tonight? =item * B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EOHTML', "simple bulleted list");
    • P: Gee, Brain, what do you want to do tonight?

    • B: The same thing we do every night, Pinky. Try to take over the world!

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item * P: Gee, Brain, what do you want to do tonight? =item * B: The same thing we do every night, Pinky. Try to take over the world! =over =item * Take over world =item * Do laundry =back =back EOPOD is($results, <<'EOHTML', "nested bulleted list");
    • P: Gee, Brain, what do you want to do tonight?

    • B: The same thing we do every night, Pinky. Try to take over the world!

      • Take over world

      • Do laundry

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item 1 P: Gee, Brain, what do you want to do tonight? =item 2 B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EOHTML', "numbered list");
    1. P: Gee, Brain, what do you want to do tonight?

    2. B: The same thing we do every night, Pinky. Try to take over the world!

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item 1 P: Gee, Brain, what do you want to do tonight? =item 2 B: The same thing we do every night, Pinky. Try to take over the world! =over =item 1 Take over world =item 2 Do laundry =back =back EOPOD is($results, <<'EOHTML', "nested numbered list");
    1. P: Gee, Brain, what do you want to do tonight?

    2. B: The same thing we do every night, Pinky. Try to take over the world!

      1. Take over world

      2. Do laundry

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item Pinky Gee, Brain, what do you want to do tonight? =item Brain The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EOHTML', "list with text headings");
    Pinky

    Gee, Brain, what do you want to do tonight?

    Brain

    The same thing we do every night, Pinky. Try to take over the world!

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item * Pinky Gee, Brain, what do you want to do tonight? =item * Brain The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is($results, <<'EOHTML', "list with bullet and text headings");
    • Pinky

      Gee, Brain, what do you want to do tonight?

    • Brain

      The same thing we do every night, Pinky. Try to take over the world!

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item * Brain =item * Pinky =back EOPOD is($results, <<'EOHTML', "bulleted author list");
    • Brain <brain@binkyandthebrain.com>

    • Pinky <pinky@binkyandthebrain.com>

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item Pinky =over =item World Domination =back =item Brain =back EOPOD is($results, <<'EOHTML', 'nested lists');
    Pinky
    World Domination
    Brain
    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =over =item Pinky On the list: =over =item World Domination Fight the good fight =item Go to Europe (Steve Martin joke) =back =item Brain Not so much =back EOPOD is($results, <<'EOHTML', 'multiparagraph nested lists');
    Pinky

    On the list:

    World Domination

    Fight the good fight

    Go to Europe

    (Steve Martin joke)

    Brain

    Not so much

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod 1 + 1 = 2; 2 + 2 = 4; EOPOD is($results, <<'EOHTML', "code block");
      1 + 1 = 2;
      2 + 2 = 4;
    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a C. C<< This code is B to Eme>! >> EOPOD is($results, <<"EOHTML", "code entity in a paragraph");

    A plain paragraph with a functionname.

    This code is important to <me>!

    EOHTML initialize($parser, $results); $parser->html_header("\n"); $parser->html_footer("\n"); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with body tags turned on. EOPOD is($results, <<"EOHTML", "adding html body tags");

    A plain paragraph with body tags turned on.

    EOHTML initialize($parser, $results); $parser->html_css('style.css'); $parser->html_header(undef); $parser->html_footer(undef); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with body tags and css tags turned on. EOPOD like($results, qr//, "adding html body tags and css tags"); initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with S. EOPOD is($results, <<"EOHTML", "Non breaking text in a paragraph");

    A plain paragraph with non breaking text.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a L. EOPOD is($results, <<"EOHTML", "Link entity in a paragraph");

    A plain paragraph with a Newlines.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a L. EOPOD is($results, <<"EOHTML", "Link entity in a paragraph");

    A plain paragraph with a "Newlines" in perlport.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a L. EOPOD is($results, <<"EOHTML", "A link in a paragraph");

    A plain paragraph with a Boo.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a L. EOPOD is($results, <<"EOHTML", "A link in a paragraph");

    A plain paragraph with a http://link.included.here.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a L. EOPOD is($results, <<"EOHTML", "A link in a paragraph");

    A plain paragraph with a http://link.included.here?o=1&p=2.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with B. EOPOD is($results, <<"EOHTML", "Bold text in a paragraph");

    A plain paragraph with bold text.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with I. EOPOD is($results, <<"EOHTML", "Italic text in a paragraph");

    A plain paragraph with italic text.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A plain paragraph with a F. EOPOD is($results, <<"EOHTML", "File name in a paragraph");

    A plain paragraph with a filename.

    EOHTML # It's not important that 's (apostrophes) be encoded for XHTML output. initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod # this header is very important & dont you forget it my $text = "File is: " . ; EOPOD is($results, <<"EOHTML", "Verbatim text with encodable entities");
      # this header is very important & dont you forget it
      my \$text = "File is: " . <FILE>;
    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A text paragraph using E and E special POD entities. EOPOD is($results, <<"EOHTML", "Text with decodable entities");

    A text paragraph using / and | special POD entities.

    EOHTML initialize($parser, $results); $parser->parse_string_document(<<'EOPOD'); =pod A text paragraph using numeric POD entities: E<60>, E<62>. EOPOD is($results, <<"EOHTML", "Text with numeric entities");

    A text paragraph using numeric POD entities: <, >.

    EOHTML my $html = q{
    #include <stdio.h>
    
    int main(int argc,char *argv[]) {
    
            printf("Hellow World\n");
            return 0;
    
    }
    
    }; initialize($parser, $results); $parser->parse_string_document("=begin html\n\n$html\n\n=end html\n"); is($results, "$html\n\n", "Text with =begin html"); SKIP: for my $use_html_entities (0, 1) { if ($use_html_entities and not $Pod::Simple::XHTML::HAS_HTML_ENTITIES) { skip("HTML::Entities not installed", 3); } local $Pod::Simple::XHTML::HAS_HTML_ENTITIES = $use_html_entities; initialize($parser, $results); $parser->codes_in_verbatim(1); $parser->parse_string_document(<<'EOPOD'); =pod # this header is very important & dont you forget it B || Blank!;> my $text = "File is: " . ; EOPOD is($results, <<"EOHTML", "Verbatim text with markup and embedded formatting");
      # this header is very important & dont you forget it
      my \$file = <FILE> || Blank!;
      my \$text = "File is: " . <FILE>;
    EOHTML # Specify characters to encode. initialize($parser, $results); $parser->html_encode_chars('><"&T'); $parser->parse_string_document(<<'EOPOD'); =pod This is Anna's "Answer" to the Question. =cut EOPOD my $T = $use_html_entities ? ord('T') : sprintf ("x%X", ord('T')); is($results, <<"EOHTML", 'HTML Entities should be only for specified characters');

    &#$T;his is Anna's "Answer" to the <q>Question</q>.

    EOHTML # Keep =encoding out of content. initialize($parser, $results); $parser->parse_string_document("=encoding ascii\n\n=head1 NAME\n"); is($results, <<"EOHTML", 'Encoding should not be in content')

    NAME

    EOHTML } ok $parser = Pod::Simple::XHTML->new, 'Construct a new parser'; $results = ''; $parser->output_string( \$results ); # Send the resulting output to a string ok $parser->parse_string_document( "=head1 Poit!" ), 'Parse with headers'; like $results, qr{\Q}, 'Should have proper http-equiv meta tag'; ok $parser = Pod::Simple::XHTML->new, 'Construct a new parser again'; ok $parser->html_charset('UTF-8'), 'Set the html charset to UTF-8'; $results = ''; $parser->output_string( \$results ); # Send the resulting output to a string ok $parser->parse_string_document( "=head1 Poit!" ), 'Parse with headers'; like $results, qr{\Q}, 'Should have http-equiv meta tag with UTF-8'; # Test the link generation methods. is $parser->resolve_pod_page_link('Net::Ping', 'INSTALL'), "$PERLDOC/Net::Ping#INSTALL", 'POD link with fragment'; is $parser->resolve_pod_page_link('perlpodspec'), "$PERLDOC/perlpodspec", 'Simple POD link'; is $parser->resolve_pod_page_link(undef, 'SYNOPSIS'), '#SYNOPSIS', 'Simple fragment link'; is $parser->resolve_pod_page_link(undef, 'this that'), '#this-that', 'Fragment link with space'; is $parser->resolve_pod_page_link('perlpod', 'this that'), "$PERLDOC/perlpod#this-that", 'POD link with fragment with space'; is $parser->resolve_man_page_link('crontab(5)', 'EXAMPLE CRON FILE'), "${MANURL}5/crontab", 'Man link with fragment'; is $parser->resolve_man_page_link('crontab(5)'), "${MANURL}5/crontab", 'Man link without fragment'; is $parser->resolve_man_page_link('crontab'), "${MANURL}1/crontab", 'Man link without section'; # Make sure that batch_mode_page_object_init() works. ok $parser->batch_mode_page_object_init(0, 0, 0, 0, 6), 'Call batch_mode_page_object_init()'; ok $parser->batch_mode, 'We should be in batch mode'; is $parser->batch_mode_current_level, 6, 'The level should have been set'; ###################################### sub initialize { $_[0] = Pod::Simple::XHTML->new (); $_[0]->html_header(""); $_[0]->html_footer(""); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; } Pod-Simple-3.43/t/encod04.t0000644000175000017500000001061314062242376013453 0ustar khwkhw# The encoding detection heuristic will choose UTF8 or CP1252. The current # implementation will usually treat CP1252 (aka "Win-Latin-1") as CP1252 but # can be fooled into seeing it as UTF8. BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 6, todo => []; } # fail with the supplied diagnostic sub my_nok { my ($diag) = @_; ok (1, 0, $diag); } ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; # Initial, isolated, non-ASCII byte triggers CP1252 guess and later # multi-byte sequence is not considered by heuristic. my $x97; my $x91; my $dash; if ($] ge 5.007_003) { $x97 = chr utf8::unicode_to_native(0x97); $x91 = chr utf8::unicode_to_native(0x91); $dash = '—'; } else { # Tests will fail for early EBCDICs $x97 = chr 0x97; $x91 = chr 0x91; $dash = '--'; } my @output_lines = split m/[\r\n]+/, Pod::Simple::XMLOutStream->_out( qq{ =head1 NAME Em::Dash $x97 ${x91}CAF\xC9\x92 =cut } ); my($guess) = "@output_lines" =~ m{Non-ASCII.*?Assuming ([\w-]+)}; if( $guess ) { if( $guess eq 'CP1252' ) { if( grep m{Dash $dash}, @output_lines ) { ok 1; } else { my_nok "failed to find expected control character in output"; } } else { my_nok "parser guessed wrong encoding expected 'CP1252' got '$guess'"; } } else { my_nok "parser failed to detect non-ASCII bytes in input"; } # Initial smart-quote character triggers CP1252 guess as expected @output_lines = split m/[\r\n]+/, Pod::Simple::XMLOutStream->_out( qq{ =head1 NAME Smart::Quote - ${x91}FUT\xC9\x92 =cut } ); if (ord("A") != 65) { # ASCII-platform dependent test skipped on this platform ok (1); } else { ($guess) = "@output_lines" =~ m{Non-ASCII.*?Assuming ([\w-]+)}; if( $guess ) { if( $guess eq 'CP1252' ) { ok 1; } else { my_nok "parser guessed wrong encoding expected 'CP1252' got '$guess'"; } } else { my_nok "parser failed to detect non-ASCII bytes in input"; } } # Initial accented character (E acute) followed by 'smart' apostrophe is legal # CP1252, which should be preferred over UTF-8 because the latter # interpretation would be "JOS" . \N{LATIN SMALL LETTER TURNED ALPHA} . "S # PLACE", and that \N{} letter is an IPA one. @output_lines = split m/[\r\n]+/, Pod::Simple::XMLOutStream->_out( qq{ =head1 NAME =head2 JOS\xC9\x92S PLACE =cut } ); if (ord("A") != 65) { # ASCII-platform dependent test skipped on this platform ok (1); } else { ($guess) = "@output_lines" =~ m{Non-ASCII.*?Assuming ([\w-]+)}; if( $guess ) { if( $guess eq 'CP1252' ) { ok 1; } else { my_nok "parser guessed wrong encoding expected 'CP1252' got '$guess'"; } } else { my_nok "parser failed to detect non-ASCII bytes in input"; } } # The previous example used a CP1252 byte sequence that also happened to be a # valid UTF8 byte sequence. In this example we use an illegal UTF-8 sequence # (it needs a third byte), so must be 1252 @output_lines = split m/[\r\n]+/, Pod::Simple::XMLOutStream->_out( qq{ =head1 NAME Smart::Apostrophe::Fail - L\xE9\x92Strange =cut } ); if (ord("A") != 65) { # ASCII-platform dependent test skipped on this platform ok (1); } else { ($guess) = "@output_lines" =~ m{Non-ASCII.*?Assuming ([\w-]+)}; if( $guess ) { if( $guess eq 'CP1252' ) { ok 1; } else { my_nok "parser guessed wrong encoding expected 'CP1252' got '$guess'"; } } else { my_nok "parser failed to detect non-ASCII bytes in input"; } } # The following is a real word example of something in CP1252 expressible in # UTF-8, but doesn't make sense in UTF-8, contributed by Bo Lindbergh. # Muvrarášša is a Sami word @output_lines = split m/[\r\n]+/, Pod::Simple::XMLOutStream->_out( qq{ =head1 NAME Muvrar\xE1\x9A\x9Aa is a mountain in Norway =cut } ); if (ord("A") != 65) { # ASCII-platform dependent test skipped on this platform ok (1); } else { ($guess) = "@output_lines" =~ m{Non-ASCII.*?Assuming ([\w-]+)}; if( $guess ) { if( $guess eq 'CP1252' ) { ok 1; } else { my_nok "parser guessed wrong encoding expected 'CP1252' got '$guess'"; } } else { my_nok "parser failed to detect non-ASCII bytes in input"; } } exit; Pod-Simple-3.43/t/basic.t0000644000175000017500000000516614062242375013306 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 31 }; #use Pod::Simple::Debug (6); ok 1; require Pod::Simple::BlackBox; ok 1; require Pod::Simple; ok 1; Pod::Simple->VERSION(.90); ok 1; #print "# Pod::Simple version $Pod::Simple::VERSION\n"; require Pod::Simple::DumpAsXML; ok 1; require Pod::Simple::XMLOutStream; ok 1; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } print "# Simple identity tests...\n"; &ok( e "", "" ); &ok( e "\n", "", ); &ok( e "\n", "\n", ); &ok( e "puppies\n\n\n\n", "", ); print "# Contentful identity tests...\n"; &ok( e "=pod\n\nFoo\n", "=pod\n\nFoo\n" ); &ok( e "=pod\n\n\n\nFoo\n\n\n", "=pod\n\n\n\nFoo\n\n\n" ); &ok( e "=pod\n\n\n\nFoo\n\n\n", "=pod\n\nFoo\n" ); # Now with some more newlines &ok( e "\n\n=pod\n\nFoo\n", "\n\n=pod\n\nFoo\n" ); &ok( e "=pod\n\n\n\nFoo\n\n\n", "=pod\n\n\n\nFoo\n\n\n" ); &ok( e "=pod\n\n\n\nFoo\n\n\n", "\n\n=pod\n\nFoo\n" ); &ok( e "=head1 Foo\n", "=head1 Foo\n" ); &ok( e "=head1 Foo\n\n=cut\n", "=head1 Foo\n\n=cut\n" ); &ok( e "=head1 Foo\n\n=cut\n", "=head1 Foo\n" ); # Now just add some newlines... &ok( e "\n\n\n\n=head1 Foo\n", "\n\n\n\n=head1 Foo\n" ); &ok( e "=head1 Foo\n\n=cut\n", "=head1 Foo\n\n=cut\n" ); &ok( e "=head1 Foo\n\n=cut\n", "\n\n\n\n=head1 Foo\n" ); print "# Simple XMLification tests...\n"; ok( Pod::Simple::XMLOutStream->_out("\n\n\nprint \$^T;\n\n\n"), qq{} # make sure the contentless flag is set ); ok( Pod::Simple::XMLOutStream->_out("\n\n"), qq{} # make sure the contentless flag is set ); ok( Pod::Simple::XMLOutStream->_out("\n"), qq{} # make sure the contentless flag is set ); ok( Pod::Simple::XMLOutStream->_out(""), qq{} # make sure the contentless flag is set ); ok( Pod::Simple::XMLOutStream->_out('', '' ) ); ok( Pod::Simple::XMLOutStream->_out("=pod\n\nFoo\n"), 'Foo' ); ok( Pod::Simple::XMLOutStream->_out("=head1 Chacha\n\nFoo\n"), 'ChachaFoo' ); # Make sure an obviously invalid Pod tag is invalid. ok( Pod::Simple::XMLOutStream->_out("=F\0blah\n\nwhatever\n"), qq{} ); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/render.t0000644000175000017500000000700714062242376013501 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } else { push @INC, '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 26 }; use Pod::Simple::TextContent; use Pod::Simple::Text; BEGIN { *mytime = defined(&Win32::GetTickCount) ? sub () {Win32::GetTickCount() / 1000} : sub () {time()} } $Pod::Simple::Text::FREAKYMODE = 1; use Pod::Simple::TiedOutFH (); chdir 't' unless $ENV{PERL_CORE}; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { require File::Spec; my $updir = File::Spec->updir; my $dir = File::Spec->catdir ($updir, 'lib', 'Pod', 'Simple', 't'); return File::Spec->catfile ($dir, $file); } else { return $file; } } my $outfile = '10000'; foreach my $file ( "junk1.pod", "junk2.pod", "perlcyg.pod", "perlfaq.pod", "perlvar.pod", ) { unless(-e source_path($file)) { ok 0; print "# But $file doesn't exist!!\n"; exit 1; } my @out; my $precooked = source_path($file); $precooked =~ s<\.pod>s; unless(-e $precooked) { ok 0; print "# But $precooked doesn't exist!!\n"; exit 1; } print "#\n#\n#\n###################\n# $file\n"; foreach my $class ('Pod::Simple::TextContent', 'Pod::Simple::Text') { my $p = $class->new; push @out, ''; $p->output_string(\$out[-1]); my $t = mytime(); $p->parse_file(source_path($file)); printf "# %s %s %sb, %.03fs\n", ref($p), source_path($file), length($out[-1]), mytime() - $t ; ok 1; } print "# Reading $precooked...\n"; open(IN, $precooked) or die "Can't read-open $precooked: $!"; { local $/; push @out, ; } close(IN); print "# ", length($out[-1]), " bytes pulled in.\n"; for (@out) { s/\s+/ /g; s/^\s+//s; s/\s+$//s; } my $faily = 0; print "#\n#Now comparing 1 and 2...\n"; $faily += compare2($out[0], $out[1]); print "#\n#Now comparing 2 and 3...\n"; $faily += compare2($out[1], $out[2]); print "#\n#Now comparing 1 and 3...\n"; $faily += compare2($out[0], $out[2]); if($faily) { ++$outfile; my @outnames = map $outfile . $_ , qw(0 1); open(OUT2, ">$outnames[0].txt") || die "Can't write-open $outnames[0].txt: $!"; foreach my $out (@out) { push @outnames, $outnames[-1]; ++$outnames[-1] }; pop @outnames; printf "# Writing to %s.txt .. %s.txt\n", $outnames[0], $outnames[-1]; shift @outnames; binmode(OUT2); foreach my $out (@out) { my $outname = shift @outnames; open(OUT, ">$outname.txt") || die "Can't write-open $outname.txt: $!"; binmode(OUT); print OUT $out, "\n"; print OUT2 $out, "\n"; close(OUT); } close(OUT2); } } print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; exit; sub compare2 { my @out = @_; if($out[0] eq $out[1]) { ok 1; return 0; } elsif( do{ for ($out[0], $out[1]) { tr/ //d; }; $out[0] eq $out[1]; }){ print "# Differ only in whitespace.\n"; ok 1; return 0; } else { #ok $out[0], $out[1]; my $x = $out[0] ^ $out[1]; $x =~ m/^(\x00*)/s or die; my $at = length($1); print "# Difference at byte $at...\n"; if($at > 10) { $at -= 5; } { print "# ", substr($out[0],$at,20), "\n"; print "# ", substr($out[1],$at,20), "\n"; print "# ^..."; } ok 0; printf "# Unequal lengths %s and %s\n", length($out[0]), length($out[1]); return 1; } } __END__ Pod-Simple-3.43/t/enc-chars.t0000644000175000017500000000324114062242376014061 0ustar khwkhw# tell parser the source POD has already been decoded from bytes to chars # =encoding line should be ignored # utf8 characters should come through unscathed BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } use Config; if ($Config::Config{'extensions'} !~ /\bEncode\b/) { print "1..0 # Skip: Encode was not built\n"; exit 0; } } use strict; use warnings; use Test; BEGIN { plan tests => 5 }; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; my $parser = Pod::Simple::XMLOutStream->new; $parser->parse_characters(1); my $output = ''; $parser->output_string( \$output ); $parser->parse_string_document(qq{ =encoding bogocode =head1 DESCRIPTION Confirm that if we tell the parser to expect character data, it avoids all the code paths that might attempt to decode the source from bytes to chars. The r\x{101}in in \x{15E}pain \x{FB02}oods the plain }); ok(1); # parsed without exception if($output =~ /POD ERRORS/) { ok(0); } else { ok(1); # no errors } $output =~ s{&#(\d+);}{chr($1)}eg; if($output =~ /The r\x{101}in in \x{15E}pain \x{FB02}oods the plain/) { ok(1); # data was not messed up } else { ok(0); } ############################################################################## # Test multiple =encoding declarations. $parser = Pod::Simple::XMLOutStream->new; $output = ''; $parser->output_string( \$output ); $parser->parse_string_document(qq{ =pod =encoding UTF-8 =encoding UTF-8 =head1 DESCRIPTION Confirm that the parser detects multiple encodings and complains. }); # Should have an error. ok($output =~ /POD ERRORS/); ok($output =~ /Cannot have multiple =encoding directives/); exit; Pod-Simple-3.43/t/fcodes_s.t0000644000175000017500000003035214062242376014006 0ustar khwkhw# fcodes S BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 80 }; #use Pod::Simple::Debug (6); ok 1; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; my $x = 'Pod::Simple::XMLOutStream'; sub e { $x->_duo(@_) } $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output print "# S as such...\n"; ok( $x->_out("=pod\n\nI like S.\n"), => 'I like bric-a-brac.' ); ok( $x->_out("=pod\n\nI like S.\n"), => 'I like bric-a-brac a gogo .' ); ok( $x->_out("=pod\n\nI like S<< bric-a-brac a gogo >>.\n"), => 'I like bric-a-brac a gogo.' ); my $unless_ascii = (chr(65) eq 'A') ? '' : "Skip because not in ASCIIland"; skip( $unless_ascii, $x->_out( sub { $_[0]->nbsp_for_S(1) }, "=pod\n\nI like S.\n"), 'I like bric-a-brac a gogo.' ); skip( $unless_ascii, $x->_out( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S>.\n}), 'I like "bric-a-brac a gogo".' ); skip( $unless_ascii, $x->_out( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S>.\n}), 'I like Stuff like that.' ); skip( $unless_ascii, $x->_out( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S|/"bric-a-brac a gogo">>.\n}), 'I like Stuff like that.' ); &ok( $x->_duo( sub { $_[0]->nbsp_for_S(1) }, "=pod\n\nI like S.\n", "=pod\n\nI like bric-a-bracE<160>aE<160>gogo.\n", )); &ok( map {my $z = $_; $z =~ s/content-implicit="yes" //g; $z =~ s/raw=".+?" //g; $z } $x->_duo( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S>.\n}, qq{=pod\n\nI like L<"bric-a-bracE<160>aE<160>gogo"|/"bric-a-brac a gogo">.\n}, )); &ok( map {my $z = $_; $z =~ s/raw=".+?" //g; $z } $x->_duo( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S>.\n}, qq{=pod\n\nI like LlikeE<160>that|"bric-a-brac a gogo">.\n}, )); &ok( map {my $z = $_; $z =~ s/content-implicit="yes" //g; $z =~ s/raw=".+?" //g; $z } $x->_duo( sub { $_[0]->nbsp_for_S(1) }, qq{=pod\n\nI like S|"bric-a-brac a gogo">>.\n}, qq{=pod\n\nI like LIthat>|"bric-a-brac a gogo">.\n}, )); use Pod::Simple::Text; $x = Pod::Simple::Text->new; $x->preserve_whitespace(1); # RT#25679 ok( $x->_out(< > foo >> is being rendered Both pod2text and pod2man S< > lose the rest of the line =head1 Do they always S< > lose the rest of the line? =cut END ), < foo is being rendered Both pod2text and pod2man lose the rest of the line Do they always lose the rest of the line? END ); $x = 'Pod::Simple::Text'; # Test text output of links. ok( $x->_out(qq{=pod\n\nL\n}), " Net::Ping\n\n" ); ok( $x->_out(qq{=pod\n\nBe sure to read the L docs\n}), " Be sure to read the Net::Ping docs\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " http://www.perl.com\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " crontab(5)\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), qq{ "Ping-pong" in Net::Ping\n\n} ); ok( $x->_out(qq{=pod\n\nL\n}), qq{ "Object Methods"\n\n} ); ok( $x->_out(qq{=pod\n\nL
    \n}), qq{ "Object Methods"\n\n} ); ok( $x->_out(qq{=pod\n\nL<"Object Methods">\n}), qq{ "Object Methods"\n\n} ); ok( $x->_out(qq{=pod\n\nLong>\n}), qq{ "Ping-pong" in Net::Ping\n\n} ); ok( $x->_out(qq{=pod\n\nL\n}), " news:comp.lang.perl.misc\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " http://www.perl.org\n\n" ); ok( $x->_out(qq{=pod\n\nSee L\n}), " See http://www.perl.org\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " http://www.perl.org/CPAN/authors/id/S/SB/SBURKE/\n\n" ); ok( $x->_out(qq{=pod\n\nLlang.perl.misc>\n}), " news:comp.lang.perl.misc\n\n" ); ok( $x->_out(qq{=pod\n\nLperl.org>\n}), " http://www.perl.org\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " things\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " things\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " Perl Error Messages\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " Perl Error Messages\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " Perl Error Messages\n\n" ); ok( $x->_out(qq{=pod\n\nL\n}), " perl.org \n\n" ); ok( $x->_out(qq{=pod\n\nSee L\n}), " See perl.org \n\n" ); # Test HTML output of links. use Pod::Simple::HTML; my $PERLDOC = "https://metacpan.org/pod"; my $MANURL = "http://man.he.net/man"; sub x { Pod::Simple::HTML->_out( sub { $_[0]->bare_output(1) }, "=pod\n\n$_[0]", ) } ok( x(qq{L\n}), qq{\n
    \n} ); ok( x(qq{Be sure to read the L docs\n}), qq{\n

    Be sure to read the Net::Ping docs

    \n} ); ok( x(qq{L\n}), qq{\n

    http://www.perl.com

    \n} ); ok( x(qq{L\n}), qq{\n

    crontab(5)

    \n} ); ok( x(qq{L\n}), qq{\n

    "Ping-pong" in Net::Ping

    \n} ); ok( x(qq{L\n}), qq{\n

    "Object Methods"

    \n} ); ok( x(qq{L\n}), qq{\n

    "Object Methods"

    \n} ); ok( x(qq{L<"Object Methods">\n}), qq{\n

    "Object Methods"

    \n} ); ok( x(qq{Long>\n}), qq{\n

    "Ping-pong" in Net::Ping

    \n} ); ok( x(qq{L\n}), qq{\n

    news:comp.lang.perl.misc

    \n} ); ok( x(qq{L\n}), qq{\n

    http://www.perl.org

    \n} ); ok( x(qq{See L\n}), qq{\n

    See http://www.perl.org

    \n} ); ok( x(qq{L\n}), qq{\n

    http://www.perl.org/CPAN/authors/id/S/SB/SBURKE/

    \n} ); ok( x(qq{Llang.perl.misc>\n}), qq{\n

    news:comp.lang.perl.misc

    \n} ); ok( x(qq{Lperl.org>\n}), qq{\n

    http://www.perl.org

    \n} ); ok( x(qq{L\n}), qq{\n

    things

    \n} ); ok( x(qq{L\n}), qq{\n

    things

    \n} ); ok( x(qq{L\n}), qq{\n

    Perl Error Messages

    \n} ); ok( x(qq{L\n}), qq{\n

    Perl Error Messages

    \n} ); ok( x(qq{L\n}), qq{\n

    Perl Error Messages

    \n} ); ok( x(qq{L\n}), qq{\n

    perl.org

    \n} ); ok( x(qq{See L\n}), qq{\n

    See perl.org

    \n} ); # Test link output in XHTML. use Pod::Simple::XHTML; sub o ($) { my $p = Pod::Simple::XHTML->new; $p->html_header(""); $p->html_footer(""); my $results = ''; $p->output_string( \$results ); # Send the resulting output to a string $p->parse_string_document("=pod\n\n$_[0]"); return $results; } ok( o(qq{L}), qq{

    Net::Ping

    \n\n} ); ok( o(qq{Be sure to read the L docs}), qq{

    Be sure to read the Net::Ping docs

    \n\n} ); ok( o(qq{L}), qq{

    http://www.perl.com

    \n\n} ); ok( o(qq{L}), qq{

    crontab(5)

    \n\n} ); ok( o(qq{L}), qq{

    "Ping-pong" in Net::Ping

    \n\n} ); ok( o(qq{L}), qq{

    "Object Methods"

    \n\n} ); ok( o(qq{L}), qq{

    "Object Methods"

    \n\n} ); ok( o(qq{L<"Object Methods">}), qq{

    "Object Methods"

    \n\n} ); ok( o(qq{Long>}), qq{

    "Ping-pong" in Net::Ping

    \n\n} ); ok( o(qq{L}), qq{

    news:comp.lang.perl.misc

    \n\n} ); ok( o(qq{L}), qq{

    http://www.perl.org

    \n\n} ); ok( o(qq{See L}), qq{

    See http://www.perl.org

    \n\n} ); ok( o(qq{L}), qq{

    http://www.perl.org/CPAN/authors/id/S/SB/SBURKE/

    \n\n} ); ok( o(qq{Llang.perl.misc>}), qq{

    news:comp.lang.perl.misc

    \n\n} ); ok( o(qq{Lperl.org>}), qq{

    http://www.perl.org

    \n\n} ); ok( o(qq{L}), qq{

    things

    \n\n} ); ok( o(qq{L}), qq{

    things

    \n\n} ); ok( o(qq{L}), qq{

    Perl Error Messages

    \n\n} ); ok( o(qq{L}), qq{

    Perl Error Messages

    \n\n} ); ok( o(qq{L}), qq{

    Perl Error Messages

    \n\n} ); ok( o(qq{L}), qq{

    perl.org

    \n\n} ); ok( o(qq{See L}), qq{

    See perl.org

    \n\n} ); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/JustPod01.t0000644000175000017500000001303614062242376013752 0ustar khwkhw#! user/bin/perl -w # t/JustPod01.t - check basics of Pod::Simple::JustPod BEGIN { chdir 't' if -d 't'; } use strict; use lib '../lib'; use Test::More tests => 2; use warnings; use utf8; use_ok('Pod::Simple::JustPod') or exit; my $parser = Pod::Simple::JustPod->new(); my $input; while ( ) { $input .= $_ } my $output; $parser->output_string( \$output ); $parser->parse_string_document( $input ); # Strip off text before =pod in the input $input =~ s/^.*(=pod.*)$/$1/mgs; my $msg = "got expected output"; if ($output eq $input) { pass($msg); } elsif ($ENV{PERL_TEST_DIFF}) { fail($msg); require File::Temp; my $orig_file = File::Temp->new(); local $/ = "\n"; chomp $input; print $orig_file $input, "\n"; close $orig_file || die "Can't close orig_file: $!"; chomp $output; my $parsed_file = File::Temp->new(); print $parsed_file $output, "\n"; close $parsed_file || die "Can't close parsed_file"; my $diff = File::Temp->new(); system("$ENV{PERL_TEST_DIFF} $orig_file $parsed_file > $diff"); open my $fh, "<", $diff || die "Can't open $diff"; my @diffs = <$fh>; diag(@diffs); } else { eval { require Text::Diff; }; if ($@) { is($output, $input, $msg); diag("Set environment variable PERL_TEST_DIFF=diff_tool or install" . " Text::Diff to see just the differences."); } else { fail($msg); diag Text::Diff::diff(\$input, \$output, { STYLE => 'Unified' }); } } __DATA__ package utf8::all; use strict; use warnings; use 5.010; # state # ABSTRACT: turn on Unicode - all of it our $VERSION = '0.010'; # VERSION use Import::Into; use parent qw(Encode charnames utf8 open warnings feature); sub import { my $target = caller; 'utf8'->import::into($target); 'open'->import::into($target, qw{:encoding(UTF-8) :std}); 'charnames'->import::into($target, qw{:full :short}); 'warnings'->import::into($target, qw{FATAL utf8}); 'feature'->import::into($target, qw{unicode_strings}) if $^V >= v5.11.0; 'feature'->import::into($target, qw{unicode_eval fc}) if $^V >= v5.16.0; { no strict qw(refs); ## no critic (TestingAndDebugging::ProhibitNoStrict) *{$target . '::readdir'} = \&_utf8_readdir; } # utf8 in @ARGV state $have_encoded_argv = 0; _encode_argv() unless $have_encoded_argv++; $^H{'utf8::all'} = 1; return; } sub _encode_argv { $_ = Encode::decode('UTF-8', $_) for @ARGV; return; } sub _utf8_readdir(*) { ## no critic (Subroutines::ProhibitSubroutinePrototypes) my $handle = shift; if (wantarray) { my @all_files = CORE::readdir($handle); $_ = Encode::decode('UTF-8', $_) for @all_files; return @all_files; } else { my $next_file = CORE::readdir($handle); $next_file = Encode::decode('UTF-8', $next_file); return $next_file; } } 1; __END__ =pod =encoding utf-8 =head1 NAME utf8::all - turn on Unicode - all of it =head1 VERSION version 0.010 =head1 SYNOPSIS use utf8::all; # Turn on UTF-8. All of it. open my $in, '<', 'contains-utf8'; # UTF-8 already turned on here print length 'føø bār'; # 7 UTF-8 characters my $utf8_arg = shift @ARGV; # @ARGV is UTF-8 too! =head1 DESCRIPTION L allows you to write your Perl encoded in UTF-8. That means UTF-8 strings, variable names, and regular expressions. C goes further, and makes C<@ARGV> encoded in UTF-8, and filehandles are opened with UTF-8 encoding turned on by default (including STDIN, STDOUT, STDERR), and charnames are imported so C<\N{...}> sequences can be used to compile Unicode characters based on names. If you I want UTF-8 for a particular filehandle, you'll have to set C. The pragma is lexically-scoped, so you can do the following if you had some reason to: { use utf8::all; open my $out, '>', 'outfile'; my $utf8_str = 'føø bār'; print length $utf8_str, "\n"; # 7 print $out $utf8_str; # out as utf8 } open my $in, '<', 'outfile'; # in as raw my $text = do { local $/; <$in>}; print length $text, "\n"; # 10, not 7! =head1 INTERACTION WITH AUTODIE If you use L, which is a great idea, you need to use at least version B<2.12>, released on L. Otherwise, autodie obliterates the IO layers set by the L pragma. See L and L. =head1 AVAILABILITY The project homepage is L. The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit L to find a CPAN site near you, or see L. =head1 SOURCE The development version is on github at L and may be cloned from L =head1 BUGS AND LIMITATIONS You can make new bug reports, and view existing ones, through the web interface at L. =head1 AUTHORS =over 4 =item * Michael Schwern =item * Mike Doherty =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2009 by Michael Schwern . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pod-Simple-3.43/t/search50.t0000644000175000017500000000514214062242376013632 0ustar khwkhwBEGIN { if( $ENV{PERL_CORE} ) { chdir 't'; use File::Spec; @INC = (File::Spec->rel2abs('../lib') ); } } use strict; use warnings; #sub Pod::Simple::Search::DEBUG () {5}; use Pod::Simple::Search; use Test::More; BEGIN { plan 'no_plan' } # print "# Test the scanning of the whole of \@INC ...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; ok $x->inc; # make sure inc=1 is the default # print $x->_state_as_string; #$x->verbose(12); use Pod::Simple; *pretty = \&Pod::Simple::BlackBox::pretty; *pretty = \&Pod::Simple::BlackBox::pretty; # avoid 'once' warning my $found = 0; $x->callback(sub { # print "# ", join(" ", map "{$_}", @_), "\n"; ++$found; return; }); # print "# \@INC == @INC\n"; my $t = time(); my($name2where, $where2name) = $x->survey(); $t = time() - $t; ok $found; # print "# Found $found items in $t seconds!\n# See...\n"; # my $p = pretty( $where2name, $name2where )."\n"; # $p =~ s/, +/,\n/g; # $p =~ s/^/# /mg; # print $p; # print "# OK, making sure strict and strict.pm were in there...\n"; # print "# (On Debian-based distributions Pod is stripped from\n", # "# strict.pm, so skip these tests.)\n"; my $nopod = not exists ($name2where->{'strict'}); SKIP: { skip 'No Pod for strict.pm', 3 if $nopod; like $name2where->{'strict'}, '/strict\.(pod|pm)$/'; ok grep( m/strict\.(pod|pm)/, keys %$where2name); ok my $strictpath = $name2where->{'strict'}, 'Should have strict path'; my @x = ($x->find('strict')||'(nil)', $strictpath); # print "# Comparing \"$x[0]\" to \"$x[1]\"\n"; for(@x) { s{[/\\]}{/}g; } # print "# => \"$x[0]\" to \"$x[1]\"\n"; is $x[0], $x[1], " find('strict') should match survey's name2where{strict}"; } # print "# Test again on a module we know is present, in case the # strict.pm tests were skipped...\n"; # Search for all files in $name2where. while (my ($testmod, $testpath) = each %{ $name2where }) { unless ( $testmod ) { fail; # no 'thatpath/.pm' means can't test find() next; } my @x = ($x->find($testmod)||'(nil)', $testpath); # print "# Comparing \"$x[0]\" to \"$x[1]\"\n"; my $result = File::Spec->rel2abs($x[0]); # print "# => \"$result\" to \"$x[1]\"\n"; if ($result ne $x[1]) { TODO: { local $TODO = 'unstable Pod::Simple::Search'; is( $result, $x[1], " find('$testmod') should match survey's name2where{$testmod}"); } } else { is( $result, $x[1], " find('$testmod') should match survey's name2where{$testmod}"); } } pass; # print "# Byebye from ", __FILE__, "\n"; # print "# @INC\n"; __END__ Pod-Simple-3.43/t/20_skip.t0000644000175000017500000000052014062242375013461 0ustar khwkhw# 20 skip under 5.8 use strict; use warnings; BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } print "1..2\n"; print "# Running under Perl v $]\n"; if($] < 5.008) { print "ok 1 # Skip under Perl before 5.8 ($])\n"; } else { print "ok 1\n"; print "# ^ not skipping\n"; } print "ok 2\n"; Pod-Simple-3.43/t/junk2o.txt0000644000175000017500000000037314062242376014005 0ustar khwkhwpie is nice E POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 2: Unknown directive: =head9 Around line 4: Unterminated B<...> sequence Around line 6: Unknown E content in E Pod-Simple-3.43/t/junk2.pod0000644000175000017500000000005614062242376013567 0ustar khwkhw =head9 I like pie B Pod-Simple-3.43/t/search12.t0000644000175000017500000000457414062242376013640 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Pod::Simple::Search; use Test; BEGIN { plan tests => 11 } print "# ", __FILE__, ": Testing the surveying of the current directory...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; $x->inc(0); use File::Spec; use Cwd; my $cwd = cwd(); print "# CWD: $cwd\n"; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { return "../lib/Pod/Simple/t/$file"; } else { return $file; } } my $here; if( -e ($here = source_path('testlib1'))) { chdir $here; } elsif(-e ($here = File::Spec->catdir($cwd, 't', 'testlib1'))) { chdir $here; } else { die "Can't find the test corpus"; } print "# OK, found the test corpus as $here\n"; ok 1; print $x->_state_as_string; #$x->verbose(12); use Pod::Simple; *pretty = \&Pod::Simple::BlackBox::pretty; my($name2where, $where2name) = $x->survey('.'); my $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; my $ascii_order; if( -e ($ascii_order = source_path('ascii_order.pl'))) { # } elsif(-e ($ascii_order = File::Spec->catfile($cwd, 't', 'ascii_order.pl'))) { # } else { die "Can't find ascii_order.pl"; } require $ascii_order; { my $names = join "|", sort ascii_order values %$where2name; ok $names, "Blorm|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|squaa|squaa::Glunk|squaa::Vliff|zikzik"; } { my $names = join "|", sort ascii_order keys %$name2where; ok $names, "Blorm|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|squaa|squaa::Glunk|squaa::Vliff|zikzik"; } ok( ($name2where->{'squaa'} || 'huh???'), '/squaa\.pm$/'); ok grep( m/squaa\.pm/, keys %$where2name ), 1; ###### Now with recurse(0) print "# Testing the surveying of a subdirectory with recursing off...\n"; $x->recurse(0); ($name2where, $where2name) = $x->survey( File::Spec->catdir($cwd, 't', 'testlib2')); $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; { my $names = lc join "|", sort ascii_order values %$where2name; ok $names, "suzzle"; } { my $names = lc join "|", sort ascii_order keys %$name2where; ok $names, "suzzle"; } ok( ($name2where->{'Vliff'} || 'huh???'), 'huh???'); ok grep( m/Vliff\.pm/, keys %$where2name ), 0; ok 1; __END__ Pod-Simple-3.43/t/corpus.t0000644000175000017500000001021714062242375013531 0ustar khwkhw# Testing a corpus of Pod files BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } use Config; if ($Config::Config{'extensions'} !~ /\bEncode\b/) { print "1..0 # Skip: Encode was not built\n"; exit 0; } if (ord("A") != 65) { print "1..0 # Skip: Encode not fully working on non-ASCII platforms at this time\n"; exit 0; } } #use Pod::Simple::Debug (10); use Test qw(plan ok skip); use File::Spec; #use utf8; use strict; use warnings; my(@testfiles, %xmlfiles, %wouldxml); #use Pod::Simple::Debug (10); BEGIN { sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { require File::Spec; my $updir = File::Spec->updir; my $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't'); return File::Spec->catdir ($dir, $file); } else { return $file; } } my @bits; if(-e( File::Spec::->catdir( @bits = source_path('corpus') ) ) ) { # OK print "# 1Bits: @bits\n"; } elsif( -e (File::Spec::->catdir( @bits = (File::Spec::->curdir, 'corpus') ) ) ) { # OK print "# 2Bits: @bits\n"; } elsif ( -e (File::Spec::->catdir( @bits = (File::Spec::->curdir, 't', 'corpus') ) ) ) { # OK print "# 3Bits: @bits\n"; } else { die "Can't find the corpusdir"; } my $corpusdir = File::Spec::->catdir( @bits); print "#Corpusdir: $corpusdir\n"; opendir(INDIR, $corpusdir) or die "Can't opendir corpusdir : $!"; my @f = map File::Spec::->catfile(@bits, $_), readdir(INDIR); closedir(INDIR); my %f; @f{@f} = (); foreach my $maybetest (sort @f) { my $xml = $maybetest; $xml =~ s/\.(txt|pod)$/\.xml/is or next; $wouldxml{$maybetest} = $xml; push @testfiles, $maybetest; foreach my $x ($xml, uc($xml), lc($xml)) { next unless exists $f{$x}; $xmlfiles{$maybetest} = $x; last; } } die "Too few test files (".@testfiles.")" unless @ARGV or @testfiles > 20; @testfiles = @ARGV if @ARGV and !grep !m/\.txt/, @ARGV; plan tests => (2 + 2*@testfiles - 1); } my $HACK = 1; #@testfiles = ('nonesuch.txt'); ok 1; my $skippy = ($] < 5.008) ? "skip because perl ($]) pre-dates v5.8.0" : 0; if($skippy) { print "# This is just perl v$], so I'm skipping many many tests.\n"; } { my @x = @testfiles; print "# Files to test:\n"; while(@x) { print "# ", join(' ', splice @x,0,3), "\n" } } require Pod::Simple::DumpAsXML; foreach my $f (@testfiles) { my $xml = $xmlfiles{$f}; if($xml) { print "#\n#To test $f against $xml\n"; } else { print "#\n# $f has no xml to test it against\n"; } my $outstring; eval { my $p = Pod::Simple::DumpAsXML->new; $p->output_string( \$outstring ); $p->parse_file( $f ); undef $p; }; if($@) { my $x = "#** Couldn't parse $f:\n $@"; $x =~ s/([\n\r]+)/\n#** /g; print $x, "\n"; ok 0; ok 0; next; } else { print "# OK, parsing $f generated ", length($outstring), " bytes\n"; ok 1; } die "Null outstring?" unless $outstring; next if $f =~ /nonesuch/; my $outfilename = ($HACK > 1) ? $wouldxml{$f} : "$wouldxml{$f}\_out"; if($HACK) { open OUT, ">$outfilename" or die "Can't write-open $outfilename: $!\n"; binmode(OUT); print OUT $outstring; close(OUT); } unless($xml) { print "# (no comparison done)\n"; ok 1; next; } open(IN, "<$xml") or die "Can't read-open $xml: $!"; #binmode(IN); local $/; my $xmlsource = ; close(IN); print "# There's errata!\n" if $outstring =~ m/start_line="-321"/; if( $xmlsource eq $outstring or do { $xmlsource =~ s/[\n\r]+/\n/g; $outstring =~ s/[\n\r]+/\n/g; $xmlsource eq $outstring; } ) { print "# (Perfect match to $xml)\n"; unlink $outfilename unless $outfilename =~ m/\.xml$/is; ok 1; next; } if($skippy) { skip $skippy, 0; } else { print STDERR "# $outfilename and $xml don't match!\n"; print STDERR `diff $xml $outfilename`; ok 0; } } print "#\n# I've been using Encode v", $Encode::VERSION ? $Encode::VERSION : "(NONE)", "\n"; print "# Byebye\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/xhtml-bkb.t0000644000175000017500000000064514062242377014114 0ustar khwkhw#!/usr/bin/perl -w # t/xhtml-bkb.t - https://rt.cpan.org/Public/Bug/Display.html?id=77686 use strict; use warnings; use Test::More tests => 1; use Pod::Simple::XHTML; my $c = < EOF my $d = Pod::Simple::XHTML->new (); $d->index (1); my $e; $d->output_string (\$e); $d->parse_string_document ($c); unlike ($e, qr!]+>]+>!); Pod-Simple-3.43/t/fornot.t0000644000175000017500000001254514062242376013534 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 21 }; #use Pod::Simple::Debug (5); BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; my $x = 'Pod::Simple::XMLOutStream'; $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output sub moj {shift->accept_target( 'mojojojo')} sub mojtext {shift->accept_target_as_text('mojojojo')} sub any {shift->accept_target( '*' )} #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ok( $x->_out( "=pod\n\nI like pie.\n\n=for mojojojo stuff\n\n=for !mojojojo bzarcho\n\nYup.\n"), 'I like pie.bzarchoYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=for psketti,mojojojo,crunk stuff\n\n=for !psketti,mojojojo,crunk bzarcho\n\nYup.\n"), 'I like pie.bzarchoYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=for :mojojojo stuff\n\n=for :!mojojojo bzarcho\n\nYup.\n"), 'I like pie.bzarchoYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=for :psketti,mojojojo,crunk stuff\n\n=for :!psketti,mojojojo,crunk bzarcho\n\nYup.\n"), 'I like pie.bzarchoYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=for :mojojojo stuff\n\n=for :!mojojojo I\n\nYup.\n"), 'I like pie.bzarchoYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=for :psketti,mojojojo,crunk stuff\n\n=for :!psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.bzarchoYup.' ); print "# ( Now just swapping '!' and ':' )\n"; ok( $x->_out( "=pod\n\nI like pie.\n\n=for :mojojojo stuff\n\n=for !:mojojojo bzarcho\n\nYup.\n"), 'I like pie.bzarchoYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=for :psketti,mojojojo,crunk stuff\n\n=for !:psketti,mojojojo,crunk bzarcho\n\nYup.\n"), 'I like pie.bzarchoYup.' ); print "# Testing accept_target ...\n"; ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for !mojojojo I\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for !psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=for :!mojojojo I\n\nYup.\n"), 'I like pie.Yup.' ); print "# Testing accept_target_as_text ...\n"; ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=for !mojojojo I\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=for !psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=for :!mojojojo I\n\nYup.\n"), 'I like pie.Yup.' ); print "# Testing accept_target(*) ...\n"; ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for !mojojojo I\n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for !mojojojo I\n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for !psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for !:mojojojo I\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=for !:psketti,mojojojo,crunk I\n\nYup.\n"), 'I like pie.stuffYup.' ); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/html03.t0000644000175000017500000000132314062242376013324 0ustar khwkhw# Testing HTML titles BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 7 }; #use Pod::Simple::Debug (10); use Pod::Simple::HTML; sub x { Pod::Simple::HTML->_out( #sub{ $_[0]->bare_output(1) }, "=pod\n\n$_[0]", ) } # make sure empty file => empty output ok 1; ok( x(''),'', "Contentlessness" ); ok( x(qq{=pod\n\nThis is a paragraph}) =~ m{}i ); ok( x(qq{This is a paragraph}) =~ m{}i ); ok( x(qq{=head1 Prok\n\nThis is a paragraph}) =~ m{Prok}i ); ok( x(qq{=head1 NAME\n\nProk -- stuff\n\nThis}), q{/Prok/} ); print "# And one for the road...\n"; ok 1; Pod-Simple-3.43/t/htmlbat.t0000644000175000017500000000520214062242376013650 0ustar khwkhw# Testing HTMLBatch BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } # Time-stamp: "2004-05-24 02:07:47 ADT" use strict; use warnings; my $DEBUG = 0; #sub Pod::Simple::HTMLBatch::DEBUG () {5}; use Test; BEGIN { plan tests => 17 } require Pod::Simple::HTMLBatch;; use File::Spec; use Cwd; my $cwd = cwd(); print "# CWD: $cwd\n" if $DEBUG; my $t_dir; my $corpus_dir; foreach my $t_maybe ( File::Spec->catdir( File::Spec->updir(), 'lib','Pod','Simple','t'), File::Spec->catdir( $cwd ), File::Spec->catdir( $cwd, 't' ), 'OHSNAP' ) { die "Can't find the test corpus" if $t_maybe eq 'OHSNAP'; next unless -e $t_maybe; $t_dir = $t_maybe; $corpus_dir = File::Spec->catdir( $t_maybe, 'testlib1' ); next unless -e $corpus_dir; last; } print "# OK, found the test corpus as $corpus_dir\n" if $DEBUG; ok 1; my $outdir; while(1) { my $rand = sprintf "%05x", rand( 0x100000 ); $outdir = File::Spec->catdir( $t_dir, "delme-$rand-out" ); last unless -e $outdir; } END { use File::Path; rmtree $outdir, 0, 0; } ok 1; print "# Output dir: $outdir\n" if $DEBUG; mkdir $outdir, 0777 or die "Can't mkdir $outdir: $!"; print "# Converting $corpus_dir => $outdir\n" if $DEBUG; my $conv = Pod::Simple::HTMLBatch->new; $conv->verbose(0); $conv->index(1); $conv->batch_convert( [$corpus_dir], $outdir ); ok 1; print "# OK, back from converting.\n" if $DEBUG; my @files; use File::Find; find( sub { push @files, $File::Find::name; if (/[.]html$/ && $_ !~ /perl|index/) { # Make sure an index was generated. open HTML, $_ or die "Cannot open $_: $!\n"; my $html = do { local $/; }; close HTML; ok $html =~ /
    /; } return; }, $outdir ); { my $long = ( grep m/zikzik\./i, @files )[0]; ok($long) or print "# How odd, no zikzik file in $outdir!?\n"; if($long) { $long =~ s{zikzik\.html?$}{}s; for(@files) { substr($_, 0, length($long)) = '' } @files = grep length($_), @files; } } if ($DEBUG) { print "#Produced in $outdir ...\n"; foreach my $f (sort @files) { print "# $f\n"; } print "# (", scalar(@files), " items total)\n"; } # Some minimal sanity checks: ok scalar(grep m/\.css/i, @files) > 5; ok scalar(grep m/\.html?/i, @files) > 5; ok scalar grep m{squaa\W+Glunk.html?}i, @files; if (my @long = grep { /^[^.]{9,}/ } map { s{^[^/]/}{} } @files) { ok 0; print "# File names too long:\n", map { "# $_\n" } @long; } else { ok 1; } # use Pod::Simple; # *pretty = \&Pod::Simple::BlackBox::pretty; print "# Bye from ", __FILE__, "\n" if $DEBUG; ok 1; Pod-Simple-3.43/t/linkclas.t0000644000175000017500000000274014062242376014021 0ustar khwkhw# Testing the LinkSection class BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } ### Test the basic sanity of the link-section treelet class use strict; use warnings; use Test; BEGIN { plan tests => 8 }; #use Pod::Simple::Debug (6); ok 1; use Pod::Simple::LinkSection; use Pod::Simple::BlackBox; # for its pretty() my $bare_treelet = ['B', {'pie' => 'no'}, 'a', ['C', {'bzrok' => 'plip'}, 'b' ], 'c' ] ; my $treelet = Pod::Simple::LinkSection->new($bare_treelet); # Make sure they're not the same ok ref($bare_treelet), 'ARRAY'; ok ref($treelet), 'Pod::Simple::LinkSection'; print "# Testing stringification...\n"; ok $treelet->stringify, 'abc'; # explicit ok join('', $treelet), 'abc'; # implicit print "# Testing non-coreferentiality...\n"; { my @stack = ($bare_treelet); my $this; while(@stack) { $this = shift @stack; if(ref($this || '') eq 'ARRAY') { push @stack, splice @$this; push @$this, ("BAD!") x 3; } elsif(ref($this || '') eq 'Pod::Simple::LinkSection') { push @stack, splice @$this; push @$this, ("BAD!") x 3; } elsif(ref($this || '') eq 'HASH') { %$this = (); } } # These will fail if $treelet and $bare_treelet are coreferential, # since we just conspicuously nuked $bare_treelet ok $treelet->stringify, 'abc'; # explicit ok join('', $treelet), 'abc'; # implicit } print "# Byebye...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/perlcygo.txt0000644000175000017500000004520714062242376014426 0ustar khwkhwNAME README.cygwin - Perl for Cygwin SYNOPSIS This document will help you configure, make, test and install Perl on Cygwin. This document also describes features of Cygwin that will affect how Perl behaves at runtime. NOTE: There are pre-built Perl packages available for Cygwin and a version of Perl is provided on the Cygwin CD. If you do not need to customize the configuration, consider using one of these packages: http://cygutils.netpedia.net/ PREREQUISITES Cygwin = GNU+Cygnus+Windows (Don't leave UNIX without it) The Cygwin tools are ports of the popular GNU development tools for Win32 platforms. They run thanks to the Cygwin library which provides the UNIX system calls and environment these programs expect. More information about this project can be found at: http://www.cygwin.com/ A recent net or commercial release of Cygwin is required. At the time this document was last updated, Cygwin 1.1.5 was current. NOTE: At this point, minimal effort has been made to provide compatibility with old (beta) Cygwin releases. The focus has been to provide a high quality release and not worry about working around old bugs. If you wish to use Perl with Cygwin B20.1 or earlier, consider using perl5.005_03, which is available in source and binary form at http://cygutils.netpedia.net/. If there is significant demand, a patch kit can be developed to port back to earlier Cygwin versions. Cygwin Configuration While building Perl some changes may be necessary to your Cygwin setup so that Perl builds cleanly. These changes are not required for normal Perl usage. NOTE: The binaries that are built will run on all Win32 versions. They do not depend on your host system (Win9x/WinME, WinNT/Win2K) or your Cygwin configuration (ntea, ntsec, binary/text mounts). The only dependencies come from hard-coded pathnames like /usr/local. However, your host system and Cygwin configuration will affect Perl's runtime behavior (see "TEST"). PATH Set the PATH environment variable so that Configure finds the Cygwin versions of programs. Any Windows directories should be removed or moved to the end of your PATH. nroff If you do not have nroff (which is part of the groff package), Configure will not prompt you to install man pages. Permissions On WinNT with either the ntea or ntsec CYGWIN settings, directory and file permissions may not be set correctly. Since the build process creates directories and files, to be safe you may want to run a `chmod -R +w *' on the entire Perl source tree. Also, it is a well known WinNT "feature" that files created by a login that is a member of the Administrators group will be owned by the Administrators group. Depending on your umask, you may find that you can not write to files that you just created (because you are no longer the owner). When using the ntsec CYGWIN setting, this is not an issue because it "corrects" the ownership to what you would expect on a UNIX system. CONFIGURE The default options gathered by Configure with the assistance of hints/cygwin.sh will build a Perl that supports dynamic loading (which requires a shared libperl.dll). This will run Configure and keep a record: ./Configure 2>&1 | tee log.configure If you are willing to accept all the defaults run Configure with -de. However, several useful customizations are available. Strip Binaries It is possible to strip the EXEs and DLLs created by the build process. The resulting binaries will be significantly smaller. If you want the binaries to be stripped, you can either add a -s option when Configure prompts you, Any additional ld flags (NOT including libraries)? [none] -s Any special flags to pass to gcc to use dynamic linking? [none] -s Any special flags to pass to ld2 to create a dynamically loaded library? [none] -s or you can edit hints/cygwin.sh and uncomment the relevant variables near the end of the file. Optional Libraries Several Perl functions and modules depend on the existence of some optional libraries. Configure will find them if they are installed in one of the directories listed as being used for library searches. Pre-built packages for most of these are available at http://cygutils.netpedia.net/. -lcrypt The crypt package distributed with Cygwin is a Linux compatible 56-bit DES crypt port by Corinna Vinschen. Alternatively, the crypt libraries in GNU libc have been ported to Cygwin. The DES based Ultra Fast Crypt port was done by Alexey Truhan: ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin/porters/Okhapkin_Sergey/cw32crypt-dist-0.tgz NOTE: There are various export restrictions on DES implementations, see the glibc README for more details. The MD5 port was done by Andy Piper: ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin/porters/Okhapkin_Sergey/libcrypt.tgz -lgdbm (use GDBM_File) GDBM is available for Cygwin. GDBM's ndbm/dbm compatibility feature also makes NDBM_File and ODBM_File possible (although they add little extra value). NOTE: The ndbm/dbm emulations only completely work on NTFS partitions. -ldb (use DB_File) BerkeleyDB is available for Cygwin. Some details can be found in ext/DB_File/DB_File.pm. NOTE: The BerkeleyDB library only completely works on NTFS partitions. -lcygipc (use IPC::SysV) A port of SysV IPC is available for Cygwin. NOTE: This has not been extensively tested. In particular, d_semctl_semun is undefined because it fails a Configure test and on Win9x the shm*() functions seem to hang. It also creates a compile time dependency because perl.h includes and (which will be required in the future when compiling CPAN modules). Configure-time Options The INSTALL document describes several Configure-time options. Some of these will work with Cygwin, others are not yet possible. Also, some of these are experimental. You can either select an option when Configure prompts you or you can define (undefine) symbols on the command line. -Uusedl Undefining this symbol forces Perl to be compiled statically. -Uusemymalloc By default Perl uses the malloc() included with the Perl source. If you want to force Perl to build with the system malloc() undefine this symbol. -Dusemultiplicity Multiplicity is required when embedding Perl in a C program and using more than one interpreter instance. This works with the Cygwin port. -Duseperlio The PerlIO abstraction works with the Cygwin port. -Duse64bitint gcc supports 64-bit integers. However, several additional long long functions are necessary to use them within Perl ({strtol,strtoul}l). These are not yet available with Cygwin. -Duselongdouble gcc supports long doubles (12 bytes). However, several additional long double math functions are necessary to use them within Perl ({atan2,cos,exp,floor,fmod,frexp,isnan,log,modf,pow,sin,sqrt}l,strtold). These are not yet available with Cygwin. -Dusethreads POSIX threads are not yet implemented in Cygwin. -Duselargefiles Although Win32 supports large files, Cygwin currently uses 32-bit integers for internal size and position calculations. Suspicious Warnings You may see some messages during Configure that seem suspicious. dlsym() ld2 is needed to build dynamic libraries, but it does not exist when dlsym() checking occurs (it is not created until `make' runs). You will see the following message: Checking whether your dlsym() needs a leading underscore ... ld2: not found I can't compile and run the test program. I'm guessing that dlsym doesn't need a leading underscore. Since the guess is correct, this is not a problem. Win9x and d_eofnblk Win9x does not correctly report EOF with a non-blocking read on a closed pipe. You will see the following messages: But it also returns -1 to signal EOF, so be careful! WARNING: you can't distinguish between EOF and no data! *** WHOA THERE!!! *** The recommended value for $d_eofnblk on this machine was "define"! Keep the recommended value? [y] At least for consistency with WinNT, you should keep the recommended value. Compiler/Preprocessor defines The following error occurs because of the Cygwin #define of _LONG_DOUBLE: Guessing which symbols your C compiler and preprocessor define... try.c:: parse error This failure does not seem to cause any problems. MAKE Simply run make and wait: make 2>&1 | tee log.make Warnings Warnings like these are normal: warning: overriding commands for target warning: ignoring old commands for target dllwrap: no export definition file provided dllwrap: creating one, but that may not be what you want ld2 During `make', ld2 will be created and installed in your $installbin directory (where you said to put public executables). It does not wait until the `make install' process to install the ld2 script, this is because the remainder of the `make' refers to ld2 without fully specifying its path and does this from multiple subdirectories. The assumption is that $installbin is in your current PATH. If this is not the case `make' will fail at some point. If this happens, just manually copy ld2 from the source directory to somewhere in your PATH. TEST There are two steps to running the test suite: make test 2>&1 | tee log.make-test cd t;./perl harness 2>&1 | tee ../log.harness The same tests are run both times, but more information is provided when running as `./perl harness'. Test results vary depending on your host system and your Cygwin configuration. If a test can pass in some Cygwin setup, it is always attempted and explainable test failures are documented. It is possible for Perl to pass all the tests, but it is more likely that some tests will fail for one of the reasons listed below. File Permissions UNIX file permissions are based on sets of mode bits for {read,write,execute} for each {user,group,other}. By default Cygwin only tracks the Win32 read-only attribute represented as the UNIX file user write bit (files are always readable, files are executable if they have a .{com,bat,exe} extension or begin with #!, directories are always readable and executable). On WinNT with the ntea CYGWIN setting, the additional mode bits are stored as extended file attributes. On WinNT with the ntsec CYGWIN setting, permissions use the standard WinNT security descriptors and access control lists. Without one of these options, these tests will fail: Failed Test List of failed ------------------------------------ io/fs.t 5, 7, 9-10 lib/anydbm.t 2 lib/db-btree.t 20 lib/db-hash.t 16 lib/db-recno.t 18 lib/gdbm.t 2 lib/ndbm.t 2 lib/odbm.t 2 lib/sdbm.t 2 op/stat.t 9, 20 (.tmp not an executable extension) Hard Links FAT partitions do not support hard links (whereas NTFS does), in which case Cygwin implements link() by copying the file. On remote (network) drives Cygwin's stat() always sets st_nlink to 1, so the link count for remote directories and files is not available. In either case, these tests will fail: Failed Test List of failed ------------------------------------ io/fs.t 4 op/stat.t 3 Filetime Granularity On FAT partitions the filetime granularity is 2 seconds. The following test will fail: Failed Test List of failed ------------------------------------ io/fs.t 18 Tainting Checks When Perl is running in taint mode, $ENV{PATH} is considered tainted and not used, so DLLs not in the default system directories will not be found. While the tests are running you will see warnings popup from the system with messages like: Win9x Error Starting Program A required .DLL file, CYGWIN1.DLL, was not found WinNT perl.exe - Unable to Locate DLL The dynamic link library cygwin1.dll could not be found in the specified path ... Just click OK and ignore them. When running `make test', 2 popups occur. During `./perl harness', 4 popups occur. Also, these tests will fail: Failed Test List of failed ------------------------------------ op/taint.t 1, 3, 31, 37 Alternatively, you can copy cygwin1.dll into the directory where the tests run: cp /bin/cygwin1.dll t or one of the Windows system directories (although, this is not recommended). /etc/group Cygwin does not require /etc/group, in which case the op/grent.t test will be skipped. The check performed by op/grent.t expects to see entries that use the members field, otherwise this test will fail: Failed Test List of failed ------------------------------------ op/grent.t 1 Script Portability Cygwin does an outstanding job of providing UNIX-like semantics on top of Win32 systems. However, in addition to the items noted above, there are some differences that you should know about. This is a very brief guide to portability, more information can be found in the Cygwin documentation. Pathnames Cygwin pathnames can be separated by forward (/) or backward (\) slashes. They may also begin with drive letters (C:) or Universal Naming Codes (//UNC). DOS device names (aux, con, prn, com*, lpt?, nul) are invalid as base filenames. However, they can be used in extensions (e.g., hello.aux). Names may contain all printable characters except these: : * ? " < > | File names are case insensitive, but case preserving. A pathname that contains a backslash or drive letter is a Win32 pathname (and not subject to the translations applied to POSIX style pathnames). Text/Binary When a file is opened it is in either text or binary mode. In text mode a file is subject to CR/LF/Ctrl-Z translations. With Cygwin, the default mode for an open() is determined by the mode of the mount that underlies the file. Perl provides a binmode() function to set binary mode on files that otherwise would be treated as text. sysopen() with the O_TEXT flag sets text mode on files that otherwise would be treated as binary: sysopen(FOO, "bar", O_WRONLY|O_CREAT|O_TEXT) lseek(), tell() and sysseek() only work with files opened in binary mode. The text/binary issue is covered at length in the Cygwin documentation. .exe The Cygwin stat(), lstat() and readlink() functions make the .exe extension transparent by looking for foo.exe when you ask for foo (unless a foo also exists). Cygwin does not require a .exe extension, but gcc adds it automatically when building a program. However, when accessing an executable as a normal file (e.g., cp in a makefile) the .exe is not transparent. The install included with Cygwin automatically appends a .exe when necessary. chown() On WinNT chown() can change a file's user and group IDs. On Win9x chown() is a no-op, although this is appropriate since there is no security model. Miscellaneous File locking using the F_GETLK command to fcntl() is a stub that returns ENOSYS. Win9x can not rename() an open file (although WinNT can). The Cygwin chroot() implementation has holes (it can not restrict file access by native Win32 programs). INSTALL This will install Perl, including man pages. make install | tee log.make-install NOTE: If STDERR is redirected `make install' will not prompt you to install perl into /usr/bin. You may need to be Administrator to run `make install'. If you are not, you must have write access to the directories in question. Information on installing the Perl documentation in HTML format can be found in the INSTALL document. MANIFEST These are the files in the Perl release that contain references to Cygwin. These very brief notes attempt to explain the reason for all conditional code. Hopefully, keeping this up to date will allow the Cygwin port to be kept as clean as possible. Documentation INSTALL README.cygwin README.win32 MANIFEST Changes Changes5.005 Changes5.004 Changes5.6 pod/perl.pod pod/perlport.pod pod/perlfaq3.pod pod/perldelta.pod pod/perl5004delta.pod pod/perl56delta.pod pod/perlhist.pod pod/perlmodlib.pod pod/buildtoc.PL pod/perltoc.pod Build, Configure, Make, Install cygwin/Makefile.SHs cygwin/ld2.in cygwin/perlld.in ext/IPC/SysV/hints/cygwin.pl ext/NDBM_File/hints/cygwin.pl ext/ODBM_File/hints/cygwin.pl hints/cygwin.sh Configure - help finding hints from uname, shared libperl required for dynamic loading Makefile.SH - linklibperl Porting/patchls - cygwin in port list installman - man pages with :: translated to . installperl - install dll/ld2/perlld, install to pods makedepend.SH - uwinfix Tests t/io/tell.t - binmode t/lib/b.t - ignore Cwd from os_extras t/lib/glob-basic.t - Win32 directory list access differs from read mode t/op/magic.t - $^X/symlink WORKAROUND, s/.exe// t/op/stat.t - no /dev, skip Win32 ftCreationTime quirk (cache manager sometimes preserves ctime of file previously created and deleted), no -u (setuid) Compiled Perl Source EXTERN.h - __declspec(dllimport) XSUB.h - __declspec(dllexport) cygwin/cygwin.c - os_extras (getcwd, spawn) perl.c - os_extras perl.h - binmode doio.c - win9x can not rename a file when it is open pp_sys.c - do not define h_errno, pp_system with spawn util.c - use setenv Compiled Module Source ext/POSIX/POSIX.xs - tzname defined externally ext/SDBM_File/sdbm/pair.c - EXTCONST needs to be redefined from EXTERN.h ext/SDBM_File/sdbm/sdbm.c - binary open Perl Modules/Scripts lib/Cwd.pm - hook to internal Cwd::cwd lib/ExtUtils/MakeMaker.pm - require MM_Cygwin.pm lib/ExtUtils/MM_Cygwin.pm - canonpath, cflags, manifypods, perl_archive lib/File/Find.pm - on remote drives stat() always sets st_nlink to 1 lib/File/Spec/Unix.pm - preserve //unc lib/File/Temp.pm - no directory sticky bit lib/perl5db.pl - use stdin not /dev/tty utils/perldoc.PL - version comment BUGS When make starts, it warns about overriding commands for perlmain.o. `make clean' does not remove library .def or .exe.stackdump files. The ld2 script contains references to the source directory. You should change these to $installbin after `make install'. Support for swapping real and effective user and group IDs is incomplete. On WinNT Cygwin provides setuid(), seteuid(), setgid() and setegid(). However, additional Cygwin calls for manipulating WinNT access tokens and security contexts are required. When building DLLs, `dllwrap --export-all-symbols' is used to export global symbols. It might be better to generate an explicit .def file (see makedef.pl). Also, DLLs can now be build with `gcc -shared'. AUTHORS Charles Wilson , Eric Fifer , alexander smishlajev , Steven Morlock , Sebastien Barre , Teun Burgers . HISTORY Last updated: 9 November 2000 Pod-Simple-3.43/t/testlib1/0000755000175000017500000000000014066435222013556 5ustar khwkhwPod-Simple-3.43/t/testlib1/zikzik.pod0000644000175000017500000000012714062242377015600 0ustar khwkhw=head1 NAME zikzik -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut Pod-Simple-3.43/t/testlib1/Zonk/0000755000175000017500000000000014066435222014477 5ustar khwkhwPod-Simple-3.43/t/testlib1/Zonk/Veng.pm0000644000175000017500000000005114062242377015733 0ustar khwkhw # This is just a podless test file. 1; Pod-Simple-3.43/t/testlib1/Zonk/Fiddle.txt0000644000175000017500000000012314062242377016426 0ustar khwkhw This is just a dummy file. It's podless and shouldn't even be scanned for pod. Pod-Simple-3.43/t/testlib1/Zonk/Pronk.pm0000644000175000017500000000243614062242377016136 0ustar khwkhw =head1 NAME Zonk::Pronk -- blorpoesu =head1 DESCRIPTION This is just a test file. This is a test Pod document in Latin-1. Its content is the last two paragraphs of Baudelaire's I. A travers ces barreaux symboliques sparant deux mondes, la grande route et le chteau, l'enfant pauvre montrait l'enfant riche son propre joujou, que celui-ci examinait avidement comme un objet rare et inconnu. Or, ce joujou, que le petit souillon agaait, agitait et secouait dans une bote grille, c'tait un rat vivantE<160>! Les parents, par conomie sans doute, avaient tir le joujou de la vie elle-mme. Et les deux enfants se riaient l'un l'autre fraternellement, avec des dents d'une I blancheur. =head2 As Verbatim A travers ces barreaux symboliques sparant deux mondes, la grande route et le chteau, l'enfant pauvre montrait l'enfant riche son propre joujou, que celui-ci examinait avidement comme un objet rare et inconnu. Or, ce joujou, que le petit souillon agaait, agitait et secouait dans une bote grille, c'tait un rat vivant! Les parents, par conomie sans doute, avaient tir le joujou de la vie elle-mme. Et les deux enfants se riaient l'un l'autre fraternellement, avec des dents d'une gale blancheur. [end] =cut print "HOOBOY!\n"; 1; Pod-Simple-3.43/t/testlib1/pod/0000755000175000017500000000000014066435222014340 5ustar khwkhwPod-Simple-3.43/t/testlib1/pod/perlthng.pod0000644000175000017500000000007514062242377016674 0ustar khwkhw =head1 NAME perlthang - This is just some test file =cut Pod-Simple-3.43/t/testlib1/pod/perlflif.pod0000644000175000017500000000007514062242377016654 0ustar khwkhw =head1 NAME perlthang - This is just some test file =cut Pod-Simple-3.43/t/testlib1/squaa.pm0000644000175000017500000000014614062242377015232 0ustar khwkhwpackage squaa; =head1 NAME squaa -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut Pod-Simple-3.43/t/testlib1/squaa/0000755000175000017500000000000014066435222014670 5ustar khwkhwPod-Simple-3.43/t/testlib1/squaa/Vliff.pm0000644000175000017500000000016514062242377016301 0ustar khwkhw =head1 NAME squaa::Vliff -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut print "HOOBOY!\n"; 1; Pod-Simple-3.43/t/testlib1/squaa/Glunk.pod0000644000175000017500000000013614062242377016457 0ustar khwkhw =head1 NAME squaa::Glunk -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut Pod-Simple-3.43/t/testlib1/hinkhonk/0000755000175000017500000000000014066435222015367 5ustar khwkhwPod-Simple-3.43/t/testlib1/hinkhonk/readme.txt0000644000175000017500000000005014062242377017363 0ustar khwkhwThis directory should never be scanned. Pod-Simple-3.43/t/testlib1/hinkhonk/Vliff.pm0000644000175000017500000000016514062242377017000 0ustar khwkhw =head1 NAME squaa::Vliff -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut print "HOOBOY!\n"; 1; Pod-Simple-3.43/t/testlib1/hinkhonk/Glunk.pod0000644000175000017500000000013614062242376017155 0ustar khwkhw =head1 NAME squaa::Glunk -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut Pod-Simple-3.43/t/testlib1/Blorm.pm0000644000175000017500000000012614062242376015170 0ustar khwkhw=head1 NAME Blorm -- blorpoesu =head1 DESCRIPTION This is just a test file. =cut Pod-Simple-3.43/t/reinit.t0000644000175000017500000000361414062242376013514 0ustar khwkhwBEGIN { chdir 't' if -d 't'; if($ENV{PERL_CORE}) { @INC = '../lib'; } } use lib '../lib'; use strict; use warnings; use Test; BEGIN { plan tests => 5 }; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { require File::Spec; my $updir = File::Spec->updir; my $dir = File::Spec->catdir ($updir, 'lib', 'Pod', 'Simple', 't'); return File::Spec->catfile ($dir, $file); } else { return $file; } } use Pod::Simple::Text; $Pod::Simple::Text::FREAKYMODE = 1; my $parser = Pod::Simple::Text->new(); foreach my $file ( "junk1.pod", "junk2.pod", "perlcyg.pod", "perlfaq.pod", "perlvar.pod", ) { unless(-e source_path($file)) { ok 0; print "# But $file doesn't exist!!\n"; next; } my $precooked = $file; my $outstring; my $compstring; $precooked =~ s<\.pod>s; $parser->reinit; $parser->output_string(\$outstring); $parser->parse_file(source_path($file)); open(IN, $precooked) or die "Can't read-open $precooked: $!"; { local $/; $compstring = ; } close(IN); for ($outstring,$compstring) { s/\s+/ /g; s/^\s+//s; s/\s+$//s; } if($outstring eq $compstring) { ok 1; next; } elsif( do{ for ($outstring, $compstring) { tr/ //d; }; $outstring eq $compstring; }){ print "# Differ only in whitespace.\n"; ok 1; next; } else { my $x = $outstring ^ $compstring; $x =~ m/^(\x00*)/s or die; my $at = length($1); print "# Difference at byte $at...\n"; if($at > 10) { $at -= 5; } { print "# ", substr($outstring,$at,20), "\n"; print "# ", substr($compstring,$at,20), "\n"; print "# ^..."; } ok 0; printf "# Unequal lengths %s and %s\n", length($outstring), length($compstring); next; } } Pod-Simple-3.43/t/begin.t0000644000175000017500000005445314062242375013314 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 62 }; my $d; #use Pod::Simple::Debug (\$d, 0); ok 1; use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; BEGIN { require FindBin; unshift @INC, $FindBin::Bin . '/lib'; require helpers; helpers->import; } my $x = 'Pod::Simple::XMLOutStream'; $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output sub moj {$_[0]->accept_target('mojojojo')} sub mojtext {$_[0]->accept_target_as_text('mojojojo')} sub any {$_[0]->accept_target_as_text('*')} #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Testing non-matching complaint...\n"; { my $out; ok( ($out = $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\nStuff\n\n=end blorp\n\nYup.\n")) =~ m/POD ERRORS/ ) or print "# Didn't contain POD ERRORS:\n# $out\n"; ok( ($out = $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :mojojojo\n\nStuff\n\n=end :blorp\n\nYup.\n")) =~ m/POD ERRORS/ ) or print "# Didn't contain POD ERRORS:\n# $out\n"; ok( ($out = $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :mojojojo\n\n=begin :zaz\n\nStuff\n\n=end :blorp\n\nYup.\n")) =~ m/POD ERRORS/ ) or print "# Didn't contain POD ERRORS:\n# $out\n"; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Testing some trivial cases of non-acceptance...\n"; ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\nStuff\n\n=end mojojojo\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\n\nStuff\n\n=end mojojojo\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :mojojojo\n\n\nStuff\n\n=end :mojojojo\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\n Stuff\n\n=end mojojojo\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\n\n Stuff\n\n=end mojojojo\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :mojojojo\n\n\n Stuff\n\n=end :mojojojo\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI\n\n=end mojojojo\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin mojojojo\n\n\nI\n\n=end mojojojo\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :mojojojo\n\n\nI\n\n=end :mojojojo\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nStuff\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\n\nStuff\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\n\nStuff\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\n Stuff\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\n\n Stuff\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\n\n Stuff\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\n\nI\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\n\nI\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.Yup.' ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Testing matching because of negated non-acceptance...\n"; #$d = 5; ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !crunk\n\nstuff\n\n=end !crunk\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin !crunk\n\nstuff\n\n=end !crunk\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !mojojojo\n\nstuff\n\n=end !mojojojo\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !mojojojo\n\nI\n\n=end !mojojojo\n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !:mojojojo\n\nI\n\n=end !:mojojojo\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin :!mojojojo \n\nI\n\n=end :!mojojojo \t \n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !crunk,zaz\n\nstuff\n\n=end !crunk,zaz\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin !crunk\n\nstuff\n\n=end !crunk\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin !crunk\n\nstuff\n\n=end !crunk\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( \&any, "=pod\n\nI like pie.\n\n=begin !crunk\n\nstuff\n\n=end !crunk\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !mojojojo\n\nstuff\n\n=end !mojojojo\n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !mojojojo\n\nI\n\n\n=end !mojojojo\n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !psketti,mojojojo,crunk\n\n\nI\n\n=end !psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( "=pod\n\nI like pie.\n\n=begin !:psketti,mojojojo,crunk\n\nI\n\n=end !:psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.stuffYup.' ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Testing accept_target + simple ...\n"; ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI\n\n=end mojojojo \n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI\n\n=end psketti,mojojojo,crunk \n\nYup.\n"), 'I like pie.I<stuff>Yup.' ); print "# Testing accept_target_as_text + simple ...\n"; ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI\n\n=end mojojojo \n\nYup.\n"), 'I like pie.stuffYup.' ); ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI\n\n=end psketti,mojojojo,crunk \n\nYup.\n"), 'I like pie.stuffYup.' ); print "# Testing accept_target + two simples ...\n"; #$d = 10; ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI\n\nHm, B!\n\n=end mojojojo\n\n\nYup.\n"), 'I like pie.I<stuff>Hm, B<things>!Yup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI\n\nHm, B!\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.I<stuff>Hm, B<things>!Yup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :mojojojo\n\nI\n\nHm, B!\n\n=end :mojojojo\n\nYup.\n"), 'I like pie.stuffHm, things!Yup.' ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\nI\n\nHm, B!\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.stuffHm, things!Yup.' ); print "# Testing accept_target_as_text + two simples ...\n"; ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI\n\nHm, B!\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.stuffHm, things!Yup.' ); ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\nI\n\nHm, B!\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), 'I like pie.stuffHm, things!Yup.' ); print "# Testing accept_target + two simples, latter with leading whitespace ...\n"; #$d = 10; ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI\n\n Hm, B!\nTrala.\n\n=end mojojojo\n\n\nYup.\n"), qq{I like pie.I<stuff> Hm, B<things>!\nTrala.\nYup.} ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI\n\n Hm, B!\nTrala.\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), qq{I like pie.I<stuff> Hm, B<things>!\nTrala.\nYup.} ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI\n\n Hm, B!\nTrala.\n\n\n=end mojojojo\n\n\nYup.\n"), qq{I like pie.I<stuff> Hm, B<things>!\nTrala.\n\nYup.} ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk\n\nI\n\n Hm, B!\nTrala.\n\n\n=end psketti,mojojojo,crunk\n\nYup.\n"), qq{I like pie.I<stuff> Hm, B<things>!\nTrala.\n\nYup.} ); print "# Testing :-target and accept_target + two simples, latter with leading whitespace ...\n"; ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :mojojojo\n\nI\nTrala!\n\n Hm, B!\nTrala.\n\n=end :mojojojo\n\nYup.\n"), qq{I like pie.stuff Trala! Hm, B<things>!\nTrala.Yup.} ); ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin :psketti,mojojojo,crunk\n\nI\nTrala!\n\n Hm, B!\nTrala.\n\n=end :psketti,mojojojo,crunk\n\nYup.\n"), qq{I like pie.stuff Trala! Hm, B<things>!\nTrala.Yup.} ); print "# now with accept_target_as_text\n"; ok( $x->_out( \&mojtext, "=pod\n\nI like pie.\n\n=begin mojojojo\n\nI\nTrala!\n\n Hm, B!\nTrala.\n\n=end mojojojo\n\nYup.\n"), qq{I like pie.stuff Trala! Hm, B<things>!\nTrala.Yup.} ); ok( $x->_out( \&mojtext, join "\n\n" => "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk", "I\nTrala!", " Hm, B!\nTrala.", "=end psketti,mojojojo,crunk", "Yup.\n" ), qq{I like pie.}. qq{}. qq{stuff Trala!}. qq{ Hm, B<things>!\nTrala.}. qq{Yup.} ); print "# Now with five paragraphs (p,v,v,p,p) and accept_target_as_text\n"; ok( $x->_out( \&mojtext, join "\n\n" => "=pod\n\nI like pie.\n\n=begin psketti,mojojojo,crunk", "I\nTrala!", " Hm, B!\nTrala.", " Oh, F<< dodads >>!\nHurf.", "Boing C\n Blorg!", "Woohah Ssquim!", "=end psketti,mojojojo,crunk", "Yup.\n" ), qq{I like pie.}. qq{}. qq{stuff Trala!}. qq{ Hm, B<things>!\nTrala.\n\n}. qq{ Oh, F<< dodads >>!\nHurf.}. qq{Boing spr- oink Blorg!}. qq{Woohah thwack woohahsquim!}. qq{Yup.} ); print "#\n# Now nested begin...end regions...\n"; sub mojprok { shift->accept_targets(qw{mojojojo prok}) } ok( $x->_out( \&mojprok, join "\n\n" => "=pod\n\nI like pie.", "=begin :psketti,mojojojo,crunk", "I\nTrala!", " Hm, B!\nTrala.", " Oh, F<< dodads >>!\nHurf.", "Boing C\n Blorg!", "=begin :prok", "Woohah Ssquim!", "=end :prok", "ZubZ<>aaz.", "=end :psketti,mojojojo,crunk", "Yup.\n" ), qq{I like pie.}. qq{}. qq{stuff Trala!}. qq{ Hm, B<things>!\nTrala.\n\n}. qq{ Oh, F<< dodads >>!\nHurf.}. qq{Boing spr- oink Blorg!}. qq{}. qq{Woohah thwack woohahsquim!}. qq{}. qq{Zubaaz.}. qq{}. qq{Yup.} ); print "# a little more complex this time...\n"; ok( $x->_out( \&mojprok, join "\n\n" => "=pod\n\nI like pie.", "=begin :psketti,mojojojo,crunk", "I\nTrala!", " Hm, B!\nTrala.", " Oh, F<< dodads >>!\nHurf.", "Boing C\n Blorg!", "=begin :prok", " Blorp, B!\nTrala.", " Khh, F<< dodads >>!\nHurf.", "Woohah Ssquim!", "=end :prok", "ZubZ<>aaz.", "=end :psketti,mojojojo,crunk", "Yup.\n" ), qq{I like pie.}. qq{}. qq{stuff Trala!}. qq{ Hm, B<things>!\nTrala.\n\n}. qq{ Oh, F<< dodads >>!\nHurf.}. qq{Boing spr- oink Blorg!}. qq{}. qq{ Blorp, B<things>!\nTrala.\n\n}. qq{ Khh, F<< dodads >>!\nHurf.}. qq{Woohah thwack woohahsquim!}. qq{}. qq{Zubaaz.}. qq{}. qq{Yup.} ); $d = 10; print "# Now with nesting where inner region is non-resolving...\n"; ok( $x->_out( \&mojprok, join "\n\n" => "=pod\n\nI like pie.", "=begin :psketti,mojojojo,crunk", "I\nTrala!", " Hm, B!\nTrala.", " Oh, F<< dodads >>!\nHurf.", "Boing C\n Blorg!", "=begin prok", " Blorp, B!\nTrala.", " Khh, F<< dodads >>!\nHurf.", "Woohah Ssquim!", "=end prok", "ZubZ<>aaz.", "=end :psketti,mojojojo,crunk", "Yup.\n" ), qq{I like pie.}. qq{}. qq{stuff Trala!}. qq{ Hm, B<things>!\nTrala.\n\n}. qq{ Oh, F<< dodads >>!\nHurf.}. qq{Boing spr- oink Blorg!}. qq{}. qq{ Blorp, B<things>!\nTrala.\n\n}. qq{ Khh, F<< dodads >>!\nHurf.\n}. qq{Woohah S<thwack\nwoohah>squim!}. qq{}. qq{Zubaaz.}. qq{}. qq{Yup.} ); print "# Now a begin...end with a non-resolving for inside\n"; ok( $x->_out( \&mojprok, join "\n\n" => "=pod\n\nI like pie.", "=begin :psketti,mojojojo,crunk", "I\nTrala!", " Hm, B!\nTrala.", " Oh, F<< dodads >>!\nHurf.", "Boing C\n Blorg!", "=for prok" . " Blorp, B!\nTrala.\n Khh, F<< dodads >>!\nHurf.", "ZubZ<>aaz.", "=end :psketti,mojojojo,crunk", "Yup.\n" ), qq{I like pie.}. qq{}. qq{stuff Trala!}. qq{ Hm, B<things>!\nTrala.\n\n}. qq{ Oh, F<< dodads >>!\nHurf.}. qq{Boing spr- oink Blorg!}. qq{}. qq{Blorp, B<things>!\nTrala.\n}. qq{ Khh, F<< dodads >>!\nHurf.}. qq{}. qq{Zubaaz.}. qq{}. qq{Yup.} ); print "# Now a begin...end with a resolving for inside\n"; ok( $x->_out( \&mojprok, join "\n\n" => "=pod\n\nI like pie.", "=begin :psketti,mojojojo,crunk", "I\nTrala!", " Hm, B!\nTrala.", " Oh, F<< dodads >>!\nHurf.", "Boing C\n Blorg!", "=for :prok" . " Blorp, B!\nTrala.\n Khh, F<< dodads >>!\nHurf.", "ZubZ<>aaz.", "=end :psketti,mojojojo,crunk", "Yup.\n" ), qq{I like pie.}. qq{}. qq{stuff Trala!}. qq{ Hm, B<things>!\nTrala.\n\n}. qq{ Oh, F<< dodads >>!\nHurf.}. qq{Boing spr- oink Blorg!}. qq{}. qq{Blorp, things! Trala. Khh, }. qq{dodads! Hurf.}. qq{}. qq{Zubaaz.}. qq{}. qq{Yup.} ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Testing matching of begin block titles\n"; ok( $x->_out( \&moj, "=pod\n\nI like pie.\n\n=begin mojojojo Title\n\nstuff\n\n=end mojojojo \n\nYup.\n"), 'I like pie.stuffYup.' ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/tiedfh.t0000644000175000017500000000236414062242377013467 0ustar khwkhw# Testing tied output filehandle BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 8 }; use Pod::Simple::TiedOutFH; ok 1; print "# Sanity test of Perl and Pod::Simple::TiedOutFH\n"; { my $x = 'abc'; my $out = Pod::Simple::TiedOutFH->handle_on($x); print $out "Puppies\n"; print $out "rrrrr"; print $out "uffuff!"; ok $x, "abcPuppies\nrrrrruffuff!"; undef $out; ok $x, "abcPuppies\nrrrrruffuff!"; } # Now test that we can have two different strings. { my $x1 = 'abc'; my $x2 = 'xyz'; my $out1 = Pod::Simple::TiedOutFH->handle_on($x1); my $out2 = Pod::Simple::TiedOutFH->handle_on($x2); print $out1 "Puppies\n"; print $out2 "Kitties\n"; print $out2 "mmmmm"; print $out1 "rrrrr"; print $out2 "iaooowwlllllllrrr!\n"; print $out1 "uffuff!"; ok $x1, "abcPuppies\nrrrrruffuff!", "out1 test"; ok $x2, "xyzKitties\nmmmmmiaooowwlllllllrrr!\n", "out2 test"; undef $out1; undef $out2; ok $x1, "abcPuppies\nrrrrruffuff!", "out1 test"; ok $x2, "xyzKitties\nmmmmmiaooowwlllllllrrr!\n", "out2 test"; } print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/search05.t0000644000175000017500000000172314062242376013633 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Pod::Simple::Search; use Test; BEGIN { plan tests => 16 } print "# Some basic sanity tests...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; print "# New object: $x\n"; print "# Version: ", $x->VERSION, "\n"; ok defined $x->can('callback'); ok defined $x->can('dir_prefix'); ok defined $x->can('inc'); ok defined $x->can('laborious'); ok defined $x->can('limit_glob'); ok defined $x->can('limit_re'); ok defined $x->can('recurse'); ok defined $x->can('shadows'); ok defined $x->can('verbose'); ok defined $x->can('survey'); ok defined $x->can('_state_as_string'); ok defined $x->can('contains_pod'); ok defined $x->can('find'); ok defined $x->can('simplify_name'); print "# Testing state dumping...\n"; print $x->_state_as_string; $x->inc("I\nLike Pie!\t!!"); print $x->_state_as_string; print "# bye\n"; ok 1; Pod-Simple-3.43/t/ascii_order.pl0000644000175000017500000000150714062242375014653 0ustar khwkhw# Helper for some of the .t's in this directory sub native_to_uni($) { # Convert from platform character set to Unicode # (which is the same as ASCII) my $string = shift; return $string if ord("A") == 65 || $] lt 5.007_003; # Doesn't work on early EBCDIC Perls my $output = ""; for my $i (0 .. length($string) - 1) { $output .= chr(utf8::native_to_unicode(ord(substr($string, $i, 1)))); } # Preserve utf8ness of input onto the output, even if it didn't need to be # utf8 utf8::upgrade($output) if utf8::is_utf8($string); return $output; } sub ascii_order { # Sort helper. Causes the order to be the same as ASCII # no matter what the platform's character set is. return native_to_uni($a) cmp native_to_uni($b); } 1 Pod-Simple-3.43/t/lib/0000755000175000017500000000000014066435222012575 5ustar khwkhwPod-Simple-3.43/t/lib/helpers.pm0000644000175000017500000000035114062242376014576 0ustar khwkhw#!perl package helpers; use strict; use warnings; use Exporter; our @ISA = qw{Exporter}; our @EXPORT_OK = qw(e f); our @EXPORT = qw{e}; sub e { Pod::Simple::DumpAsXML->_duo(@_) }; sub f { Pod::Simple::DumpAsXML->_duo(@_) }; 1;Pod-Simple-3.43/t/search28.t0000644000175000017500000000366714062242376013651 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Pod::Simple::Search; use Test; BEGIN { plan tests => 4 } print "# ", __FILE__, ": Testing limit_glob ...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; $x->inc(0); $x->shadows(1); use File::Spec; use Cwd; my $cwd = cwd(); print "# CWD: $cwd\n"; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { return "../lib/Pod/Simple/t/$file"; } else { return $file; } } my($here1, $here2, $here3); if( -e ($here1 = source_path( 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = source_path( 'testlib2')); die "But where's $here3?" unless -e ($here3 = source_path( 'testlib3')); } elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = File::Spec->catdir($cwd, 't', 'testlib2')); die "But where's $here3?" unless -e ($here3 = File::Spec->catdir($cwd, 't', 'testlib3')); } else { die "Can't find the test corpora"; } print "# OK, found the test corpora\n# as $here1\n# and $here2\n# and $here3\n#\n"; ok 1; print $x->_state_as_string; #$x->verbose(12); use Pod::Simple; *pretty = \&Pod::Simple::BlackBox::pretty; my $glob = '*z*k*'; print "# Limiting to $glob\n"; $x->limit_glob($glob); my($name2where, $where2name) = $x->survey($here1, $here2, $here3); my $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; my $ascii_order; if( -e ($ascii_order = source_path('ascii_order.pl'))) { # } elsif(-e ($ascii_order = File::Spec->catfile($cwd, 't', 'ascii_order.pl'))) { # } else { die "Can't find ascii_order.pl"; } require $ascii_order; { my $names = join "|", sort ascii_order values %$where2name; ok $names, "Zonk::Pronk|perlzuk|zikzik"; } print "# OK, bye from ", __FILE__, "\n"; ok 1; __END__ Pod-Simple-3.43/t/emptylists.t0000644000175000017500000000273214062242376014437 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 5 }; ok 1; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; my $x = 'Pod::Simple::XMLOutStream'; $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output sub on {shift->parse_empty_lists(1)} sub off {shift->parse_empty_lists(0)} my $pod = <_out($pod), '' ); print "# Testing explicit parse_empty_lists( FALSE ) ...\n"; ok( $x->_out(\&off, $pod), '' ); print "# Testing parse_empty_lists( TRUE ) ...\n"; ok( $x->_out(\&on, $pod), '' ); print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; Pod-Simple-3.43/t/search20.t0000644000175000017500000000612214062242376013626 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Pod::Simple::Search; use Test; BEGIN { plan tests => 11 } print "# ", __FILE__, ": Testing the scanning of several (well, two) docroots...\n"; my $x = Pod::Simple::Search->new; die "Couldn't make an object!?" unless ok defined $x; $x->inc(0); $x->callback(sub { print "# ", join(" ", map "{$_}", @_), "\n"; return; }); use File::Spec; use Cwd; my $cwd = cwd(); print "# CWD: $cwd\n"; sub source_path { my $file = shift; if ($ENV{PERL_CORE}) { return "../lib/Pod/Simple/t/$file"; } else { return $file; } } my($here1, $here2); if( -e ($here1 = source_path('testlib1'))) { die "But where's $here2?" unless -e ($here2 = source_path('testlib2')); } elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'testlib1' ))) { die "But where's $here2?" unless -e ($here2 = File::Spec->catdir($cwd, 't', 'testlib2')); } else { die "Can't find the test corpora"; } print "# OK, found the test corpora\n# as $here1\n# and $here2\n"; ok 1; print $x->_state_as_string; #$x->verbose(12); use Pod::Simple; *pretty = \&Pod::Simple::BlackBox::pretty; print "# OK, starting run...\n# [[\n"; my($name2where, $where2name) = $x->survey($here1, $here2); print "# ]]\n#OK, run done.\n"; my $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; my $ascii_order; if( -e ($ascii_order = source_path('ascii_order.pl'))) { # } elsif(-e ($ascii_order = File::Spec->catfile($cwd, 't', 'ascii_order.pl'))) { # } else { die "Can't find ascii_order.pl"; } require $ascii_order; { my $names = join "|", sort ascii_order values %$where2name; skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, $names, "Blorm|Suzzle|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|perlzoned|perlzuk|squaa|squaa::Glunk|squaa::Vliff|squaa::Wowo|zikzik"; } { my $names = join "|", sort ascii_order keys %$name2where; skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, $names, "Blorm|Suzzle|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|perlzoned|perlzuk|squaa|squaa::Glunk|squaa::Vliff|squaa::Wowo|zikzik"; } ok( ($name2where->{'squaa'} || 'huh???'), '/squaa\.pm$/'); ok grep( m/squaa\.pm/, keys %$where2name ), 1; ###### Now with recurse(0) $x->recurse(0); print "# OK, starting run without recurse...\n# [[\n"; ($name2where, $where2name) = $x->survey($here1, $here2); print "# ]]\n#OK, run without recurse done.\n"; $p = pretty( $where2name, $name2where )."\n"; $p =~ s/, +/,\n/g; $p =~ s/^/# /mg; print $p; { my $names = join "|", sort ascii_order values %$where2name; skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, $names, "Blorm|Suzzle|squaa|zikzik"; } { my $names = join "|", sort ascii_order keys %$name2where; skip $^O eq 'VMS' ? '-- case may or may not be preserved' : 0, $names, "Blorm|Suzzle|squaa|zikzik"; } ok( ($name2where->{'squaa'} || 'huh???'), '/squaa\.pm$/'); ok grep( m/squaa\.pm/, keys %$where2name ), 1; ok 1; __END__ Pod-Simple-3.43/t/junk1o.txt0000644000175000017500000000047614062242376014010 0ustar khwkhwpie is nice E POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 2: =cut found outside a pod block. Skipping to next block. Around line 4: Unknown directive: =head9 Around line 6: Unterminated B<...> sequence Around line 8: Unknown E content in E Pod-Simple-3.43/t/html02.t0000644000175000017500000000146014062242376013325 0ustar khwkhw# Testing HTML text styles BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } #use Pod::Simple::Debug (10); use strict; use warnings; use Test; BEGIN { plan tests => 7}; use Pod::Simple::HTML; sub x { Pod::Simple::HTML->_out( sub{ $_[0]->bare_output(1) }, "=pod\n\n$_[0]", ) } ok 1; my @pairs = ( [ "I" => qq{\n

    italicized

    \n} ], [ 'B' => qq{\n

    bolded

    \n} ], [ 'C' => qq{\n

    code

    \n} ], [ 'F' => qq{\n

    /tmp/foo

    \n} ], [ 'F' => qq{\n

    /tmp/foo

    \n} ], ); foreach( @pairs ) { print "# Testing pod source $$_[0] ...\n" unless $_->[0] =~ m/\n/; ok( x($_->[0]), $_->[1] ) } print "# And one for the road...\n"; ok 1; Pod-Simple-3.43/t/ac_d.t0000644000175000017500000000646114062242375013112 0ustar khwkhwBEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use warnings; use Test; BEGIN { plan tests => 14 }; #use Pod::Simple::Debug (6); use Pod::Simple::DumpAsXML; use Pod::Simple::XMLOutStream; print "# Pod::Simple version $Pod::Simple::VERSION\n"; $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output $Pod::Simple::XMLOutStream::ATTR_PAD = ' '; $Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output my $x = 'Pod::Simple::XMLOutStream'; ok 1; print "# Testing exceptions being thrown...\n"; eval { $x->new->accept_directive('head1') }; if($@) { ok 1 } # print " # Good: exception thrown: $@\n" } else { ok 0,1, 'No exception thrown!' } eval { $x->new->accept_directive('I like pie') }; if($@) { ok 1 } # print " # Good: exception thrown: $@\n" } else { ok 0,1, 'No exception thrown!' } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # print "Testing basic directive behavior...\n"; sub Pd { shift->accept_directive_as_data( 'freepies') } sub Pv { shift->accept_directive_as_verbatim( 'freepies') } sub Pp { shift->accept_directive_as_processed('freepies') } ok( $x->_out( "\n=freepies Mmmmpie\n\n") => '/POD ERROR/' ); ok( $x->_out(\&Pp, "\n=freepies Mmmmpie\n\n"), 'Mmmmpie' ); ok( $x->_out(\&Pv, "\n=freepies Mmmmpie\n\n"), 'Mmmmpie' ); ok( $x->_out(\&Pd, "\n=freepies Mmmmpie\n\n"), 'Mmmmpie' ); # print "Testing more complex directive behavior...\n"; ok( $x->_out(\&Pp, "\n=freepies Mmmmpie \n\tI! \n\n"), 'Mmmmpie is good!' ); ok( $x->_out(\&Pd, "\n=freepies Mmmmpie \n\tI! \n\n"), qq{Mmmmpie \n\tI<is good>! } ); ok( $x->_out(\&Pv, "\n=freepies Mmmmpie \n\tI! \n\n"), qq{Mmmmpie \n I<is good>! } ); # print "Testing within larger documents...\n"; ok( $x->_out(\&Pp, "\n=head1 NAME\n\nPie Consortium -- me gustan pasteles\n\n=freepies Mmmmpie \n\tI! \n\nGoody!"), 'NAMEPie Consortium -- me gustan pastelesMmmmpie is good!Goody!' ); ok( $x->_out(\&Pd, "\n=head1 NAME\n\nPie Consortium -- me gustan pasteles\n\n=freepies Mmmmpie \n\tI! \n\nGoody!"), qq{NAMEPie Consortium -- me gustan pastelesMmmmpie \n\tI<is good>! Goody!} ); ok( $x->_out(\&Pv, "\n=head1 NAME\n\nPie Consortium -- me gustan pasteles\n\n=freepies Mmmmpie \n\tI! \n\nGoody!"), qq{NAMEPie Consortium -- me gustan pastelesMmmmpie \n I<is good>! Goody!} ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "# Wrapping up... one for the road...\n"; ok 1; print "# --- Done with ", __FILE__, " --- \n"; __END__ Pod-Simple-3.43/MANIFEST.SKIP0000644000175000017500000000201014062242374013453 0ustar khwkhw#!start included /usr/local/lib/perl5/5.10.1/ExtUtils/MANIFEST.SKIP # Avoid version control files. \bRCS\b \bCVS\b \bSCCS\b ,v$ \B\.svn\b \B\.git\b \B\.github\b \B\.gitignore\b \b_darcs\b \B\.cvsignore$ # Avoid VMS specific MakeMaker generated files \bDescrip.MMS$ \bDESCRIP.MMS$ \bdescrip.mms$ # Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bMakeMaker-\d \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ \bBuild.bat$ \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ \.tmp$ \.# \.rej$ \.travis.yml # Avoid OS-specific files/dirs # Mac OSX metadata \B\.DS_Store # Mac OSX SMB mount metadata files \B\._ # Avoid Devel::Cover files. \bcover_db\b #!end included /usr/local/lib/perl5/5.10.1/ExtUtils/MANIFEST.SKIP ^Pod-Simple ^[-_a-zA-Z0-9]+[0-9]+\.[0-9]+(?:_[0-9]+)?$ \.out$ delme \.rej$ \..*\.sw.?$ ~ ^MYMETA\.yml$ ^MYMETA\.json$ Pod-Simple-3.43/MANIFEST0000644000175000017500000001063414066435222012721 0ustar khwkhwChangeLog lib/Pod/Simple.pm lib/Pod/Simple.pod lib/Pod/Simple/BlackBox.pm lib/Pod/Simple/Checker.pm lib/Pod/Simple/Debug.pm lib/Pod/Simple/DumpAsText.pm lib/Pod/Simple/DumpAsXML.pm lib/Pod/Simple/HTML.pm lib/Pod/Simple/HTMLBatch.pm lib/Pod/Simple/HTMLLegacy.pm lib/Pod/Simple/JustPod.pm lib/Pod/Simple/LinkSection.pm lib/Pod/Simple/Methody.pm lib/Pod/Simple/Progress.pm lib/Pod/Simple/PullParser.pm lib/Pod/Simple/PullParserEndToken.pm lib/Pod/Simple/PullParserStartToken.pm lib/Pod/Simple/PullParserTextToken.pm lib/Pod/Simple/PullParserToken.pm lib/Pod/Simple/RTF.pm lib/Pod/Simple/Search.pm lib/Pod/Simple/SimpleTree.pm lib/Pod/Simple/Subclassing.pod lib/Pod/Simple/Text.pm lib/Pod/Simple/TextContent.pm lib/Pod/Simple/TiedOutFH.pm lib/Pod/Simple/Transcode.pm lib/Pod/Simple/TranscodeDumb.pm lib/Pod/Simple/TranscodeSmart.pm lib/Pod/Simple/XHTML.pm lib/Pod/Simple/XMLOutStream.pm Makefile.PL MANIFEST This list of files MANIFEST.SKIP README t/00about.t t/20_skip.t t/ac_d.t t/accept01.t t/accept05.t t/ascii_order.pl t/basic.t t/begin.t t/cbacks.t t/chunking.t t/closeys.t t/content_seen.t t/corpus.t t/corpus/2202jp.txt t/corpus/2202jp.xml t/corpus/2202jpx.txt t/corpus/2202jpx.xml t/corpus/2202jpy.txt t/corpus/2202jpy.xml t/corpus/2202jpz.txt t/corpus/2202jpz.xml t/corpus/8859_7.pod t/corpus/8859_7.xml t/corpus/cp1256.txt t/corpus/cp1256.xml t/corpus/enc_char_directive.txt t/corpus/enc_char_directive.xml t/corpus/enc_char_wrong_directive.txt t/corpus/enc_char_wrong_directive.xml t/corpus/encwarn01.txt t/corpus/encwarn01.xml t/corpus/encwarn02.txt t/corpus/encwarn02.xml t/corpus/encwarn03.txt t/corpus/encwarn03.xml t/corpus/encwarn04.txt t/corpus/encwarn04.xml t/corpus/fet_cont.txt t/corpus/fet_cont.xml t/corpus/fet_dup.txt t/corpus/fet_dup.xml t/corpus/iso6.txt t/corpus/iso6.xml t/corpus/koi8r.txt t/corpus/koi8r.xml t/corpus/laozi38.txt t/corpus/laozi38.xml t/corpus/laozi38b.txt t/corpus/laozi38b.xml t/corpus/laozi38p.pod t/corpus/laozi38p.xml t/corpus/lat1fr.txt t/corpus/lat1fr.xml t/corpus/lat1frim.txt t/corpus/lat1frim.xml t/corpus/nonesuch.txt t/corpus/nonesuch.xml t/corpus/pasternak_cp1251.txt t/corpus/pasternak_cp1251.xml t/corpus/plain.txt t/corpus/plain.xml t/corpus/plain_explicit.txt t/corpus/plain_explicit.xml t/corpus/plain_latin1.txt t/corpus/plain_latin1.xml t/corpus/plain_utf8.txt t/corpus/plain_utf8.xml t/corpus/polish_utf8.txt t/corpus/polish_utf8.xml t/corpus/s2763_sjis.txt t/corpus/s2763_sjis.xml t/corpus/thai_iso11.txt t/corpus/thai_iso11.xml t/corpus2/fiqhakbar_iso6.txt t/corpus2/fiqhakbar_iso6.xml t/corpus2/polish_implicit_utf8.txt t/corpus2/polish_utf16be_bom.txt t/corpus2/polish_utf16le_bom.txt t/corpus2/polish_utf8_bom.txt t/corpus2/polish_utf8_bom.xml t/corpus2/polish_utf8_bom2.txt t/corpus2/polish_utf8_bom2.xml t/corpus2/README t/emptylists.t t/enc-chars.t t/encod01.t t/encod02.t t/encod03.t t/encod04.t t/end_over.t t/eol.t t/eol2.t t/fake-closers.t t/fcodes.t t/fcodes_e.t t/fcodes_l.t t/fcodes_s.t t/for.t t/fornot.t t/github_issue_79.t t/heads.t t/html01.t t/html02.t t/html03.t t/htmlbat.t t/items.t t/items02.t t/itemstar.t t/junk1.pod t/junk1o.txt t/junk2.pod t/junk2o.txt t/JustPod01.t t/JustPod02.t t/JustPod_corpus.t t/lib/helpers.pm t/linkclas.t t/output.t t/perlcyg.pod t/perlcygo.txt t/perlfaq.pod t/perlfaqo.txt t/perlvar.pod t/perlvaro.txt t/puller.t t/pulltitl.t t/reinit.t t/render.t t/rtf_utf8.t t/search05.t t/search10.t t/search12.t t/search20.t t/search22.t t/search25.t t/search26.t t/search27.t t/search28.t t/search29.t t/search50.t t/search60.t t/search60/A/x.pod t/search60/B/X.pod t/stree.t t/strpvbtm.t t/testlib1/Blorm.pm t/testlib1/hinkhonk/Glunk.pod t/testlib1/hinkhonk/readme.txt t/testlib1/hinkhonk/Vliff.pm t/testlib1/pod/perlflif.pod t/testlib1/pod/perlthng.pod t/testlib1/squaa.pm t/testlib1/squaa/Glunk.pod t/testlib1/squaa/Vliff.pm t/testlib1/zikzik.pod t/testlib1/Zonk/Fiddle.txt t/testlib1/Zonk/Pronk.pm t/testlib1/Zonk/Veng.pm t/testlib2/hinkhonk/Glunk.pod t/testlib2/hinkhonk/readme.txt t/testlib2/hinkhonk/Vliff.pm t/testlib2/pod/perlthng.pod t/testlib2/pod/perlzuk.pod t/testlib2/pods/perlzoned.pod t/testlib2/squaa/Vliff.pm t/testlib2/squaa/Wowo.pod t/testlib2/Suzzle.pm t/testlib3/squaa/Vliff.pm t/tiedfh.t t/verb_fmt.t t/verbatim.t t/whine.t t/x_nixer.t t/xhtml-bkb.t t/xhtml01.t t/xhtml05.t t/xhtml10.t t/xhtml15.t t/xhtml20.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Pod-Simple-3.43/META.yml0000644000175000017500000000207414066435222013040 0ustar khwkhw--- abstract: 'framework for parsing Pod' author: - 'Allison Randal ' build_requires: ExtUtils::MakeMaker: '0' Test: '1.25' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Pod-Simple no_index: directory: - t - inc recommends: Encode: '2.78' requires: Carp: '0' Config: '0' Cwd: '0' File::Basename: '0' File::Find: '0' File::Spec: '0' Pod::Escapes: '1.04' Symbol: '0' Test::More: '0' Text::Wrap: '98.112902' if: '0' integer: '0' overload: '0' strict: '0' resources: MailingList: https://lists.perl.org/list/pod-people.html bugtracker: https://github.com/perl-pod/pod-simple/issues homepage: https://metacpan.org/pod/Pod::Simple license: http://dev.perl.org/licenses/ repository: git://github.com/perl-pod/pod-simple.git version: '3.43' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Pod-Simple-3.43/lib/0000755000175000017500000000000014066435222012332 5ustar khwkhwPod-Simple-3.43/lib/Pod/0000755000175000017500000000000014066435222013054 5ustar khwkhwPod-Simple-3.43/lib/Pod/Simple/0000755000175000017500000000000014066435222014305 5ustar khwkhwPod-Simple-3.43/lib/Pod/Simple/Checker.pm0000644000175000017500000001247014062242374016213 0ustar khwkhw # A quite dimwitted pod2plaintext that need only know how to format whatever # text comes out of Pod::BlackBox's _gen_errata require 5; package Pod::Simple::Checker; use strict; use Carp (); use Pod::Simple::Methody (); use Pod::Simple (); use vars qw( @ISA $VERSION ); $VERSION = '3.43'; @ISA = ('Pod::Simple::Methody'); BEGIN { *DEBUG = defined(&Pod::Simple::DEBUG) ? \&Pod::Simple::DEBUG : sub() {0} } use Text::Wrap 98.112902 (); # was 2001.0131, but I don't think we need that $Text::Wrap::wrap = 'overflow'; #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub any_errata_seen { # read-only accessor return $_[1]->{'Errata_seen'}; } sub new { my $self = shift; my $new = $self->SUPER::new(@_); $new->{'output_fh'} ||= *STDOUT{IO}; $new->nix_X_codes(1); $new->nbsp_for_S(1); $new->{'Thispara'} = ''; $new->{'Indent'} = 0; $new->{'Indentstring'} = ' '; $new->{'Errata_seen'} = 0; return $new; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub handle_text { $_[0]{'Errata_seen'} and $_[0]{'Thispara'} .= $_[1] } sub start_Para { $_[0]{'Thispara'} = '' } sub start_head1 { if($_[0]{'Errata_seen'}) { $_[0]{'Thispara'} = ''; } else { if($_[1]{'errata'}) { # start of errata! $_[0]{'Errata_seen'} = 1; $_[0]{'Thispara'} = $_[0]{'source_filename'} ? "$_[0]{'source_filename'} -- " : '' } } } sub start_head2 { $_[0]{'Thispara'} = '' } sub start_head3 { $_[0]{'Thispara'} = '' } sub start_head4 { $_[0]{'Thispara'} = '' } sub start_Verbatim { $_[0]{'Thispara'} = '' } sub start_item_bullet { $_[0]{'Thispara'} = '* ' } sub start_item_number { $_[0]{'Thispara'} = "$_[1]{'number'}. " } sub start_item_text { $_[0]{'Thispara'} = '' } sub start_over_bullet { ++$_[0]{'Indent'} } sub start_over_number { ++$_[0]{'Indent'} } sub start_over_text { ++$_[0]{'Indent'} } sub start_over_block { ++$_[0]{'Indent'} } sub end_over_bullet { --$_[0]{'Indent'} } sub end_over_number { --$_[0]{'Indent'} } sub end_over_text { --$_[0]{'Indent'} } sub end_over_block { --$_[0]{'Indent'} } # . . . . . Now the actual formatters: sub end_head1 { $_[0]->emit_par(-4) } sub end_head2 { $_[0]->emit_par(-3) } sub end_head3 { $_[0]->emit_par(-2) } sub end_head4 { $_[0]->emit_par(-1) } sub end_Para { $_[0]->emit_par( 0) } sub end_item_bullet { $_[0]->emit_par( 0) } sub end_item_number { $_[0]->emit_par( 0) } sub end_item_text { $_[0]->emit_par(-2) } sub emit_par { return unless $_[0]{'Errata_seen'}; my($self, $tweak_indent) = splice(@_,0,2); my $length = 2 * $self->{'Indent'} + ($tweak_indent||0); my $indent = ' ' x ($length > 0 ? $length : 0); # Yes, 'STRING' x NEGATIVE gives '', same as 'STRING' x 0 # 'Negative repeat count does nothing' since 5.22 $self->{'Thispara'} =~ s/$Pod::Simple::shy//g; my $out = Text::Wrap::wrap($indent, $indent, $self->{'Thispara'} .= "\n"); $out =~ s/$Pod::Simple::nbsp/ /g; print {$self->{'output_fh'}} $out, #"\n" ; $self->{'Thispara'} = ''; return; } # . . . . . . . . . . And then off by its lonesome: sub end_Verbatim { return unless $_[0]{'Errata_seen'}; my $self = shift; $self->{'Thispara'} =~ s/$Pod::Simple::nbsp/ /g; $self->{'Thispara'} =~ s/$Pod::Simple::shy//g; my $i = ' ' x ( 2 * $self->{'Indent'} + 4); $self->{'Thispara'} =~ s/^/$i/mg; print { $self->{'output_fh'} } '', $self->{'Thispara'}, "\n\n" ; $self->{'Thispara'} = ''; return; } #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1; __END__ =head1 NAME Pod::Simple::Checker -- check the Pod syntax of a document =head1 SYNOPSIS perl -MPod::Simple::Checker -e \ "exit Pod::Simple::Checker->filter(shift)->any_errata_seen" \ thingy.pod =head1 DESCRIPTION This class is for checking the syntactic validity of Pod. It works by basically acting like a simple-minded version of L that formats only the "Pod Errors" section (if Pod::Simple even generates one for the given document). This is a subclass of L and inherits all its methods. =head1 SEE ALSO L, L, L =head1 SUPPORT Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail list. Send an empty email to pod-people-subscribe@perl.org to subscribe. This module is managed in an open GitHub repository, L. Feel free to fork and contribute, or to clone L and send patches! Patches against Pod::Simple are welcome. Please send bug reports to . =head1 COPYRIGHT AND DISCLAIMERS Copyright (c) 2002 Sean M. Burke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 AUTHOR Pod::Simple was created by Sean M. Burke . But don't bother him, he's retired. Pod::Simple is maintained by: =over =item * Allison Randal C =item * Hans Dieter Pearcey C =item * David E. Wheeler C =back =cut Pod-Simple-3.43/lib/Pod/Simple/XMLOutStream.pm0000644000175000017500000001107214062242374017150 0ustar khwkhw require 5; package Pod::Simple::XMLOutStream; use strict; use Carp (); use Pod::Simple (); use vars qw( $ATTR_PAD @ISA $VERSION $SORT_ATTRS); $VERSION = '3.43'; BEGIN { @ISA = ('Pod::Simple'); *DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG; } $ATTR_PAD = "\n" unless defined $ATTR_PAD; # Don't mess with this unless you know what you're doing. $SORT_ATTRS = 0 unless defined $SORT_ATTRS; sub new { my $self = shift; my $new = $self->SUPER::new(@_); $new->{'output_fh'} ||= *STDOUT{IO}; $new->keep_encoding_directive(1); #$new->accept_codes('VerbatimFormatted'); return $new; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub _handle_element_start { # ($self, $element_name, $attr_hash_r) my $fh = $_[0]{'output_fh'}; my($key, $value); DEBUG and print STDERR "++ $_[1]\n"; print $fh "<", $_[1]; if($SORT_ATTRS) { foreach my $key (sort keys %{$_[2]}) { unless($key =~ m/^~/s) { next if $key eq 'start_line' and $_[0]{'hide_line_numbers'}; _xml_escape($value = $_[2]{$key}); print $fh $ATTR_PAD, $key, '="', $value, '"'; } } } else { # faster while(($key,$value) = each %{$_[2]}) { unless($key =~ m/^~/s) { next if $key eq 'start_line' and $_[0]{'hide_line_numbers'}; _xml_escape($value); print $fh $ATTR_PAD, $key, '="', $value, '"'; } } } print $fh ">"; return; } sub _handle_text { DEBUG and print STDERR "== \"$_[1]\"\n"; if(length $_[1]) { my $text = $_[1]; _xml_escape($text); print {$_[0]{'output_fh'}} $text; } return; } sub _handle_element_end { DEBUG and print STDERR "-- $_[1]\n"; print {$_[0]{'output_fh'}} ""; return; } # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ sub _xml_escape { foreach my $x (@_) { # Escape things very cautiously: if ($] ge 5.007_003) { $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg; } else { # Is broken for non-ASCII platforms on early perls $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg; } # Yes, stipulate the list without a range, so that this can work right on # all charsets that this module happens to run under. } return; } #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1; __END__ =head1 NAME Pod::Simple::XMLOutStream -- turn Pod into XML =head1 SYNOPSIS perl -MPod::Simple::XMLOutStream -e \ "exit Pod::Simple::XMLOutStream->filter(shift)->any_errata_seen" \ thingy.pod =head1 DESCRIPTION Pod::Simple::XMLOutStream is a subclass of L that parses Pod and turns it into XML. Pod::Simple::XMLOutStream inherits methods from L. =head1 SEE ALSO L is rather like this class; see its documentation for a discussion of the differences. L, L, L L The older (and possibly obsolete) libraries L, L =head1 ABOUT EXTENDING POD TODO: An example or two of =extend, then point to Pod::Simple::Subclassing =head1 SEE ALSO L, L, L =head1 SUPPORT Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail list. Send an empty email to pod-people-subscribe@perl.org to subscribe. This module is managed in an open GitHub repository, L. Feel free to fork and contribute, or to clone L and send patches! Patches against Pod::Simple are welcome. Please send bug reports to . =head1 COPYRIGHT AND DISCLAIMERS Copyright (c) 2002-2004 Sean M. Burke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 AUTHOR Pod::Simple was created by Sean M. Burke . But don't bother him, he's retired. Pod::Simple is maintained by: =over =item * Allison Randal C =item * Hans Dieter Pearcey C =item * David E. Wheeler C =back =cut Pod-Simple-3.43/lib/Pod/Simple/DumpAsText.pm0000644000175000017500000000770314062242374016710 0ustar khwkhw require 5; package Pod::Simple::DumpAsText; $VERSION = '3.43'; use Pod::Simple (); BEGIN {@ISA = ('Pod::Simple')} use strict; use Carp (); BEGIN { *DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG } sub new { my $self = shift; my $new = $self->SUPER::new(@_); $new->{'output_fh'} ||= *STDOUT{IO}; $new->accept_codes('VerbatimFormatted'); $new->keep_encoding_directive(1); return $new; } #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ sub _handle_element_start { # ($self, $element_name, $attr_hash_r) my $fh = $_[0]{'output_fh'}; my($key, $value); DEBUG and print STDERR "++ $_[1]\n"; print $fh ' ' x ($_[0]{'indent'} || 0), "++", $_[1], "\n"; $_[0]{'indent'}++; while(($key,$value) = each %{$_[2]}) { unless($key =~ m/^~/s) { next if $key eq 'start_line' and $_[0]{'hide_line_numbers'}; _perly_escape($key); _perly_escape($value); printf $fh qq{%s \\ "%s" => "%s"\n}, ' ' x ($_[0]{'indent'} || 0), $key, $value; } } return; } sub _handle_text { DEBUG and print STDERR "== \"$_[1]\"\n"; if(length $_[1]) { my $indent = ' ' x $_[0]{'indent'}; my $text = $_[1]; _perly_escape($text); $text =~ # A not-totally-brilliant wrapping algorithm: s/( [^\n]{55} # Snare some characters from a line [^\n\ ]{0,50} # and finish any current word ) \ {1,10}(?!\n) # capture some spaces not at line-end /$1"\n$indent . "/gx # => line-break here ; print {$_[0]{'output_fh'}} $indent, '* "', $text, "\"\n"; } return; } sub _handle_element_end { DEBUG and print STDERR "-- $_[1]\n"; print {$_[0]{'output_fh'}} ' ' x --$_[0]{'indent'}, "--", $_[1], "\n"; return; } # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . sub _perly_escape { foreach my $x (@_) { $x =~ s/([^\x00-\xFF])/sprintf'\x{%X}',ord($1)/eg; # Escape things very cautiously: $x =~ s/([^-\n\t \&\<\>\'!\#\%\(\)\*\+,\.\/\:\;=\?\~\[\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/sprintf'\x%02X',ord($1)/eg; } return; } #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1; __END__ =head1 NAME Pod::Simple::DumpAsText -- dump Pod-parsing events as text =head1 SYNOPSIS perl -MPod::Simple::DumpAsText -e \ "exit Pod::Simple::DumpAsText->filter(shift)->any_errata_seen" \ thingy.pod =head1 DESCRIPTION This class is for dumping, as text, the events gotten from parsing a Pod document. This class is of interest to people writing Pod formatters based on Pod::Simple. It is useful for seeing exactly what events you get out of some Pod that you feed in. This is a subclass of L and inherits all its methods. =head1 SEE ALSO L L =head1 SUPPORT Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail list. Send an empty email to pod-people-subscribe@perl.org to subscribe. This module is managed in an open GitHub repository, L. Feel free to fork and contribute, or to clone L and send patches! Patches against Pod::Simple are welcome. Please send bug reports to . =head1 COPYRIGHT AND DISCLAIMERS Copyright (c) 2002 Sean M. Burke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 AUTHOR Pod::Simple was created by Sean M. Burke . But don't bother him, he's retired. Pod::Simple is maintained by: =over =item * Allison Randal C =item * Hans Dieter Pearcey C =item * David E. Wheeler C =back =cut Pod-Simple-3.43/lib/Pod/Simple/PullParser.pm0000644000175000017500000006220114062242374016735 0ustar khwkhwrequire 5; package Pod::Simple::PullParser; $VERSION = '3.43'; use Pod::Simple (); BEGIN {@ISA = ('Pod::Simple')} use strict; use Carp (); use Pod::Simple::PullParserStartToken; use Pod::Simple::PullParserEndToken; use Pod::Simple::PullParserTextToken; BEGIN { *DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG } __PACKAGE__->_accessorize( 'source_fh', # the filehandle we're reading from 'source_scalar_ref', # the scalarref we're reading from 'source_arrayref', # the arrayref we're reading from ); #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # # And here is how we implement a pull-parser on top of a push-parser... sub filter { my($self, $source) = @_; $self = $self->new unless ref $self; $source = *STDIN{IO} unless defined $source; $self->set_source($source); $self->output_fh(*STDOUT{IO}); $self->run; # define run() in a subclass if you want to use filter()! return $self; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub parse_string_document { my $this = shift; $this->set_source(\ $_[0]); $this->run; } sub parse_file { my($this, $filename) = @_; $this->set_source($filename); $this->run; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # In case anyone tries to use them: sub run { use Carp (); if( __PACKAGE__ eq ref($_[0]) || $_[0]) { # I'm not being subclassed! Carp::croak "You can call run() only on subclasses of " . __PACKAGE__; } else { Carp::croak join '', "You can't call run() because ", ref($_[0]) || $_[0], " didn't define a run() method"; } } sub parse_lines { use Carp (); Carp::croak "Use set_source with ", __PACKAGE__, " and subclasses, not parse_lines"; } sub parse_line { use Carp (); Carp::croak "Use set_source with ", __PACKAGE__, " and subclasses, not parse_line"; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub new { my $class = shift; my $self = $class->SUPER::new(@_); die "Couldn't construct for $class" unless $self; $self->{'token_buffer'} ||= []; $self->{'start_token_class'} ||= 'Pod::Simple::PullParserStartToken'; $self->{'text_token_class'} ||= 'Pod::Simple::PullParserTextToken'; $self->{'end_token_class'} ||= 'Pod::Simple::PullParserEndToken'; DEBUG > 1 and print STDERR "New pullparser object: $self\n"; return $self; } # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ sub get_token { my $self = shift; DEBUG > 1 and print STDERR "\nget_token starting up on $self.\n"; DEBUG > 2 and print STDERR " Items in token-buffer (", scalar( @{ $self->{'token_buffer'} } ) , ") :\n", map( " " . $_->dump . "\n", @{ $self->{'token_buffer'} } ), @{ $self->{'token_buffer'} } ? '' : ' (no tokens)', "\n" ; until( @{ $self->{'token_buffer'} } ) { DEBUG > 3 and print STDERR "I need to get something into my empty token buffer...\n"; if($self->{'source_dead'}) { DEBUG and print STDERR "$self 's source is dead.\n"; push @{ $self->{'token_buffer'} }, undef; } elsif(exists $self->{'source_fh'}) { my @lines; my $fh = $self->{'source_fh'} || Carp::croak('You have to call set_source before you can call get_token'); DEBUG and print STDERR "$self 's source is filehandle $fh.\n"; # Read those many lines at a time for(my $i = Pod::Simple::MANY_LINES; $i--;) { DEBUG > 3 and print STDERR " Fetching a line from source filehandle $fh...\n"; local $/ = $Pod::Simple::NL; push @lines, scalar(<$fh>); # readline DEBUG > 3 and print STDERR " Line is: ", defined($lines[-1]) ? $lines[-1] : "\n"; unless( defined $lines[-1] ) { DEBUG and print STDERR "That's it for that source fh! Killing.\n"; delete $self->{'source_fh'}; # so it can be GC'd last; } # but pass thru the undef, which will set source_dead to true # TODO: look to see if $lines[-1] is =encoding, and if so, # do horribly magic things } if(DEBUG > 8) { print STDERR "* I've gotten ", scalar(@lines), " lines:\n"; foreach my $l (@lines) { if(defined $l) { print STDERR " line {$l}\n"; } else { print STDERR " line undef\n"; } } print STDERR "* end of ", scalar(@lines), " lines\n"; } $self->SUPER::parse_lines(@lines); } elsif(exists $self->{'source_arrayref'}) { DEBUG and print STDERR "$self 's source is arrayref $self->{'source_arrayref'}, with ", scalar(@{$self->{'source_arrayref'}}), " items left in it.\n"; DEBUG > 3 and print STDERR " Fetching ", Pod::Simple::MANY_LINES, " lines.\n"; $self->SUPER::parse_lines( splice @{ $self->{'source_arrayref'} }, 0, Pod::Simple::MANY_LINES ); unless( @{ $self->{'source_arrayref'} } ) { DEBUG and print STDERR "That's it for that source arrayref! Killing.\n"; $self->SUPER::parse_lines(undef); delete $self->{'source_arrayref'}; # so it can be GC'd } # to make sure that an undef is always sent to signal end-of-stream } elsif(exists $self->{'source_scalar_ref'}) { DEBUG and print STDERR "$self 's source is scalarref $self->{'source_scalar_ref'}, with ", length(${ $self->{'source_scalar_ref'} }) - (pos(${ $self->{'source_scalar_ref'} }) || 0), " characters left to parse.\n"; DEBUG > 3 and print STDERR " Fetching a line from source-string...\n"; if( ${ $self->{'source_scalar_ref'} } =~ m/([^\n\r]*)((?:\r?\n)?)/g ) { #print(">> $1\n"), $self->SUPER::parse_lines($1) if length($1) or length($2) or pos( ${ $self->{'source_scalar_ref'} }) != length( ${ $self->{'source_scalar_ref'} }); # I.e., unless it's a zero-length "empty line" at the very # end of "foo\nbar\n" (i.e., between the \n and the EOS). } else { # that's the end. Byebye $self->SUPER::parse_lines(undef); delete $self->{'source_scalar_ref'}; DEBUG and print STDERR "That's it for that source scalarref! Killing.\n"; } } else { die "What source??"; } } DEBUG and print STDERR "get_token about to return ", Pod::Simple::pretty( @{$self->{'token_buffer'}} ? $self->{'token_buffer'}[-1] : undef ), "\n"; return shift @{$self->{'token_buffer'}}; # that's an undef if empty } sub unget_token { my $self = shift; DEBUG and print STDERR "Ungetting ", scalar(@_), " tokens: ", @_ ? "@_\n" : "().\n"; foreach my $t (@_) { Carp::croak "Can't unget that, because it's not a token -- it's undef!" unless defined $t; Carp::croak "Can't unget $t, because it's not a token -- it's a string!" unless ref $t; Carp::croak "Can't unget $t, because it's not a token object!" unless UNIVERSAL::can($t, 'type'); } unshift @{$self->{'token_buffer'}}, @_; DEBUG > 1 and print STDERR "Token buffer now has ", scalar(@{$self->{'token_buffer'}}), " items in it.\n"; return; } #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # $self->{'source_filename'} = $source; sub set_source { my $self = shift @_; return $self->{'source_fh'} unless @_; Carp::croak("Cannot assign new source to pull parser; create a new instance, instead") if $self->{'source_fh'} || $self->{'source_scalar_ref'} || $self->{'source_arrayref'}; my $handle; if(!defined $_[0]) { Carp::croak("Can't use empty-string as a source for set_source"); } elsif(ref(\( $_[0] )) eq 'GLOB') { $self->{'source_filename'} = '' . ($handle = $_[0]); DEBUG and print STDERR "$self 's source is glob $_[0]\n"; # and fall thru } elsif(ref( $_[0] ) eq 'SCALAR') { $self->{'source_scalar_ref'} = $_[0]; DEBUG and print STDERR "$self 's source is scalar ref $_[0]\n"; return; } elsif(ref( $_[0] ) eq 'ARRAY') { $self->{'source_arrayref'} = $_[0]; DEBUG and print STDERR "$self 's source is array ref $_[0]\n"; return; } elsif(ref $_[0]) { $self->{'source_filename'} = '' . ($handle = $_[0]); DEBUG and print STDERR "$self 's source is fh-obj $_[0]\n"; } elsif(!length $_[0]) { Carp::croak("Can't use empty-string as a source for set_source"); } else { # It's a filename! DEBUG and print STDERR "$self 's source is filename $_[0]\n"; { local *PODSOURCE; open(PODSOURCE, "<$_[0]") || Carp::croak "Can't open $_[0]: $!"; $handle = *PODSOURCE{IO}; } $self->{'source_filename'} = $_[0]; DEBUG and print STDERR " Its name is $_[0].\n"; # TODO: file-discipline things here! } $self->{'source_fh'} = $handle; DEBUG and print STDERR " Its handle is $handle\n"; return 1; } # ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ sub get_title_short { shift->get_short_title(@_) } # alias sub get_short_title { my $title = shift->get_title(@_); $title = $1 if $title =~ m/^(\S{1,60})\s+--?\s+./s; # turn "Foo::Bar -- bars for your foo" into "Foo::Bar" return $title; } sub get_title { shift->_get_titled_section( 'NAME', max_token => 50, desperate => 1, @_) } sub get_version { shift->_get_titled_section( 'VERSION', max_token => 400, accept_verbatim => 1, max_content_length => 3_000, @_, ); } sub get_description { shift->_get_titled_section( 'DESCRIPTION', max_token => 400, max_content_length => 3_000, @_, ) } sub get_authors { shift->get_author(@_) } # a harmless alias sub get_author { my $this = shift; # Max_token is so high because these are # typically at the end of the document: $this->_get_titled_section('AUTHOR' , max_token => 10_000, @_) || $this->_get_titled_section('AUTHORS', max_token => 10_000, @_); } #-------------------------------------------------------------------------- sub _get_titled_section { # Based on a get_title originally contributed by Graham Barr my($self, $titlename, %options) = (@_); my $max_token = delete $options{'max_token'}; my $desperate_for_title = delete $options{'desperate'}; my $accept_verbatim = delete $options{'accept_verbatim'}; my $max_content_length = delete $options{'max_content_length'}; my $nocase = delete $options{'nocase'}; $max_content_length = 120 unless defined $max_content_length; Carp::croak( "Unknown " . ((1 == keys %options) ? "option: " : "options: ") . join " ", map "[$_]", sort keys %options ) if keys %options; my %content_containers; $content_containers{'Para'} = 1; if($accept_verbatim) { $content_containers{'Verbatim'} = 1; $content_containers{'VerbatimFormatted'} = 1; } my $token_count = 0; my $title; my @to_unget; my $state = 0; my $depth = 0; Carp::croak "What kind of titlename is \"$titlename\"?!" unless defined $titlename and $titlename =~ m/^[A-Z ]{1,60}$/s; #sanity my $titlename_re = quotemeta($titlename); my $head1_text_content; my $para_text_content; my $skipX; while( ++$token_count <= ($max_token || 1_000_000) and defined(my $token = $self->get_token) ) { push @to_unget, $token; if ($state == 0) { # seeking =head1 if( $token->is_start and $token->tagname eq 'head1' ) { DEBUG and print STDERR " Found head1. Seeking content...\n"; ++$state; $head1_text_content = ''; } } elsif($state == 1) { # accumulating text until end of head1 if( $token->is_text ) { unless ($skipX) { DEBUG and print STDERR " Adding \"", $token->text, "\" to head1-content.\n"; $head1_text_content .= $token->text; } } elsif( $token->is_tagname('X') ) { # We're going to want to ignore X<> stuff. $skipX = $token->is_start; DEBUG and print STDERR +($skipX ? 'Start' : 'End'), 'ing ignoring of X<> tag'; } elsif( $token->is_end and $token->tagname eq 'head1' ) { DEBUG and print STDERR " Found end of head1. Considering content...\n"; $head1_text_content = uc $head1_text_content if $nocase; if($head1_text_content eq $titlename or $head1_text_content =~ m/\($titlename_re\)/s # We accept "=head1 Nomen Modularis (NAME)" for sake of i18n ) { DEBUG and print STDERR " Yup, it was $titlename. Seeking next para-content...\n"; ++$state; } elsif( $desperate_for_title # if we're so desperate we'll take the first # =head1's content as a title and $head1_text_content =~ m/\S/ and $head1_text_content !~ m/^[ A-Z]+$/s and $head1_text_content !~ m/\((?: NAME | TITLE | VERSION | AUTHORS? | DESCRIPTION | SYNOPSIS | COPYRIGHT | LICENSE | NOTES? | FUNCTIONS? | METHODS? | CAVEATS? | BUGS? | SEE\ ALSO | SWITCHES | ENVIRONMENT )\)/sx # avoid accepting things like =head1 Thingy Thongy (DESCRIPTION) and ($max_content_length ? (length($head1_text_content) <= $max_content_length) # sanity : 1) ) { # Looks good; trim it ($title = $head1_text_content) =~ s/\s+$//; DEBUG and print STDERR " It looks titular: \"$title\".\n\n Using that.\n"; last; } else { --$state; DEBUG and print STDERR " Didn't look titular ($head1_text_content).\n", "\n Dropping back to seeking-head1-content mode...\n"; } } } elsif($state == 2) { # seeking start of para (which must immediately follow) if($token->is_start and $content_containers{ $token->tagname }) { DEBUG and print STDERR " Found start of Para. Accumulating content...\n"; $para_text_content = ''; ++$state; } else { DEBUG and print " Didn't see an immediately subsequent start-Para. Reseeking H1\n"; $state = 0; } } elsif($state == 3) { # accumulating text until end of Para if( $token->is_text ) { DEBUG and print STDERR " Adding \"", $token->text, "\" to para-content.\n"; $para_text_content .= $token->text; # and keep looking } elsif( $token->is_end and $content_containers{ $token->tagname } ) { DEBUG and print STDERR " Found end of Para. Considering content: ", $para_text_content, "\n"; if( $para_text_content =~ m/\S/ and ($max_content_length ? (length($para_text_content) <= $max_content_length) : 1) ) { # Some minimal sanity constraints, I think. DEBUG and print STDERR " It looks contentworthy, I guess. Using it.\n"; $title = $para_text_content; last; } else { DEBUG and print STDERR " Doesn't look at all contentworthy!\n Giving up.\n"; undef $title; last; } } } else { die "IMPOSSIBLE STATE $state!\n"; # should never happen } } # Put it all back! $self->unget_token(@to_unget); if(DEBUG) { if(defined $title) { print STDERR " Returning title <$title>\n" } else { print STDERR "Returning title <>\n" } } return '' unless defined $title; $title =~ s/^\s+//; return $title; } #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # # Methods that actually do work at parse-time: sub _handle_element_start { my $self = shift; # leaving ($element_name, $attr_hash_r) DEBUG > 2 and print STDERR "++ $_[0] (", map("<$_> ", %{$_[1]}), ")\n"; push @{ $self->{'token_buffer'} }, $self->{'start_token_class'}->new(@_); return; } sub _handle_text { my $self = shift; # leaving ($text) DEBUG > 2 and print STDERR "== $_[0]\n"; push @{ $self->{'token_buffer'} }, $self->{'text_token_class'}->new(@_); return; } sub _handle_element_end { my $self = shift; # leaving ($element_name); DEBUG > 2 and print STDERR "-- $_[0]\n"; push @{ $self->{'token_buffer'} }, $self->{'end_token_class'}->new(@_); return; } #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1; __END__ =head1 NAME Pod::Simple::PullParser -- a pull-parser interface to parsing Pod =head1 SYNOPSIS my $parser = SomePodProcessor->new; $parser->set_source( "whatever.pod" ); $parser->run; Or: my $parser = SomePodProcessor->new; $parser->set_source( $some_filehandle_object ); $parser->run; Or: my $parser = SomePodProcessor->new; $parser->set_source( \$document_source ); $parser->run; Or: my $parser = SomePodProcessor->new; $parser->set_source( \@document_lines ); $parser->run; And elsewhere: require 5; package SomePodProcessor; use strict; use base qw(Pod::Simple::PullParser); sub run { my $self = shift; Token: while(my $token = $self->get_token) { ...process each token... } } =head1 DESCRIPTION This class is for using Pod::Simple to build a Pod processor -- but one that uses an interface based on a stream of token objects, instead of based on events. This is a subclass of L and inherits all its methods. A subclass of Pod::Simple::PullParser should define a C method that calls C<< $token = $parser->get_token >> to pull tokens. See the source for Pod::Simple::RTF for an example of a formatter that uses Pod::Simple::PullParser. =head1 METHODS =over =item my $token = $parser->get_token This returns the next token object (which will be of a subclass of L), or undef if the parser-stream has hit the end of the document. =item $parser->unget_token( $token ) =item $parser->unget_token( $token1, $token2, ... ) This restores the token object(s) to the front of the parser stream. =back The source has to be set before you can parse anything. The lowest-level way is to call C: =over =item $parser->set_source( $filename ) =item $parser->set_source( $filehandle_object ) =item $parser->set_source( \$document_source ) =item $parser->set_source( \@document_lines ) =back Or you can call these methods, which Pod::Simple::PullParser has defined to work just like Pod::Simple's same-named methods: =over =item $parser->parse_file(...) =item $parser->parse_string_document(...) =item $parser->filter(...) =item $parser->parse_from_file(...) =back For those to work, the Pod-processing subclass of Pod::Simple::PullParser has to have defined a $parser->run method -- so it is advised that all Pod::Simple::PullParser subclasses do so. See the Synopsis above, or the source for Pod::Simple::RTF. Authors of formatter subclasses might find these methods useful to call on a parser object that you haven't started pulling tokens from yet: =over =item my $title_string = $parser->get_title This tries to get the title string out of $parser, by getting some tokens, and scanning them for the title, and then ungetting them so that you can process the token-stream from the beginning. For example, suppose you have a document that starts out: =head1 NAME Hoo::Boy::Wowza -- Stuff B yeah! $parser->get_title on that document will return "Hoo::Boy::Wowza -- Stuff wow yeah!". If the document starts with: =head1 Name Hoo::Boy::W00t -- Stuff B yeah! Then you'll need to pass the C option in order to recognize "Name": $parser->get_title(nocase => 1); In cases where get_title can't find the title, it will return empty-string (""). =item my $title_string = $parser->get_short_title This is just like get_title, except that it returns just the modulename, if the title seems to be of the form "SomeModuleName -- description". For example, suppose you have a document that starts out: =head1 NAME Hoo::Boy::Wowza -- Stuff B yeah! then $parser->get_short_title on that document will return "Hoo::Boy::Wowza". But if the document starts out: =head1 NAME Hooboy, stuff B yeah! then $parser->get_short_title on that document will return "Hooboy, stuff wow yeah!". If the document starts with: =head1 Name Hoo::Boy::W00t -- Stuff B yeah! Then you'll need to pass the C option in order to recognize "Name": $parser->get_short_title(nocase => 1); If the title can't be found, then get_short_title returns empty-string (""). =item $author_name = $parser->get_author This works like get_title except that it returns the contents of the "=head1 AUTHOR\n\nParagraph...\n" section, assuming that that section isn't terribly long. To recognize a "=head1 Author\n\nParagraph\n" section, pass the C option: $parser->get_author(nocase => 1); (This method tolerates "AUTHORS" instead of "AUTHOR" too.) =item $description_name = $parser->get_description This works like get_title except that it returns the contents of the "=head1 DESCRIPTION\n\nParagraph...\n" section, assuming that that section isn't terribly long. To recognize a "=head1 Description\n\nParagraph\n" section, pass the C option: $parser->get_description(nocase => 1); =item $version_block = $parser->get_version This works like get_title except that it returns the contents of the "=head1 VERSION\n\n[BIG BLOCK]\n" block. Note that this does NOT return the module's C<$VERSION>!! To recognize a "=head1 Version\n\n[BIG BLOCK]\n" section, pass the C option: $parser->get_version(nocase => 1); =back =head1 NOTE You don't actually I to define a C method. If you're writing a Pod-formatter class, you should define a C just so that users can call C etc, but you don't I to. And if you're not writing a formatter class, but are instead just writing a program that does something simple with a Pod::PullParser object (and not an object of a subclass), then there's no reason to bother subclassing to add a C method. =head1 SEE ALSO L L -- and its subclasses L, L, and L. L, which inspired this. =head1 SUPPORT Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail list. Send an empty email to pod-people-subscribe@perl.org to subscribe. This module is managed in an open GitHub repository, L. Feel free to fork and contribute, or to clone L and send patches! Patches against Pod::Simple are welcome. Please send bug reports to . =head1 COPYRIGHT AND DISCLAIMERS Copyright (c) 2002 Sean M. Burke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 AUTHOR Pod::Simple was created by Sean M. Burke . But don't bother him, he's retired. Pod::Simple is maintained by: =over =item * Allison Randal C =item * Hans Dieter Pearcey C =item * David E. Wheeler C =back =cut JUNK: sub _old_get_title { # some witchery in here my $self = $_[0]; my $title; my @to_unget; while(1) { push @to_unget, $self->get_token; unless(defined $to_unget[-1]) { # whoops, short doc! pop @to_unget; last; } DEBUG and print STDERR "-Got token ", $to_unget[-1]->dump, "\n"; (DEBUG and print STDERR "Too much in the buffer.\n"), last if @to_unget > 25; # sanity my $pattern = ''; if( #$to_unget[-1]->type eq 'end' #and $to_unget[-1]->tagname eq 'Para' #and ($pattern = join('', map {; ($_->type eq 'start') ? ("<" . $_->tagname .">") : ($_->type eq 'end' ) ? ("tagname .">") : ($_->type eq 'text' ) ? ($_->text =~ m<^([A-Z]+)$>s ? $1 : 'X') : "BLORP" } @to_unget )) =~ m{NAME(X|)+$}s ) { # Whee, it fits the pattern DEBUG and print STDERR "Seems to match =head1 NAME pattern.\n"; $title = ''; foreach my $t (reverse @to_unget) { last if $t->type eq 'start' and $t->tagname eq 'Para'; $title = $t->text . $title if $t->type eq 'text'; } undef $title if $title =~ m<^\s*$>; # make sure it's contentful! last; } elsif ($pattern =~ m{(.+)$} and !( $1 eq '1' and $2 eq 'NAME' ) ) { # Well, it fits a fallback pattern DEBUG and print STDERR "Seems to match NAMEless pattern.\n"; $title = ''; foreach my $t (reverse @to_unget) { last if $t->type eq 'start' and $t->tagname =~ m/^head\d$/s; $title = $t->text . $title if $t->type eq 'text'; } undef $title if $title =~ m<^\s*$>; # make sure it's contentful! last; } else { DEBUG and $pattern and print STDERR "Leading pattern: $pattern\n"; } } # Put it all back: $self->unget_token(@to_unget); if(DEBUG) { if(defined $title) { print STDERR " Returning title <$title>\n" } else { print STDERR "Returning title <>\n" } } return '' unless defined $title; return $title; } Pod-Simple-3.43/lib/Pod/Simple/PullParserEndToken.pm0000644000175000017500000000550414062242374020370 0ustar khwkhw require 5; package Pod::Simple::PullParserEndToken; use Pod::Simple::PullParserToken (); use strict; use vars qw(@ISA $VERSION); @ISA = ('Pod::Simple::PullParserToken'); $VERSION = '3.43'; sub new { # Class->new(tagname); my $class = shift; return bless ['end', @_], ref($class) || $class; } # Purely accessors: sub tagname { (@_ == 2) ? ($_[0][1] = $_[1]) : $_[0][1] } sub tag { shift->tagname(@_) } # shortcut: sub is_tagname { $_[0][1] eq $_[1] } sub is_tag { shift->is_tagname(@_) } 1; __END__ =head1 NAME Pod::Simple::PullParserEndToken -- end-tokens from Pod::Simple::PullParser =head1 SYNOPSIS (See L) =head1 DESCRIPTION When you do $parser->get_token on a L, you might get an object of this class. This is a subclass of L and inherits all its methods, and adds these methods: =over =item $token->tagname This returns the tagname for this end-token object. For example, parsing a "=head1 ..." line will give you a start-token with the tagname of "head1", token(s) for its content, and then an end-token with the tagname of "head1". =item $token->tagname(I) This changes the tagname for this end-token object. You probably won't need to do this. =item $token->tag(...) A shortcut for $token->tagname(...) =item $token->is_tag(I) or $token->is_tagname(I) These are shortcuts for C<< $token->tag() eq I >> =back You're unlikely to ever need to construct an object of this class for yourself, but if you want to, call C<< Pod::Simple::PullParserEndToken->new( I ) >> =head1 SEE ALSO L, L, L =head1 SUPPORT Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail list. Send an empty email to pod-people-subscribe@perl.org to subscribe. This module is managed in an open GitHub repository, L. Feel free to fork and contribute, or to clone L and send patches! Patches against Pod::Simple are welcome. Please send bug reports to . =head1 COPYRIGHT AND DISCLAIMERS Copyright (c) 2002 Sean M. Burke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 AUTHOR Pod::Simple was created by Sean M. Burke . But don't bother him, he's retired. Pod::Simple is maintained by: =over =item * Allison Randal C =item * Hans Dieter Pearcey C =item * David E. Wheeler C =back =cut Pod-Simple-3.43/lib/Pod/Simple/Transcode.pm0000644000175000017500000000134014062242374016563 0ustar khwkhw require 5; package Pod::Simple::Transcode; use strict; use vars qw($VERSION @ISA); $VERSION = '3.43'; BEGIN { if(defined &DEBUG) {;} # Okay elsif( defined &Pod::Simple::DEBUG ) { *DEBUG = \&Pod::Simple::DEBUG; } else { *DEBUG = sub () {0}; } } foreach my $class ( 'Pod::Simple::TranscodeSmart', 'Pod::Simple::TranscodeDumb', '', ) { $class or die "Couldn't load any encoding classes"; DEBUG and print STDERR "About to try loading $class...\n"; eval "require $class;"; if($@) { DEBUG and print STDERR "Couldn't load $class: $@\n"; } else { DEBUG and print STDERR "OK, loaded $class.\n"; @ISA = ($class); last; } } sub _blorp { return; } # just to avoid any "empty class" warning 1; __END__ Pod-Simple-3.43/lib/Pod/Simple/LinkSection.pm0000644000175000017500000001031514062242374017065 0ustar khwkhw require 5; package Pod::Simple::LinkSection; # Based somewhat dimly on Array::Autojoin use strict; use Pod::Simple::BlackBox; use vars qw($VERSION ); $VERSION = '3.43'; use overload( # So it'll stringify nice '""' => \&Pod::Simple::BlackBox::stringify_lol, 'bool' => \&Pod::Simple::BlackBox::stringify_lol, # '.=' => \&tack_on, # grudgingly support 'fallback' => 1, # turn on cleverness ); sub tack_on { $_[0] = ['', {}, "$_[0]" ]; return $_[0][2] .= $_[1]; } sub as_string { goto &Pod::Simple::BlackBox::stringify_lol; } sub stringify { goto &Pod::Simple::BlackBox::stringify_lol; } sub new { my $class = shift; $class = ref($class) || $class; my $new; if(@_ == 1) { if (!ref($_[0] || '')) { # most common case: one bare string return bless ['', {}, $_[0] ], $class; } elsif( ref($_[0] || '') eq 'ARRAY') { $new = [ @{ $_[0] } ]; } else { Carp::croak( "$class new() doesn't know to clone $new" ); } } else { # misc stuff $new = [ '', {}, @_ ]; } # By now it's a treelet: [ 'foo', {}, ... ] foreach my $x (@$new) { if(ref($x || '') eq 'ARRAY') { $x = $class->new($x); # recurse } elsif(ref($x || '') eq 'HASH') { $x = { %$x }; } # otherwise leave it. } return bless $new, $class; } # Not much in this class is likely to be link-section specific -- # but it just so happens that link-sections are about the only treelets # that are exposed to the user. 1; __END__ # TODO: let it be an option whether a given subclass even wants little treelets? __END__ =head1 NAME Pod::Simple::LinkSection -- represent "section" attributes of L codes =head1 SYNOPSIS # a long story =head1 DESCRIPTION This class is not of interest to general users. Pod::Simple uses this class for representing the value of the "section" attribute of "L" start-element events. Most applications can just use the normal stringification of objects of this class; they stringify to just the text content of the section, such as "foo" for C<< LZ<> >>, and "bar" for C<< LZ<>> >>. However, anyone particularly interested in getting the full value of the treelet, can just traverse the content of the treeleet @$treelet_object. To wit: % perl -MData::Dumper -e "use base qw(Pod::Simple::Methody); sub start_L { print Dumper($_[1]{'section'} ) } __PACKAGE__->new->parse_string_document('=head1 Lbaz>>') " Output: $VAR1 = bless( [ '', {}, 'b', bless( [ 'I', {}, 'ar' ], 'Pod::Simple::LinkSection' ), 'baz' ], 'Pod::Simple::LinkSection' ); But stringify it and you get just the text content: % perl -MData::Dumper -e "use base qw(Pod::Simple::Methody); sub start_L { print Dumper( '' . $_[1]{'section'} ) } __PACKAGE__->new->parse_string_document('=head1 Lbaz>>') " Output: $VAR1 = 'barbaz'; =head1 SEE ALSO L =head1 SUPPORT Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail list. Send an empty email to pod-people-subscribe@perl.org to subscribe. This module is managed in an open GitHub repository, L. Feel free to fork and contribute, or to clone L and send patches! Patches against Pod::Simple are welcome. Please send bug reports to . =head1 COPYRIGHT AND DISCLAIMERS Copyright (c) 2004 Sean M. Burke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 AUTHOR Pod::Simple was created by Sean M. Burke . But don't bother him, he's retired. Pod::Simple is maintained by: =over =item * Allison Randal C =item * Hans Dieter Pearcey C =item * David E. Wheeler C =back =cut Pod-Simple-3.43/lib/Pod/Simple/Debug.pm0000644000175000017500000001102114062242374015664 0ustar khwkhwrequire 5; package Pod::Simple::Debug; use strict; use vars qw($VERSION ); $VERSION = '3.43'; sub import { my($value,$variable); if(@_ == 2) { $value = $_[1]; } elsif(@_ == 3) { ($variable, $value) = @_[1,2]; ($variable, $value) = ($value, $variable) if defined $value and ref($value) eq 'SCALAR' and not(defined $variable and ref($variable) eq 'SCALAR') ; # tolerate getting it backwards unless( defined $variable and ref($variable) eq 'SCALAR') { require Carp; Carp::croak("Usage:\n use Pod::Simple::Debug (NUMVAL)\nor" . "\n use Pod::Simple::Debug (\\\$var, STARTNUMVAL)\nAborting"); } } else { require Carp; Carp::croak("Usage:\n use Pod::Simple::Debug (NUMVAL)\nor" . "\n use Pod::Simple::Debug (\\\$var, STARTNUMVAL)\nAborting"); } if( defined &Pod::Simple::DEBUG ) { require Carp; Carp::croak("It's too late to call Pod::Simple::Debug -- " . "Pod::Simple has already loaded\nAborting"); } $value = 0 unless defined $value; unless($value =~ m/^-?\d+$/) { require Carp; Carp::croak( "$value isn't a numeric value." . "\nUsage:\n use Pod::Simple::Debug (NUMVAL)\nor" . "\n use Pod::Simple::Debug (\\\$var, STARTNUMVAL)\nAborting"); } if( defined $variable ) { # make a not-really-constant *Pod::Simple::DEBUG = sub () { $$variable } ; $$variable = $value; print STDERR "# Starting Pod::Simple::DEBUG = non-constant $variable with val $value\n"; } else { *Pod::Simple::DEBUG = eval " sub () { $value } "; print STDERR "# Starting Pod::Simple::DEBUG = $value\n"; } require Pod::Simple; return; } 1; __END__ =head1 NAME Pod::Simple::Debug -- put Pod::Simple into trace/debug mode =head1 SYNOPSIS use Pod::Simple::Debug (5); # or some integer Or: my $debuglevel; use Pod::Simple::Debug (\$debuglevel, 0); ...some stuff that uses Pod::Simple to do stuff, but which you don't want debug output from... $debug_level = 4; ...some stuff that uses Pod::Simple to do stuff, but which you DO want debug output from... $debug_level = 0; =head1 DESCRIPTION This is an internal module for controlling the debug level (a.k.a. trace level) of Pod::Simple. This is of interest only to Pod::Simple developers. =head1 CAVEATS Note that you should load this module I loading Pod::Simple (or any Pod::Simple-based class). If you try loading Pod::Simple::Debug after &Pod::Simple::DEBUG is already defined, Pod::Simple::Debug will throw a fatal error to the effect that "It's too late to call Pod::Simple::Debug". Note that the C)> mode will make Pod::Simple (et al) run rather slower, since &Pod::Simple::DEBUG won't be a constant sub anymore, and so Pod::Simple (et al) won't compile with constant-folding. =head1 GUTS Doing this: use Pod::Simple::Debug (5); # or some integer is basically equivalent to: BEGIN { sub Pod::Simple::DEBUG () {5} } # or some integer use Pod::Simple (); And this: use Pod::Simple::Debug (\$debug_level,0); # or some integer is basically equivalent to this: my $debug_level; BEGIN { $debug_level = 0 } BEGIN { sub Pod::Simple::DEBUG () { $debug_level } use Pod::Simple (); =head1 SEE ALSO L The article "Constants in Perl", in I issue 21. See L =head1 SUPPORT Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail list. Send an empty email to pod-people-subscribe@perl.org to subscribe. This module is managed in an open GitHub repository, L. Feel free to fork and contribute, or to clone L and send patches! Patches against Pod::Simple are welcome. Please send bug reports to . =head1 COPYRIGHT AND DISCLAIMERS Copyright (c) 2002 Sean M. Burke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 AUTHOR Pod::Simple was created by Sean M. Burke . But don't bother him, he's retired. Pod::Simple is maintained by: =over =item * Allison Randal C =item * Hans Dieter Pearcey C =item * David E. Wheeler C =back =cut Pod-Simple-3.43/lib/Pod/Simple/HTML.pm0000644000175000017500000010370714062242374015417 0ustar khwkhwrequire 5; package Pod::Simple::HTML; use strict; use Pod::Simple::PullParser (); use vars qw( @ISA %Tagmap $Computerese $LamePad $Linearization_Limit $VERSION $Perldoc_URL_Prefix $Perldoc_URL_Postfix $Man_URL_Prefix $Man_URL_Postfix $Title_Prefix $Title_Postfix $HTML_EXTENSION %ToIndex $Doctype_decl $Content_decl ); @ISA = ('Pod::Simple::PullParser'); $VERSION = '3.43'; BEGIN { if(defined &DEBUG) { } # no-op elsif( defined &Pod::Simple::DEBUG ) { *DEBUG = \&Pod::Simple::DEBUG } else { *DEBUG = sub () {0}; } } $Doctype_decl ||= ''; # No. Just No. Don't even ask me for it. # qq{\n}; $Content_decl ||= q{}; $HTML_EXTENSION = '.html' unless defined $HTML_EXTENSION; $Computerese = "" unless defined $Computerese; $LamePad = '' unless defined $LamePad; $Linearization_Limit = 120 unless defined $Linearization_Limit; # headings/items longer than that won't get an $Perldoc_URL_Prefix = 'https://metacpan.org/pod/' unless defined $Perldoc_URL_Prefix; $Perldoc_URL_Postfix = '' unless defined $Perldoc_URL_Postfix; $Man_URL_Prefix = 'http://man.he.net/man'; $Man_URL_Postfix = ''; $Title_Prefix = '' unless defined $Title_Prefix; $Title_Postfix = '' unless defined $Title_Postfix; %ToIndex = map {; $_ => 1 } qw(head1 head2 head3 head4 ); # item-text # 'item-text' stuff in the index doesn't quite work, and may # not be a good idea anyhow. __PACKAGE__->_accessorize( 'perldoc_url_prefix', # In turning L into http://whatever/Foo%3a%3aBar, what # to put before the "Foo%3a%3aBar". # (for singleton mode only?) 'perldoc_url_postfix', # what to put after "Foo%3a%3aBar" in the URL. Normally "". 'man_url_prefix', # In turning L into http://whatever/man/1/crontab, what # to put before the "1/crontab". 'man_url_postfix', # what to put after the "1/crontab" in the URL. Normally "". 'batch_mode', # whether we're in batch mode 'batch_mode_current_level', # When in batch mode, how deep the current module is: 1 for "LWP", # 2 for "LWP::Procotol", 3 for "LWP::Protocol::GHTTP", etc 'title_prefix', 'title_postfix', # What to put before and after the title in the head. # Should already be &-escaped 'html_h_level', 'html_header_before_title', 'html_header_after_title', 'html_footer', 'top_anchor', 'index', # whether to add an index at the top of each page # (actually it's a table-of-contents, but we'll call it an index, # out of apparently longstanding habit) 'html_css', # URL of CSS file to point to 'html_javascript', # URL of Javascript file to point to 'force_title', # should already be &-escaped 'default_title', # should already be &-escaped ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my @_to_accept; %Tagmap = ( 'Verbatim' => "\n", '/Verbatim' => "\n", 'VerbatimFormatted' => "\n", '/VerbatimFormatted' => "\n", 'VerbatimB' => "", '/VerbatimB' => "", 'VerbatimI' => "", '/VerbatimI' => "", 'VerbatimBI' => "", '/VerbatimBI' => "", 'Data' => "\n", '/Data' => "\n", 'head1' => "\n

    ", # And also stick in an 'head2' => "\n

    ", # '' 'head3' => "\n

    ", # '' 'head4' => "\n

    ", # '' 'head5' => "\n

    ", # '' 'head6' => "\n
    ", # '' '/head1' => "
    \n", '/head2' => "

    \n", '/head3' => "\n", '/head4' => "\n", '/head5' => "\n", '/head6' => "\n", 'X' => "", changes(qw( Para=p B=b I=i over-bullet=ul over-number=ol over-text=dl over-block=blockquote item-bullet=li item-number=li item-text=dt )), changes2( map {; m/^([-a-z]+)/s && push @_to_accept, $1; $_ } qw[ sample=samp definition=dfn keyboard=kbd variable=var citation=cite abbreviation=abbr acronym=acronym subscript=sub superscript=sup big=big small=small underline=u strikethrough=s preformat=pre teletype=tt ] # no point in providing a way to get ..., I think ), '/item-bullet' => "$LamePad\n", '/item-number' => "$LamePad\n", '/item-text' => "$LamePad\n", 'item-body' => "\n
    ", '/item-body' => "
    \n", 'B' => "", '/B' => "", 'I' => "", '/I' => "", 'F' => "", '/F' => "", 'C' => "", '/C' => "
    ", 'L' => "", # ideally never used! '/L' => "", ); sub changes { return map {; m/^([-_:0-9a-zA-Z]+)=([-_:0-9a-zA-Z]+)$/s ? ( $1, => "\n<$2>", "/$1", => "\n" ) : die "Funky $_" } @_; } sub changes2 { return map {; m/^([-_:0-9a-zA-Z]+)=([-_:0-9a-zA-Z]+)$/s ? ( $1, => "<$2>", "/$1", => "" ) : die "Funky $_" } @_; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub go { Pod::Simple::HTML->parse_from_file(@ARGV); exit 0 } # Just so we can run from the command line. No options. # For that, use perldoc! #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub new { my $new = shift->SUPER::new(@_); #$new->nix_X_codes(1); $new->nbsp_for_S(1); $new->accept_targets( 'html', 'HTML' ); $new->accept_codes('VerbatimFormatted'); $new->accept_codes(@_to_accept); DEBUG > 2 and print STDERR "To accept: ", join(' ',@_to_accept), "\n"; $new->perldoc_url_prefix( $Perldoc_URL_Prefix ); $new->perldoc_url_postfix( $Perldoc_URL_Postfix ); $new->man_url_prefix( $Man_URL_Prefix ); $new->man_url_postfix( $Man_URL_Postfix ); $new->title_prefix( $Title_Prefix ); $new->title_postfix( $Title_Postfix ); $new->html_header_before_title( qq[$Doctype_decl] ); $new->html_header_after_title( join "\n" => "", $Content_decl, "\n", $new->version_tag_comment, "\n", ); $new->html_footer( qq[\n\n\n\n] ); $new->top_anchor( "\n" ); $new->{'Tagmap'} = {%Tagmap}; return $new; } sub __adjust_html_h_levels { my ($self) = @_; my $Tagmap = $self->{'Tagmap'}; my $add = $self->html_h_level; return unless defined $add; return if ($self->{'Adjusted_html_h_levels'}||0) == $add; $add -= 1; for (1 .. 6) { $Tagmap->{"head$_"} =~ s/$_/$_ + $add/e; $Tagmap->{"/head$_"} =~ s/$_/$_ + $add/e; } } sub batch_mode_page_object_init { my($self, $batchconvobj, $module, $infile, $outfile, $depth) = @_; DEBUG and print STDERR "Initting $self\n for $module\n", " in $infile\n out $outfile\n depth $depth\n"; $self->batch_mode(1); $self->batch_mode_current_level($depth); return $self; } sub run { my $self = $_[0]; return $self->do_middle if $self->bare_output; return $self->do_beginning && $self->do_middle && $self->do_end; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub do_beginning { my $self = $_[0]; my $title; if(defined $self->force_title) { $title = $self->force_title; DEBUG and print STDERR "Forcing title to be $title\n"; } else { # Actually try looking for the title in the document: $title = $self->get_short_title(); unless($self->content_seen) { DEBUG and print STDERR "No content seen in search for title.\n"; return; } $self->{'Title'} = $title; if(defined $title and $title =~ m/\S/) { $title = $self->title_prefix . esc($title) . $self->title_postfix; } else { $title = $self->default_title; $title = '' unless defined $title; DEBUG and print STDERR "Title defaults to $title\n"; } } my $after = $self->html_header_after_title || ''; if($self->html_css) { my $link = $self->html_css =~ m/html_css # It's a big blob of markup, let's drop it in : sprintf( # It's just a URL, so let's wrap it up qq[\n], $self->html_css, ); $after =~ s{()}{$link\n$1}i; # otherwise nevermind } $self->_add_top_anchor(\$after); if($self->html_javascript) { my $link = $self->html_javascript =~ m/html_javascript # It's a big blob of markup, let's drop it in : sprintf( # It's just a URL, so let's wrap it up qq[\n], $self->html_javascript, ); $after =~ s{()}{$link\n$1}i; # otherwise nevermind } print {$self->{'output_fh'}} $self->html_header_before_title || '', $title, # already escaped $after, ; DEBUG and print STDERR "Returning from do_beginning...\n"; return 1; } sub _add_top_anchor { my($self, $text_r) = @_; unless($$text_r and $$text_r =~ m/name=['"]___top['"]/) { # a hack $$text_r .= $self->top_anchor || ''; } return; } sub version_tag_comment { my $self = shift; return sprintf "\n", esc( ref($self), $self->VERSION(), $ISA[0], $ISA[0]->VERSION(), $], scalar(gmtime($ENV{SOURCE_DATE_EPOCH} || time)), ), $self->_modnote(), ; } sub _modnote { my $class = ref($_[0]) || $_[0]; return join "\n " => grep m/\S/, split "\n", qq{ If you want to change this HTML document, you probably shouldn't do that by changing it directly. Instead, see about changing the calling options to $class, and/or subclassing $class, then reconverting this document from the Pod source. When in doubt, email the author of $class for advice. See 'perldoc $class' for more info. }; } sub do_end { my $self = $_[0]; print {$self->{'output_fh'}} $self->html_footer || ''; return 1; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Normally this would just be a call to _do_middle_main_loop -- but we # have to do some elaborate things to emit all the content and then # summarize it and output it /before/ the content that it's a summary of. sub do_middle { my $self = $_[0]; return $self->_do_middle_main_loop unless $self->index; if( $self->output_string ) { # An efficiency hack my $out = $self->output_string; #it's a reference to it my $sneakytag = "\f\f\e\e\b\bIndex Here\e\e\b\b\f\f\n"; $$out .= $sneakytag; $self->_do_middle_main_loop; $sneakytag = quotemeta($sneakytag); my $index = $self->index_as_html(); if( $$out =~ s/$sneakytag/$index/s ) { # Expected case DEBUG and print STDERR "Inserted ", length($index), " bytes of index HTML into $out.\n"; } else { DEBUG and print STDERR "Odd, couldn't find where to insert the index in the output!\n"; # I don't think this should ever happen. } return 1; } unless( $self->output_fh ) { require Carp; Carp::confess("Parser object \$p doesn't seem to have any output object! I don't know how to deal with that."); } # If we get here, we're outputting to a FH. So we need to do some magic. # Namely, divert all content to a string, which we output after the index. my $fh = $self->output_fh; my $content = ''; { # Our horrible bait and switch: $self->output_string( \$content ); $self->_do_middle_main_loop; $self->abandon_output_string(); $self->output_fh($fh); } print $fh $self->index_as_html(); print $fh $content; return 1; } ########################################################################### sub index_as_html { my $self = $_[0]; # This is meant to be called AFTER the input document has been parsed! my $points = $self->{'PSHTML_index_points'} || []; @$points > 1 or return qq[
    \n]; # There's no point in having a 0-item or 1-item index, I dare say. my(@out) = qq{\n
    }; my $level = 0; my( $target_level, $previous_tagname, $tagname, $text, $anchorname, $indent); foreach my $p (@$points, ['head0', '(end)']) { ($tagname, $text) = @$p; $anchorname = $self->section_escape($text); if( $tagname =~ m{^head(\d+)$} ) { $target_level = 0 + $1; } else { # must be some kinda list item if($previous_tagname =~ m{^head\d+$} ) { $target_level = $level + 1; } else { $target_level = $level; # no change needed } } # Get to target_level by opening or closing ULs while($level > $target_level) { --$level; push @out, (" " x $level) . ""; } while($level < $target_level) { ++$level; push @out, (" " x ($level-1)) . "
      "; } $previous_tagname = $tagname; next unless $level; $indent = ' ' x $level; push @out, sprintf "%s
    • %s", $indent, $level, esc($anchorname), esc($text) ; } push @out, "
    \n"; return join "\n", @out; } ########################################################################### sub _do_middle_main_loop { my $self = $_[0]; my $fh = $self->{'output_fh'}; my $tagmap = $self->{'Tagmap'}; $self->__adjust_html_h_levels; my($token, $type, $tagname, $linkto, $linktype); my @stack; my $dont_wrap = 0; while($token = $self->get_token) { # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if( ($type = $token->type) eq 'start' ) { if(($tagname = $token->tagname) eq 'L') { $linktype = $token->attr('type') || 'insane'; $linkto = $self->do_link($token); if(defined $linkto and length $linkto) { esc($linkto); # (Yes, SGML-escaping applies on top of %-escaping! # But it's rarely noticeable in practice.) print $fh qq{}; } else { print $fh ""; # Yes, an 'a' element with no attributes! } } elsif ($tagname eq 'item-text' or $tagname =~ m/^head\d$/s) { print $fh $tagmap->{$tagname} || next; my @to_unget; while(1) { push @to_unget, $self->get_token; last if $to_unget[-1]->is_end and $to_unget[-1]->tagname eq $tagname; # TODO: support for X<...>'s found in here? (maybe hack into linearize_tokens) } my $name = $self->linearize_tokens(@to_unget); $name = $self->do_section($name, $token) if defined $name; print $fh "index ? " href='#___top' title='click to go to top of document'\n" : "\n"; } if(defined $name) { my $esc = esc( $self->section_name_tidy( $name ) ); print $fh qq[name="$esc"]; DEBUG and print STDERR "Linearized ", scalar(@to_unget), " tokens as \"$name\".\n"; push @{ $self->{'PSHTML_index_points'} }, [$tagname, $name] if $ToIndex{ $tagname }; # Obviously, this discards all formatting codes (saving # just their content), but ahwell. } else { # ludicrously long, so nevermind DEBUG and print STDERR "Linearized ", scalar(@to_unget), " tokens, but it was too long, so nevermind.\n"; } print $fh "\n>"; $self->unget_token(@to_unget); } elsif ($tagname eq 'Data') { my $next = $self->get_token; next unless defined $next; unless( $next->type eq 'text' ) { $self->unget_token($next); next; } DEBUG and print STDERR " raw text ", $next->text, "\n"; # The parser sometimes preserves newlines and sometimes doesn't! (my $text = $next->text) =~ s/\n\z//; print $fh $text, "\n"; next; } else { if( $tagname =~ m/^over-/s ) { push @stack, ''; } elsif( $tagname =~ m/^item-/s and @stack and $stack[-1] ) { print $fh $stack[-1]; $stack[-1] = ''; } print $fh $tagmap->{$tagname} || next; ++$dont_wrap if $tagname eq 'Verbatim' or $tagname eq "VerbatimFormatted" or $tagname eq 'X'; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } elsif( $type eq 'end' ) { if( ($tagname = $token->tagname) =~ m/^over-/s ) { if( my $end = pop @stack ) { print $fh $end; } } elsif( $tagname =~ m/^item-/s and @stack) { $stack[-1] = $tagmap->{"/$tagname"}; if( $tagname eq 'item-text' and defined(my $next = $self->get_token) ) { $self->unget_token($next); if( $next->type eq 'start' ) { print $fh $tagmap->{"/item-text"},$tagmap->{"item-body"}; $stack[-1] = $tagmap->{"/item-body"}; } } next; } print $fh $tagmap->{"/$tagname"} || next; --$dont_wrap if $tagname eq 'Verbatim' or $tagname eq 'X'; # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } elsif( $type eq 'text' ) { esc($type = $token->text); # reuse $type, why not $type =~ s/([\?\!\"\'\.\,]) /$1\n/g unless $dont_wrap; print $fh $type; } } return 1; } ########################################################################### # sub do_section { my($self, $name, $token) = @_; return $name; } sub do_link { my($self, $token) = @_; my $type = $token->attr('type'); if(!defined $type) { $self->whine("Typeless L!?", $token->attr('start_line')); } elsif( $type eq 'pod') { return $self->do_pod_link($token); } elsif( $type eq 'url') { return $self->do_url_link($token); } elsif( $type eq 'man') { return $self->do_man_link($token); } else { $self->whine("L of unknown type $type!?", $token->attr('start_line')); } return 'FNORG'; # should never get called } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub do_url_link { return $_[1]->attr('to') } sub do_man_link { my ($self, $link) = @_; my $to = $link->attr('to'); my $frag = $link->attr('section'); return undef unless defined $to and length $to; # should never happen $frag = $self->section_escape($frag) if defined $frag and length($frag .= ''); # (stringify) DEBUG and print STDERR "Resolving \"$to/$frag\"\n\n"; return $self->resolve_man_page_link($to, $frag); } sub do_pod_link { # And now things get really messy... my($self, $link) = @_; my $to = $link->attr('to'); my $section = $link->attr('section'); return undef unless( # should never happen (defined $to and length $to) or (defined $section and length $section) ); $section = $self->section_escape($section) if defined $section and length($section .= ''); # (stringify) DEBUG and printf STDERR "Resolving \"%s\" \"%s\"...\n", $to || "(nil)", $section || "(nil)"; { # An early hack: my $complete_url = $self->resolve_pod_link_by_table($to, $section); if( $complete_url ) { DEBUG > 1 and print STDERR "resolve_pod_link_by_table(T,S) gives ", $complete_url, "\n (Returning that.)\n"; return $complete_url; } else { DEBUG > 4 and print STDERR " resolve_pod_link_by_table(T,S)", " didn't return anything interesting.\n"; } } if(defined $to and length $to) { # Give this routine first hack again my $there = $self->resolve_pod_link_by_table($to); if(defined $there and length $there) { DEBUG > 1 and print STDERR "resolve_pod_link_by_table(T) gives $there\n"; } else { $there = $self->resolve_pod_page_link($to, $section); # (I pass it the section value, but I don't see a # particular reason it'd use it.) DEBUG > 1 and print STDERR "resolve_pod_page_link gives ", $there || "(nil)", "\n"; unless( defined $there and length $there ) { DEBUG and print STDERR "Can't resolve $to\n"; return undef; } # resolve_pod_page_link returning undef is how it # can signal that it gives up on making a link } $to = $there; } #DEBUG and print STDERR "So far [", $to||'nil', "] [", $section||'nil', "]\n"; my $out = (defined $to and length $to) ? $to : ''; $out .= "#" . $section if defined $section and length $section; unless(length $out) { # sanity check DEBUG and printf STDERR "Oddly, couldn't resolve \"%s\" \"%s\"...\n", $to || "(nil)", $section || "(nil)"; return undef; } DEBUG and print STDERR "Resolved to $out\n"; return $out; } # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . sub section_escape { my($self, $section) = @_; return $self->section_url_escape( $self->section_name_tidy($section) ); } sub section_name_tidy { my($self, $section) = @_; $section =~ s/^\s+//; $section =~ s/\s+$//; $section =~ tr/ /_/; if ($] ge 5.006) { $section =~ s/[[:cntrl:][:^ascii:]]//g; # drop crazy characters } elsif ('A' eq chr(65)) { # But not on early EBCDIC $section =~ tr/\x00-\x1F\x80-\x9F//d; } $section = $self->unicode_escape_url($section); $section = '_' unless length $section; return $section; } sub section_url_escape { shift->general_url_escape(@_) } sub pagepath_url_escape { shift->general_url_escape(@_) } sub manpage_url_escape { shift->general_url_escape(@_) } sub general_url_escape { my($self, $string) = @_; $string =~ s/([^\x00-\xFF])/join '', map sprintf('%%%02X',$_), unpack 'C*', $1/eg; # express Unicode things as urlencode(utf(orig)). # A pretty conservative escaping, behoovey even for query components # of a URL (see RFC 2396) if ($] ge 5.007_003) { $string =~ s/([^-_\.!~*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/sprintf('%%%02X',utf8::native_to_unicode(ord($1)))/eg; } else { # Is broken for non-ASCII platforms on early perls $string =~ s/([^-_\.!~*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/sprintf('%%%02X',ord($1))/eg; } # Yes, stipulate the list without a range, so that this can work right on # all charsets that this module happens to run under. return $string; } #-------------------------------------------------------------------------- # # Oh look, a yawning portal to Hell! Let's play touch football right by it! # sub resolve_pod_page_link { # resolve_pod_page_link must return a properly escaped URL my $self = shift; return $self->batch_mode() ? $self->resolve_pod_page_link_batch_mode(@_) : $self->resolve_pod_page_link_singleton_mode(@_) ; } sub resolve_pod_page_link_singleton_mode { my($self, $it) = @_; return undef unless defined $it and length $it; my $url = $self->pagepath_url_escape($it); $url =~ s{::$}{}s; # probably never comes up anyway $url =~ s{::}{/}g unless $self->perldoc_url_prefix =~ m/\?/s; # sane DWIM? return undef unless length $url; return $self->perldoc_url_prefix . $url . $self->perldoc_url_postfix; } sub resolve_pod_page_link_batch_mode { my($self, $to) = @_; DEBUG > 1 and print STDERR " During batch mode, resolving $to ...\n"; my @path = grep length($_), split m/::/s, $to, -1; unless( @path ) { # sanity DEBUG and print STDERR "Very odd! Splitting $to gives (nil)!\n"; return undef; } $self->batch_mode_rectify_path(\@path); my $out = join('/', map $self->pagepath_url_escape($_), @path) . $HTML_EXTENSION; DEBUG > 1 and print STDERR " => $out\n"; return $out; } sub batch_mode_rectify_path { my($self, $pathbits) = @_; my $level = $self->batch_mode_current_level; $level--; # how many levels up to go to get to the root if($level < 1) { unshift @$pathbits, '.'; # just to be pretty } else { unshift @$pathbits, ('..') x $level; } return; } sub resolve_man_page_link { my ($self, $to, $frag) = @_; my ($page, $section) = $to =~ /^([^(]+)(?:[(](\d+)[)])?$/; return undef unless defined $page and length $page; $section ||= 1; return $self->man_url_prefix . "$section/" . $self->manpage_url_escape($page) . $self->man_url_postfix; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub resolve_pod_link_by_table { # A crazy hack to allow specifying custom L => URL mappings return unless $_[0]->{'podhtml_LOT'}; # An optimizy shortcut my($self, $to, $section) = @_; # TODO: add a method that actually populates podhtml_LOT from a file? if(defined $section) { $to = '' unless defined $to and length $to; return $self->{'podhtml_LOT'}{"$to#$section"}; # quite possibly undef! } else { return $self->{'podhtml_LOT'}{$to}; # quite possibly undef! } return; } ########################################################################### sub linearize_tokens { # self, tokens my $self = shift; my $out = ''; my $t; while($t = shift @_) { if(!ref $t or !UNIVERSAL::can($t, 'is_text')) { $out .= $t; # a string, or some insane thing } elsif($t->is_text) { $out .= $t->text; } elsif($t->is_start and $t->tag eq 'X') { # Ignore until the end of this X<...> sequence: my $x_open = 1; while($x_open) { next if( ($t = shift @_)->is_text ); if( $t->is_start and $t->tag eq 'X') { ++$x_open } elsif($t->is_end and $t->tag eq 'X') { --$x_open } } } } return undef if length $out > $Linearization_Limit; return $out; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub unicode_escape_url { my($self, $string) = @_; $string =~ s/([^\x00-\xFF])/'('.ord($1).')'/eg; # Turn char 1234 into "(1234)" return $string; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub esc { # a function. if(defined wantarray) { if(wantarray) { @_ = splice @_; # break aliasing } else { my $x = shift; if ($] ge 5.007_003) { $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg; } else { # Is broken for non-ASCII platforms on early perls $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg; } return $x; } } foreach my $x (@_) { # Escape things very cautiously: if (defined $x) { if ($] ge 5.007_003) { $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg } else { # Is broken for non-ASCII platforms on early perls $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg } } # Leave out "- so that "--" won't make it thru in X-generated comments # with text in them. # Yes, stipulate the list without a range, so that this can work right on # all charsets that this module happens to run under. } return @_; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1; __END__ =head1 NAME Pod::Simple::HTML - convert Pod to HTML =head1 SYNOPSIS perl -MPod::Simple::HTML -e Pod::Simple::HTML::go thingy.pod =head1 DESCRIPTION This class is for making an HTML rendering of a Pod document. This is a subclass of L and inherits all its methods (and options). Note that if you want to do a batch conversion of a lot of Pod documents to HTML, you should see the module L. =head1 CALLING FROM THE COMMAND LINE TODO perl -MPod::Simple::HTML -e Pod::Simple::HTML::go Thing.pod Thing.html =head1 CALLING FROM PERL =head2 Minimal code use Pod::Simple::HTML; my $p = Pod::Simple::HTML->new; $p->output_string(\my $html); $p->parse_file('path/to/Module/Name.pm'); open my $out, '>', 'out.html' or die "Cannot open 'out.html': $!\n"; print $out $html; =head2 More detailed example use Pod::Simple::HTML; Set the content type: $Pod::Simple::HTML::Content_decl = q{}; my $p = Pod::Simple::HTML->new; Include a single javascript source: $p->html_javascript('http://abc.com/a.js'); Or insert multiple javascript source in the header (or for that matter include anything, thought this is not recommended) $p->html_javascript(' '); Include a single css source in the header: $p->html_css('/style.css'); or insert multiple css sources: $p->html_css(' '); Tell the parser where should the output go. In this case it will be placed in the $html variable: my $html; $p->output_string(\$html); Parse and process a file with pod in it: $p->parse_file('path/to/Module/Name.pm'); =head1 METHODS TODO all (most?) accessorized methods The following variables need to be set B the call to the ->new constructor. Set the string that is included before the opening tag: $Pod::Simple::HTML::Doctype_decl = qq{\n}; Set the content-type in the HTML head: (defaults to ISO-8859-1) $Pod::Simple::HTML::Content_decl = q{}; Set the value that will be embedded in the opening tags of F, C tags and verbatim text. F maps to , C maps to , Verbatim text maps to
     (Computerese defaults to "")
    
      $Pod::Simple::HTML::Computerese =  ' class="some_class_name';
    
    =head2 html_css
    
    =head2 html_javascript
    
    =head2 title_prefix
    
    =head2 title_postfix
    
    =head2 html_header_before_title
    
    This includes everything before the  opening tag including the Document type
    and including the opening <title> tag. The following call will set it to be a simple HTML
    file:
    
      $p->html_header_before_title('<html><head><title>');
    
    =head2 top_anchor
    
    By default Pod::Simple::HTML adds a dummy anchor at the top of the HTML.
    You can change it by calling
    
      $p->top_anchor('<a name="zz" >');
    
    =head2 html_h_level
    
    Normally =head1 will become <h1>, =head2 will become <h2> etc.
    Using the html_h_level method will change these levels setting the h level
    of =head1 tags:
    
      $p->html_h_level(3);
    
    Will make sure that =head1 will become <h3> and =head2 will become <h4> etc...
    
    
    =head2 index
    
    Set it to some true value if you want to have an index (in reality a table of contents)
    to be added at the top of the generated HTML.
    
      $p->index(1);
    
    =head2 html_header_after_title
    
    Includes the closing tag of  and through the rest of the head
    till the opening of the body
    
      $p->html_header_after_title('...');
    
    =head2 html_footer
    
    The very end of the document:
    
      $p->html_footer( qq[\n\n\n\n] );
    
    =head1 SUBCLASSING
    
    Can use any of the methods described above but for further customization
    one needs to override some of the methods:
    
      package My::Pod;
      use strict;
      use warnings;
    
      use base 'Pod::Simple::HTML';
    
      # needs to return a URL string such
      # http://some.other.com/page.html
      # #anchor_in_the_same_file
      # /internal/ref.html
      sub do_pod_link {
        # My::Pod object and Pod::Simple::PullParserStartToken object
        my ($self, $link) = @_;
    
        say $link->tagname;          # will be L for links
        say $link->attr('to');       # 
        say $link->attr('type');     # will be 'pod' always
        say $link->attr('section');
    
        # Links local to our web site
        if ($link->tagname eq 'L' and $link->attr('type') eq 'pod') {
          my $to = $link->attr('to');
          if ($to =~ /^Padre::/) {
              $to =~ s{::}{/}g;
              return "/docs/Padre/$to.html";
          }
        }
    
        # all other links are generated by the parent class
        my $ret = $self->SUPER::do_pod_link($link);
        return $ret;
      }
    
      1;
    
    Meanwhile in script.pl:
    
      use My::Pod;
    
      my $p = My::Pod->new;
    
      my $html;
      $p->output_string(\$html);
      $p->parse_file('path/to/Module/Name.pm');
      open my $out, '>', 'out.html' or die;
      print $out $html;
    
    TODO
    
    maybe override do_beginning do_end
    
    =head1 SEE ALSO
    
    L, L
    
    TODO: a corpus of sample Pod input and HTML output?  Or common
    idioms?
    
    =head1 SUPPORT
    
    Questions or discussion about POD and Pod::Simple should be sent to the
    pod-people@perl.org mail list. Send an empty email to
    pod-people-subscribe@perl.org to subscribe.
    
    This module is managed in an open GitHub repository,
    L. Feel free to fork and contribute, or
    to clone L and send patches!
    
    Patches against Pod::Simple are welcome. Please send bug reports to
    .
    
    =head1 COPYRIGHT AND DISCLAIMERS
    
    Copyright (c) 2002-2004 Sean M. Burke.
    
    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.
    
    This program is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of
    merchantability or fitness for a particular purpose.
    
    =head1 ACKNOWLEDGEMENTS
    
    Thanks to L for permission to use its
    L site for man page links.
    
    Thanks to L for permission to use the
    site for Perl module links.
    
    =head1 AUTHOR
    
    Pod::Simple was created by Sean M. Burke .
    But don't bother him, he's retired.
    
    Pod::Simple is maintained by:
    
    =over
    
    =item * Allison Randal C
    
    =item * Hans Dieter Pearcey C
    
    =item * David E. Wheeler C
    
    =back
    
    =cut
    Pod-Simple-3.43/lib/Pod/Simple/XHTML.pm0000644000175000017500000006374014062242374015551 0ustar  khwkhw=pod
    
    =head1 NAME
    
    Pod::Simple::XHTML -- format Pod as validating XHTML
    
    =head1 SYNOPSIS
    
      use Pod::Simple::XHTML;
    
      my $parser = Pod::Simple::XHTML->new();
    
      ...
    
      $parser->parse_file('path/to/file.pod');
    
    =head1 DESCRIPTION
    
    This class is a formatter that takes Pod and renders it as XHTML
    validating HTML.
    
    This is a subclass of L and inherits all its
    methods. The implementation is entirely different than
    L, but it largely preserves the same interface.
    
    =head2 Minimal code
    
      use Pod::Simple::XHTML;
      my $psx = Pod::Simple::XHTML->new;
      $psx->output_string(\my $html);
      $psx->parse_file('path/to/Module/Name.pm');
      open my $out, '>', 'out.html' or die "Cannot open 'out.html': $!\n";
      print $out $html;
    
    You can also control the character encoding and entities. For example, if
    you're sure that the POD is properly encoded (using the C<=encoding> command),
    you can prevent high-bit characters from being encoded as HTML entities and
    declare the output character set as UTF-8 before parsing, like so:
    
      $psx->html_charset('UTF-8');
      $psx->html_encode_chars(q{&<>'"});
    
    =cut
    
    package Pod::Simple::XHTML;
    use strict;
    use vars qw( $VERSION @ISA $HAS_HTML_ENTITIES );
    $VERSION = '3.43';
    use Pod::Simple::Methody ();
    @ISA = ('Pod::Simple::Methody');
    
    BEGIN {
      $HAS_HTML_ENTITIES = eval "require HTML::Entities; 1";
    }
    
    my %entities = (
      q{>} => 'gt',
      q{<} => 'lt',
      q{'} => '#39',
      q{"} => 'quot',
      q{&} => 'amp',
    );
    
    sub encode_entities {
      my $self = shift;
      my $ents = $self->html_encode_chars;
      return HTML::Entities::encode_entities( $_[0], $ents ) if $HAS_HTML_ENTITIES;
      if (defined $ents) {
          $ents =~ s,(?:
    
      my $parser = Pod::PseudoPod::HTML->new();
      $parser->set_optional_param("value");
      $parser->parse_file($file);
    
    =head2 perldoc_url_prefix
    
    In turning L into http://whatever/Foo%3a%3aBar, what
    to put before the "Foo%3a%3aBar". The default value is
    "https://metacpan.org/pod/".
    
    =head2 perldoc_url_postfix
    
    What to put after "Foo%3a%3aBar" in the URL. This option is not set by
    default.
    
    =head2 man_url_prefix
    
    In turning C<< L >> into http://whatever/man/1/crontab, what
    to put before the "1/crontab". The default value is
    "http://man.he.net/man".
    
    =head2 man_url_postfix
    
    What to put after "1/crontab" in the URL. This option is not set by default.
    
    =head2 title_prefix, title_postfix
    
    What to put before and after the title in the head. The values should
    already be &-escaped.
    
    =head2 html_css
    
      $parser->html_css('path/to/style.css');
    
    The URL or relative path of a CSS file to include. This option is not
    set by default.
    
    =head2 html_javascript
    
    The URL or relative path of a JavaScript file to pull in. This option is
    not set by default.
    
    =head2 html_doctype
    
    A document type tag for the file. This option is not set by default.
    
    =head2 html_charset
    
    The character set to declare in the Content-Type meta tag created by default
    for C. Note that this option will be ignored if the value of
    C is changed. Defaults to "ISO-8859-1".
    
    =head2 html_header_tags
    
    Additional arbitrary HTML tags for the header of the document. The
    default value is just a content type header tag:
    
      
    
    Add additional meta tags here, or blocks of inline CSS or JavaScript
    (wrapped in the appropriate tags).
    
    =head3 html_encode_chars
    
    A string containing all characters that should be encoded as HTML entities,
    specified using the regular expression character class syntax (what you find
    within brackets in regular expressions). This value will be passed as the
    second argument to the C function of L. If
    L is not installed, then any characters other than C<&<>"'>
    will be encoded numerically.
    
    =head2 html_h_level
    
    This is the level of HTML "Hn" element to which a Pod "head1" corresponds.  For
    example, if C is set to 2, a head1 will produce an H2, a head2
    will produce an H3, and so on.
    
    =head2 default_title
    
    Set a default title for the page if no title can be determined from the
    content. The value of this string should already be &-escaped.
    
    =head2 force_title
    
    Force a title for the page (don't try to determine it from the content).
    The value of this string should already be &-escaped.
    
    =head2 html_header, html_footer
    
    Set the HTML output at the beginning and end of each file. The default
    header includes a title, a doctype tag (if C is set), a
    content tag (customized by C), a tag for a CSS file
    (if C is set), and a tag for a Javascript file (if
    C is set). The default footer simply closes the C
    and C tags.
    
    The options listed above customize parts of the default header, but
    setting C or C completely overrides the
    built-in header or footer. These may be useful if you want to use
    template tags instead of literal HTML headers and footers or are
    integrating converted POD pages in a larger website.
    
    If you want no headers or footers output in the HTML, set these options
    to the empty string.
    
    =head2 index
    
    Whether to add a table-of-contents at the top of each page (called an
    index for the sake of tradition).
    
    =head2 anchor_items
    
    Whether to anchor every definition C<=item> directive. This needs to be
    enabled if you want to be able to link to specific C<=item> directives, which
    are output as C<< 
    >> elements. Disabled by default. =head2 backlink Whether to turn every =head1 directive into a link pointing to the top of the page (specifically, the opening body tag). =cut __PACKAGE__->_accessorize( 'perldoc_url_prefix', 'perldoc_url_postfix', 'man_url_prefix', 'man_url_postfix', 'title_prefix', 'title_postfix', 'html_css', 'html_javascript', 'html_doctype', 'html_charset', 'html_encode_chars', 'html_h_level', 'title', # Used internally for the title extracted from the content 'default_title', 'force_title', 'html_header', 'html_footer', 'index', 'anchor_items', 'backlink', 'batch_mode', # whether we're in batch mode 'batch_mode_current_level', # When in batch mode, how deep the current module is: 1 for "LWP", # 2 for "LWP::Procotol", 3 for "LWP::Protocol::GHTTP", etc ); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =head1 SUBCLASSING If the standard options aren't enough, you may want to subclass Pod::Simple::XHMTL. These are the most likely candidates for methods you'll want to override when subclassing. =cut sub new { my $self = shift; my $new = $self->SUPER::new(@_); $new->{'output_fh'} ||= *STDOUT{IO}; $new->perldoc_url_prefix('https://metacpan.org/pod/'); $new->man_url_prefix('http://man.he.net/man'); $new->html_charset('ISO-8859-1'); $new->nix_X_codes(1); $new->{'scratch'} = ''; $new->{'to_index'} = []; $new->{'output'} = []; $new->{'saved'} = []; $new->{'ids'} = { '_podtop_' => 1 }; # used in $new->{'in_li'} = []; $new->{'__region_targets'} = []; $new->{'__literal_targets'} = {}; $new->accept_targets_as_html( 'html', 'HTML' ); return $new; } sub html_header_tags { my $self = shift; return $self->{html_header_tags} = shift if @_; return $self->{html_header_tags} ||= ''; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =head2 handle_text This method handles the body of text within any element: it's the body of a paragraph, or everything between a "=begin" tag and the corresponding "=end" tag, or the text within an L entity, etc. You would want to override this if you are adding a custom element type that does more than just display formatted text. Perhaps adding a way to generate HTML tables from an extended version of POD. So, let's say you want to add a custom element called 'foo'. In your subclass's C method, after calling C you'd call: $new->accept_targets_as_text( 'foo' ); Then override the C method in the subclass to check for when "$flags->{'target'}" is equal to 'foo' and set a flag that marks that you're in a foo block (maybe "$self->{'in_foo'} = 1"). Then override the C method to check for the flag, and pass $text to your custom subroutine to construct the HTML output for 'foo' elements, something like: sub handle_text { my ($self, $text) = @_; if ($self->{'in_foo'}) { $self->{'scratch'} .= build_foo_html($text); return; } $self->SUPER::handle_text($text); } =head2 handle_code This method handles the body of text that is marked up to be code. You might for instance override this to plug in a syntax highlighter. The base implementation just escapes the text. The callback methods C and C emits the C tags before and after C is invoked, so you might want to override these together with C if this wrapping isn't suitable. Note that the code might be broken into multiple segments if there are nested formatting codes inside a C<< CE...> >> sequence. In between the calls to C other markup tags might have been emitted in that case. The same is true for verbatim sections if the C option is turned on. =head2 accept_targets_as_html This method behaves like C, but also marks the region as one whose content should be emitted literally, without HTML entity escaping or wrapping in a C
    element. =cut sub __in_literal_xhtml_region { return unless @{ $_[0]{__region_targets} }; my $target = $_[0]{__region_targets}[-1]; return $_[0]{__literal_targets}{ $target }; } sub accept_targets_as_html { my ($self, @targets) = @_; $self->accept_targets(@targets); $self->{__literal_targets}{$_} = 1 for @targets; } sub handle_text { # escape special characters in HTML (<, >, &, etc) my $text = $_[0]->__in_literal_xhtml_region ? $_[1] : $_[0]->encode_entities( $_[1] ); if ($_[0]{'in_code'} && @{$_[0]{'in_code'}}) { # Intentionally use the raw text in $_[1], even if we're not in a # literal xhtml region, since handle_code calls encode_entities. $_[0]->handle_code( $_[1], $_[0]{'in_code'}[-1] ); } else { if ($_[0]->{in_for}) { my $newlines = $_[0]->__in_literal_xhtml_region ? "\n\n" : ''; if ($_[0]->{started_for}) { if ($text =~ /\S/) { delete $_[0]->{started_for}; $_[0]{'scratch'} .= $text . $newlines; } # Otherwise, append nothing until we have something to append. } else { # The parser sometimes preserves newlines and sometimes doesn't! $text =~ s/\n\z//; $_[0]{'scratch'} .= $text . $newlines; } } else { # Just plain text. $_[0]{'scratch'} .= $text; } } $_[0]{htext} .= $text if $_[0]{'in_head'}; } sub start_code { $_[0]{'scratch'} .= ''; } sub end_code { $_[0]{'scratch'} .= ''; } sub handle_code { $_[0]{'scratch'} .= $_[0]->encode_entities( $_[1] ); } sub start_Para { $_[0]{'scratch'} .= '

    '; } sub start_Verbatim { $_[0]{'scratch'} = '

    ';
        push(@{$_[0]{'in_code'}}, 'Verbatim');
        $_[0]->start_code($_[0]{'in_code'}[-1]);
    }
    
    sub start_head1 {  $_[0]{'in_head'} = 1; $_[0]{htext} = ''; }
    sub start_head2 {  $_[0]{'in_head'} = 2; $_[0]{htext} = ''; }
    sub start_head3 {  $_[0]{'in_head'} = 3; $_[0]{htext} = ''; }
    sub start_head4 {  $_[0]{'in_head'} = 4; $_[0]{htext} = ''; }
    sub start_head5 {  $_[0]{'in_head'} = 5; $_[0]{htext} = ''; }
    sub start_head6 {  $_[0]{'in_head'} = 6; $_[0]{htext} = ''; }
    
    sub start_item_number {
        $_[0]{'scratch'} = "\n" if ($_[0]{'in_li'}->[-1] && pop @{$_[0]{'in_li'}});
        $_[0]{'scratch'} .= '
  • '; push @{$_[0]{'in_li'}}, 1; } sub start_item_bullet { $_[0]{'scratch'} = "

  • \n" if ($_[0]{'in_li'}->[-1] && pop @{$_[0]{'in_li'}}); $_[0]{'scratch'} .= '
  • '; push @{$_[0]{'in_li'}}, 1; } sub start_item_text { # see end_item_text } sub start_over_bullet { $_[0]{'scratch'} = '

      '; push @{$_[0]{'in_li'}}, 0; $_[0]->emit } sub start_over_block { $_[0]{'scratch'} = '
        '; $_[0]->emit } sub start_over_number { $_[0]{'scratch'} = '
          '; push @{$_[0]{'in_li'}}, 0; $_[0]->emit } sub start_over_text { $_[0]{'scratch'} = '
          '; $_[0]{'dl_level'}++; $_[0]{'in_dd'} ||= []; $_[0]->emit } sub end_over_block { $_[0]{'scratch'} .= '
      '; $_[0]->emit } sub end_over_number { $_[0]{'scratch'} = "\n" if ( pop @{$_[0]{'in_li'}} ); $_[0]{'scratch'} .= ''; pop @{$_[0]{'in_li'}}; $_[0]->emit; } sub end_over_bullet { $_[0]{'scratch'} = "\n" if ( pop @{$_[0]{'in_li'}} ); $_[0]{'scratch'} .= '
    '; pop @{$_[0]{'in_li'}}; $_[0]->emit; } sub end_over_text { if ($_[0]{'in_dd'}[ $_[0]{'dl_level'} ]) { $_[0]{'scratch'} = "\n"; $_[0]{'in_dd'}[ $_[0]{'dl_level'} ] = 0; } $_[0]{'scratch'} .= ''; $_[0]{'dl_level'}--; $_[0]->emit; } # . . . . . Now the actual formatters: sub end_Para { $_[0]{'scratch'} .= '

    '; $_[0]->emit } sub end_Verbatim { $_[0]->end_code(pop(@{$_[0]->{'in_code'}})); $_[0]{'scratch'} .= '
  • '; $_[0]->emit; } sub _end_head { my $h = delete $_[0]{in_head}; my $add = $_[0]->html_h_level; $add = 1 unless defined $add; $h += $add - 1; my $id = $_[0]->idify($_[0]{htext}); my $text = $_[0]{scratch}; $_[0]{'scratch'} = $_[0]->backlink && ($h - $add == 0) # backlinks enabled && =head1 ? qq{
    $text} : qq{$text}; $_[0]->emit; push @{ $_[0]{'to_index'} }, [$h, $id, delete $_[0]{'htext'}]; } sub end_head1 { shift->_end_head(@_); } sub end_head2 { shift->_end_head(@_); } sub end_head3 { shift->_end_head(@_); } sub end_head4 { shift->_end_head(@_); } sub end_head5 { shift->_end_head(@_); } sub end_head6 { shift->_end_head(@_); } sub end_item_bullet { $_[0]{'scratch'} .= '

    '; $_[0]->emit } sub end_item_number { $_[0]{'scratch'} .= '

    '; $_[0]->emit } sub end_item_text { # idify and anchor =item content if wanted my $dt_id = $_[0]{'anchor_items'} ? ' id="'. $_[0]->idify($_[0]{'scratch'}) .'"' : ''; # reset scratch my $text = $_[0]{scratch}; $_[0]{'scratch'} = ''; if ($_[0]{'in_dd'}[ $_[0]{'dl_level'} ]) { $_[0]{'scratch'} = "\n"; $_[0]{'in_dd'}[ $_[0]{'dl_level'} ] = 0; } $_[0]{'scratch'} .= qq{$text
    \n
    }; $_[0]{'in_dd'}[ $_[0]{'dl_level'} ] = 1; $_[0]->emit; } # This handles =begin and =for blocks of all kinds. sub start_for { my ($self, $flags) = @_; push @{ $self->{__region_targets} }, $flags->{target_matching}; $self->{started_for} = 1; $self->{in_for} = 1; unless ($self->__in_literal_xhtml_region) { $self->{scratch} .= '{scratch} .= qq( class="$flags->{target}") if $flags->{target}; $self->{scratch} .= ">\n\n"; } } sub end_for { my ($self) = @_; delete $self->{started_for}; delete $self->{in_for}; if ($self->__in_literal_xhtml_region) { # Remove trailine newlines. $self->{'scratch'} =~ s/\s+\z//s; } else { $self->{'scratch'} .= '
    '; } pop @{ $self->{__region_targets} }; $self->emit; } sub start_Document { my ($self) = @_; if (defined $self->html_header) { $self->{'scratch'} .= $self->html_header; $self->emit unless $self->html_header eq ""; } else { my ($doctype, $title, $metatags, $bodyid); $doctype = $self->html_doctype || ''; $title = $self->force_title || $self->title || $self->default_title || ''; $metatags = $self->html_header_tags || ''; if (my $css = $self->html_css) { if ($css !~ /encode_entities($css) . '" type="text/css" />'; } else { $metatags .= $css; } } if ($self->html_javascript) { $metatags .= qq{\n'; } $bodyid = $self->backlink ? ' id="_podtop_"' : ''; $self->{'scratch'} .= <<"HTML"; $doctype $title $metatags HTML $self->emit; } } sub end_Document { my ($self) = @_; my $to_index = $self->{'to_index'}; if ($self->index && @{ $to_index } ) { my @out; my $level = 0; my $indent = -1; my $space = ''; my $id = ' id="index"'; for my $h (@{ $to_index }, [0]) { my $target_level = $h->[0]; # Get to target_level by opening or closing ULs if ($level == $target_level) { $out[-1] .= ''; } elsif ($level > $target_level) { $out[-1] .= '' if $out[-1] =~ /^\s+
  • /; while ($level > $target_level) { --$level; push @out, (' ' x --$indent) . '
  • ' if @out && $out[-1] =~ m{^\s+<\/ul}; push @out, (' ' x --$indent) . ''; } push @out, (' ' x --$indent) . '' if $level; } else { while ($level < $target_level) { ++$level; push @out, (' ' x ++$indent) . '
  • ' if @out && $out[-1]=~ /^\s*
      "; $id = ''; } ++$indent; } next unless $level; $space = ' ' x $indent; push @out, sprintf '%s
    • %s', $space, $h->[1], $h->[2]; } # Splice the index in between the HTML headers and the first element. my $offset = defined $self->html_header ? $self->html_header eq '' ? 0 : 1 : 1; splice @{ $self->{'output'} }, $offset, 0, join "\n", @out; } if (defined $self->html_footer) { $self->{'scratch'} .= $self->html_footer; $self->emit unless $self->html_footer eq ""; } else { $self->{'scratch'} .= "\n"; $self->emit; } if ($self->index) { print {$self->{'output_fh'}} join ("\n\n", @{ $self->{'output'} }), "\n\n"; @{$self->{'output'}} = (); } } # Handling code tags sub start_B { $_[0]{'scratch'} .= '' } sub end_B { $_[0]{'scratch'} .= '' } sub start_C { push(@{$_[0]{'in_code'}}, 'C'); $_[0]->start_code($_[0]{'in_code'}[-1]); } sub end_C { $_[0]->end_code(pop(@{$_[0]{'in_code'}})); } sub start_F { $_[0]{'scratch'} .= '' } sub end_F { $_[0]{'scratch'} .= '' } sub start_I { $_[0]{'scratch'} .= '' } sub end_I { $_[0]{'scratch'} .= '' } sub start_L { my ($self, $flags) = @_; my ($type, $to, $section) = @{$flags}{'type', 'to', 'section'}; my $url = $self->encode_entities( $type eq 'url' ? $to : $type eq 'pod' ? $self->resolve_pod_page_link($to, $section) : $type eq 'man' ? $self->resolve_man_page_link($to, $section) : undef ); # If it's an unknown type, use an attribute-less like HTML.pm. $self->{'scratch'} .= '' : '>'); } sub end_L { $_[0]{'scratch'} .= '' } sub start_S { $_[0]{'scratch'} .= '' } sub end_S { $_[0]{'scratch'} .= '' } sub emit { my($self) = @_; if ($self->index) { push @{ $self->{'output'} }, $self->{'scratch'}; } else { print {$self->{'output_fh'}} $self->{'scratch'}, "\n\n"; } $self->{'scratch'} = ''; return; } =head2 resolve_pod_page_link my $url = $pod->resolve_pod_page_link('Net::Ping', 'INSTALL'); my $url = $pod->resolve_pod_page_link('perlpodspec'); my $url = $pod->resolve_pod_page_link(undef, 'SYNOPSIS'); Resolves a POD link target (typically a module or POD file name) and section name to a URL. The resulting link will be returned for the above examples as: https://metacpan.org/pod/Net::Ping#INSTALL https://metacpan.org/pod/perlpodspec #SYNOPSIS Note that when there is only a section argument the URL will simply be a link to a section in the current document. =cut sub resolve_pod_page_link { my ($self, $to, $section) = @_; return undef unless defined $to || defined $section; if (defined $section) { $section = '#' . $self->idify($self->encode_entities($section), 1); return $section unless defined $to; } else { $section = '' } return ($self->perldoc_url_prefix || '') . $self->encode_entities($to) . $section . ($self->perldoc_url_postfix || ''); } =head2 resolve_man_page_link my $url = $pod->resolve_man_page_link('crontab(5)', 'EXAMPLE CRON FILE'); my $url = $pod->resolve_man_page_link('crontab'); Resolves a man page link target and numeric section to a URL. The resulting link will be returned for the above examples as: http://man.he.net/man5/crontab http://man.he.net/man1/crontab Note that the first argument is required. The section number will be parsed from it, and if it's missing will default to 1. The second argument is currently ignored, as L does not currently include linkable IDs or anchor names in its pages. Subclass to link to a different man page HTTP server. =cut sub resolve_man_page_link { my ($self, $to, $section) = @_; return undef unless defined $to; my ($page, $part) = $to =~ /^([^(]+)(?:[(](\d+)[)])?$/; return undef unless $page; return ($self->man_url_prefix || '') . ($part || 1) . "/" . $self->encode_entities($page) . ($self->man_url_postfix || ''); } =head2 idify my $id = $pod->idify($text); my $hash = $pod->idify($text, 1); This method turns an arbitrary string into a valid XHTML ID attribute value. The rules enforced, following L, are: =over =item * The id must start with a letter (a-z or A-Z) =item * All subsequent characters can be letters, numbers (0-9), hyphens (-), underscores (_), colons (:), and periods (.). =item * The final character can't be a hyphen, colon, or period. URLs ending with these characters, while allowed by XHTML, can be awkward to extract from plain text. =item * Each id must be unique within the document. =back In addition, the returned value will be unique within the context of the Pod::Simple::XHTML object unless a second argument is passed a true value. ID attributes should always be unique within a single XHTML document, but pass the true value if you are creating not an ID but a URL hash to point to an ID (i.e., if you need to put the "#foo" in C<< foo >>. =cut sub idify { my ($self, $t, $not_unique) = @_; for ($t) { s/<[^>]+>//g; # Strip HTML. s/&[^;]+;//g; # Strip entities. s/^\s+//; s/\s+$//; # Strip white space. s/^([^a-zA-Z]+)$/pod$1/; # Prepend "pod" if no valid chars. s/^[^a-zA-Z]+//; # First char must be a letter. s/[^-a-zA-Z0-9_:.]+/-/g; # All other chars must be valid. s/[-:.]+$//; # Strip trailing punctuation. } return $t if $not_unique; my $i = ''; $i++ while $self->{ids}{"$t$i"}++; return "$t$i"; } =head2 batch_mode_page_object_init $pod->batch_mode_page_object_init($batchconvobj, $module, $infile, $outfile, $depth); Called by L so that the class has a chance to initialize the converter. Internally it sets the C property to true and sets C, but Pod::Simple::XHTML does not currently use those features. Subclasses might, though. =cut sub batch_mode_page_object_init { my ($self, $batchconvobj, $module, $infile, $outfile, $depth) = @_; $self->batch_mode(1); $self->batch_mode_current_level($depth); return $self; } sub html_header_after_title { } 1; __END__ =head1 SEE ALSO L, L, L =head1 SUPPORT Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail list. Send an empty email to pod-people-subscribe@perl.org to subscribe. This module is managed in an open GitHub repository, L. Feel free to fork and contribute, or to clone L and send patches! Patches against Pod::Simple are welcome. Please send bug reports to . =head1 COPYRIGHT AND DISCLAIMERS Copyright (c) 2003-2005 Allison Randal. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 ACKNOWLEDGEMENTS Thanks to L for permission to use its L site for man page links. Thanks to L for permission to use the site for Perl module links. =head1 AUTHOR Pod::Simpele::XHTML was created by Allison Randal . Pod::Simple was created by Sean M. Burke . But don't bother him, he's retired. Pod::Simple is maintained by: =over =item * Allison Randal C =item * Hans Dieter Pearcey C =item * David E. Wheeler C =back =cut Pod-Simple-3.43/lib/Pod/Simple/PullParserStartToken.pm0000644000175000017500000001006214062242374020752 0ustar khwkhw require 5; package Pod::Simple::PullParserStartToken; use Pod::Simple::PullParserToken (); use strict; use vars qw(@ISA $VERSION); @ISA = ('Pod::Simple::PullParserToken'); $VERSION = '3.43'; sub new { # Class->new(tagname, optional_attrhash); my $class = shift; return bless ['start', @_], ref($class) || $class; } # Purely accessors: sub tagname { (@_ == 2) ? ($_[0][1] = $_[1]) : $_[0][1] } sub tag { shift->tagname(@_) } sub is_tagname { $_[0][1] eq $_[1] } sub is_tag { shift->is_tagname(@_) } sub attr_hash { $_[0][2] ||= {} } sub attr { if(@_ == 2) { # Reading: $token->attr('attrname') ${$_[0][2] || return undef}{ $_[1] }; } elsif(@_ > 2) { # Writing: $token->attr('attrname', 'newval') ${$_[0][2] ||= {}}{ $_[1] } = $_[2]; } else { require Carp; Carp::croak( 'usage: $object->attr("val") or $object->attr("key", "newval")'); return undef; } } 1; __END__ =head1 NAME Pod::Simple::PullParserStartToken -- start-tokens from Pod::Simple::PullParser =head1 SYNOPSIS (See L) =head1 DESCRIPTION When you do $parser->get_token on a L object, you might get an object of this class. This is a subclass of L and inherits all its methods, and adds these methods: =over =item $token->tagname This returns the tagname for this start-token object. For example, parsing a "=head1 ..." line will give you a start-token with the tagname of "head1", token(s) for its content, and then an end-token with the tagname of "head1". =item $token->tagname(I) This changes the tagname for this start-token object. You probably won't need to do this. =item $token->tag(...) A shortcut for $token->tagname(...) =item $token->is_tag(I) or $token->is_tagname(I) These are shortcuts for C<< $token->tag() eq I >> =item $token->attr(I) This returns the value of the I attribute for this start-token object, or undef. For example, parsing a LZ<> link will produce a start-token with a "to" attribute with the value "Foo", a "type" attribute with the value "pod", and a "section" attribute with the value "Bar". =item $token->attr(I, I) This sets the I attribute for this start-token object to I. You probably won't need to do this. =item $token->attr_hash This returns the hashref that is the attribute set for this start-token. This is useful if (for example) you want to ask what all the attributes are -- you can just do C<< keys %{$token->attr_hash} >> =back You're unlikely to ever need to construct an object of this class for yourself, but if you want to, call C<< Pod::Simple::PullParserStartToken->new( I, I ) >> =head1 SEE ALSO L, L, L =head1 SEE ALSO L, L, L =head1 SUPPORT Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail list. Send an empty email to pod-people-subscribe@perl.org to subscribe. This module is managed in an open GitHub repository, L. Feel free to fork and contribute, or to clone L and send patches! Patches against Pod::Simple are welcome. Please send bug reports to . =head1 COPYRIGHT AND DISCLAIMERS Copyright (c) 2002 Sean M. Burke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 AUTHOR Pod::Simple was created by Sean M. Burke . But don't bother him, he's retired. Pod::Simple is maintained by: =over =item * Allison Randal C =item * Hans Dieter Pearcey C =item * David E. Wheeler C =back =cut Pod-Simple-3.43/lib/Pod/Simple/HTMLLegacy.pm0000644000175000017500000000530614062242374016540 0ustar khwkhw require 5; package Pod::Simple::HTMLLegacy; use strict; use vars qw($VERSION); use Getopt::Long; $VERSION = "5.01"; #-------------------------------------------------------------------------- # # This class is meant to thinly emulate bad old Pod::Html # # TODO: some basic docs sub pod2html { my @args = (@_); my( $verbose, $infile, $outfile, $title ); my $index = 1; { my($help); my($netscape); # dummy local @ARGV = @args; GetOptions( "help" => \$help, "verbose!" => \$verbose, "infile=s" => \$infile, "outfile=s" => \$outfile, "title=s" => \$title, "index!" => \$index, "netscape!" => \$netscape, ) or return bad_opts(@args); bad_opts(@args) if @ARGV; # it should be all switches! return help_message() if $help; } for($infile, $outfile) { $_ = undef unless defined and length } if($verbose) { warn sprintf "%s version %s\n", __PACKAGE__, $VERSION; warn "OK, processed args [@args] ...\n"; warn sprintf " Verbose: %s\n Index: %s\n Infile: %s\n Outfile: %s\n Title: %s\n", map defined($_) ? $_ : "(nil)", $verbose, $index, $infile, $outfile, $title, ; *Pod::Simple::HTML::DEBUG = sub(){1}; } require Pod::Simple::HTML; Pod::Simple::HTML->VERSION(3); die "No such input file as $infile\n" if defined $infile and ! -e $infile; my $pod = Pod::Simple::HTML->new; $pod->force_title($title) if defined $title; $pod->index($index); return $pod->parse_from_file($infile, $outfile); } #-------------------------------------------------------------------------- sub bad_opts { die _help_message(); } sub help_message { print STDOUT _help_message() } #-------------------------------------------------------------------------- sub _help_message { join '', "[", __PACKAGE__, " version ", $VERSION, qq~] Usage: pod2html --help --infile= --outfile= --verbose --index --noindex Options: --help - prints this message. --[no]index - generate an index at the top of the resulting html (default behavior). --infile - filename for the pod to convert (input taken from stdin by default). --outfile - filename for the resulting html file (output sent to stdout by default). --title - title that will appear in resulting html file. --[no]verbose - self-explanatory (off by default). Note that pod2html is DEPRECATED, and this version implements only some of the options known to older versions. For more information, see 'perldoc pod2html'. ~; } 1; __END__ OVER the underpass! UNDER the overpass! Around the FUTURE and BEYOND REPAIR!! Pod-Simple-3.43/lib/Pod/Simple/HTMLBatch.pm0000644000175000017500000011732014062242374016355 0ustar khwkhw require 5; package Pod::Simple::HTMLBatch; use strict; use vars qw( $VERSION $HTML_RENDER_CLASS $HTML_EXTENSION $CSS $JAVASCRIPT $SLEEPY $SEARCH_CLASS @ISA ); $VERSION = '3.43'; @ISA = (); # Yup, we're NOT a subclass of Pod::Simple::HTML! # TODO: nocontents stylesheets. Strike some of the color variations? use Pod::Simple::HTML (); BEGIN {*esc = \&Pod::Simple::HTML::esc } use File::Spec (); use Pod::Simple::Search; $SEARCH_CLASS ||= 'Pod::Simple::Search'; BEGIN { if(defined &DEBUG) { } # no-op elsif( defined &Pod::Simple::DEBUG ) { *DEBUG = \&Pod::Simple::DEBUG } else { *DEBUG = sub () {0}; } } $SLEEPY = 1 if !defined $SLEEPY and $^O =~ /mswin|mac/i; # flag to occasionally sleep for $SLEEPY - 1 seconds. $HTML_RENDER_CLASS ||= "Pod::Simple::HTML"; # # Methods beginning with "_" are particularly internal and possibly ugly. # Pod::Simple::_accessorize( __PACKAGE__, 'verbose', # how verbose to be during batch conversion 'html_render_class', # what class to use to render 'search_class', # what to use to search for POD documents 'contents_file', # If set, should be the name of a file (in current directory) # to write the list of all modules to 'index', # will set $htmlpage->index(...) to this (true or false) 'progress', # progress object 'contents_page_start', 'contents_page_end', 'css_flurry', '_css_wad', 'javascript_flurry', '_javascript_wad', 'no_contents_links', # set to true to suppress automatic adding of << links. '_contents', ); # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Just so we can run from the command line more easily sub go { @ARGV == 2 or die sprintf( "Usage: perl -M%s -e %s:go indirs outdir\n (or use \"\@INC\" for indirs)\n", __PACKAGE__, __PACKAGE__, ); if(defined($ARGV[1]) and length($ARGV[1])) { my $d = $ARGV[1]; -e $d or die "I see no output directory named \"$d\"\nAborting"; -d $d or die "But \"$d\" isn't a directory!\nAborting"; -w $d or die "Directory \"$d\" isn't writeable!\nAborting"; } __PACKAGE__->batch_convert(@ARGV); } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub new { my $new = bless {}, ref($_[0]) || $_[0]; $new->html_render_class($HTML_RENDER_CLASS); $new->search_class($SEARCH_CLASS); $new->verbose(1 + DEBUG); $new->_contents([]); $new->index(1); $new-> _css_wad([]); $new->css_flurry(1); $new->_javascript_wad([]); $new->javascript_flurry(1); $new->contents_file( 'index' . ($HTML_EXTENSION || $Pod::Simple::HTML::HTML_EXTENSION) ); $new->contents_page_start( join "\n", grep $_, $Pod::Simple::HTML::Doctype_decl, "", "Perl Documentation", $Pod::Simple::HTML::Content_decl, "", "\n\n

      Perl Documentation

      \n" ); # override if you need a different title $new->contents_page_end( sprintf( "\n\n

      Generated by %s v%s under Perl v%s\n
      At %s GMT.

      \n\n\n", esc( ref($new), eval {$new->VERSION} || $VERSION, $], scalar(gmtime($ENV{SOURCE_DATE_EPOCH} || time)), ))); return $new; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub muse { my $self = shift; if($self->verbose) { print 'T+', int(time() - $self->{'_batch_start_time'}), "s: ", @_, "\n"; } return 1; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub batch_convert { my($self, $dirs, $outdir) = @_; $self ||= __PACKAGE__; # tolerate being called as an optionless function $self = $self->new unless ref $self; # tolerate being used as a class method if(!defined($dirs) or $dirs eq '' or $dirs eq '@INC' ) { $dirs = ''; } elsif(ref $dirs) { # OK, it's an explicit set of dirs to scan, specified as an arrayref. } else { # OK, it's an explicit set of dirs to scan, specified as a # string like "/thing:/also:/whatever/perl" (":"-delim, as usual) # or, under MSWin, like "c:/thing;d:/also;c:/whatever/perl" (";"-delim!) require Config; my $ps = quotemeta( $Config::Config{'path_sep'} || ":" ); $dirs = [ grep length($_), split qr/$ps/, $dirs ]; } $outdir = $self->filespecsys->curdir unless defined $outdir and length $outdir; $self->_batch_convert_main($dirs, $outdir); } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub _batch_convert_main { my($self, $dirs, $outdir) = @_; # $dirs is either false, or an arrayref. # $outdir is a pathspec. $self->{'_batch_start_time'} ||= time(); $self->muse( "= ", scalar(localtime) ); $self->muse( "Starting batch conversion to \"$outdir\"" ); my $progress = $self->progress; if(!$progress and $self->verbose > 0 and $self->verbose() <= 5) { require Pod::Simple::Progress; $progress = Pod::Simple::Progress->new( ($self->verbose < 2) ? () # Default omission-delay : ($self->verbose == 2) ? 1 # Reduce the omission-delay : 0 # Eliminate the omission-delay ); $self->progress($progress); } if($dirs) { $self->muse(scalar(@$dirs), " dirs to scan: @$dirs"); } else { $self->muse("Scanning \@INC. This could take a minute or two."); } my $mod2path = $self->find_all_pods($dirs ? $dirs : ()); $self->muse("Done scanning."); my $total = keys %$mod2path; unless($total) { $self->muse("No pod found. Aborting batch conversion.\n"); return $self; } $progress and $progress->goal($total); $self->muse("Now converting pod files to HTML.", ($total > 25) ? " This will take a while more." : () ); $self->_spray_css( $outdir ); $self->_spray_javascript( $outdir ); $self->_do_all_batch_conversions($mod2path, $outdir); $progress and $progress->done(sprintf ( "Done converting %d files.", $self->{"__batch_conv_page_count"} )); return $self->_batch_convert_finish($outdir); return $self; } sub _do_all_batch_conversions { my($self, $mod2path, $outdir) = @_; $self->{"__batch_conv_page_count"} = 0; foreach my $module (sort {lc($a) cmp lc($b)} keys %$mod2path) { $self->_do_one_batch_conversion($module, $mod2path, $outdir); sleep($SLEEPY - 1) if $SLEEPY; } return; } sub _batch_convert_finish { my($self, $outdir) = @_; $self->write_contents_file($outdir); $self->muse("Done with batch conversion. $$self{'__batch_conv_page_count'} files done."); $self->muse( "= ", scalar(localtime) ); $self->progress and $self->progress->done("All done!"); return; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub _do_one_batch_conversion { my($self, $module, $mod2path, $outdir, $outfile) = @_; my $retval; my $total = scalar keys %$mod2path; my $infile = $mod2path->{$module}; my @namelets = grep m/\S/, split "::", $module; # this can stick around in the contents LoL my $depth = scalar @namelets; die "Contentless thingie?! $module $infile" unless @namelets; #sanity $outfile ||= do { my @n = @namelets; $n[-1] .= $HTML_EXTENSION || $Pod::Simple::HTML::HTML_EXTENSION; $self->filespecsys->catfile( $outdir, @n ); }; my $progress = $self->progress; my $page = $self->html_render_class->new; if(DEBUG > 5) { $self->muse($self->{"__batch_conv_page_count"} + 1, "/$total: ", ref($page), " render ($depth) $module => $outfile"); } elsif(DEBUG > 2) { $self->muse($self->{"__batch_conv_page_count"} + 1, "/$total: $module => $outfile") } # Give each class a chance to init the converter: $page->batch_mode_page_object_init($self, $module, $infile, $outfile, $depth) if $page->can('batch_mode_page_object_init'); # Init for the index (TOC), too. $self->batch_mode_page_object_init($page, $module, $infile, $outfile, $depth) if $self->can('batch_mode_page_object_init'); # Now get busy... $self->makepath($outdir => \@namelets); $progress and $progress->reach($self->{"__batch_conv_page_count"}, "Rendering $module"); if( $retval = $page->parse_from_file($infile, $outfile) ) { ++ $self->{"__batch_conv_page_count"} ; $self->note_for_contents_file( \@namelets, $infile, $outfile ); } else { $self->muse("Odd, parse_from_file(\"$infile\", \"$outfile\") returned false."); } $page->batch_mode_page_object_kill($self, $module, $infile, $outfile, $depth) if $page->can('batch_mode_page_object_kill'); # The following isn't a typo. Note that it switches $self and $page. $self->batch_mode_page_object_kill($page, $module, $infile, $outfile, $depth) if $self->can('batch_mode_page_object_kill'); DEBUG > 4 and printf STDERR "%s %sb < $infile %s %sb\n", $outfile, -s $outfile, $infile, -s $infile ; undef($page); return $retval; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub filespecsys { $_[0]{'_filespecsys'} || 'File::Spec' } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub note_for_contents_file { my($self, $namelets, $infile, $outfile) = @_; # I think the infile and outfile parts are never used. -- SMB # But it's handy to have them around for debugging. if( $self->contents_file ) { my $c = $self->_contents(); push @$c, [ join("::", @$namelets), $infile, $outfile, $namelets ] # 0 1 2 3 ; DEBUG > 3 and print STDERR "Noting @$c[-1]\n"; } return; } #_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- sub write_contents_file { my($self, $outdir) = @_; my $outfile = $self->_contents_filespec($outdir) || return; $self->muse("Preparing list of modules for ToC"); my($toplevel, # maps toplevelbit => [all submodules] $toplevel_form_freq, # ends up being 'foo' => 'Foo' ) = $self->_prep_contents_breakdown; my $Contents = eval { $self->_wopen($outfile) }; if( $Contents ) { $self->muse( "Writing contents file $outfile" ); } else { warn "Couldn't write-open contents file $outfile: $!\nAbort writing to $outfile at all"; return; } $self->_write_contents_start( $Contents, $outfile, ); $self->_write_contents_middle( $Contents, $outfile, $toplevel, $toplevel_form_freq ); $self->_write_contents_end( $Contents, $outfile, ); return $outfile; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub _write_contents_start { my($self, $Contents, $outfile) = @_; my $starter = $self->contents_page_start || ''; { my $css_wad = $self->_css_wad_to_markup(1); if( $css_wad ) { $starter =~ s{()}{\n$css_wad\n$1}i; # otherwise nevermind } my $javascript_wad = $self->_javascript_wad_to_markup(1); if( $javascript_wad ) { $starter =~ s{()}{\n$javascript_wad\n$1}i; # otherwise nevermind } } unless(print $Contents $starter, "
      \n" ) { warn "Couldn't print to $outfile: $!\nAbort writing to $outfile at all"; close($Contents); return 0; } return 1; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub _write_contents_middle { my($self, $Contents, $outfile, $toplevel2submodules, $toplevel_form_freq) = @_; foreach my $t (sort keys %$toplevel2submodules) { my @downlines = sort {$a->[-1] cmp $b->[-1]} @{ $toplevel2submodules->{$t} }; printf $Contents qq[
      %s
      \n
      \n], esc( $t, $toplevel_form_freq->{$t} ) ; my($path, $name); foreach my $e (@downlines) { $name = $e->[0]; $path = join( "/", '.', esc( @{$e->[3]} ) ) . ($HTML_EXTENSION || $Pod::Simple::HTML::HTML_EXTENSION); print $Contents qq{ }, esc($name), "  \n"; } print $Contents "
      \n\n"; } return 1; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub _write_contents_end { my($self, $Contents, $outfile) = @_; unless( print $Contents "
      \n", $self->contents_page_end || '', ) { warn "Couldn't write to $outfile: $!"; } close($Contents) or warn "Couldn't close $outfile: $!"; return 1; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub _prep_contents_breakdown { my($self) = @_; my $contents = $self->_contents; my %toplevel; # maps lctoplevelbit => [all submodules] my %toplevel_form_freq; # ends up being 'foo' => 'Foo' # (mapping anycase forms to most freq form) foreach my $entry (@$contents) { my $toplevel = $entry->[0] =~ m/^perl\w*$/ ? 'perl_core_docs' # group all the perlwhatever docs together : $entry->[3][0] # normal case ; ++$toplevel_form_freq{ lc $toplevel }{ $toplevel }; push @{ $toplevel{ lc $toplevel } }, $entry; push @$entry, lc($entry->[0]); # add a sort-order key to the end } foreach my $toplevel (sort keys %toplevel) { my $fgroup = $toplevel_form_freq{$toplevel}; $toplevel_form_freq{$toplevel} = ( sort { $fgroup->{$b} <=> $fgroup->{$a} or $a cmp $b } keys %$fgroup # This hash is extremely unlikely to have more than 4 members, so this # sort isn't so very wasteful )[0]; } return(\%toplevel, \%toplevel_form_freq) if wantarray; return \%toplevel; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub _contents_filespec { my($self, $outdir) = @_; my $outfile = $self->contents_file; return unless $outfile; return $self->filespecsys->catfile( $outdir, $outfile ); } #_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- sub makepath { my($self, $outdir, $namelets) = @_; return unless @$namelets > 1; for my $i (0 .. ($#$namelets - 1)) { my $dir = $self->filespecsys->catdir( $outdir, @$namelets[0 .. $i] ); if(-e $dir) { die "$dir exists but not as a directory!?" unless -d $dir; next; } DEBUG > 3 and print STDERR " Making $dir\n"; mkdir $dir, 0777 or die "Can't mkdir $dir: $!\nAborting" ; } return; } #_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- sub batch_mode_page_object_init { my $self = shift; my($page, $module, $infile, $outfile, $depth) = @_; # TODO: any further options to percolate onto this new object here? $page->default_title($module); $page->index( $self->index ); $page->html_css( $self-> _css_wad_to_markup($depth) ); $page->html_javascript( $self->_javascript_wad_to_markup($depth) ); $self->add_header_backlink($page, $module, $infile, $outfile, $depth); $self->add_footer_backlink($page, $module, $infile, $outfile, $depth); return $self; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub add_header_backlink { my $self = shift; return if $self->no_contents_links; my($page, $module, $infile, $outfile, $depth) = @_; $page->html_header_after_title( join '', $page->html_header_after_title || '', qq[

      <<

      \n], ) if $self->contents_file ; return; } sub add_footer_backlink { my $self = shift; return if $self->no_contents_links; my($page, $module, $infile, $outfile, $depth) = @_; $page->html_footer( join '', qq[

      <<

      \n], $page->html_footer || '', ) if $self->contents_file ; return; } sub url_up_to_contents { my($self, $depth) = @_; --$depth; return join '/', ('..') x $depth, esc($self->contents_file); } #_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- sub find_all_pods { my($self, $dirs) = @_; # You can override find_all_pods in a subclass if you want to # do extra filtering or whatnot. But for the moment, we just # pass to modnames2paths: return $self->modnames2paths($dirs); } #_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- sub modnames2paths { # return a hashref mapping modulenames => paths my($self, $dirs) = @_; my $m2p; { my $search = $self->search_class->new; DEBUG and print STDERR "Searching via $search\n"; $search->verbose(1) if DEBUG > 10; $search->progress( $self->progress->copy->goal(0) ) if $self->progress; $search->shadows(0); # don't bother noting shadowed files $search->inc( $dirs ? 0 : 1 ); $search->survey( $dirs ? @$dirs : () ); $m2p = $search->name2path; die "What, no name2path?!" unless $m2p; } $self->muse("That's odd... no modules found!") unless keys %$m2p; if( DEBUG > 4 ) { print STDERR "Modules found (name => path):\n"; foreach my $m (sort {lc($a) cmp lc($b)} keys %$m2p) { print STDERR " $m $$m2p{$m}\n"; } print STDERR "(total ", scalar(keys %$m2p), ")\n\n"; } elsif( DEBUG ) { print STDERR "Found ", scalar(keys %$m2p), " modules.\n"; } $self->muse( "Found ", scalar(keys %$m2p), " modules." ); # return the Foo::Bar => /whatever/Foo/Bar.pod|pm hashref return $m2p; } #=========================================================================== sub _wopen { # this is abstracted out so that the daemon class can override it my($self, $outpath) = @_; require Symbol; my $out_fh = Symbol::gensym(); DEBUG > 5 and print STDERR "Write-opening to $outpath\n"; return $out_fh if open($out_fh, "> $outpath"); require Carp; Carp::croak("Can't write-open $outpath: $!"); } #========================================================================== sub add_css { my($self, $url, $is_default, $name, $content_type, $media, $_code) = @_; return unless $url; unless($name) { # cook up a reasonable name based on the URL $name = $url; if( $name !~ m/\?/ and $name =~ m{([^/]+)$}s ) { $name = $1; $name =~ s/\.css//i; } } $media ||= 'all'; $content_type ||= 'text/css'; my $bunch = [$url, $name, $content_type, $media, $_code]; if($is_default) { unshift @{ $self->_css_wad }, $bunch } else { push @{ $self->_css_wad }, $bunch } return; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub _spray_css { my($self, $outdir) = @_; return unless $self->css_flurry(); $self->_gen_css_wad(); my $lol = $self->_css_wad; foreach my $chunk (@$lol) { my $url = $chunk->[0]; my $outfile; if( ref($chunk->[-1]) and $url =~ m{^(_[-a-z0-9_]+\.css$)} ) { $outfile = $self->filespecsys->catfile( $outdir, "$1" ); DEBUG > 5 and print STDERR "Noting $$chunk[0] as a file I'll create.\n"; } else { DEBUG > 5 and print STDERR "OK, noting $$chunk[0] as an external CSS.\n"; # Requires no further attention. next; } #$self->muse( "Writing autogenerated CSS file $outfile" ); my $Cssout = $self->_wopen($outfile); print $Cssout ${$chunk->[-1]} or warn "Couldn't print to $outfile: $!\nAbort writing to $outfile at all"; close($Cssout); DEBUG > 5 and print STDERR "Wrote $outfile\n"; } return; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub _css_wad_to_markup { my($self, $depth) = @_; my @css = @{ $self->_css_wad || return '' }; return '' unless @css; my $rel = 'stylesheet'; my $out = ''; --$depth; my $uplink = $depth ? ('../' x $depth) : ''; foreach my $chunk (@css) { next unless $chunk and @$chunk; my( $url1, $url2, $title, $type, $media) = ( $self->_maybe_uplink( $chunk->[0], $uplink ), esc(grep !ref($_), @$chunk) ); $out .= qq{\n}; $rel = 'alternate stylesheet'; # alternates = all non-first iterations } return $out; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub _maybe_uplink { # if the given URL looks relative, return the given uplink string -- # otherwise return emptystring my($self, $url, $uplink) = @_; ($url =~ m{^\./} or $url !~ m{[/\:]} ) ? $uplink : '' # qualify it, if/as needed } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub _gen_css_wad { my $self = $_[0]; my $css_template = $self->_css_template; foreach my $variation ( # Commented out for sake of concision: # # 011n=black_with_red_on_white # 001n=black_with_yellow_on_white # 101n=black_with_green_on_white # 110=white_with_yellow_on_black # 010=white_with_green_on_black # 011=white_with_blue_on_black # 100=white_with_red_on_black '110n=blkbluw', # black_with_blue_on_white '010n=blkmagw', # black_with_magenta_on_white '100n=blkcynw', # black_with_cyan_on_white '101=whtprpk', # white_with_purple_on_black '001=whtnavk', # white_with_navy_blue_on_black '010a=grygrnk', # grey_with_green_on_black '010b=whtgrng', # white_with_green_on_grey '101an=blkgrng', # black_with_green_on_grey '101bn=grygrnw', # grey_with_green_on_white ) { my $outname = $variation; my($flipmode, @swap) = ( ($4 || ''), $1,$2,$3) if $outname =~ s/^([012])([012])([[012])([a-z]*)=?//s; @swap = () if '010' eq join '', @swap; # 010 is a swop-no-op! my $this_css = "/* This file is autogenerated. Do not edit. $variation */\n\n" . $css_template; # Only look at three-digitty colors, for now at least. if( $flipmode =~ m/n/ ) { $this_css =~ s/(#[0-9a-fA-F]{3})\b/_color_negate($1)/eg; $this_css =~ s/\bthin\b/medium/g; } $this_css =~ s<#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])\b> < join '', '#', ($1,$2,$3)[@swap] >eg if @swap; if( $flipmode =~ m/a/) { $this_css =~ s/#fff\b/#999/gi } # black -> dark grey elsif($flipmode =~ m/b/) { $this_css =~ s/#000\b/#666/gi } # white -> light grey my $name = $outname; $name =~ tr/-_/ /; $self->add_css( "_$outname.css", 0, $name, 0, 0, \$this_css); } # Now a few indexless variations: for (my ($outfile, $variation) = each %{{ blkbluw => 'black_with_blue_on_white', whtpurk => 'white_with_purple_on_black', whtgrng => 'white_with_green_on_grey', grygrnw => 'grey_with_green_on_white', }}) { my $this_css = join "\n", "/* This file is autogenerated. Do not edit. $outfile */\n", "\@import url(\"./_$variation.css\");", ".indexgroup { display: none; }", "\n", ; my $name = $outfile; $name =~ tr/-_/ /; $self->add_css( "_$outfile.css", 0, $name, 0, 0, \$this_css); } return; } sub _color_negate { my $x = lc $_[0]; $x =~ tr[0123456789abcdef] [fedcba9876543210]; return $x; } #=========================================================================== sub add_javascript { my($self, $url, $content_type, $_code) = @_; return unless $url; push @{ $self->_javascript_wad }, [ $url, $content_type || 'text/javascript', $_code ]; return; } sub _spray_javascript { my($self, $outdir) = @_; return unless $self->javascript_flurry(); $self->_gen_javascript_wad(); my $lol = $self->_javascript_wad; foreach my $script (@$lol) { my $url = $script->[0]; my $outfile; if( ref($script->[-1]) and $url =~ m{^(_[-a-z0-9_]+\.js$)} ) { $outfile = $self->filespecsys->catfile( $outdir, "$1" ); DEBUG > 5 and print STDERR "Noting $$script[0] as a file I'll create.\n"; } else { DEBUG > 5 and print STDERR "OK, noting $$script[0] as an external JavaScript.\n"; next; } #$self->muse( "Writing JavaScript file $outfile" ); my $Jsout = $self->_wopen($outfile); print $Jsout ${$script->[-1]} or warn "Couldn't print to $outfile: $!\nAbort writing to $outfile at all"; close($Jsout); DEBUG > 5 and print STDERR "Wrote $outfile\n"; } return; } sub _gen_javascript_wad { my $self = $_[0]; my $js_code = $self->_javascript || return; $self->add_javascript( "_podly.js", 0, \$js_code); return; } sub _javascript_wad_to_markup { my($self, $depth) = @_; my @scripts = @{ $self->_javascript_wad || return '' }; return '' unless @scripts; my $out = ''; --$depth; my $uplink = $depth ? ('../' x $depth) : ''; foreach my $s (@scripts) { next unless $s and @$s; my( $url1, $url2, $type, $media) = ( $self->_maybe_uplink( $s->[0], $uplink ), esc(grep !ref($_), @$s) ); $out .= qq{\n}; } return $out; } #=========================================================================== sub _css_template { return $CSS } sub _javascript { return $JAVASCRIPT } $CSS = <<'EOCSS'; /* For accessibility reasons, never specify text sizes in px/pt/pc/in/cm/mm */ @media all { .hide { display: none; } } @media print { .noprint, div.indexgroup, .backlinktop, .backlinkbottom { display: none } * { border-color: black !important; color: black !important; background-color: transparent !important; background-image: none !important; } dl.superindex > dd { word-spacing: .6em; } } @media aural, braille, embossed { div.indexgroup { display: none; } /* Too noisy, don't you think? */ dl.superindex > dt:before { content: "Group "; } dl.superindex > dt:after { content: " contains:"; } .backlinktop a:before { content: "Back to contents"; } .backlinkbottom a:before { content: "Back to contents"; } } @media aural { dl.superindex > dt { pause-before: 600ms; } } @media screen, tty, tv, projection { .noscreen { display: none; } a:link { color: #7070ff; text-decoration: underline; } a:visited { color: #e030ff; text-decoration: underline; } a:active { color: #800000; text-decoration: underline; } body.contentspage a { text-decoration: none; } a.u { color: #fff !important; text-decoration: none; } body.pod { margin: 0 5px; color: #fff; background-color: #000; } body.pod h1, body.pod h2, body.pod h3, body.pod h4, body.pod h5, body.pod h6 { font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; font-weight: normal; margin-top: 1.2em; margin-bottom: .1em; border-top: thin solid transparent; /* margin-left: -5px; border-left: 2px #7070ff solid; padding-left: 3px; */ } body.pod h1 { border-top-color: #0a0; } body.pod h2 { border-top-color: #080; } body.pod h3 { border-top-color: #040; } body.pod h4 { border-top-color: #010; } body.pod h5 { border-top-color: #010; } body.pod h6 { border-top-color: #010; } p.backlinktop + h1 { border-top: none; margin-top: 0em; } p.backlinktop + h2 { border-top: none; margin-top: 0em; } p.backlinktop + h3 { border-top: none; margin-top: 0em; } p.backlinktop + h4 { border-top: none; margin-top: 0em; } p.backlinktop + h5 { border-top: none; margin-top: 0em; } p.backlinktop + h6 { border-top: none; margin-top: 0em; } body.pod dt { font-size: 105%; /* just a wee bit more than normal */ } .indexgroup { font-size: 80%; } .backlinktop, .backlinkbottom { margin-left: -5px; margin-right: -5px; background-color: #040; border-top: thin solid #050; border-bottom: thin solid #050; } .backlinktop a, .backlinkbottom a { text-decoration: none; color: #080; background-color: #000; border: thin solid #0d0; } .backlinkbottom { margin-bottom: 0; padding-bottom: 0; } .backlinktop { margin-top: 0; padding-top: 0; } body.contentspage { color: #fff; background-color: #000; } body.contentspage h1 { color: #0d0; margin-left: 1em; margin-right: 1em; text-indent: -.9em; font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; font-weight: normal; border-top: thin solid #fff; border-bottom: thin solid #fff; text-align: center; } dl.superindex > dt { font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; font-weight: normal; font-size: 90%; margin-top: .45em; /* margin-bottom: -.15em; */ } dl.superindex > dd { word-spacing: .6em; /* most important rule here! */ } dl.superindex > a:link { text-decoration: none; color: #fff; } .contentsfooty { border-top: thin solid #999; font-size: 90%; } } /* The End */ EOCSS #========================================================================== $JAVASCRIPT = <<'EOJAVASCRIPT'; // From http://www.alistapart.com/articles/alternate/ function setActiveStyleSheet(title) { var i, a, main; for(i=0 ; (a = document.getElementsByTagName("link")[i]) ; i++) { if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { a.disabled = true; if(a.getAttribute("title") == title) a.disabled = false; } } } function getActiveStyleSheet() { var i, a; for(i=0 ; (a = document.getElementsByTagName("link")[i]) ; i++) { if( a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled ) return a.getAttribute("title"); } return null; } function getPreferredStyleSheet() { var i, a; for(i=0 ; (a = document.getElementsByTagName("link")[i]) ; i++) { if( a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title") ) return a.getAttribute("title"); } return null; } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0 ; i < ca.length ; i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } window.onload = function(e) { var cookie = readCookie("style"); var title = cookie ? cookie : getPreferredStyleSheet(); setActiveStyleSheet(title); } window.onunload = function(e) { var title = getActiveStyleSheet(); createCookie("style", title, 365); } var cookie = readCookie("style"); var title = cookie ? cookie : getPreferredStyleSheet(); setActiveStyleSheet(title); // The End EOJAVASCRIPT # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1; __END__ =head1 NAME Pod::Simple::HTMLBatch - convert several Pod files to several HTML files =head1 SYNOPSIS perl -MPod::Simple::HTMLBatch -e 'Pod::Simple::HTMLBatch::go' in out =head1 DESCRIPTION This module is used for running batch-conversions of a lot of HTML documents This class is NOT a subclass of Pod::Simple::HTML (nor of bad old Pod::Html) -- although it uses Pod::Simple::HTML for doing the conversion of each document. The normal use of this class is like so: use Pod::Simple::HTMLBatch; my $batchconv = Pod::Simple::HTMLBatch->new; $batchconv->some_option( some_value ); $batchconv->some_other_option( some_other_value ); $batchconv->batch_convert( \@search_dirs, $output_dir ); =head2 FROM THE COMMAND LINE Note that this class also provides (but does not export) the function Pod::Simple::HTMLBatch::go. This is basically just a shortcut for C<< Pod::Simple::HTMLBatch->batch_convert(@ARGV) >>. It's meant to be handy for calling from the command line. However, the shortcut requires that you specify exactly two command-line arguments, C and C. Example: % mkdir out_html % perl -MPod::Simple::HTMLBatch -e Pod::Simple::HTMLBatch::go @INC out_html (to convert the pod from Perl's @INC files under the directory ./out_html) (Note that the command line there contains a literal atsign-I-N-C. This is handled as a special case by batch_convert, in order to save you having to enter the odd-looking "" as the first command-line parameter when you mean "just use whatever's in @INC".) Example: % mkdir ../seekrut % chmod og-rx ../seekrut % perl -MPod::Simple::HTMLBatch -e Pod::Simple::HTMLBatch::go . ../seekrut (to convert the pod under the current dir into HTML files under the directory ./seekrut) Example: % perl -MPod::Simple::HTMLBatch -e Pod::Simple::HTMLBatch::go happydocs . (to convert all pod from happydocs into the current directory) =head1 MAIN METHODS =over =item $batchconv = Pod::Simple::HTMLBatch->new; This creates a new batch converter. The method doesn't take parameters. To change the converter's attributes, use the L<"/ACCESSOR METHODS"> below. =item $batchconv->batch_convert( I, I ); This searches the directories given in I and writes HTML files for each of these to a corresponding directory in I. The directory I must exist. =item $batchconv->batch_convert( undef , ...); =item $batchconv->batch_convert( q{@INC}, ...); These two values for I specify that the normal Perl @INC =item $batchconv->batch_convert( \@dirs , ...); This specifies that the input directories are the items in the arrayref C<\@dirs>. =item $batchconv->batch_convert( "somedir" , ...); This specifies that the director "somedir" is the input. (This can be an absolute or relative path, it doesn't matter.) A common value you might want would be just "." for the current directory: $batchconv->batch_convert( "." , ...); =item $batchconv->batch_convert( 'somedir:someother:also' , ...); This specifies that you want the dirs "somedir", "someother", and "also" scanned, just as if you'd passed the arrayref C<[qw( somedir someother also)]>. Note that a ":"-separator is normal under Unix, but Under MSWin, you'll need C<'somedir;someother;also'> instead, since the pathsep on MSWin is ";" instead of ":". (And I is because ":" often comes up in paths, like C<"c:/perl/lib">.) (Exactly what separator character should be used, is gotten from C<$Config::Config{'path_sep'}>, via the L module.) =item $batchconv->batch_convert( ... , undef ); This specifies that you want the HTML output to go into the current directory. (Note that a missing or undefined value means a different thing in the first slot than in the second. That's so that C with no arguments (or undef arguments) means "go from @INC, into the current directory.) =item $batchconv->batch_convert( ... , 'somedir' ); This specifies that you want the HTML output to go into the directory 'somedir'. (This can be an absolute or relative path, it doesn't matter.) =back Note that you can also call C as a class method, like so: Pod::Simple::HTMLBatch->batch_convert( ... ); That is just short for this: Pod::Simple::HTMLBatch-> new-> batch_convert(...); That is, it runs a conversion with default options, for whatever inputdirs and output dir you specify. =head2 ACCESSOR METHODS The following are all accessor methods -- that is, they don't do anything on their own, but just alter the contents of the conversion object, which comprises the options for this particular batch conversion. We show the "put" form of the accessors below (i.e., the syntax you use for setting the accessor to a specific value). But you can also call each method with no parameters to get its current value. For example, C<< $self->contents_file() >> returns the current value of the contents_file attribute. =over =item $batchconv->verbose( I ); This controls how verbose to be during batch conversion, as far as notes to STDOUT (or whatever is C
  • Net::Ping