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