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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (hide annotations) (download)
Mon Oct 8 07:17:18 2007 UTC (17 years, 1 month ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.12: +4 -2 lines
++ manakai/lib/Message/DOM/ChangeLog	8 Oct 2007 07:16:56 -0000
2007-10-08  Wakaba  <wakaba@suika.fam.cx>

	* Event.pm, EventTarget.pm, EventTargetNode.pm,
	EventException.pm: Implemented (but not tested!).

	* DOMException.pm (MALFORMED_EVENT_TYPE_ERR,
	EVENT_INTERFACE_NOT_SUPPORTED_ERR, EXTERNAL_EVENT_ERR): New
	error subtypes.

	* DOMImplementation.pm ($HasFeature): The |Event| feature,
	version |3.0|, is added.

	* Document.pm, Node.pm: Event attributes and
	methods are implemented.

1 wakaba 1.1 package Message::DOM::DOMImplementation;
2     use strict;
3 wakaba 1.13 our $VERSION=do{my @r=(q$Revision: 1.12 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
4 wakaba 1.9 push our @ISA, 'Message::IF::DOMImplementation',
5     'Message::IF::AtomDOMImplementation';
6 wakaba 1.1
7     sub ____new ($) {
8     my $self = bless {}, shift;
9     return $self;
10     } # ____new
11 wakaba 1.4 *new = \&____new;
12 wakaba 1.1
13     sub AUTOLOAD {
14     my $method_name = our $AUTOLOAD;
15     $method_name =~ s/.*:://;
16     return if $method_name eq 'DESTROY';
17    
18     my $module_name = {
19 wakaba 1.9 create_atom_entry_document => 'Message::DOM::Atom::AtomElement',
20     create_atom_feed_document => 'Message::DOM::Atom::AtomElement',
21 wakaba 1.11 create_document => 'Message::DOM::Document',
22 wakaba 1.2 create_document_type => 'Message::DOM::DocumentType',
23 wakaba 1.1 create_uri_reference => 'Message::URI::URIReference',
24     }->{$method_name};
25     if ($module_name) {
26     eval qq{ require $module_name } or die $@;
27     no strict 'refs';
28     goto &{ $AUTOLOAD };
29     } else {
30     require Carp;
31     Carp::croak (qq<Can't locate method "$AUTOLOAD">);
32     }
33     } # AUTOLOAD
34 wakaba 1.4
35 wakaba 1.1 ## URIImplementation
36     sub create_uri_reference ($$);
37    
38 wakaba 1.4 our $HasFeature;
39     $HasFeature->{core}->{''} = 1;
40     $HasFeature->{core}->{'1.0'} = 1;
41     $HasFeature->{core}->{'2.0'} = 1;
42     $HasFeature->{core}->{'3.0'} = 1;
43 wakaba 1.13 $HasFeature->{events}->{''} = 1;
44     $HasFeature->{events}->{'3.0'} = 1; ## TODO: 2.0?
45 wakaba 1.12 $HasFeature->{html}->{''} = 1;
46     $HasFeature->{html}->{'5.0'} = 1; ## TODO: 1.0, 2.0
47     $HasFeature->{xhtml}->{''} = 1;
48     $HasFeature->{xhtml}->{'5.0'} = 1; ## TODO: 2.0
49 wakaba 1.8 $HasFeature->{traversal}->{''} = 1;
50     $HasFeature->{traversal}->{'2.0'} = 1;
51 wakaba 1.4 $HasFeature->{xml}->{''} = 1;
52     $HasFeature->{xml}->{'1.0'} = 1;
53     $HasFeature->{xml}->{'2.0'} = 1;
54     $HasFeature->{xml}->{'3.0'} = 1;
55     $HasFeature->{xmlversion}->{''} = 1;
56     $HasFeature->{xmlversion}->{'1.0'} = 1;
57     $HasFeature->{xmlversion}->{'1.1'} = 1;
58 wakaba 1.9 $HasFeature->{q<http://suika.fam.cx/www/2006/feature/atom>}->{''} = 1;
59     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/atom>}->{'1.0'} = 1;
60     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/atomthreading>}->{''} = 1;
61     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/atomthreading>}->{'1.0'} = 1;
62 wakaba 1.4 $HasFeature->{q<http://suika.fam.cx/www/2006/feature/min>}->{''} = 1;
63     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/min>}->{'3.0'} = 1;
64 wakaba 1.12 $HasFeature->{q<http://suika.fam.cx/www/2006/feature/uri>}->{''} = 1;
65     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/uri>}->{'4.0'} = 1;
66 wakaba 1.4 $HasFeature->{q<http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#minimum>}->{''} = 1;
67     $HasFeature->{q<http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#minimum>}->{'3.0'} = 1;
68     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctype>}->{''} = 1;
69     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctype>}->{'3.0'} = 1;
70 wakaba 1.6 $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctypedeclaration>}->{''} = 1;
71     $HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctypedeclaration>}->{'3.0'} = 1;
72 wakaba 1.4
73 wakaba 1.5 sub ___report_error { $_[1]->throw }
74    
75 wakaba 1.4 ## |DOMImplementation| methods
76    
77     sub create_document ($;$$$);
78    
79 wakaba 1.7 sub create_document_type ($$$$);
80 wakaba 1.1
81 wakaba 1.4 sub get_feature ($$;$) {
82     my $feature = lc $_[1]; ## TODO: What |lc|?
83     $feature =~ s/^\+//;
84    
85     if ($HasFeature->{$feature}->{defined $_[2] ? $_[2] : ''}) {
86     return $_[0];
87     } else {
88     return undef;
89     }
90     } # get_feature
91 wakaba 1.1
92 wakaba 1.4 sub has_feature ($$;$) {
93     my $feature = lc $_[1];
94     my $plus = $feature =~ s/^\+// ? 1 : 0;
95     return $HasFeature->{$feature}->{defined $_[2] ? $_[2] : ''};
96     } # has_feature
97 wakaba 1.1
98 wakaba 1.9 ## |AtomDOMImplementation| methods
99    
100     sub create_atom_entry_document ($$;$$);
101    
102     sub create_atom_feed_document ($$;$$);
103    
104 wakaba 1.1 package Message::IF::DOMImplementation;
105 wakaba 1.9 package Message::IF::AtomDOMImplementation;
106 wakaba 1.1
107 wakaba 1.4 =head1 LICENSE
108    
109     Copyright 2007 Wakaba <w@suika.fam.cx>
110    
111     This program is free software; you can redistribute it and/or
112     modify it under the same terms as Perl itself.
113    
114     =cut
115    
116 wakaba 1.1 1;
117 wakaba 1.13 ## $Date: 2007/08/11 13:06:39 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24