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
|
|
67950
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
120
|
|
6
|
4
|
|
|
4
|
|
19
|
use vars qw(@EXPORT_OK @EXPORT @ISA $VERSION $xshNS); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
291
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
20
|
use Exporter; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
145
|
|
9
|
4
|
|
|
4
|
|
3842
|
use XML::XSH::Functions qw(:default); |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
1664
|
|
10
|
4
|
|
|
4
|
|
2274
|
use XML::XSH::Completion; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN { |
13
|
|
|
|
|
|
|
$VERSION = '1.8.4'; |
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 (DEPRECATED) A powerfull scripting language/shell for XPath-based editing of XML |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DEPRECATED |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This module is deprecated, use XML::XSH2 instead. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SYNOPSIS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use XML::XSH; |
33
|
|
|
|
|
|
|
xsh(<<'__XSH__'); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# ... XSH Language commands (example borrowed from Kip Hampton's article) ... |
36
|
|
|
|
|
|
|
open sources="perl_channels.xml"; # open a document from file |
37
|
|
|
|
|
|
|
create merge news-items; # create a new document |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
foreach sources://rss-url { # traverse the sources document |
40
|
|
|
|
|
|
|
open src=${{ string(@href) }}; # load the URL given by @href attribute |
41
|
|
|
|
|
|
|
map { $_ = lc($_) } //*; # lowercase all tag names |
42
|
|
|
|
|
|
|
xcopy src://item # copy all items from the src document |
43
|
|
|
|
|
|
|
into merge:/news-items[1]; # into the news-items element in merge document |
44
|
|
|
|
|
|
|
close src; # close src document (not mandatory) |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
close sources; |
47
|
|
|
|
|
|
|
saveas merge "files/headlines.xml"; # save the resulting merge document |
48
|
|
|
|
|
|
|
close merge; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__XSH__ |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 REQUIRES |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
XML::LibXML, XML::XUpdate::LibXML |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 EXPORTS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
xsh() |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This module implements XSH sripting language. XSH stands for XML |
63
|
|
|
|
|
|
|
(editing) SHell. XSH language is documented in L |
64
|
|
|
|
|
|
|
and on L. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The distribution package of XML::XSH module includes XSH shell |
67
|
|
|
|
|
|
|
interpreter called C (see L). To use it interactively, run |
68
|
|
|
|
|
|
|
C. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 C |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Initialize the XSH language parser and interpreter. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 C |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Execute commands in XSH language. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Petr Pajas, pajas@matfyz.cz |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SEE ALSO |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
L, L, L, L |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |