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