/[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.5 - (hide annotations) (download)
Mon Jul 8 11:47:20 2002 UTC (22 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.4: +3 -2 lines
2002-07-08  Wakaba <w@suika.fam.cx>

	* Message.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.5 $VERSION=do{my @r=(q$Revision: 1.4 $=~/\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.2
94 wakaba 1.1 =head1 LICENSE
95    
96     Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
97    
98     This program is free software; you can redistribute it and/or modify
99     it under the terms of the GNU General Public License as published by
100     the Free Software Foundation; either version 2 of the License, or
101     (at your option) any later version.
102    
103     This program is distributed in the hope that it will be useful,
104     but WITHOUT ANY WARRANTY; without even the implied warranty of
105     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
106     GNU General Public License for more details.
107    
108     You should have received a copy of the GNU General Public License
109     along with this program; see the file COPYING. If not, write to
110     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
111     Boston, MA 02111-1307, USA.
112    
113     =head1 CHANGE
114    
115     See F<ChangeLog>.
116 wakaba 1.5 $Date: 2002/07/06 10:29:31 $
117 wakaba 1.1
118     =cut
119    
120     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24