line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Exception::3XX; |
2
|
|
|
|
|
|
|
$HTTP::Exception::3XX::VERSION = '0.04006'; |
3
|
27
|
|
|
27
|
|
1008
|
use strict; |
|
27
|
|
|
|
|
51
|
|
|
27
|
|
|
|
|
1191
|
|
4
|
27
|
|
|
27
|
|
264
|
use base 'HTTP::Exception::Base'; |
|
27
|
|
|
|
|
59
|
|
|
27
|
|
|
|
|
1290454
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub is_info () { '' } |
7
|
|
|
|
|
|
|
sub is_success () { '' } |
8
|
|
|
|
|
|
|
sub is_redirect () { 1 } |
9
|
|
|
|
|
|
|
sub is_error () { '' } |
10
|
|
|
|
|
|
|
sub is_client_error () { '' } |
11
|
|
|
|
|
|
|
sub is_server_error () { '' } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub location { |
14
|
16
|
100
|
|
16
|
1
|
356
|
$_[0]->{location} = $_[1] if (@_ > 1); |
15
|
16
|
|
|
|
|
69
|
return $_[0]->{location}; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub Fields { |
19
|
145
|
|
|
145
|
1
|
98033
|
my $self = shift; |
20
|
145
|
|
|
|
|
795
|
my @fields = $self->SUPER::Fields(); |
21
|
|
|
|
|
|
|
# TODO: default-value or required, maybe alter new |
22
|
145
|
|
|
|
|
272
|
push @fields, qw(location); # additional Fields |
23
|
145
|
|
|
|
|
539
|
return @fields; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
HTTP::Exception::3XX - Base Class for 3XX (redirect) Exceptions |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 VERSION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
version 0.04006 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SYNOPSIS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
use HTTP::Exception; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# all are exactly the same |
42
|
|
|
|
|
|
|
HTTP::Exception->throw(301, location => 'google.com'); |
43
|
|
|
|
|
|
|
HTTP::Exception::301->throw(location => 'google.com'); |
44
|
|
|
|
|
|
|
HTTP::Exception::MOVED_PERMANENTLY->throw(location => 'google.com'); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# and in your favourite Webframework |
47
|
|
|
|
|
|
|
eval { ... } |
48
|
|
|
|
|
|
|
if (my $e = HTTP::Exception::301->caught) { |
49
|
|
|
|
|
|
|
my $self->req->redirect($e->location); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This package is the base class for all 3XX (redirect) Exceptions. |
55
|
|
|
|
|
|
|
This makes adding features for a range of exceptions easier. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
DON'T USE THIS PACKAGE DIRECTLY. 'use HTTP::Exception' does this for you. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 ADDITIONAL FIELDS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Fields, that 3XX-Exceptions provide over HTTP::Exceptions. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 location |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Indicates, where the browser is being redirected to. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Thomas Mueller, C<< >> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 BUGS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
74
|
|
|
|
|
|
|
C, or through the web interface at |
75
|
|
|
|
|
|
|
L. |
76
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
77
|
|
|
|
|
|
|
your bug as I make changes. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SUPPORT |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
perldoc HTTP::Exception::Base |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
You can also look for information at: |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=over 4 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
L |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
L |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * CPAN Ratings |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
L |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item * Search CPAN |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
L |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=back |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Copyright 2010 Thomas Mueller. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
112
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
113
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |