Pod::Eventual::Reconstruct - Construct a document from Pod::Eventual events
version 0.1.2
Constructing a Document from a series of Pod::Eventual events is not hard, its just slightly nuanced, and there's a few small pitfalls for people who want input == output consistency.
This module simply implements the basic layers of edge-cases to make that simpler.
# Write to $string my $string; my $recon = Pod::Eventual::Reconstruct->string_writer( $string ) # or my $recon = Pod::Eventual::Reconstruct->string_writer( \$string ) # ( both work ) # Write to $file my $recon = Pod::Eventual::Reconstruct->file_writer( $file ) # Write to file in utf8 mode my $recon = Pod::Eventual::Reconstruct->file_writer_utf8( $file ) # Write to filehandle my $recon = Pod::Eventual::Reconstruct->handle_writer_utf8( $handle )
$recon->write_event( $hashref_from_pod_elemental )
Create a reconstructor that writes to a string
my $reconstructor = ::Reconstruct->string_writer( $string ) my $reconstructor = ::Reconstruct->string_writer( \$string )
Create a reconstructor that writes to a file
my $reconstructor = ::Reconstruct->file_writer( $file_name )
Values of Path::Tiny or Path::Class should also work as values of $file_name
Path::Tiny
Path::Class
$file_name
Create a reconstructor that writes to a file in raw mode
my $reconstructor = ::Reconstruct->file_writer_raw( $file_name )
Create a reconstructor that writes to a file in utf8 mode
utf8
my $reconstructor = ::Reconstruct->file_writer_utf8( $file_name )
Create a reconstructor that writes to a file handle
my $reconstructor = ::Reconstruct->handle_writer( $handle )
Write a Pod::Eventual event of any kind to the output target.
Pod::Eventual
$recon->write_event( $eventhash );
Note: This is just a proxy for the other methods which delegates based on the value of $eventhash->{type}.
$eventhash->{type}
Unknown type's will cause errors.
type
Write a Pod::Eventual command event.
command
$event->{type} MUST be eq 'command'
$event->{type}
eq 'command'
$recon->write_command({ type => 'command', ... });
Write a Pod::Eventual text event.
text
$event->{type} MUST be eq 'text'
eq 'text'
$recon->write_text({ type => 'text', ... });
Write a Pod::Eventual nonpod event.
nonpod
$event->{type} MUST be eq 'nonpod'
eq 'nonpod'
$recon->write_nonpod({ type => 'nonpod', ... });
Write a Pod::Eventual blank event.
blank
$event->{type} MUST be eq 'blank'
eq 'blank'
$recon->write_blank({ type => 'blank', ... });
Kent Fredric <kentfredric@gmail.com>
This software is copyright (c) 2013 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Pod::Eventual::Reconstruct, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pod::Eventual::Reconstruct
CPAN shell
perl -MCPAN -e shell install Pod::Eventual::Reconstruct
For more information on module installation, please visit the detailed CPAN module installation guide.