XML-Easy-ProceduralWriter

 view release on metacpan or  search on metacpan

lib/XML/Easy/ProceduralWriter.pm  view on Meta::CPAN

            text "then they'd be ".($bottles > 1 ? $bottles-1 : "no")." green bottle";
            text "s" unless $bottles-1 == 1;
            text " hanging on the wall";
          };
        };
      }
    }, "UTF-16BE");

=cut

sub xml_element(&) {

  # create a temporary place to store whatever we're putting
  local @XML::Easy::ProceduralWriter::stuff = ();
  shift->();

  croak "No root node specified"
    unless @XML::Easy::ProceduralWriter::stuff;

  croak "More than one root node specified"
    if @XML::Easy::ProceduralWriter::stuff > 3;

lib/XML/Easy/ProceduralWriter.pm  view on Meta::CPAN



=item xml_bytes { ... }

The same as xml_element, but returns a scalar containing octlets that have a UTF-8
encoded representation of the character representation of the string (i.e. this is
what you want to use to create something you can pass to C<print>)

=cut

sub xml_bytes(&) {
  my $data = shift;
  local $Carp::CarpLevel = $Carp::CarpLevel + 1;
  return xml10_write_document(&xml_element($data), "UTF-8"); ## no critic Subroutines::ProhibitAmpersandSigils
}
push @EXPORT, "xml_bytes";

=item element $element_name, $key => $value, $key => $value, $block

Create an XML::Easy::Element element and add it to the enclosing element.



( run in 0.627 second using v1.01-cache-2.11-cpan-49f99fa48dc )