File Coverage

blib/lib/XML/XSH.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


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