source: server/trunk/web/lib/Sophie/Controller/Compat.pm @ 246

Last change on this file since 246 was 246, checked in by nanardon, 13 years ago
  • fix compat url /{rpm,srpm} with subpart
File size: 1.4 KB
Line 
1package Sophie::Controller::Compat;
2use Moose;
3use namespace::autoclean;
4
5BEGIN {extends 'Catalyst::Controller'; }
6
7=head1 NAME
8
9Sophie::Controller::Compat - Catalyst Controller
10
11=head1 DESCRIPTION
12
13Catalyst Controller.
14
15=head1 METHODS
16
17=cut
18
19sub viewrpm :Path('/viewrpm') :Args(0) {
20    my ($self, $c) = @_;
21    $c->res->redirect($c->uri_for('/rpms'));
22}
23
24sub viewrpms :Path('/viewrpm') :Args {
25    my ($self, $c, $pkgid, @args) = @_;
26
27    $c->res->redirect($c->uri_for('/rpms', $pkgid, @args));
28}
29
30sub rpm :Path('/rpm') :Args {
31    my ($self, $c, $dist, $rpm, @uargs) = @_;
32   
33    my @args = split(',', $dist);
34    if (@args == 2) {
35        unshift(@args, '');
36    }
37    $c->res->redirect($c->uri_for('/distrib', @args, 'rpms', $rpm, @uargs));
38}
39
40sub srpm :Path('/srpm') :Args {
41    my ($self, $c, $dist, $rpm, @uargs) = @_;
42   
43    my @args = split(',', $dist);
44    if (@args == 2) {
45        unshift(@args, '');
46    }
47    $c->res->redirect($c->uri_for('/distrib', @args, 'srpms', $rpm, @uargs));
48}
49
50# /distrib/foo,bar,baz/RPM
51sub distrib :Private {
52    my ($self, $c, $distrib, $rpm) = @_;
53
54    my @args = split(',', $distrib);
55    if (@args == 2) {
56        unshift(@args, '');
57    }
58    $c->res->redirect($c->uri_for('/distrib', @args, 'rpms', $rpm));
59}
60
61=head1 AUTHOR
62
63Olivier Thauvin
64
65=head1 LICENSE
66
67This library is free software. You can redistribute it and/or modify
68it under the same terms as Perl itself.
69
70=cut
71
72__PACKAGE__->meta->make_immutable;
73
741;
Note: See TracBrowser for help on using the repository browser.