1 |
wakaba |
1.1 |
package Message::DOM::EntityReference; |
2 |
|
|
use strict; |
3 |
|
|
our $VERSION=do{my @r=(q$Revision: 1.1 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
4 |
|
|
push our @ISA, 'Message::DOM::Node', 'Message::IF::EntityReference'; |
5 |
|
|
require Message::DOM::Node; |
6 |
|
|
|
7 |
|
|
## Spec: |
8 |
|
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-11C98490> |
9 |
|
|
|
10 |
|
|
sub ____new ($$$) { |
11 |
|
|
my $self = shift->SUPER::____new (shift); |
12 |
|
|
$$self->{name} = $_[0]; |
13 |
|
|
return $self; |
14 |
|
|
} # ____new |
15 |
|
|
|
16 |
|
|
sub AUTOLOAD { |
17 |
|
|
my $method_name = our $AUTOLOAD; |
18 |
|
|
$method_name =~ s/.*:://; |
19 |
|
|
return if $method_name eq 'DESTROY'; |
20 |
|
|
|
21 |
|
|
if ({ |
22 |
|
|
## Read-only attributes (trivial accessors) |
23 |
|
|
name => 1, |
24 |
|
|
}->{$method_name}) { |
25 |
|
|
no strict 'refs'; |
26 |
|
|
eval qq{ |
27 |
|
|
sub $method_name (\$) { |
28 |
|
|
if (\@_ > 1) { |
29 |
|
|
require Carp; |
30 |
|
|
Carp::croak (qq<Can't modify read-only attribute>); |
31 |
|
|
} |
32 |
|
|
return \${\$_[0]}->{$method_name}; |
33 |
|
|
} |
34 |
|
|
}; |
35 |
|
|
goto &{ $AUTOLOAD }; |
36 |
|
|
} elsif ({ |
37 |
|
|
## Read-write attributes (DOMString, trivial accessors) |
38 |
|
|
}->{$method_name}) { |
39 |
|
|
no strict 'refs'; |
40 |
|
|
eval qq{ |
41 |
|
|
sub $method_name (\$) { |
42 |
|
|
if (\@_ > 1) { |
43 |
|
|
\${\$_[0]}->{$method_name} = ''.$_[1]; |
44 |
|
|
} |
45 |
|
|
return \${\$_[0]}->{$method_name}; |
46 |
|
|
} |
47 |
|
|
}; |
48 |
|
|
goto &{ $AUTOLOAD }; |
49 |
|
|
} else { |
50 |
|
|
require Carp; |
51 |
|
|
Carp::croak (qq<Can't locate method "$AUTOLOAD">); |
52 |
|
|
} |
53 |
|
|
} # AUTOLOAD |
54 |
|
|
sub name ($); |
55 |
|
|
|
56 |
|
|
## The |Node| interface - attribute |
57 |
|
|
|
58 |
|
|
sub node_type { 5 } # ENTITY_REFERENCE_NODE |
59 |
|
|
|
60 |
|
|
package Message::IF::EntityReference; |
61 |
|
|
|
62 |
|
|
package Message::DOM::Document; |
63 |
|
|
|
64 |
|
|
## Spec: |
65 |
|
|
## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-392B75AE> |
66 |
|
|
## Compatibility note: |
67 |
|
|
## <http://suika.fam.cx/gate/2005/sw/createEntityReference> |
68 |
|
|
|
69 |
|
|
sub create_entity_reference ($$) { |
70 |
|
|
return Message::DOM::EntityReference->____new (@_[0, 1]); |
71 |
|
|
} # create_entity_reference |
72 |
|
|
|
73 |
|
|
1; |
74 |
|
|
## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL> |
75 |
|
|
## $Date: 2007/06/13 12:05:35 $ |