1 |
wakaba |
1.1 |
package Message::DOM::AttributeDefinition; |
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::AttributeDefinition'; |
5 |
|
|
require Message::DOM::Node; |
6 |
|
|
|
7 |
|
|
## Spec: |
8 |
|
|
## <http://suika.fam.cx/gate/2005/sw/AttributeDefinition> |
9 |
|
|
|
10 |
|
|
sub ____new ($$$) { |
11 |
|
|
my $self = shift->SUPER::____new (shift); |
12 |
|
|
$$self->{node_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 |
|
|
}->{$method_name}) { |
24 |
|
|
no strict 'refs'; |
25 |
|
|
eval qq{ |
26 |
|
|
sub $method_name (\$) { |
27 |
|
|
if (\@_ > 1) { |
28 |
|
|
require Carp; |
29 |
|
|
Carp::croak (qq<Can't modify read-only attribute>); |
30 |
|
|
} |
31 |
|
|
return \${\$_[0]}->{$method_name}; |
32 |
|
|
} |
33 |
|
|
}; |
34 |
|
|
goto &{ $AUTOLOAD }; |
35 |
|
|
} elsif ({ |
36 |
|
|
## Read-write attributes (DOMString, trivial accessors) |
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 |
|
|
|
54 |
|
|
## The |Node| interface - attribute |
55 |
|
|
|
56 |
|
|
sub node_type { 81002 } # ATTRIBUTE_DEFINITION_NODE |
57 |
|
|
|
58 |
|
|
package Message::IF::AttributeDefinition; |
59 |
|
|
|
60 |
|
|
package Message::DOM::Document; |
61 |
|
|
|
62 |
|
|
## Spec: |
63 |
|
|
## <http://suika.fam.cx/gate/2005/sw/DocumentXDoctype> |
64 |
|
|
|
65 |
|
|
sub create_attribute_definition ($$$) { |
66 |
|
|
return Message::DOM::AttributeDefinition->____new (@_[0, 1]); |
67 |
|
|
} # create_attribute_definition |
68 |
|
|
|
69 |
|
|
1; |
70 |
|
|
## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL> |
71 |
|
|
## $Date: 2007/06/13 12:05:35 $ |