1 |
wakaba |
1.1 |
package Message::DOM::Notation; |
2 |
|
|
use strict; |
3 |
wakaba |
1.4 |
our $VERSION=do{my @r=(q$Revision: 1.3 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
4 |
wakaba |
1.1 |
push our @ISA, 'Message::DOM::Node', 'Message::IF::Notation'; |
5 |
|
|
require Message::DOM::Node; |
6 |
|
|
|
7 |
|
|
sub ____new ($$$) { |
8 |
|
|
my $self = shift->SUPER::____new (shift); |
9 |
|
|
$$self->{node_name} = $_[0]; |
10 |
|
|
return $self; |
11 |
|
|
} # ____new |
12 |
|
|
|
13 |
|
|
sub AUTOLOAD { |
14 |
|
|
my $method_name = our $AUTOLOAD; |
15 |
|
|
$method_name =~ s/.*:://; |
16 |
|
|
return if $method_name eq 'DESTROY'; |
17 |
|
|
|
18 |
|
|
if ({ |
19 |
|
|
## Read-only attributes (trivial accessors) |
20 |
wakaba |
1.2 |
node_name => 1, |
21 |
wakaba |
1.1 |
}->{$method_name}) { |
22 |
|
|
no strict 'refs'; |
23 |
|
|
eval qq{ |
24 |
|
|
sub $method_name (\$) { |
25 |
|
|
if (\@_ > 1) { |
26 |
|
|
require Carp; |
27 |
|
|
Carp::croak (qq<Can't modify read-only attribute>); |
28 |
|
|
} |
29 |
|
|
return \${\$_[0]}->{$method_name}; |
30 |
|
|
} |
31 |
|
|
}; |
32 |
|
|
goto &{ $AUTOLOAD }; |
33 |
|
|
} elsif ({ |
34 |
|
|
## Read-write attributes (DOMString, trivial accessors) |
35 |
|
|
public_id => 1, |
36 |
|
|
system_id => 1, |
37 |
|
|
}->{$method_name}) { |
38 |
|
|
no strict 'refs'; |
39 |
|
|
eval qq{ |
40 |
|
|
sub $method_name (\$) { |
41 |
|
|
if (\@_ > 1) { |
42 |
|
|
\${\$_[0]}->{$method_name} = ''.$_[1]; |
43 |
|
|
} |
44 |
|
|
return \${\$_[0]}->{$method_name}; |
45 |
|
|
} |
46 |
|
|
}; |
47 |
|
|
goto &{ $AUTOLOAD }; |
48 |
|
|
} else { |
49 |
|
|
require Carp; |
50 |
|
|
Carp::croak (qq<Can't locate method "$AUTOLOAD">); |
51 |
|
|
} |
52 |
|
|
} # AUTOLOAD |
53 |
|
|
sub public_id ($;$); |
54 |
|
|
sub system_id ($;$); |
55 |
|
|
|
56 |
|
|
## The |Node| interface - attribute |
57 |
|
|
|
58 |
wakaba |
1.3 |
sub child_nodes ($) { |
59 |
|
|
require Message::DOM::NodeList; |
60 |
|
|
return bless \\($_[0]), 'Message::DOM::NodeList::EmptyNodeList'; |
61 |
|
|
} # child_nodes |
62 |
wakaba |
1.2 |
|
63 |
|
|
sub node_name ($); # read-only trivial accessor |
64 |
|
|
|
65 |
wakaba |
1.3 |
sub node_type () { 12 } # NOTATION_NODE |
66 |
wakaba |
1.1 |
|
67 |
wakaba |
1.4 |
sub text_content ($;$) { undef } |
68 |
|
|
|
69 |
wakaba |
1.1 |
package Message::IF::Notation; |
70 |
|
|
|
71 |
|
|
package Message::DOM::Document; |
72 |
|
|
|
73 |
wakaba |
1.2 |
sub create_notation ($$) { |
74 |
wakaba |
1.1 |
return Message::DOM::Notation->____new (@_[0, 1]); |
75 |
|
|
} # create_notation |
76 |
|
|
|
77 |
wakaba |
1.3 |
=head1 LICENSE |
78 |
|
|
|
79 |
|
|
Copyright 2007 Wakaba <w@suika.fam.cx> |
80 |
|
|
|
81 |
|
|
This program is free software; you can redistribute it and/or |
82 |
|
|
modify it under the same terms as Perl itself. |
83 |
|
|
|
84 |
|
|
=cut |
85 |
|
|
|
86 |
wakaba |
1.1 |
1; |
87 |
wakaba |
1.4 |
## $Date: 2007/06/16 08:05:48 $ |