GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
XML::Compile::Dumper(3) User Contributed Perl Documentation XML::Compile::Dumper(3)

XML::Compile::Dumper - Remember precompiled XML processors

 # create readers and writers or soap things
 my $reader = $schema->compile(READER => '{myns}mytype');
 my $writer = $schema->compile(WRITER => ...);

 # then dump them into a package
 my $dumper = XML::Compile::Dumper->new
   (package => 'My::Package', filename => 'My/Package.pm');
 $dumper->freeze(foo => $reader, bar => $writer);
 $dumper->close;

 # later, they can get recalled using
 use My::Package;
 my $hash = foo($xml);
 my $doc  = bar($doc, $xml);

This module simplifies the task of saving and loading pre-compiled translators. Schema's can get huge, and when you are not creating a daemon to do the XML communication, you may end-up compiling and interpreting these large schemas often, just to be able to process simple data-structures.

Based on the excellent module Data::Dump::Streamer, this module helps you create standard Perl packages which contain the reader and writer code references.

WARNING: this feature was introduced in release 0.17. Using perl 5.8.8, libxml 2.6.26, XML::LibXML 2.60, and Data::Dump::Streamer 2.03, Perl complains about "PmmREFCNT_dec: REFCNT decremented below 0! during global destruction." when the tests are run. This bug can be anywhere. Therefore, these tests are disabled by default in t/TestTools.pm. If you have time, could you please run the tests with "$skip_dumper = 0;" and report the results to the author?

$obj->close

Finalize the produced file. This will be called automatically if the objects goes out-of-scope.

XML::Compile::Dumper->new(OPTIONS)

Create an object which will collect the information for the output file. You have to specify either a "filehandle" or a "filename". A filehandle will be closed after processing.

 Option    --Default
 filehandle  undef
 filename    undef
 package     <required>

. filehandle => "IO::Handle"

. filename => FILENAME

The file will be written using utf8 encoding, using IO::File. If you want something else, open your filehandle first, and provide that as argument.

. package => PACKAGE

The name-space which will be used: it will produce a "package" line in the output.

$obj->file

Returns the output file-handle, which you may use to add extensions to the module.

$obj->footer(FILEHANDLE)

$obj->freeze(PAIRS|HASH)

Produce the dump for a group of code references, which will be made available under a normal subroutine name. This method can only be called once.

$obj->header(FILEHANDLE, PACKAGE)

Prints the header text to the file.

Error: either filename or filehandle required

Error: freeze can only be called once

The various closures may have related variables, and therefore need to be dumped in one go.

Error: freeze needs PAIRS or a HASH

Error: package name required

The perl module which is produced is cleanly encapsulating the produced program text in a perl package name-space. The name has to be provided.

Error: value with $name is not a code reference

This module is part of XML-Compile-Dumper distribution version 0.13, built on March 26, 2010. Website: http://perl.overmeer.net/xml-compile/

All modules in this suite: XML::Compile, XML::Compile::SOAP, XML::Compile::SOAP12, XML::Compile::SOAP::Daemon, XML::Compile::Tester, XML::Compile::Cache, XML::Compile::Dumper, XML::Compile::RPC, and XML::Rewrite, XML::ExistDB, XML::LibXML::Simple.

Please post questions or ideas to the mailinglist at http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile For life contact with other developers, visit the "#xml-compile" channel on "irc.perl.org".

Copyrights 2007-2010 by Mark Overmeer. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html

2010-03-26 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.