/[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.4 - (show annotations) (download)
Sat Jul 7 05:58:11 2007 UTC (17 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.3: +52 -10 lines
++ manakai/t/ChangeLog	7 Jul 2007 05:55:43 -0000
	* DOM-DOMImplementation.t: New tests for features are added.

	* DOM-DOMImplementationSource.t: New test script.

2007-07-07  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/DOM/ChangeLog	7 Jul 2007 05:58:02 -0000
	* DOMImplementation.pm (new): New method name for |____new|.
	It will be defined in the DOM Perl Binding specification
	as part of |DOMImplementation| interface.
	($HasFeature): Defined for features support.
	(has_feature, get_feature): Implemented.

	* DOMStringList.pm: Don't load the |Message::DOM::DOMException|
	module unless necessary.
	(___report_error): Removed since it is not used in fact.

	* DOMImplementationList.pm, DOMImplementationSource.pm,
	DOMImplementationRegistry.pm: New modules.

2007-07-07  Wakaba  <wakaba@suika.fam.cx>

1 package Message::DOM::DOMImplementation;
2 use strict;
3 our $VERSION=do{my @r=(q$Revision: 1.3 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
4 push our @ISA, 'Message::IF::DOMImplementation';
5
6 sub ____new ($) {
7 my $self = bless {}, shift;
8 return $self;
9 } # ____new
10 *new = \&____new;
11
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 create_document_type => 'Message::DOM::DocumentType',
20 create_mc_decode_handler => 'Message::Charset::Encode',
21 create_uri_reference => 'Message::URI::URIReference',
22 get_charset_name_from_uri => 'Message::Charset::Encode',
23 get_uri_from_charset_name => 'Message::Charset::Encode',
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
35 ## MCImplementation
36 sub create_mc_decode_handler;
37 sub get_charset_name_from_uri;
38 sub get_uri_from_charset_name;
39 ## URIImplementation
40 sub create_uri_reference ($$);
41
42 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
67 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
78 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
84 package Message::IF::DOMImplementation;
85
86 =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 1;
96 ## $Date: 2007/07/07 04:47:29 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24