| 1 | package URI::cid; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 4 | ▶ | use base qw(URI); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 4 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | =head1 NAME | ||||||||||
| 12 | |||||||||||
| 13 | URI::cid - RFC 2392 cid: URI implementation | ||||||||||
| 14 | |||||||||||
| 15 | =head1 VERSION | ||||||||||
| 16 | |||||||||||
| 17 | Version 0.02 | ||||||||||
| 18 | |||||||||||
| 19 | =cut | ||||||||||
| 20 | |||||||||||
| 21 | 4 | our $VERSION = '0.02'; | |||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||
| 25 | |||||||||||
| 26 | use URI; | ||||||||||
| 27 | |||||||||||
| 28 | my $cid = $URI->new('cid:'); | ||||||||||
| 29 | $cid->cid('c6a62d04-1037-475e-a2be-ea38f9a78b64@foobar.local') | ||||||||||
| 30 | |||||||||||
| 31 | # or, pull it straight from the header: | ||||||||||
| 32 | |||||||||||
| 33 | my $cid = URI::cid->parse($mimepart->header('Content-ID')); | ||||||||||
| 34 | |||||||||||
| 35 | # and put it back: | ||||||||||
| 36 | |||||||||||
| 37 | $mimepart->header('Content-ID' => $cid->format); | ||||||||||
| 38 | |||||||||||
| 39 | =head1 DESCRIPTION | ||||||||||
| 40 | |||||||||||
| 41 | L<RFC 2392|http://tools.ietf.org/html/rfc2392> defines a | ||||||||||
| 42 | straight-forward method of expressing the contents of email | ||||||||||
| 43 | C<Message-ID> and C<Content-ID> headers as URIs. This module provides | ||||||||||
| 44 | some utility methods for working with them. | ||||||||||
| 45 | |||||||||||
| 46 | =head1 METHODS | ||||||||||
| 47 | |||||||||||
| 48 | =head2 cid | ||||||||||
| 49 | |||||||||||
| 50 | Get or set the C<Content-ID>. | ||||||||||
| 51 | |||||||||||
| 52 | =cut | ||||||||||
| 53 | |||||||||||
| 54 | 2 | ▶ | sub cid { | ||||||||
|
Subroutine
cid: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 55 | 2 | my $self = shift; | |||||||||
| 56 | 2 | $self->opaque(@_); | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | =head2 parse | ||||||||||
| 60 | |||||||||||
| 61 | Parse (i.e., remove the confining angle-brackets from) a C<Content-ID> | ||||||||||
| 62 | header. | ||||||||||
| 63 | |||||||||||
| 64 | =cut | ||||||||||
| 65 | |||||||||||
| 66 | 1 | ▶ | sub parse { | ||||||||
|
Subroutine
parse: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 67 | 1 | my ($self, $string) = @_; | |||||||||
| 68 | 1 | ▶ | $self = URI->new('cid:') unless ref $self; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 69 | |||||||||||
| 70 | 1 | $string =~ s/^\s*<([^>]*)>\s*$/$1/; | |||||||||
| 71 | 1 | $self->cid($string); | |||||||||
| 72 | 1 | $self; | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | =head2 format | ||||||||||
| 76 | |||||||||||
| 77 | Format a C<cid:> URI as a C<Content-ID> header value. | ||||||||||
| 78 | |||||||||||
| 79 | =cut | ||||||||||
| 80 | |||||||||||
| 81 | 1 | ▶ | sub format { | ||||||||
|
Subroutine
format: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 82 | 1 | sprintf '<%s>', shift->cid; | |||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | =head1 SEE ALSO | ||||||||||
| 86 | |||||||||||
| 87 | =over 4 | ||||||||||
| 88 | |||||||||||
| 89 | =item L<http://tools.ietf.org/html/rfc2392> | ||||||||||
| 90 | |||||||||||
| 91 | =item L<Email::Simple> | ||||||||||
| 92 | |||||||||||
| 93 | =item L<Email::MIME> | ||||||||||
| 94 | |||||||||||
| 95 | =back | ||||||||||
| 96 | |||||||||||
| 97 | =head1 AUTHOR | ||||||||||
| 98 | |||||||||||
| 99 | Dorian Taylor, C<< <dorian at cpan.org> >> | ||||||||||
| 100 | |||||||||||
| 101 | =head1 BUGS | ||||||||||
| 102 | |||||||||||
| 103 | Please report any bugs or feature requests to C<bug-uri-mid at | ||||||||||
| 104 | rt.cpan.org>, or through the web interface at | ||||||||||
| 105 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=URI-mid>. I will be | ||||||||||
| 106 | notified, and then you'll automatically be notified of progress on | ||||||||||
| 107 | your bug as I make changes. | ||||||||||
| 108 | |||||||||||
| 109 | =head1 SUPPORT | ||||||||||
| 110 | |||||||||||
| 111 | You can find documentation for this module with the perldoc command. | ||||||||||
| 112 | |||||||||||
| 113 | perldoc URI::cid | ||||||||||
| 114 | |||||||||||
| 115 | You can also look for information at: | ||||||||||
| 116 | |||||||||||
| 117 | =over 4 | ||||||||||
| 118 | |||||||||||
| 119 | =item * RT: CPAN's request tracker (report bugs here) | ||||||||||
| 120 | |||||||||||
| 121 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=URI-mid> | ||||||||||
| 122 | |||||||||||
| 123 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||
| 124 | |||||||||||
| 125 | L<http://annocpan.org/dist/URI-mid> | ||||||||||
| 126 | |||||||||||
| 127 | =item * CPAN Ratings | ||||||||||
| 128 | |||||||||||
| 129 | L<http://cpanratings.perl.org/d/URI-mid> | ||||||||||
| 130 | |||||||||||
| 131 | =item * Search CPAN | ||||||||||
| 132 | |||||||||||
| 133 | L<http://search.cpan.org/dist/URI-mid/> | ||||||||||
| 134 | |||||||||||
| 135 | =back | ||||||||||
| 136 | |||||||||||
| 137 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 138 | |||||||||||
| 139 | Copyright 2012 Dorian Taylor. | ||||||||||
| 140 | |||||||||||
| 141 | Licensed under the Apache License, Version 2.0 (the "License"); you | ||||||||||
| 142 | may not use this file except in compliance with the License. You may | ||||||||||
| 143 | obtain a copy of the License at | ||||||||||
| 144 | |||||||||||
| 145 | L<http://www.apache.org/licenses/LICENSE-2.0> | ||||||||||
| 146 | |||||||||||
| 147 | Unless required by applicable law or agreed to in writing, software | ||||||||||
| 148 | distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||
| 149 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||||||||||
| 150 | implied. See the License for the specific language governing | ||||||||||
| 151 | permissions and limitations under the License. | ||||||||||
| 152 | |||||||||||
| 153 | |||||||||||
| 154 | =cut | ||||||||||
| 155 | |||||||||||
| 156 | 4 | 1; # End of URI::cid | |||||||||