Provided by: libxml-compile-perl_1.63-3_all bug

NAME

       XML::Compile::Util - Utility routines for XML::Compile components

INHERITANCE

        XML::Compile::Util
          is a Exporter

SYNOPSIS

        use XML::Compile::Util;
        my $node_type = pack_type $ns, $localname;
        my ($ns, $localname) = unpack_type $node_type;

DESCRIPTION

       The functions provided by this package are used by various XML::Compile components, which
       on their own may be unrelated.

FUNCTIONS

   Constants
       The following URIs are exported as constants, to avoid typing in the same long URIs each
       time again: XMLNS, SCHEMA1999, SCHEMA2000, SCHEMA2001, and SCHEMA2001i.

   Packing
       pack_id($ns, $id)
           Translates the two arguments into one compact string representation of the node id.

           example:

            print pack_id 'http://my-ns', 'my-id';
            # shows:  http://my-ns#my-id

       pack_type( [$ns], $localname )
           Translates the arguments into one compact string representation of the node type.
           When the $ns is not present, "undef", or an empty string, then no namespace is
           presumed, and no curly braces part made.

           example:

            print pack_type 'http://my-ns', 'my-type';
            # shows:  {http://my-ns}my-type

            print pack_type 'my-type';
            print pack_type undef, 'my-type';
            print pack_type '', 'my-type';
            # all three show:   my-type

       unpack_id($string)
           Returns a LIST of two elements: the name-space and the id, as included in the $string.
           That $string must be compatible with the result of pack_id().

       unpack_type($string)
           Returns a LIST of two elements: the name-space and the localname, as included in the
           $string.  That $string must be compatible with the result of pack_type().  When no
           name-space is present, an empty string is used.

   Other
       add_duration( $duration, [$time] )
           [1.44] Add the $duration to the $time (defaults to 'now')  This is an expensive
           operation: in many cases the duration2secs() produces useful results as well.

           example:

              my $now      = time;
              my $deadline = add_duration 'P1M', $now;  # deadline in 1 month

       duration2secs($duration)
           [1.44] Translate any format into seconds.  This is an example of a valid duration:
           "-PT1M30.5S"  Average month and year lengths are used.  If you need more precise
           calculations, then use add_duration().

       even_elements(LIST)
           Returns the even-numbered elements from the LIST.

       odd_elements(LIST)
           Returns the odd-numbered elements from the LIST.

       type_of_node($node)
           Translate an XML::LibXML::Node into a packed type.

SEE ALSO

       This module is part of XML-Compile distribution version 1.63, built on July 02, 2019.
       Website: http://perl.overmeer.net/xml-compile/

LICENSE

       Copyrights 2006-2019 by [Mark Overmeer <markov@cpan.org>]. 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://dev.perl.org/licenses/