FunctionalPerl

 view release on metacpan or  search on metacpan

lib/PXML.pm  view on Meta::CPAN

#
# Copyright (c) 2015-2020 Christian Jaeger, copying@christianjaeger.ch
#
# This is free software, offered under either the same terms as perl 5
# or the terms of the Artistic License version 2 or the terms of the
# MIT License (Expat version). See the file COPYING.md that came
# bundled with this file.
#

=head1 NAME

PXML - functional XML handling, general functions

=head1 SYNOPSIS

    use PXML qw(is_pxml_element);
    use PXML::XHTML qw(P);

    ok is_pxml_element P();
    is P("Hi <there>")->string, '<p>Hi &lt;there&gt;</p>';

    use PXML ":all";

    is(pxmlbody("foo")->string, "foo");


=head1 DESCRIPTION

General Functions for the PXML libraries.

=head1 SEE ALSO

L<PXML::Element>, L<PXML::Tags>, L<PXML::SVG>, L<PXML::XHTML>,
L<PXML::HTML5>, L<PXML::Util>, L<PXML::Serialize>, L<PXML::Preserialize>,
L<http://functional-perl/>

=head1 NOTE

This is alpha software! Read the status section in the package README
or on the L<website|http://functional-perl.org/>.

=cut

package PXML;
use strict;
use warnings;
use warnings FATAL => 'uninitialized';
use Exporter "import";

our @EXPORT      = qw(is_pxml_element);
our @EXPORT_OK   = qw(pxmlbody pxmlflush is_pxmlflush);
our %EXPORT_TAGS = (all => [@EXPORT, @EXPORT_OK]);

use PXML::Element;

use FP::Predicates 'instance_of';
use Scalar::Util qw(blessed);

sub is_pxml_element;
*is_pxml_element = instance_of("PXML::Element");

{

    package PXML::Body;

    # hacky?.
    *string = \&PXML::Element::string;
}

sub pxmlbody {
    bless [@_], "PXML::Body"
}

my $flush = bless [], "PXML::Flush";

sub pxmlflush {
    $flush



( run in 0.632 second using v1.01-cache-2.11-cpan-7fcb06a456a )