From: Sebastian Riedel Date: Fri, 21 Oct 2005 12:45:56 +0000 (+0000) Subject: Fixed pod and added Catalyst::Utils::appprefix X-Git-Tag: 5.7099_04~1162 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=41ca9ba7190b75d9ee3adebf37188309cad986a4;hp=10bdcbe8078d0136e2bc53f47ea1f63e36c947a8;p=catagits%2FCatalyst-Runtime.git Fixed pod and added Catalyst::Utils::appprefix --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 0d2f091..86886b0 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -1681,7 +1681,7 @@ Sebastian Riedel, C =head1 LICENSE This library is free software . You can redistribute it and/or modify it under -the same terms as perl itself. +the same terms as Perl itself. =cut diff --git a/lib/Catalyst/Build.pm b/lib/Catalyst/Build.pm index d37840e..47be034 100644 --- a/lib/Catalyst/Build.pm +++ b/lib/Catalyst/Build.pm @@ -97,8 +97,8 @@ Sebastian Riedel, C =head1 LICENSE -This library is free software . You can redistribute it and/or modify it under -the same terms as perl itself. +This library is free software, you can redistribute it and/or modify it under +the same terms as Perl itself. =cut diff --git a/lib/Catalyst/Engine/Test.pm b/lib/Catalyst/Engine/Test.pm index 8173bde..5dd0523 100644 --- a/lib/Catalyst/Engine/Test.pm +++ b/lib/Catalyst/Engine/Test.pm @@ -2,7 +2,7 @@ package Catalyst::Engine::Test; use strict; use base 'Catalyst::Engine::CGI'; -use Catalyst::Utils; +use HTTP::Request; use HTTP::Response; use HTTP::Status; use NEXT; @@ -58,7 +58,18 @@ sub finalize_headers { sub run { my ( $self, $class, $request ) = @_; - $request = Catalyst::Utils::request($request); + # Construct request + unless ( ref $request ) { + if ( $request =~ m/http/i ) { + $request = URI->new($request)->canonical; + } + else { + $request = URI->new( 'http://localhost' . $request )->canonical; + } + } + unless ( ref $request eq 'HTTP::Request' ) { + $request = HTTP::Request->new( 'GET', $request ); + } $request->header( 'Host' => sprintf( '%s:%d', $request->uri->host, $request->uri->port ) diff --git a/lib/Catalyst/Helper.pm b/lib/Catalyst/Helper.pm index 2ae3996..c31df67 100644 --- a/lib/Catalyst/Helper.pm +++ b/lib/Catalyst/Helper.pm @@ -9,6 +9,7 @@ use IO::File; use FindBin; use Template; use Catalyst; +use Catalyst::Utils; use Catalyst::Exception; my %cache; @@ -61,8 +62,7 @@ sub mk_app { $self->{name} = $name; $self->{dir} = $name; $self->{dir} =~ s/\:\:/-/g; - $self->{appprefix} = lc $self->{dir}; - $self->{appprefix} =~ s/-/_/g; + $self->{appprefix} = Catalyst::Utils::appprefix($name); $self->{startperl} = $Config{startperl}; $self->{scriptgen} = $Catalyst::CATALYST_SCRIPT_GEN || 4; $self->{author} = $self->{author} = $ENV{'AUTHOR'} @@ -449,8 +449,8 @@ Sebastian Riedel, C =head1 LICENSE -This library is free software . You can redistribute it and/or modify -it under the same terms as perl itself. +This library is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. =cut @@ -522,8 +522,8 @@ sub default : Private { =head1 LICENSE -This library is free software . You can redistribute it and/or modify -it under the same terms as perl itself. +This library is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. =cut @@ -633,8 +633,8 @@ Sebastian Riedel, C Copyright 2004 Sebastian Riedel. All rights reserved. -This library is free software. You can redistribute it and/or modify -it under the same terms as perl itself. +This library is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. =cut __fastcgi__ @@ -671,8 +671,8 @@ Sebastian Riedel, C Copyright 2004 Sebastian Riedel. All rights reserved. -This library is free software. You can redistribute it and/or modify -it under the same terms as perl itself. +This library is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. =cut __server__ @@ -759,8 +759,8 @@ Sebastian Riedel, C Copyright 2004 Sebastian Riedel. All rights reserved. -This library is free software. You can redistribute it and/or modify -it under the same terms as perl itself. +This library is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. =cut __test__ @@ -816,8 +816,8 @@ Sebastian Riedel, C Copyright 2004 Sebastian Riedel. All rights reserved. -This library is free software. You can redistribute it and/or modify -it under the same terms as perl itself. +This library is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. =cut __create__ @@ -882,8 +882,8 @@ Sebastian Riedel, C Copyright 2004 Sebastian Riedel. All rights reserved. -This library is free software. You can redistribute it and/or modify -it under the same terms as perl itself. +This library is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. =cut __compclass__ @@ -929,8 +929,8 @@ Catalyst component. =head1 LICENSE -This library is free software . You can redistribute it and/or modify -it under the same terms as perl itself. +This library is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. =cut diff --git a/lib/Catalyst/Utils.pm b/lib/Catalyst/Utils.pm index c4d9ca8..c76a247 100644 --- a/lib/Catalyst/Utils.pm +++ b/lib/Catalyst/Utils.pm @@ -22,6 +22,19 @@ See L. =over 4 +=item appprefix($class) + +Returns the application prefix for the class + +=cut + +sub appprefix { + my $class = shift; + $class =~ s/\:\:/_/g; + $class = lc($class); + return $class; +} + =item attrs($coderef) Returns attributes for coderef in a arrayref @@ -211,32 +224,6 @@ sub reflect_actions { return $actions; } -=item request($string); - -Returns an C from a string. - -=cut - -sub request { - my $request = shift; - - unless ( ref $request ) { - - if ( $request =~ m/http/i ) { - $request = URI->new($request)->canonical; - } - else { - $request = URI->new( 'http://localhost' . $request )->canonical; - } - } - - unless ( ref $request eq 'HTTP::Request' ) { - $request = HTTP::Request->new( 'GET', $request ); - } - - return $request; -} - =back =head1 AUTHOR