/[suikacvs]/messaging/manakai/lib/Message/DOM/AttributeDefinition.pm
Suika

Contents of /messaging/manakai/lib/Message/DOM/AttributeDefinition.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Fri Jun 15 14:32:50 2007 UTC (17 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.1: +18 -3 lines
++ manakai/t/ChangeLog	15 Jun 2007 14:31:27 -0000
2007-06-15  Wakaba  <wakaba@suika.fam.cx>

	* DOM-Node.t: New test.

2007-06-15  Wakaba  <wakaba@suika.fam.cx>

	* DOM-Document.t: New test.

++ manakai/lib/Message/DOM/ChangeLog	15 Jun 2007 14:32:37 -0000
2007-06-15  Wakaba  <wakaba@suika.fam.cx>

	* ProcessingInstruction.pm, EntityReference.pm,
	CDATASection, DocumentFragment.pm, DOMDocument.pm, Entity.pm,
	ElementTypeDefinition.pm, AttributeDefinition.pm,
	DocumentType.pm, DOMElement.pm, Attr.pm,
	CharacterData.pm, Text.pm, Comment.pm (node_name,
	node_value, node_type): Implemented.

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 wakaba 1.2 node_name => 1,
24 wakaba 1.1 }->{$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    
55     ## The |Node| interface - attribute
56    
57 wakaba 1.2 ## Spec:
58     ## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-F68D095>
59     ## <http://suika.fam.cx/gate/2005/sw/AttributeDefinition>
60    
61     sub node_name ($); # read-only trivial accessor
62    
63     ## Spec:
64     ## <http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-111237558>
65    
66     sub node_type ($) { 81002 } # ATTRIBUTE_DEFINITION_NODE
67    
68     ## Spec:
69     ## <http://suika.fam.cx/gate/2005/sw/AttributeDefinition#anchor-2>
70    
71     ## TODO: node_value
72 wakaba 1.1
73     package Message::IF::AttributeDefinition;
74    
75     package Message::DOM::Document;
76    
77     ## Spec:
78     ## <http://suika.fam.cx/gate/2005/sw/DocumentXDoctype>
79    
80 wakaba 1.2 sub create_attribute_definition ($$) {
81 wakaba 1.1 return Message::DOM::AttributeDefinition->____new (@_[0, 1]);
82     } # create_attribute_definition
83    
84     1;
85     ## License: <http://suika.fam.cx/~wakaba/archive/2004/8/18/license#Perl+MPL>
86 wakaba 1.2 ## $Date: 2007/06/14 13:10:06 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24