The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/env perl

package XML::XSS::xss;
our $AUTHORITY = 'cpan:YANICK';
#ABSTRACT: command-line XML::XSS processor
$XML::XSS::xss::VERSION = '0.3.5';
use Getopt::Long;

GetOptions(
    'script=s' => \my $script,
    'm=s' => \my $module,
    'stylesheet=s' => \my $stylesheet,
);

my $document = join '', <>;

my $xss;

if( $stylesheet ) {
    my $class = "XML::XSS::Stylesheet::$stylesheet";
    eval "use $class";
    die $@ if $@;

    $xss = $class->new;
}
elsif ( $script ) {
    $xss = do $script;
}
elsif( $module ) {
    eval "use $module";
    $xss = $module->new;
}

print $xss->render( $document );

__END__

=pod

=encoding UTF-8

=head1 NAME

XML::XSS::xss - command-line XML::XSS processor

=head1 VERSION

version 0.3.5

=head1 SYNOPSIS

    xss --stylesheet <stylesheet> document.xml

=head1 AUTHOR

Yanick Champoux <yanick@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2017, 2013, 2011, 2010 by Yanick Champoux.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut