blib/lib/XML/XSH2.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 27 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # $Id: XSH2.pm,v 2.3 2007-01-02 22:03:23 pajas Exp $
2  
3 package XML::XSH2;
4  
5 use strict;
6 use vars qw(@EXPORT_OK @EXPORT @ISA $VERSION);
7  
8 BEGIN {
9 $VERSION='2.1.7'; # VERSION TEMPLATE
10 @ISA = qw(Exporter);
11 @EXPORT = qw(&xsh);
12 @EXPORT_OK = @XML::XSH2::Functions::EXPORT_OK;
13 *xshNS = \'http://xsh.sourceforge.net/xsh/';
14  
15 use Exporter;
16 use XML::XSH2::Functions qw(:default);
17 use XML::XSH2::Completion;
18  
19 }
20  
21  
22  
23 1;
24  
25 =head1 NAME
26  
27 XML::XSH2 - A powerfull scripting language/shell for XPath-based editing of XML
28  
29 =head1 SYNOPSIS
30  
31 use XML::XSH2;
32 xsh(<<'__XSH__');
33  
34 # ... XSH Language commands (example borrowed from Kip Hampton's article) ...
35 $sources := open "perl_channels.xml"; # open a document from file
36 $merge := create "news-items"; # create a new document
37  
38 foreach $sources//rss-url { # traverse the sources document
39 my $src := open @href; # load the URL given by @href attribute
40 map { $_ = lc($_) } //*; # lowercase all tag names
41 xcopy $src//item # copy all items from the src document
42 into $merge/news-items[1]; # into the news-items element in merge document
43 close $src; # close src document (not mandatory)
44 };
45 close $sources;
46 save --file "files/headlines.xml" $merge; # save the resulting merge document
47 close $merge;
48  
49 __XSH__
50  
51 =head1 REQUIRES
52  
53 XML::LibXML, XML::XUpdate::LibXML
54  
55 =head1 EXPORTS
56  
57 xsh()
58  
59 =head1 DESCRIPTION
60  
61 This module implements XSH sripting language. XSH stands for XML
62 (editing) SHell. XSH language is documented in L<XSH>
63 and on L<http://xsh.sourceforge.net/documentation.html>.
64  
65 The distribution package of XML::XSH2 module includes XSH shell
66 interpreter called C<xsh> (see L<xsh>). To use it interactively, run
67 C<xsh -i>.
68  
69 =head2 C<xsh_init>
70  
71 Initialize the XSH language parser and interpreter.
72  
73 =head2 C<xsh>
74  
75 Execute commands in XSH language.
76  
77 =head1 AUTHOR
78  
79 Petr Pajas, pajas@matfyz.cz
80  
81 =head1 SEE ALSO
82  
83 L<xsh>, L<XSH2>, L<XML::XSH2::Compile>, L<XML::LibXML>, L<XML::XUpdate>
84  
85 =cut