XML/XSH.pm

filter: Statementstmt 86.6% 13 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 90.0% 18 / 20 CC 1 SCAR 0.6
CC
1
Cov
87%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« XML/XSH/Grammar.pm ↑ Summary XML/XSH/CompletionList.pm »
1 # $Id: XSH.pm,v 1.12 2003/09/08 15:52:58 pajas Exp $
2  
3 package XML::XSH;
4  
5 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use vars qw(@EXPORT_OK @EXPORT @ISA $VERSION $xshNS);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use XML::XSH::Functions qw(:default);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use XML::XSH::Completion;
Subroutine BEGIN: called CC=1 SCAR=2.6
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<XSH>
60 and on L<http://xsh.sourceforge.net/doc>.
61  
62 The distribution package of XML::XSH module includes XSH shell
63 interpreter called C<xsh> (see L<xsh>). To use it interactively, run
64 C<xsh -i>.
65  
66 =head2 C<xsh_init>
67  
68 Initialize the XSH language parser and interpreter.
69  
70 =head2 C<xsh>
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<xsh>, L<XSH>, L<XML::LibXML>, L<XML::XUpdate>
81  
82 =cut
« XML/XSH/Grammar.pm ↑ Summary XML/XSH/CompletionList.pm »