catalyst で 強引にフォワードさせてみたかった。

package specification::View::Forward;

use strict;
use HTTP::Request;
use HTTP::Response;
use LWP::UserAgent;
use base qw( Catalyst::View );

__PACKAGE__->mk_accessors('forwardurl');

=head1 NAME

specification::View::Forward

=head1 DESCRIPTION

=head1 AUTHOR

=head1 SEE ALSO

L<specification>

=head1 LICENSE

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

sub new 
{
    my($class, $c, $arguments) = @_;
    my $self = $class->next::method($c);
                return $self;
}

sub process 
{
    my ( $self, $c ) = @_;
    my $url = $c->stash->{forwardurl};
    my $ua = new LWP::UserAgent;
    my $req = HTTP::Request->new('GET' => $url);
    my $res = $ua->request($req);
    $c->response->body($res->content);
}
1;