Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 17 commits
  • 11 files changed
  • 0 commit comments
  • 5 contributors
Commits on Feb 08, 2012
@bobtfish bobtfish Fix dead links to cpansearch.perl.org to point to metacpan.org 8026799
Commits on Feb 12, 2012
@ribasushi ribasushi Catalyst is tested and works just fine with 5.8.3. Reflect in require…
…ments.

Files=29, Tests=2997, 29 wallclock secs ( 0.46 usr  0.02 sys + 28.44 cusr  0.64 csys = 29.56 CPU)
(with aggregated tests)

Files=144, Tests=2946, 218 wallclock secs ( 0.82 usr  0.24 sys + 212.72 cusr  4.20 csys = 217.98 CPU)
(without aggregation)

Note - this was fully tested with a modified LWP as per RT#74190.

Here is a dump of my requirement list:

rabbit@Thesaurus:~/devel/cat_runtime/Catalyst-Runtime-5.90008$ perl -v

This is perl, v5.8.3 built for i686-linux-thread-multi

rabbit@Thesaurus:~/devel/cat_runtime/Catalyst-Runtime-5.90008$ perl Makefile.PL
*** Module::AutoInstall version 1.04
*** Checking for Perl dependencies...
[Core Features]
- Class::Data::Inheritable               ...loaded. (0.08)
- Test::Exception                        ...loaded. (0.31)
- Test::More                             ...loaded. (0.98 >= 0.88)
- Data::Dump                             ...loaded. (1.19)
- HTTP::Request::Common                  ...loaded. (6.00)
- List::MoreUtils                        ...loaded. (0.30)
- namespace::autoclean                   ...loaded. (0.12 >= 0.09)
- namespace::clean                       ...loaded. (0.20 >= 0.13)
- B::Hooks::EndOfScope                   ...loaded. (0.09 >= 0.08)
- MooseX::Emulate::Class::Accessor::Fast ...loaded. (0.00903 >= 0.00903)
- Class::Load                            ...loaded. (0.13 >= 0.12)
- Class::MOP                             ...loaded. (2.0402 >= 0.95)
- Data::OptList                          ...loaded. (0.107)
- Moose                                  ...loaded. (2.0402 >= 1.03)
- MooseX::MethodAttributes::Inheritable  ...loaded. (0.26 >= 0.24)
- MooseX::Role::WithOverloading          ...loaded. (0.09 >= 0.09)
- MooseX::Types::LoadableClass           ...loaded. (0.006 >= 0.003)
- Carp                                   ...loaded. (1.01)
- Class::C3::Adopt::NEXT                 ...loaded. (0.13 >= 0.07)
- CGI::Simple::Cookie                    ...loaded. (1.113 >= 1.109)
- Data::Dump                             ...loaded. (1.19)
- Data::OptList                          ...loaded. (0.107)
- HTML::Entities                         ...loaded. (3.69)
- HTML::HeadParser                       ...loaded. (3.69)
- HTTP::Body                             ...loaded. (1.15 >= 1.06)
- HTTP::Headers                          ...loaded. (6.00 >= 1.64)
- HTTP::Request                          ...loaded. (6.00 >= 5.814)
- HTTP::Response                         ...loaded. (6.01 >= 5.813)
- HTTP::Request::AsCGI                   ...loaded. (1.2 >= 1.0)
- LWP::UserAgent                         ...loaded. (6.03)
- Module::Pluggable                      ...loaded. (3.9 >= 3.9)
- Path::Class                            ...loaded. (0.23 >= 0.09)
- Scalar::Util                           ...loaded. (1.23)
- Sub::Exporter                          ...loaded. (0.982)
- Text::SimpleTable                      ...loaded. (2.03 >= 0.03)
- Time::HiRes                            ...loaded. (1.52)
- Tree::Simple                           ...loaded. (1.18 >= 1.15)
- Tree::Simple::Visitor::FindByPath      ...loaded. (0.03)
- Try::Tiny                              ...loaded. (0.09)
- URI                                    ...loaded. (1.59 >= 1.35)
- Task::Weaken                           ...loaded. (1.04)
- Text::Balanced                         ...loaded. (1.95)
- MRO::Compat                            ...loaded. (0.11)
- MooseX::Getopt                         ...loaded. (0.39 >= 0.30)
- MooseX::Types                          ...loaded. (0.25)
- MooseX::Types::Common::Numeric         ...loaded. (0.001004)
- String::RewritePrefix                  ...loaded. (0.006 >= 0.004)
- Plack                                  ...loaded. (0.9985 >= 0.9974)
- Plack::Middleware::ReverseProxy        ...loaded. (0.11 >= 0.04)
- Plack::Test::ExternalServer            ...loaded. (0.01)
0f6be50
Commits on Feb 14, 2012
@edenc edenc documenting back-compat issue with environment variables 7e9340d
@bobtfish bobtfish Fix the debug page, how did that slip through? 40d07fe
Commits on Feb 16, 2012
@bobtfish bobtfish Require B::Hooks::EndOfScope 0.10 8529a7e
@bobtfish bobtfish Re-write changelog entry 3217aa7
@bobtfish bobtfish Trim massive explanation, not actually needed here 9c95f3f
@bobtfish bobtfish Version 5.90009 8d19686
@bobtfish bobtfish Some sane testing for home utility. 0f519d6
@bobtfish bobtfish Split out into new function 03fb1be
@bobtfish bobtfish Tests and fixes for conditional inclusion 15c4069
@bobtfish bobtfish Update changelog 0c17b66
@bobtfish bobtfish Doc new function 40e6e22
Commits on Feb 18, 2012
@shadowcat-mst shadowcat-mst release commit for 5.90010 fed36d6
@arodland arodland Fix spelling d17ae38
@arodland arodland Spell out "current directory"
To make aspell happy, and maybe make people less confused.
122020c
Commits on Feb 21, 2012
@bobtfish bobtfish Additional fixes for path stuff f7ac80e
View
27 Changes
@@ -1,11 +1,38 @@
# This file documents the revision history for Perl extension Catalyst.
Bug fixes:
+ - Yet another fix to the previous fix to Catalyst::ScriptRunner which
+ was resulting in the lib directory not being pushed onto @INC.
+ When you were in a directory in your checkout below the root
+ of the application.
+ - Bug fix to again correctly detect checkouts in dist zilla using
+ applications.
+
+5.90010 - 2012-02-18 00:01:00
+
+ Bug fixes:
+ - Fix the previous fix to Catalyst::ScriptRunner which was resulting
+ in the lib directory not being pushed onto @INC.
+ This meant perl ./script/myapp_server.pl failed, however
+ perl -Ilib ./script/myapp_server.pl would succeed.
+
+5.90009 - 2012-02-16 09:06:00
+
+ Bug fixes:
+ - Fix the debug page so that it works as expected with the latest
+ refactoring.
+
- The Catalyst::Utils::home function is used to find if the application
is a checkout in Catalyst::ScriptRunner. This means that a non-existant
lib directory that is relative to the script install location is not
included when not running from a checkout.
+ - Fix dead links to cpansearch.perl.org to point to metacpan.org.
+
+ - Require the latest version of B::Hooks::EndOfScope (0.10) to avoid an
+ issue with new versions of Module::Runtime (0.012) on perl 5.10
+ which stopped Catalyst::Controller from compiling.
+
5.90008 - TRIAL 2012-02-06 20:49:00
New features and refactoring:
View
4 Makefile.PL
@@ -8,7 +8,7 @@ use Module::Install::AuthorRequires;
use Module::Install::CheckConflicts;
use Module::Install::AuthorTests;
-perl_version '5.008004';
+perl_version '5.008003';
name 'Catalyst-Runtime';
all_from 'lib/Catalyst/Runtime.pm';
@@ -16,7 +16,7 @@ all_from 'lib/Catalyst/Runtime.pm';
requires 'List::MoreUtils';
requires 'namespace::autoclean' => '0.09';
requires 'namespace::clean' => '0.13';
-requires 'B::Hooks::EndOfScope' => '0.08';
+requires 'B::Hooks::EndOfScope' => '0.10';
requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00903';
requires 'Class::Load' => '0.12';
requires 'Class::MOP' => '0.95';
View
14 lib/Catalyst.pm
@@ -38,7 +38,7 @@ use Plack::Middleware::ReverseProxy;
use Plack::Middleware::IIS6ScriptNameFix;
use Plack::Middleware::LighttpdScriptNameFix;
-BEGIN { require 5.008004; }
+BEGIN { require 5.008003; }
has stack => (is => 'ro', default => sub { [] });
has stash => (is => 'rw', default => sub { {} });
@@ -100,7 +100,7 @@ __PACKAGE__->stats_class('Catalyst::Stats');
# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.90008';
+our $VERSION = '5.90010';
sub import {
my ( $class, @arguments ) = @_;
@@ -1553,18 +1553,18 @@ sub welcome_message {
We do, however, provide you with a few starting points.</p>
<p>If you want to jump right into web development with Catalyst
you might want to start with a tutorial.</p>
-<pre>perldoc <a href="http://cpansearch.perl.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Tutorial.pod">Catalyst::Manual::Tutorial</a></code>
+<pre>perldoc <a href="https://metacpan.org/module/Catalyst::Manual::Tutorial">Catalyst::Manual::Tutorial</a></code>
</pre>
<p>Afterwards you can go on to check out a more complete look at our features.</p>
<pre>
-<code>perldoc <a href="http://cpansearch.perl.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod">Catalyst::Manual::Intro</a>
+<code>perldoc <a href="https://metacpan.org/module/Catalyst::Manual::Intro">Catalyst::Manual::Intro</a>
<!-- Something else should go here, but the Catalyst::Manual link seems unhelpful -->
</code></pre>
<h2>What to do next?</h2>
<p>Next it's time to write an actual application. Use the
- helper scripts to generate <a href="http://cpansearch.perl.org/search?query=Catalyst%3A%3AController%3A%3A&amp;mode=all">controllers</a>,
- <a href="http://cpansearch.perl.org/search?query=Catalyst%3A%3AModel%3A%3A&amp;mode=all">models</a>, and
- <a href="http://cpansearch.perl.org/search?query=Catalyst%3A%3AView%3A%3A&amp;mode=all">views</a>;
+ helper scripts to generate <a href="https://metacpan.org/search?q=Catalyst%3A%3AController">controllers</a>,
+ <a href="https://metacpan.org/search?q=Catalyst%3A%3AModel">models</a>, and
+ <a href="https://metacpan.org/search?q=Catalyst%3A%3AView">views</a>;
they can save you a lot of work.</p>
<pre><code>script/${prefix}_create.pl --help</code></pre>
<p>Also, be sure to check out the vast and growing
View
4 lib/Catalyst/Engine.pm
@@ -180,10 +180,6 @@ sub finalize_error {
$title = $name = "$name on Catalyst $Catalyst::VERSION";
$name = "<h1>$name</h1>";
- # Don't show context in the dump
- $c->req->_clear_context;
- $c->res->_clear_context;
-
# Don't show body parser in the dump
$c->req->_clear_body;
View
4 lib/Catalyst/Runtime.pm
@@ -3,11 +3,11 @@ package Catalyst::Runtime;
use strict;
use warnings;
-BEGIN { require 5.008004; }
+BEGIN { require 5.008003; }
# Remember to update this in Catalyst as well!
-our $VERSION = '5.90008';
+our $VERSION = '5.90010';
=head1 NAME
View
2 lib/Catalyst/ScriptRunner.pm
@@ -35,7 +35,7 @@ sub subclass_with_traits {
sub run {
my ($self, $appclass, $scriptclass) = @_;
- if (my $home = Catalyst::Utils::home($appclass)) {
+ if (my $home = Catalyst::Utils::find_home_unloaded_in_checkout()) {
lib->import(File::Spec->catdir($home, 'lib'));
}
View
7 lib/Catalyst/Upgrading.pod
@@ -515,6 +515,13 @@ The correct fix is to re-arrange your class's inheritance hierarchy so that the
COMPONENT method you would like to inherit is the first (left-hand most)
COMPONENT method in your @ISA.
+=head2 Development server relying on environment variables
+
+Previously, the development server would allow propagation of system
+environment variables into the request environment, this has changed with the
+adoption of Plack. You can use L<Plack::Middleware::ForceEnv> to achieve the
+same effect.
+
=head1 WARNINGS
=head2 Actions in your application class
View
76 lib/Catalyst/Utils.pm
@@ -6,9 +6,10 @@ use HTTP::Request;
use Path::Class;
use URI;
use Carp qw/croak/;
-use Cwd;
+use FindBin qw/ $Bin /;
use Class::MOP;
use String::RewritePrefix;
+use List::MoreUtils qw/ any /;
use namespace::clean;
@@ -154,10 +155,22 @@ sub class2tempdir {
return $tmpdir->stringify;
}
+=head2 dist_indicator_file_list
+
+Returns a list of files which can be tested to check if you're inside a checkout
+
+=cut
+
+sub dist_indicator_file_list {
+ qw/ Makefile.PL Build.PL dist.ini /;
+}
+
=head2 home($class)
Returns home directory for given class.
+Note that the class must be loaded for the home directory to be found using this function.
+
=cut
sub home {
@@ -172,27 +185,8 @@ sub home {
# find the @INC entry in which $file was found
(my $path = $inc_entry) =~ s/$file$//;
- $path ||= cwd() if !defined $path || !length $path;
- my $home = dir($path)->absolute->cleanup;
-
- # pop off /lib and /blib if they're there
- $home = $home->parent while $home =~ /b?lib$/;
-
- # only return the dir if it has a Makefile.PL or Build.PL or dist.ini
- if (-f $home->file("Makefile.PL") or -f $home->file("Build.PL")
- or -f $home->file("dist.ini")) {
-
- # clean up relative path:
- # MyApp/script/.. -> MyApp
-
- my $dir;
- my @dir_list = $home->dir_list();
- while (($dir = pop(@dir_list)) && $dir eq '..') {
- $home = dir($home)->parent->parent;
- }
-
- return $home->stringify;
- }
+ my $home = find_home_unloaded_in_checkout($path);
+ return $home if $home;
}
{
@@ -211,6 +205,44 @@ sub home {
return 0;
}
+=head2 find_home_unloaded_in_checkout ($path)
+
+Tries to determine if C<$path> (or $FindBin::Bin if not supplied)
+looks like a checkout. Any leading lib, script or blib components
+will be removed, then the directory produced will be checked
+for the existence of a C<< dist_indicator_file_list() >>.
+
+If one is found, the directory will be returned, otherwise false.
+
+=cut
+
+sub find_home_unloaded_in_checkout {
+ my ($path) = @_;
+ $path ||= $Bin if !defined $path || !length $path;
+ my $home = dir($path)->absolute->cleanup;
+
+ # pop off /lib and /blib if they're there
+ $home = $home->parent while $home =~ /b?lib$/;
+ # pop off /script if it's there.
+ $home = $home->parent while $home =~ /b?script$/;
+
+ # only return the dir if it has a Makefile.PL or Build.PL or dist.ini
+ if (any { $_ } map { -f $home->file($_) } dist_indicator_file_list()) {
+
+ # clean up relative path:
+ # MyApp/script/.. -> MyApp
+
+ my $dir;
+ my @dir_list = $home->dir_list();
+ while (($dir = pop(@dir_list)) && $dir eq '..') {
+ $home = dir($home)->parent->parent;
+ }
+
+ return $home->stringify;
+ }
+
+}
+
=head2 prefix($class, $name);
Returns a prefixed action.
View
6 t/aggregate/unit_core_script_server-without_modules.t
@@ -1,6 +1,12 @@
use strict;
use warnings;
use FindBin qw/$Bin/;
+
+# Package::Stash::XS has a weird =~ XS invocation during its compilation
+# This interferes with @INC hooks that do rematcuing on their own on
+# perls before 5.8.7. Just use the PP version to work around this.
+BEGIN { $ENV{PACKAGE_STASH_IMPLEMENTATION} = 'PP' if $] < '5.008007' }
+
use Test::More;
use Try::Tiny;
View
42 t/aggregate/unit_core_scriptrunner_home.t
@@ -0,0 +1,42 @@
+use strict;
+use warnings;
+use Test::More;
+use FindBin qw/$Bin/;
+use Test::Exception;
+use lib "$Bin/../lib";
+use File::Temp qw/ tempdir /;
+use Cwd;
+
+use_ok('Catalyst::ScriptRunner');
+
+my $cwd = cwd();
+
+my $d = tempdir(); #CLEANUP => 1);
+chdir($d) or die;
+mkdir("lib") or die;
+mkdir(File::Spec->catdir("lib", "MyApp")) or die;
+mkdir(File::Spec->catdir("lib", "MyApp", "Script")) or die;
+
+open(my $fh, '>', 'Makefile.PL') or die;
+close($fh) or die;
+
+open($fh, '>', File::Spec->catdir("lib", "MyApp", "Script", "Foo.pm")) or die;
+print $fh q{package MyApp::Script::Foo;
+use Moose;
+use namespace::autoclean;
+
+with 'Catalyst::ScriptRole';
+
+sub run { __PACKAGE__ }
+
+1;
+};
+close($fh) or die;
+
+use_ok 'Catalyst::ScriptRunner';
+
+is Catalyst::ScriptRunner->run('MyApp', 'Foo'), 'MyApp::Script::Foo';
+
+chdir($cwd) or die;
+
+done_testing;
View
45 t/aggregate/unit_utils_home.t
@@ -0,0 +1,45 @@
+use strict;
+use warnings;
+
+use Test::More;
+use File::Temp qw/ tempdir /;
+use Catalyst::Utils;
+use File::Spec;
+use Path::Class qw/ dir /;
+use Cwd qw/ cwd /;
+
+my @dists = Catalyst::Utils::dist_indicator_file_list();
+is(scalar(@dists), 3, 'Makefile.PL Build.PL dist.ini');
+
+my $cwd = cwd();
+foreach my $inc ('', 'lib', 'blib'){
+ my $d = tempdir(CLEANUP => 1);
+ chdir($d);
+ local $INC{'MyApp.pm'} = File::Spec->catdir($d, $inc, 'MyApp.pm');
+ ok !Catalyst::Utils::home('MyApp'), "No files found inc $inc";
+ open(my $fh, '>', "Makefile.PL");
+ close($fh);
+ is Catalyst::Utils::home('MyApp'), dir($d)->absolute->cleanup, "Did find inc '$inc'";
+}
+
+{
+ my $d = tempdir(CLEANUP => 1);
+ local $INC{'MyApp.pm'} = File::Spec->catdir($d, 'MyApp.pm');
+ ok !Catalyst::Utils::home('MyApp'), 'No files found';
+ mkdir File::Spec->catdir($d, 'MyApp');
+ is Catalyst::Utils::home('MyApp'), dir($d, 'MyApp')->absolute->cleanup;
+}
+
+{
+ my $d = tempdir(CLEANUP => 1);
+ chdir($d);
+ ok !Catalyst::Utils::find_home_unloaded_in_checkout();
+ open(my $fh, '>', "Makefile.PL");
+ close($fh);
+ is Catalyst::Utils::find_home_unloaded_in_checkout(), cwd(), "Did find home_unloaded_in_checkout"
+}
+
+chdir($cwd);
+
+done_testing;
+

No commit comments for this range

Something went wrong with that request. Please try again.