OpenOffice-PerlPoint

 view release on metacpan or  search on metacpan

lib/OpenOffice/PerlPoint.pm  view on Meta::CPAN

              notes

              metaData

              userAgent
              ping

              skipmetadata
              imagebufferdir
              metadataTemplate
              userdefinedDocdata
             );


# define data: delimiter handling
my %delimiters=(
                'text:footnote-citation' => {
                                             begin => '[',
                                             end   => ']',
                                            },
                'text:footnote-body'     => {

lib/OpenOffice/PerlPoint.pm  view on Meta::CPAN

=item date

last modification

=item keywords

keywords describing the document

=item User defined fields

All names defined by C<userdefinedDocdata>.

=back

=item %tools

Keys: C<generator> holds the name of the program that wrote the OO document.
C<converter> holds the name of the converter, usually the name of this module.

=item $source

lib/OpenOffice/PerlPoint.pm  view on Meta::CPAN

=back

This option has no effect if C<skipmetadata> is set.


=item skipmetadata

If set to a true value meta data processing is bypassed.


=item userdefinedDocdata

Each OO document can be described by various predefined data, which are set automatically
(like the modification date) or set up by the document author in a dialog (like the
documents title). Additionally, OO allows to define up to four user informations. Called
C<info1> to I<info4> by default, they can be named individually if required.

This option expects a reference to an array of names for those user defined document data entries.
The names can be used in templates passed in via option C<metadataTemplate> to access the data
stored in the related document fields.

lib/OpenOffice/PerlPoint.pm  view on Meta::CPAN


  # build object
  my __PACKAGE__ $me=fields::new($class);

  # store configuration
  $me->{$_}=$pars{$_} for qw(
                             file
                             imagebufferdir
                             skipmetadata
                             metadataTemplate
                             userdefinedDocdata
                            );

  # aggregate a user agent object
  $me->{userAgent}=new LWP::UserAgent;
  $me->{userAgent}->timeout(1);
  $me->{userAgent}->env_proxy;

  # and a Net::Ping object
  $me->{ping}=new Net::Ping;

lib/OpenOffice/PerlPoint.pm  view on Meta::CPAN

                                                                 creator
                                                                 date
                                                                 description
                                                                 keywords
                                                                 subject
                                                                 title
                                                                );

     # get user defined metadata, as set up by caller
     my %userDefinedMetadata=$me->{metadata}->user_defined;
     $me->{metaData}{$_}=$userDefinedMetadata{$_} || 'unknown' for @{$me->{userdefinedDocdata}};

     # get generator
     $generator=$me->{metadata}->generator;
     $generator='unknown program' unless $generator;
    }

  # process meta data, if configured
  if (defined $me->{metadataTemplate})
   {
    # build safe environment

lib/OpenOffice/PerlPoint.pm.~1~  view on Meta::CPAN

              notes

              metaData

              userAgent
              ping

              skipmetadata
              imagebufferdir
              metadataTemplate
              userdefinedDocdata
             );


# define data: delimiter handling
my %delimiters=(
                'text:footnote-citation' => {
                                             begin => '[',
                                             end   => ']',
                                            },
                'text:footnote-body'     => {

lib/OpenOffice/PerlPoint.pm.~1~  view on Meta::CPAN

=item date

last modification

=item keywords

keywords describing the document

=item User defined fields

All names defined by C<userdefinedDocdata>.

=back

=item %tools

Keys: C<generator> holds the name of the program that wrote the OO document.
C<converter> holds the name of the converter, usually the name of this module.

=item $source

lib/OpenOffice/PerlPoint.pm.~1~  view on Meta::CPAN

=back

This option has no effect if C<skipmetadata> is set.


=item skipmetadata

If set to a true value meta data processing is bypassed.


=item userdefinedDocdata

Each OO document can be described by various predefined data, which are set automatically
(like the modification date) or set up by the document author in a dialog (like the
documents title). Additionally, OO allows to define up to four user informations. Called
C<info1> to I<info4> by default, they can be named individually if required.

This option expects a reference to an array of names for those user defined document data entries.
The names can be used in templates passed in via option C<metadataTemplate> to access the data
stored in the related document fields.

lib/OpenOffice/PerlPoint.pm.~1~  view on Meta::CPAN


  # build object
  my __PACKAGE__ $me=fields::new($class);

  # store configuration
  $me->{$_}=$pars{$_} for qw(
                             file
                             imagebufferdir
                             skipmetadata
                             metadataTemplate
                             userdefinedDocdata
                            );

  # aggregate a user agent object
  $me->{userAgent}=new LWP::UserAgent;
  $me->{userAgent}->timeout(1);
  $me->{userAgent}->env_proxy;

  # and a Net::Ping object
  $me->{ping}=new Net::Ping;

lib/OpenOffice/PerlPoint.pm.~1~  view on Meta::CPAN

                                                                 creator
                                                                 date
                                                                 description
                                                                 keywords
                                                                 subject
                                                                 title
                                                                );

     # get user defined metadata, as set up by caller
     my %userDefinedMetadata=$me->{metadata}->user_defined;
     $me->{metaData}{$_}=$userDefinedMetadata{$_} || 'unknown' for @{$me->{userdefinedDocdata}};

     # get generator
     $generator=$me->{metadata}->generator;
     $generator='unknown program' unless $generator;
    }

  # process meta data, if configured
  if (defined $me->{metadataTemplate})
   {
    # build safe environment

t/text.t  view on Meta::CPAN




# Open Office 1.0 format
{
 # build a converter object
 my $oo2pp=new OpenOffice::PerlPoint(
                                     file               => 't/text.sxw',
                                     imagebufferdir     => 't/ibd1',
                                     metadataTemplate   => $template,
                                     userdefinedDocdata => [qw(author copyright version)],
                                    );

 # convert document
 my $perlpoint=$oo2pp->oo2pp;

 # check result
 is(diff('t/text-sxw.pp', \$perlpoint), '', 'OO Text 1.0');
}


# Open Office 2.0 (OASIS Open Document) format
{
 local($TODO)="Open Document support is incomplete at the moment.";

 # build a converter object
 my $oo2pp=new OpenOffice::PerlPoint(
                                     file => 't/text.odt',
                                     imagebufferdir => 't/ibd2',
                                     metadataTemplate   => $template,
                                     userdefinedDocdata => [qw(author copyright version)],
                                    );

 # convert document
 my $perlpoint=$oo2pp->oo2pp;

 # check result
 is(diff('t/text-odt.pp', \$perlpoint), '', 'OASIS Open Document');
}

# clean up



( run in 0.545 second using v1.01-cache-2.11-cpan-454fe037f31 )