1 |
joko |
1.1 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
|
|
## ------------------------------------------------------------------------- |
4 |
|
|
## $Id: xupdate.pl,v 1.3 2003/04/26 01:42:39 joko Exp $ |
5 |
|
|
## ------------------------------------------------------------------------- |
6 |
|
|
## $Log: xupdate.pl,v $ |
7 |
|
|
## ------------------------------------------------------------------------- |
8 |
|
|
|
9 |
|
|
|
10 |
|
|
=pod |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
=head1 NAME |
14 |
|
|
|
15 |
|
|
xupdate.pl |
16 |
|
|
|
17 |
|
|
|
18 |
|
|
=head2 Description |
19 |
|
|
|
20 |
|
|
Please visit "perldoc XML::XUpdate::XSLT". |
21 |
|
|
|
22 |
|
|
|
23 |
|
|
=head3 Todo |
24 |
|
|
|
25 |
|
|
o mimic interface from already established "xupdate.pl" |
26 |
|
|
o replace shortcuts::files through File::Butler? |
27 |
|
|
|
28 |
|
|
|
29 |
|
|
=cut |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
package main; |
33 |
|
|
|
34 |
|
|
use strict; |
35 |
|
|
use warnings; |
36 |
|
|
|
37 |
|
|
BEGIN { |
38 |
|
|
use lib '../../libs'; |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
use XML::XUpdate::XSLT; |
42 |
|
|
use shortcuts::files qw( f2s ); |
43 |
|
|
use Data::Dumper; |
44 |
|
|
|
45 |
|
|
|
46 |
|
|
sub main { |
47 |
|
|
|
48 |
|
|
my $xupdate = XML::XUpdate::XSLT->new( |
49 |
|
|
warnings => 1 |
50 |
|
|
); |
51 |
|
|
|
52 |
|
|
#print Dumper($xupdate); |
53 |
|
|
|
54 |
|
|
# open required files |
55 |
|
|
$xupdate->open_document( f2s("wd_document.xml") ); |
56 |
|
|
$xupdate->open_xupdate( f2s("wd_xupdate.xml") ); |
57 |
|
|
|
58 |
|
|
$xupdate->process(); |
59 |
|
|
my $result = $xupdate->toString(); |
60 |
|
|
|
61 |
|
|
# some error checking ... |
62 |
|
|
if ($result) { |
63 |
|
|
print $result, "\n"; |
64 |
|
|
} else { |
65 |
|
|
print "No result.", "\n"; |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
main(); |
71 |
|
|
print "ready.", "\n"; |
72 |
|
|
|
73 |
|
|
1; |
74 |
|
|
__END__ |