.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "XML::Compile::Dumper 3pm" .TH XML::Compile::Dumper 3pm "2021-01-08" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" XML::Compile::Dumper \- Remember precompiled XML processors .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& # create readers and writers or soap things \& my $reader = $schema\->compile(READER => \*(Aq{myns}mytype\*(Aq); \& my $writer = $schema\->compile(WRITER => ...); \& \& # then dump them into a package \& my $dumper = XML::Compile::Dumper\->new \& (package => \*(AqMy::Package\*(Aq, filename => \*(AqMy/Package.pm\*(Aq); \& $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); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" 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 \s-1XML\s0 communication, you may end-up compiling and interpreting these large schemas often, just to be able to process simple data-structures. .PP Based on the excellent module Data::Dump::Streamer, this module helps you create standard Perl packages which contain the reader and writer code references. .PP \&\s-1WARNING:\s0 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 \f(CW"PmmREFCNT_dec: REFCNT decremented below 0! during global destruction."\fR 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 \&\f(CW\*(C`$skip_dumper = 0;\*(C'\fR and report the results to the author? .SH "METHODS" .IX Header "METHODS" .SS "Constructors" .IX Subsection "Constructors" .ie n .IP "$obj\->\fBclose\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBclose\fR()" 4 .IX Item "$obj->close()" Finalize the produced file. This will be called automatically if the objects goes out-of-scope. .IP "XML::Compile::Dumper\->\fBnew\fR(%options)" 4 .IX Item "XML::Compile::Dumper->new(%options)" Create an object which will collect the information for the output file. You have to specify either a \f(CW\*(C`filehandle\*(C'\fR or a \f(CW\*(C`filename\*(C'\fR. A filehandle will be closed after processing. .Sp .Vb 4 \& \-Option \-\-Default \& filehandle undef \& filename undef \& package .Ve .RS 4 .ie n .IP "filehandle => ""IO::Handle""" 2 .el .IP "filehandle => \f(CWIO::Handle\fR" 2 .IX Item "filehandle => IO::Handle" .PD 0 .IP "filename => \s-1FILENAME\s0" 2 .IX Item "filename => FILENAME" .PD 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. .IP "package => \s-1PACKAGE\s0" 2 .IX Item "package => PACKAGE" The name-space which will be used: it will produce a \f(CW\*(C`package\*(C'\fR line in the output. .RE .RS 4 .RE .SS "Accessors" .IX Subsection "Accessors" .ie n .IP "$obj\->\fBfile\fR()" 4 .el .IP "\f(CW$obj\fR\->\fBfile\fR()" 4 .IX Item "$obj->file()" Returns the output file-handle, which you may use to add extensions to the module. .SS "Producers" .IX Subsection "Producers" .ie n .IP "$obj\->\fBfooter\fR($fh)" 4 .el .IP "\f(CW$obj\fR\->\fBfooter\fR($fh)" 4 .IX Item "$obj->footer($fh)" .PD 0 .ie n .IP "$obj\->\fBfreeze\fR(PAIRS|HASH)" 4 .el .IP "\f(CW$obj\fR\->\fBfreeze\fR(PAIRS|HASH)" 4 .IX Item "$obj->freeze(PAIRS|HASH)" .PD 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. .ie n .IP "$obj\->\fBheader\fR($fh, $package)" 4 .el .IP "\f(CW$obj\fR\->\fBheader\fR($fh, \f(CW$package\fR)" 4 .IX Item "$obj->header($fh, $package)" Prints the header text to the file. .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" .IP "Error: either filename or filehandle required" 4 .IX Item "Error: either filename or filehandle required" .PD 0 .IP "Error: freeze can only be called once" 4 .IX Item "Error: freeze can only be called once" .PD The various closures may have related variables, and therefore need to be dumped in one go. .IP "Error: freeze needs \s-1PAIRS\s0 or a \s-1HASH\s0" 4 .IX Item "Error: freeze needs PAIRS or a HASH" .PD 0 .IP "Error: package name required" 4 .IX Item "Error: package name required" .PD 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. .ie n .IP "Error: value with $name is not a code reference" 4 .el .IP "Error: value with \f(CW$name\fR is not a code reference" 4 .IX Item "Error: value with $name is not a code reference" .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of XML-Compile-Dumper distribution version 0.14, built on January 22, 2014. Website: \fIhttp://perl.overmeer.net/xml\-compile/\fR .PP Other distributions in this suite: XML::Compile, XML::Compile::SOAP, XML::Compile::WSDL11, XML::Compile::SOAP12, XML::Compile::SOAP::Daemon, XML::Compile::SOAP::WSA, XML::Compile::C14N, XML::Compile::WSS, XML::Compile::WSS::Signature, XML::Compile::Tester, XML::Compile::Cache, XML::Compile::Dumper, XML::Compile::RPC, XML::Rewrite and XML::LibXML::Simple. .PP Please post questions or ideas to the mailinglist at \&\fIhttp://lists.scsys.co.uk/cgi\-bin/mailman/listinfo/xml\-compile\fR . For live contact with other developers, visit the \f(CW\*(C`#xml\-compile\*(C'\fR channel on \f(CW\*(C`irc.perl.org\*(C'\fR. .SH "LICENSE" .IX Header "LICENSE" Copyrights 2007\-2014 by [Mark Overmeer]. For other contributors see ChangeLog. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See \fIhttp://www.perl.com/perl/misc/Artistic.html\fR