[Catalyst-commits] r6856 - in trunk/Catalyst-Plugin-SubRequest: . lib lib/Catalyst lib/Catalyst/Plugin

bricas at dev.catalyst.perl.org bricas at dev.catalyst.perl.org
Thu Sep 6 17:08:38 GMT 2007


Author: bricas
Date: 2007-09-06 17:08:38 +0100 (Thu, 06 Sep 2007)
New Revision: 6856

Added:
   trunk/Catalyst-Plugin-SubRequest/MANIFEST.SKIP
   trunk/Catalyst-Plugin-SubRequest/lib/
   trunk/Catalyst-Plugin-SubRequest/lib/Catalyst/
   trunk/Catalyst-Plugin-SubRequest/lib/Catalyst/Plugin/
   trunk/Catalyst-Plugin-SubRequest/lib/Catalyst/Plugin/SubRequest.pm
Removed:
   trunk/Catalyst-Plugin-SubRequest/MANIFEST
   trunk/Catalyst-Plugin-SubRequest/META.yml
   trunk/Catalyst-Plugin-SubRequest/SubRequest.pm
Modified:
   trunk/Catalyst-Plugin-SubRequest/Changes
   trunk/Catalyst-Plugin-SubRequest/Makefile.PL
   trunk/Catalyst-Plugin-SubRequest/README
Log:
distro updates. switch to module::install. regen readme (RT #16459)

Modified: trunk/Catalyst-Plugin-SubRequest/Changes
===================================================================
--- trunk/Catalyst-Plugin-SubRequest/Changes	2007-09-06 16:00:47 UTC (rev 6855)
+++ trunk/Catalyst-Plugin-SubRequest/Changes	2007-09-06 16:08:38 UTC (rev 6856)
@@ -1,26 +1,39 @@
 Revision history for Perl extension Catalyst::Plugin::SubRequest
 
+0.12  2007-09-05
+        - Switch to Module::Install
+        - Fixed README (RT #16459)
+
 0.11  2007-04-03 14:13:00
         - $c->req->params restored after sub_request
+
 0.10  2005-12-08 13:15:00  
         - Updated test suite to work with new catalyst.
+
 0.09  2005-10-28 01:07:00 
     	- localize body rather than output, which is an alias
+
 0.08  2005-12-10 01:34:00 
 	    - patch to handle NEXT trouble.
+
 0.07  2005-08-01 12:08:00 
         - reset path.
         - allow passing params.
+
 0.06  2005-06-08 20:27:00 
         - Flush params as well
         - allow stuff to be passed to the stash
+
 0.05  2005-03-19 20:27:00 
         - Added a log message in debug mode.
+
 0.04  2005-03-19 20:27:00
         - Updated forward to cat5 style
         - Using Catalyst::Dispatch::dispatch instead of forward.
+
 0.03  2005-03-19 20:27:00
         - Fixed documentation.
+
 0.02  2005-03-19 10:32:00
         - Ooops, missed MANIFEST
 

Deleted: trunk/Catalyst-Plugin-SubRequest/MANIFEST
===================================================================
--- trunk/Catalyst-Plugin-SubRequest/MANIFEST	2007-09-06 16:00:47 UTC (rev 6855)
+++ trunk/Catalyst-Plugin-SubRequest/MANIFEST	2007-09-06 16:08:38 UTC (rev 6856)
@@ -1,11 +0,0 @@
-Changes
-Makefile.PL
-MANIFEST			This list of files
-META.yml
-README
-SubRequest.pm
-t/01use.t
-t/02subreq.t
-t/03pod.t
-t/04podcoverage.t
-t/lib/TestApp.pm

Added: trunk/Catalyst-Plugin-SubRequest/MANIFEST.SKIP
===================================================================
--- trunk/Catalyst-Plugin-SubRequest/MANIFEST.SKIP	                        (rev 0)
+++ trunk/Catalyst-Plugin-SubRequest/MANIFEST.SKIP	2007-09-06 16:08:38 UTC (rev 6856)
@@ -0,0 +1,29 @@
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+,v$
+\B\.svn\b
+
+# Avoid Makemaker generated and utility files.
+\bMakefile$
+\bblib
+\bMakeMaker-\d
+\bpm_to_blib$
+\bblibdirs$
+^MANIFEST\.SKIP$
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build
+
+# Avoid temp and backup files.
+~$
+\.tmp$
+\.old$
+\.bak$
+\#$
+\b\.#
+\.DS_Store$
+
+# No tarballs!
+\.gz$

Deleted: trunk/Catalyst-Plugin-SubRequest/META.yml
===================================================================
--- trunk/Catalyst-Plugin-SubRequest/META.yml	2007-09-06 16:00:47 UTC (rev 6855)
+++ trunk/Catalyst-Plugin-SubRequest/META.yml	2007-09-06 16:08:38 UTC (rev 6856)
@@ -1,11 +0,0 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         Catalyst-Plugin-SubRequest
-version:      0.09
-version_from: SubRequest.pm
-installdirs:  site
-requires:
-    Catalyst:                      2.99
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17

Modified: trunk/Catalyst-Plugin-SubRequest/Makefile.PL
===================================================================
--- trunk/Catalyst-Plugin-SubRequest/Makefile.PL	2007-09-06 16:00:47 UTC (rev 6855)
+++ trunk/Catalyst-Plugin-SubRequest/Makefile.PL	2007-09-06 16:08:38 UTC (rev 6856)
@@ -1,10 +1,11 @@
-use ExtUtils::MakeMaker;
+use inc::Module::Install 0.67;
 
-WriteMakefile(
-    NAME      => 'Catalyst::Plugin::SubRequest',
-    AUTHOR    => 'Marcus Ramberg <marcus at thefeed.no>',
-    PREREQ_PM => {
-        Catalyst     => '5.00',
-    },
-    VERSION_FROM => 'SubRequest.pm'
-);
+name 'Catalyst-Plugin-SubRequest';
+all_from 'lib/Catalyst/Plugin/SubRequest.pm';
+
+requires 'Catalyst::Runtime';
+
+requires 'Test::More';
+
+auto_install;
+WriteAll;

Modified: trunk/Catalyst-Plugin-SubRequest/README
===================================================================
--- trunk/Catalyst-Plugin-SubRequest/README	2007-09-06 16:00:47 UTC (rev 6855)
+++ trunk/Catalyst-Plugin-SubRequest/README	2007-09-06 16:08:38 UTC (rev 6856)
@@ -1,22 +1,36 @@
 NAME
-    Catalyst::Plugin::Static - Serve static files with Catalyst
+    Catalyst::Plugin::SubRequest - Make subrequests to actions in Catalyst
 
 SYNOPSIS
-        use Catalyst 'Static';
+        use Catalyst 'SubRequest';
 
-        $c->serve_static;
+        $c->subreq('/test/foo/bar', { template => 'magic.tt' });
 
+        $c->subreq(        {       path            => '/test/foo/bar',
+                           body            => $body        },
+                   {       template        => 'magic.tt'           });
+
 DESCRIPTION
-    Serve static files from config->{root}.
+    Make subrequests to actions in Catalyst. Uses the catalyst dispatcher,
+    so it will work like an external url call.
 
-  METHODS
-   serve_static
+METHODS
+    subreq [path as string or hash ref], [stash as hash ref], [parameters as
+    hash ref]
+    sub_request
+        Takes a full path to a path you'd like to dispatch to. If the path
+        is passed as a hash ref then it can include body, action, match and
+        path. Any additional parameters are put into the stash.
+
 SEE ALSO
     Catalyst.
 
 AUTHOR
-    Sebastian Riedel, "sri at cpan.org"
+    Marcus Ramberg, "mramberg at cpan.org"
 
+THANK YOU
+    SRI, for writing the awesome Catalyst framework
+
 COPYRIGHT
     This program is free software, you can redistribute it and/or modify it
     under the same terms as Perl itself.

Deleted: trunk/Catalyst-Plugin-SubRequest/SubRequest.pm
===================================================================
--- trunk/Catalyst-Plugin-SubRequest/SubRequest.pm	2007-09-06 16:00:47 UTC (rev 6855)
+++ trunk/Catalyst-Plugin-SubRequest/SubRequest.pm	2007-09-06 16:08:38 UTC (rev 6856)
@@ -1,136 +0,0 @@
-package Catalyst::Plugin::SubRequest;
-
-use strict;
-use Time::HiRes qw/tv_interval/;
-
-our $VERSION = '0.11';
-
-=head1 NAME
-
-Catalyst::Plugin::SubRequest - Make subrequests to actions in Catalyst
-
-=head1 SYNOPSIS
-
-    use Catalyst 'SubRequest';
-
-    $c->subreq('/test/foo/bar', { template => 'magic.tt' });
-
-    $c->subreq(        {       path            => '/test/foo/bar',
-                       body            => $body        },
-               {       template        => 'magic.tt'           });
-
-=head1 DESCRIPTION
-
-Make subrequests to actions in Catalyst. Uses the  catalyst
-dispatcher, so it will work like an external url call.
-
-=head1 METHODS
-
-=over 4 
-
-=item subreq [path as string or hash ref], [stash as hash ref], [parameters as hash ref]
-
-=item sub_request
-
-Takes a full path to a path you'd like to dispatch to.
-If the path is passed as a hash ref then it can include body, action, match and path.
-Any additional parameters are put into the stash.
-
-=back 
-
-=cut
-
-*subreq = \&sub_request;
-
-sub sub_request {
-    my ( $c, $path, $stash, $params ) = @_;
-
-    $path =~ s#^/##;
-
-    $params ||= {};
-
-    my %request_mods = (
-        body => undef,
-        action => undef,
-        match => undef,
-        parameters => $params,
-    );
-
-    if (ref $path eq 'HASH') {
-        @request_mods{keys %$path} = values %$path;
-    } else {
-        $request_mods{path} = $path;
-    }
-
-    my $fake_engine = bless(
-        {
-            orig_request => $c->req,
-            request_mods => \%request_mods,
-        },
-        'Catalyst::Plugin::SubRequest::Internal::FakeEngine'
-    );
-
-    my $class = ref($c);
-
-    no strict 'refs';
-    no warnings 'redefine';
-
-    local *{"${class}::engine"} = sub { $fake_engine };
-
-    my $inner_ctx = $class->prepare;
-
-    $inner_ctx->stash($stash || {});
-    
-    $inner_ctx->dispatch;
-    
-    if ($c->debug) {
-        $inner_ctx->stats->setNodeValue({
-            action => 'subrequest:',
-            comment => '',
-            elapsed => sprintf('%fs', tv_interval($inner_ctx->stats->getNodeValue)),
-        });
-        $c->stats->addChild($inner_ctx->stats);
-    }
-    
-    return $inner_ctx->response->body;
-}
-
-=head1 SEE ALSO
-
-L<Catalyst>.
-
-=head1 AUTHOR
-
-Marcus Ramberg, C<mramberg at cpan.org>
-
-=head1 THANK YOU
-
-SRI, for writing the awesome Catalyst framework
-
-=head1 COPYRIGHT
-
-This program is free software, you can redistribute it and/or modify it under
-the same terms as Perl itself.
-
-=cut
-
-package # hide from PAUSE
-  Catalyst::Plugin::SubRequest::Internal::FakeEngine;
-
-sub AUTOLOAD { return 1; } # yeah yeah yeah
-
-sub prepare {
-    my ($self, $c) = @_;
-    my $req = $c->request;
-    
-    @{$req}{keys %{$self->{orig_request}}} = values %{$self->{orig_request}};
-    while (my ($key,$value) = each %{$self->{request_mods}}) {
-        if (my $mut = $req->can($key)) {
-            $req->$mut($value);
-        } else {
-            $req->{$key} = $value;
-        }
-    }
-}
-
-1;

Copied: trunk/Catalyst-Plugin-SubRequest/lib/Catalyst/Plugin/SubRequest.pm (from rev 5786, trunk/Catalyst-Plugin-SubRequest/SubRequest.pm)
===================================================================
--- trunk/Catalyst-Plugin-SubRequest/lib/Catalyst/Plugin/SubRequest.pm	                        (rev 0)
+++ trunk/Catalyst-Plugin-SubRequest/lib/Catalyst/Plugin/SubRequest.pm	2007-09-06 16:08:38 UTC (rev 6856)
@@ -0,0 +1,136 @@
+package Catalyst::Plugin::SubRequest;
+
+use strict;
+use Time::HiRes qw/tv_interval/;
+
+our $VERSION = '0.12';
+
+=head1 NAME
+
+Catalyst::Plugin::SubRequest - Make subrequests to actions in Catalyst
+
+=head1 SYNOPSIS
+
+    use Catalyst 'SubRequest';
+
+    $c->subreq('/test/foo/bar', { template => 'magic.tt' });
+
+    $c->subreq(        {       path            => '/test/foo/bar',
+                       body            => $body        },
+               {       template        => 'magic.tt'           });
+
+=head1 DESCRIPTION
+
+Make subrequests to actions in Catalyst. Uses the  catalyst
+dispatcher, so it will work like an external url call.
+
+=head1 METHODS
+
+=over 4 
+
+=item subreq [path as string or hash ref], [stash as hash ref], [parameters as hash ref]
+
+=item sub_request
+
+Takes a full path to a path you'd like to dispatch to.
+If the path is passed as a hash ref then it can include body, action, match and path.
+Any additional parameters are put into the stash.
+
+=back 
+
+=cut
+
+*subreq = \&sub_request;
+
+sub sub_request {
+    my ( $c, $path, $stash, $params ) = @_;
+
+    $path =~ s#^/##;
+
+    $params ||= {};
+
+    my %request_mods = (
+        body => undef,
+        action => undef,
+        match => undef,
+        parameters => $params,
+    );
+
+    if (ref $path eq 'HASH') {
+        @request_mods{keys %$path} = values %$path;
+    } else {
+        $request_mods{path} = $path;
+    }
+
+    my $fake_engine = bless(
+        {
+            orig_request => $c->req,
+            request_mods => \%request_mods,
+        },
+        'Catalyst::Plugin::SubRequest::Internal::FakeEngine'
+    );
+
+    my $class = ref($c);
+
+    no strict 'refs';
+    no warnings 'redefine';
+
+    local *{"${class}::engine"} = sub { $fake_engine };
+
+    my $inner_ctx = $class->prepare;
+
+    $inner_ctx->stash($stash || {});
+    
+    $inner_ctx->dispatch;
+    
+    if ($c->debug) {
+        $inner_ctx->stats->setNodeValue({
+            action => 'subrequest:',
+            comment => '',
+            elapsed => sprintf('%fs', tv_interval($inner_ctx->stats->getNodeValue)),
+        });
+        $c->stats->addChild($inner_ctx->stats);
+    }
+    
+    return $inner_ctx->response->body;
+}
+
+=head1 SEE ALSO
+
+L<Catalyst>.
+
+=head1 AUTHOR
+
+Marcus Ramberg, C<mramberg at cpan.org>
+
+=head1 THANK YOU
+
+SRI, for writing the awesome Catalyst framework
+
+=head1 COPYRIGHT
+
+This program is free software, you can redistribute it and/or modify it under
+the same terms as Perl itself.
+
+=cut
+
+package # hide from PAUSE
+  Catalyst::Plugin::SubRequest::Internal::FakeEngine;
+
+sub AUTOLOAD { return 1; } # yeah yeah yeah
+
+sub prepare {
+    my ($self, $c) = @_;
+    my $req = $c->request;
+    
+    @{$req}{keys %{$self->{orig_request}}} = values %{$self->{orig_request}};
+    while (my ($key,$value) = each %{$self->{request_mods}}) {
+        if (my $mut = $req->can($key)) {
+            $req->$mut($value);
+        } else {
+            $req->{$key} = $value;
+        }
+    }
+}
+
+1;




More information about the Catalyst-commits mailing list