| 1 |
wakaba |
1.1 |
package Message::DOM::DOMImplementation; |
| 2 |
|
|
use strict; |
| 3 |
wakaba |
1.4 |
our $VERSION=do{my @r=(q$Revision: 1.3 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
| 4 |
wakaba |
1.1 |
push our @ISA, 'Message::IF::DOMImplementation'; |
| 5 |
|
|
|
| 6 |
|
|
sub ____new ($) { |
| 7 |
|
|
my $self = bless {}, shift; |
| 8 |
|
|
return $self; |
| 9 |
|
|
} # ____new |
| 10 |
wakaba |
1.4 |
*new = \&____new; |
| 11 |
wakaba |
1.1 |
|
| 12 |
|
|
sub AUTOLOAD { |
| 13 |
|
|
my $method_name = our $AUTOLOAD; |
| 14 |
|
|
$method_name =~ s/.*:://; |
| 15 |
|
|
return if $method_name eq 'DESTROY'; |
| 16 |
|
|
|
| 17 |
|
|
my $module_name = { |
| 18 |
|
|
create_document => 'Message::DOM::DOMDocument', ## TODO: New module name |
| 19 |
wakaba |
1.2 |
create_document_type => 'Message::DOM::DocumentType', |
| 20 |
wakaba |
1.3 |
create_mc_decode_handler => 'Message::Charset::Encode', |
| 21 |
wakaba |
1.1 |
create_uri_reference => 'Message::URI::URIReference', |
| 22 |
wakaba |
1.3 |
get_charset_name_from_uri => 'Message::Charset::Encode', |
| 23 |
|
|
get_uri_from_charset_name => 'Message::Charset::Encode', |
| 24 |
wakaba |
1.1 |
}->{$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.3 |
## MCImplementation |
| 36 |
|
|
sub create_mc_decode_handler; |
| 37 |
|
|
sub get_charset_name_from_uri; |
| 38 |
|
|
sub get_uri_from_charset_name; |
| 39 |
wakaba |
1.1 |
## URIImplementation |
| 40 |
|
|
sub create_uri_reference ($$); |
| 41 |
|
|
|
| 42 |
wakaba |
1.4 |
our $HasFeature; |
| 43 |
|
|
$HasFeature->{core}->{''} = 1; |
| 44 |
|
|
$HasFeature->{core}->{'1.0'} = 1; |
| 45 |
|
|
$HasFeature->{core}->{'2.0'} = 1; |
| 46 |
|
|
$HasFeature->{core}->{'3.0'} = 1; |
| 47 |
|
|
$HasFeature->{xml}->{''} = 1; |
| 48 |
|
|
$HasFeature->{xml}->{'1.0'} = 1; |
| 49 |
|
|
$HasFeature->{xml}->{'2.0'} = 1; |
| 50 |
|
|
$HasFeature->{xml}->{'3.0'} = 1; |
| 51 |
|
|
$HasFeature->{xmlversion}->{''} = 1; |
| 52 |
|
|
$HasFeature->{xmlversion}->{'1.0'} = 1; |
| 53 |
|
|
$HasFeature->{xmlversion}->{'1.1'} = 1; |
| 54 |
|
|
$HasFeature->{q<http://suika.fam.cx/www/2006/feature/min>}->{''} = 1; |
| 55 |
|
|
$HasFeature->{q<http://suika.fam.cx/www/2006/feature/min>}->{'3.0'} = 1; |
| 56 |
|
|
$HasFeature->{q<http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#minimum>}->{''} = 1; |
| 57 |
|
|
$HasFeature->{q<http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#minimum>}->{'3.0'} = 1; |
| 58 |
|
|
$HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctype>}->{''} = 1; |
| 59 |
|
|
$HasFeature->{q<http://suika.fam.cx/www/2006/feature/xdoctype>}->{'3.0'} = 1; |
| 60 |
|
|
|
| 61 |
|
|
## |DOMImplementation| methods |
| 62 |
|
|
|
| 63 |
|
|
sub create_document ($;$$$); |
| 64 |
|
|
|
| 65 |
|
|
sub create_document_type ($$;$$); |
| 66 |
wakaba |
1.1 |
|
| 67 |
wakaba |
1.4 |
sub get_feature ($$;$) { |
| 68 |
|
|
my $feature = lc $_[1]; ## TODO: What |lc|? |
| 69 |
|
|
$feature =~ s/^\+//; |
| 70 |
|
|
|
| 71 |
|
|
if ($HasFeature->{$feature}->{defined $_[2] ? $_[2] : ''}) { |
| 72 |
|
|
return $_[0]; |
| 73 |
|
|
} else { |
| 74 |
|
|
return undef; |
| 75 |
|
|
} |
| 76 |
|
|
} # get_feature |
| 77 |
wakaba |
1.1 |
|
| 78 |
wakaba |
1.4 |
sub has_feature ($$;$) { |
| 79 |
|
|
my $feature = lc $_[1]; |
| 80 |
|
|
my $plus = $feature =~ s/^\+// ? 1 : 0; |
| 81 |
|
|
return $HasFeature->{$feature}->{defined $_[2] ? $_[2] : ''}; |
| 82 |
|
|
} # has_feature |
| 83 |
wakaba |
1.1 |
|
| 84 |
|
|
package Message::IF::DOMImplementation; |
| 85 |
|
|
|
| 86 |
wakaba |
1.4 |
=head1 LICENSE |
| 87 |
|
|
|
| 88 |
|
|
Copyright 2007 Wakaba <w@suika.fam.cx> |
| 89 |
|
|
|
| 90 |
|
|
This program is free software; you can redistribute it and/or |
| 91 |
|
|
modify it under the same terms as Perl itself. |
| 92 |
|
|
|
| 93 |
|
|
=cut |
| 94 |
|
|
|
| 95 |
wakaba |
1.1 |
1; |
| 96 |
wakaba |
1.4 |
## $Date: 2007/07/07 04:47:29 $ |