line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Controller::VersionedURI; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Revert Catalyst::Plugin::VersionedURI's munging |
4
|
|
|
|
|
|
|
$Catalyst::Controller::VersionedURI::VERSION = '1.2.0'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
188367
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
3
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
4395
|
use Catalyst::DispatchType::Regex; |
|
1
|
|
|
|
|
35209
|
|
|
1
|
|
|
|
|
33
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
4
|
BEGIN { extends 'Catalyst::Controller' } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
after BUILDALL => sub { |
16
|
|
|
|
|
|
|
my $self = shift; |
17
|
|
|
|
|
|
|
my $app = $self->_app; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $regex = $app->versioned_uri_regex; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# we catch the old versions too |
22
|
1
|
|
|
1
|
0
|
5
|
eval <<"END"; |
|
1
|
|
|
2
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
44287
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
113
|
|
|
2
|
|
|
|
|
61
|
|
23
|
|
|
|
|
|
|
sub versioned :Regex('(${regex})v') { |
24
|
|
|
|
|
|
|
my ( \$self, \$c ) = \@_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my \$uri = \$c->req->uri; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
\$uri =~ s#(${regex})v.*?/#\$1#; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
\$c->res->redirect( \$uri ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
END |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=pod |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=encoding UTF-8 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Catalyst::Controller::VersionedURI - Revert Catalyst::Plugin::VersionedURI's munging |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 VERSION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
version 1.2.0 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SYNOPSIS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
package MyApp::Controller::VersionedURI; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
use parent 'Catalyst::Controller::VersionedURI'; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This controller creates actions to catch the |
64
|
|
|
|
|
|
|
versioned uris created by C<Catalyst::Plugin::VersionedURI> |
65
|
|
|
|
|
|
|
with the I<in_path> parameter set to I<true>. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SEE ALSO |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
L<Catalyst::Plugin::VersionedURI> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AUTHOR |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Yanick Champoux <yanick@babyl.dyndns.org> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Yanick Champoux. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
80
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |