File Coverage

blib/lib/XML/XSH2.pm
Criterion Covered Total %
statement 20 21 95.2
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 26 27 96.3


line stmt bran cond sub pod time code
1             # $Id: XSH2.pm,v 2.3 2007-01-02 22:03:23 pajas Exp $
2              
3             package XML::XSH2;
4              
5 8     8   105859 use strict;
  8         65  
  8         269  
6 8     8   40 use vars qw(@EXPORT_OK @EXPORT @ISA $VERSION);
  8         14  
  8         818  
7              
8 0           BEGIN {
9 8     8   27 $VERSION='2.2.8'; # VERSION TEMPLATE
10 8         149 @ISA = qw(Exporter);
11 8         33 @EXPORT = qw(&xsh);
12 8         61 @EXPORT_OK = @XML::XSH2::Functions::EXPORT_OK;
13 8         289 *xshNS = \'http://xsh.sourceforge.net/xsh/';
14              
15 8     8   59 use Exporter;
  8         38  
  8         403  
16 8     8   7518 use XML::XSH2::Functions qw(:default);
  8         30  
  8         2716  
17 8     8   3485 use XML::XSH2::Completion;
  8         28  
  8         254  
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
63             and on L.
64              
65             The distribution package of XML::XSH2 module includes XSH shell
66             interpreter called C (see L). To use it interactively, run
67             C.
68              
69             =head2 C
70              
71             Initialize the XSH language parser and interpreter.
72              
73             =head2 C
74              
75             Execute commands in XSH language.
76              
77             =head1 AUTHORS
78              
79             Petr Pajas, pajas@matfyz.cz
80             E. Choroba, choroba@matfyz.cz
81              
82             =head1 SEE ALSO
83              
84             L, L, L, L, L
85              
86             =cut