/[suikacvs]/messaging/manakai/lib/Message/Header/Default.pm
Suika

Contents of /messaging/manakai/lib/Message/Header/Default.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Sat Jul 6 10:29:31 2002 UTC (22 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.3: +3 -2 lines
2002-07-06  Wakaba <w@suika.fam.cx>

	* HTTP.pm: New module.

1 wakaba 1.1
2     =head1 NAME
3    
4     Message::Header::Default --- Internet Messages -- Definition
5     for Default Namespace of Header Fields
6    
7     =cut
8    
9     package Message::Header::Default;
10     use strict;
11     use vars qw($VERSION);
12 wakaba 1.4 $VERSION=do{my @r=(q$Revision: 1.3 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
13 wakaba 1.1 require Message::Header;
14    
15     our %OPTION;
16    
17     ## Case sensibility of field name
18     $OPTION{case_sensible} = 1;
19 wakaba 1.3 #$OPTION{to_be_goodcase} = \&...;
20 wakaba 1.1 $OPTION{n11n_name} = \&_name_n11n;
21     $OPTION{n11n_prefix} = \&_name_n11n;
22    
23     ## Namespace URI of this namespace
24     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:default';
25    
26     ## Force & hyphened prefix name of this namespace (ex. "prefix-name")
27     $OPTION{namespace_phname} = 'default';
28     $OPTION{namespace_phname_goodcase} = 'default';
29    
30     ## `Good' & dotted prefix name of this namespace (ex. "prefix.name", "prefix2.name")
31     $OPTION{namespace_good_prefix} = 'DEFAULT';
32    
33     ## Field body data type (specified by package name)
34     $OPTION{value_type} = {
35     ':default' => ['Message::Field::Unstructured'],
36     };
37    
38 wakaba 1.2 ## mailto: URL safe level
39     $OPTION{uri_mailto_safe} = {
40     ## 1 all (no check) 2 no trace & bcc & from
41     ## 3 no sender's info 4 (default) (currently not used)
42     ## 5 only a few
43     ':default' => 1,
44     };
45    
46 wakaba 1.1 ##
47    
48     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
49     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
50    
51 wakaba 1.2 ## $self->_goodcase ($namespace_package_name, $field_name, \%option)
52     sub _goodcase ($$$\%) {
53 wakaba 1.1 no strict 'refs';
54     my $self = shift;
55 wakaba 1.2 my ($nspack, $name, $option) = @_;
56 wakaba 1.1 if (${$nspack.'::OPTION'}{goodcase}->{$name}) {
57     return ${$nspack.'::OPTION'}{goodcase}->{$name};
58     }
59     $name =~ s/(?:^|-)[a-z]/uc $&/ge;
60     $name;
61     }
62    
63     sub _name_n11n ($$$) {
64     no strict 'refs';
65     my $self = shift;
66     my $nspack = shift;
67     my $name = shift;
68     unless (${$nspack.'::OPTION'}{case_sensible}) {
69     lc $name;
70     } else {
71     $name;
72     }
73     }
74    
75     package Message::Header::XCGI;
76     our %OPTION = %Message::Header::Default::OPTION;
77     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:http:cgi:x';
78     $OPTION{namespace_phname} = 'x-cgi';
79     $OPTION{namespace_phname_goodcase} = 'X-CGI';
80    
81     $OPTION{case_sensible} = 0;
82     $OPTION{to_be_goodcase} = \&Message::Header::Default::_goodcase;
83    
84     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
85     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
86    
87 wakaba 1.2
88     ##
89    
90     require Message::Header::RFC822;
91 wakaba 1.4 require Message::Header::HTTP;
92 wakaba 1.2
93 wakaba 1.1 =head1 LICENSE
94    
95     Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
96    
97     This program is free software; you can redistribute it and/or modify
98     it under the terms of the GNU General Public License as published by
99     the Free Software Foundation; either version 2 of the License, or
100     (at your option) any later version.
101    
102     This program is distributed in the hope that it will be useful,
103     but WITHOUT ANY WARRANTY; without even the implied warranty of
104     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
105     GNU General Public License for more details.
106    
107     You should have received a copy of the GNU General Public License
108     along with this program; see the file COPYING. If not, write to
109     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
110     Boston, MA 02111-1307, USA.
111    
112     =head1 CHANGE
113    
114     See F<ChangeLog>.
115 wakaba 1.4 $Date: 2002/06/16 10:45:54 $
116 wakaba 1.1
117     =cut
118    
119     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24