XML::C...Dumper(3pm)

๐Ÿ“ฆ
version 0.14 ยท 2 versions
  • 0.14 ยท debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.14 ยท ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

โœจ XML::Compile::Dumper โœจ

okay bestie, gather round ๐Ÿ’– this is a User Contributed Perl Documentation page, and it's literally the "remember my precompiled XML processors so I don't have to do all that work again" module. it's giving main character energy for your schema compile times. no cap.


๐ŸŒธ NAME ๐ŸŒธ

XML::Compile::Dumper โ€” Remember precompiled XML processors ๐Ÿง โœจ


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

# 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);

like, you freeze them ๐ŸงŠ, you close, and later you just use My::Package and boom, your foo and bar are back. iconic behaviour fr fr ๐Ÿ‘‘


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so this module is out here simplifying the task of saving and loading pre-compiled translators. the way that schemas can get huge โ€” and when you're not building a daemon to do the XML communication, you may end up compiling and interpreting these big ol' schemas constantly, just to be able to process simple data-structures ๐Ÿ˜ญ that's so much wasted effort bestie.

built on top of the excellent Data::Dump::Streamer, this module helps you create standard Perl packages which contain the reader and writer code references. slay ๐Ÿ’…

โš ๏ธ 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? ๐Ÿฅบ๐Ÿซถ

๐Ÿ’… METHODS ๐Ÿ’…

๐Ÿงš Constructors ๐Ÿงš

  • $obj->close() โ€” Finalize the produced file. this will be called automatically if the object goes out-of-scope, so it's got your back ๐Ÿซถ
  • 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. you do you ๐Ÿ’–

  • package => PACKAGE

The name-space which will be used: it will produce a package line in the output. it's literally required, no skips ๐Ÿšซ

๐Ÿ”ฎ Accessors ๐Ÿ”ฎ

  • $obj->file() โ€” Returns the output file-handle, which you may use to add extensions to the module. cute lil extra credit moment โœจ

๐ŸŒˆ Producers ๐ŸŒˆ

  • $obj->footer($fh)
  • $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. one and done, periodt ๐Ÿ’…
  • $obj->header($fh, $package) โ€” Prints the header text to the file.

๐Ÿ”ฅ DIAGNOSTICS ๐Ÿ”ฅ

  • 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. that's why, bestie, no second chances ๐Ÿ™ˆ
  • 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

๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

this module is part of XML-Compile-Dumper distribution version 0.14, built on January 22, 2014. website: http://perl.overmeer.net/xml-compile/ ๐ŸŒ

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. the whole squad is here ๐Ÿซ‚

please post questions or ideas to the mailinglist at http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile . for live contact with other developers, visit the "#xml-compile" channel on irc.perl.org. come hang out, iykyk ๐Ÿ’ฌ


๐Ÿ“ LICENSE ๐Ÿ“

Copyrights 2007-2014 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 ๐Ÿ“œ


and that's the whole thing bestie, we ate and left no crumbs ๐Ÿ’…โœจ this page was served to you by perl v5.34.0, dated 2022-06-28 โ€” mwah, love u, go compile something ๐Ÿฆ‹๐Ÿ’–๐ŸŽ€

๐Ÿ“ฆ where this page comes from