Lines 1-5
Link Here
|
1 |
--- lib/MIME/Field/ParamVal.pm.orig Sun Nov 5 04:54:49 2000 |
1 |
--- ../MIME-tools-5.411.orig/lib/MIME/Field/ParamVal.pm Sat Nov 4 20:54:49 2000 |
2 |
+++ lib/MIME/Field/ParamVal.pm Thu Jun 6 10:15:15 2002 |
2 |
+++ lib/MIME/Field/ParamVal.pm Wed Nov 19 09:13:45 2003 |
|
|
3 |
@@ -9,42 +9,42 @@ |
4 |
=head1 SYNOPSIS |
5 |
|
6 |
# Create an object for a content-type field: |
7 |
- $field = new Mail::Field 'Content-type'; |
8 |
- |
9 |
+ $field = new Mail::Field 'Content-type'; |
10 |
+ |
11 |
# Set some attributes: |
12 |
$field->param('_' => 'text/html'); |
13 |
$field->param('charset' => 'us-ascii'); |
14 |
$field->param('boundary' => '---ABC---'); |
15 |
- |
16 |
+ |
17 |
# Same: |
18 |
$field->set('_' => 'text/html', |
19 |
'charset' => 'us-ascii', |
20 |
'boundary' => '---ABC---'); |
21 |
- |
22 |
+ |
23 |
# Get an attribute, or undefined if not present: |
24 |
print "no id!" if defined($field->param('id')); |
25 |
- |
26 |
+ |
27 |
# Same, but use empty string for missing values: |
28 |
print "no id!" if ($field->paramstr('id') eq ''); |
29 |
- |
30 |
+ |
31 |
# Output as string: |
32 |
print $field->stringify, "\n"; |
33 |
|
34 |
|
35 |
=head1 DESCRIPTION |
36 |
|
37 |
-This is an abstract superclass of most MIME fields. It handles |
38 |
+This is an abstract superclass of most MIME fields. It handles |
39 |
fields with a general syntax like this: |
40 |
|
41 |
Content-Type: Message/Partial; |
42 |
- number=2; total=3; |
43 |
- id="oc=jpbe0M2Yt4s@thumper.bellcore.com" |
44 |
+ number=2; total=3; |
45 |
+ id="oc=jpbe0M2Yt4s@thumper.bellcore.com" |
46 |
|
47 |
Comments are supported I<between> items, like this: |
48 |
|
49 |
Content-Type: Message/Partial; (a comment) |
50 |
- number=2 (another comment) ; (yet another comment) total=3; |
51 |
- id="oc=jpbe0M2Yt4s@thumper.bellcore.com" |
52 |
+ number=2 (another comment) ; (yet another comment) total=3; |
53 |
+ id="oc=jpbe0M2Yt4s@thumper.bellcore.com" |
54 |
|
55 |
|
56 |
=head1 PUBLIC INTERFACE |
3 |
@@ -100,6 +100,9 @@ |
57 |
@@ -100,6 +100,9 @@ |
4 |
# token = 1*<any (ASCII) CHAR except SPACE, CTLs, or tspecials> |
58 |
# token = 1*<any (ASCII) CHAR except SPACE, CTLs, or tspecials> |
5 |
# |
59 |
# |
Lines 20-25
Link Here
|
20 |
|
74 |
|
21 |
#------------------------------ |
75 |
#------------------------------ |
22 |
# |
76 |
# |
|
|
77 |
@@ -133,7 +139,7 @@ |
78 |
'total' => 3, |
79 |
'id' => "ocj=pbe0M2"); |
80 |
|
81 |
-Note that a single argument is taken to be a I<reference> to |
82 |
+Note that a single argument is taken to be a I<reference> to |
83 |
a paramhash, while multiple args are taken to be the elements |
84 |
of the paramhash themselves. |
85 |
|
86 |
@@ -160,16 +166,16 @@ |
87 |
it as a hash reference. For example, here is a field with parameters: |
88 |
|
89 |
Content-Type: Message/Partial; |
90 |
- number=2; total=3; |
91 |
- id="oc=jpbe0M2Yt4s@thumper.bellcore.com" |
92 |
+ number=2; total=3; |
93 |
+ id="oc=jpbe0M2Yt4s@thumper.bellcore.com" |
94 |
|
95 |
Here is how you'd extract them: |
96 |
|
97 |
$params = $class->parse_params('content-type'); |
98 |
if ($$params{'_'} eq 'message/partial') { |
99 |
- $number = $$params{'number'}; |
100 |
- $total = $$params{'total'}; |
101 |
- $id = $$params{'id'}; |
102 |
+ $number = $$params{'number'}; |
103 |
+ $total = $$params{'total'}; |
104 |
+ $id = $$params{'id'}; |
105 |
} |
106 |
|
107 |
Like field names, parameter names are coerced to lowercase. |
23 |
@@ -181,10 +187,40 @@ |
108 |
@@ -181,10 +187,40 @@ |
24 |
|
109 |
|
25 |
=cut |
110 |
=cut |
Lines 112-114
Link Here
|
112 |
debug " field param <$param> = <$params{$param}>"; |
197 |
debug " field param <$param> = <$params{$param}>"; |
113 |
} |
198 |
} |
114 |
|
199 |
|
|
|
200 |
@@ -227,7 +301,7 @@ |
201 |
|
202 |
# Allow use as constructor, for MIME::Head: |
203 |
ref($self) or $self = bless({}, $self); |
204 |
- |
205 |
+ |
206 |
# Get params, and stuff them into the self object: |
207 |
$self->set($self->parse_params($string)); |
208 |
} |