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