Pod-PerlPoint

 view release on metacpan or  search on metacpan

lib/PerlPoint/Import/POD.pm  view on Meta::CPAN




# = HISTORY SECTION =====================================================================

# ---------------------------------------------------------------------------------------
# version | date     | author   | changes
# ---------------------------------------------------------------------------------------
# 0.01    |09.04.2006| JSTENZEL | new.
# ---------------------------------------------------------------------------------------

# = POD SECTION =========================================================================

=head1 NAME

B<PerlPoint::Import::POD> - a standard PerlPoint import filter for POD

=head1 VERSION

This manual describes version B<0.01>.

=head1 SYNOPSIS

   # command line: process a POD file
   perlpoint ... IMPORT:file.pod

   ...

   # or, in a PerlPoint source:

   // include a POD file with "pod" extension
   \INCLUDE{import=1 file="example.pod"}

   // include a POD file without "pod" extension
   \INCLUDE{import=pod file="example"}

   // import a snippet in POD,
   // which in turn contains some PerlPoint
   \EMBED{import=pod}
   
   =head2 Embedded PerlPoint

   A POD paragraph.

   =for perlpoint It \I<works>!

   \END_EMBED


=head1 DESCRIPTION

Standard import filters are loaded automatically by the Parser
when you import a POD file in one of the ways shown in the
I<SYNOPSIS>.


=head1 FUNCTION

According to the standard import filter API (see C<PerlPoint::Parser>) this
module provides one function, C<importFilter()>. I transforms a POD file
into PerlPoint.

=cut




# check perl version
require 5.00503;

# = PACKAGE SECTION ======================================================================

# declare package
package PerlPoint::Import::POD;

# declare package version
$VERSION=0.01;


# = PRAGMA SECTION =======================================================================

# set pragmata
use strict;


# = LIBRARY SECTION ======================================================================

# load libraries
use Pod::PerlPoint 0.05;

# declare the filter function
sub importFilter
 {
  # declare variables
  my ($pod2pp, $result, $i);

  # get source and sourcefile name
  my ($pod, $sourcefile)=(join('', "\n\n\n", @main::_ifilterText), $main::_ifilterFile);

  # transform it into PerlPoint
  {
   # build a translator object and configure it
   ($pod2pp, $result)=(new Pod::PerlPoint());
   $pod2pp->output_string(\$result);
   $pod2pp->configure(parser40=>($PerlPoint::Parser::VERSION>=0.40));

   # parse file



( run in 0.864 second using v1.01-cache-2.11-cpan-71847e10f99 )