r3084 - in
/packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current:
Build.PL Changes MANIFEST META.yml Makefile.PL README
lib/MasonX/Interp/WithCallbacks.pm t/05object.t t/09cgi.t t/htdocs/alt.mc
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Sat Jun 17 15:33:46 UTC 2006
Author: gregoa-guest
Date: Sat Jun 17 15:33:44 2006
New Revision: 3084
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3084
Log:
Load /tmp/tmp.PwSkTg6227/libmasonx-interp-withcallbacks-perl-1.15 into
packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current.
Added:
packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/htdocs/alt.mc
Modified:
packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Build.PL
packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Changes
packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/MANIFEST
packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/META.yml
packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Makefile.PL
packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/README
packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/lib/MasonX/Interp/WithCallbacks.pm
packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/05object.t
packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/09cgi.t
Modified: packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Build.PL?rev=3084&op=diff
==============================================================================
--- packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Build.PL (original)
+++ packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Build.PL Sat Jun 17 15:33:44 2006
@@ -10,7 +10,7 @@
'HTML::Mason' => '1.23',
'Test::Simple' => '0.17',
'Class::Container' => '0.09',
- 'Params::CallbackRequest' => '1.11',
+ 'Params::CallbackRequest' => '1.15',
},
build_requires => {
'Test::Simple' => '0.17'
Modified: packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Changes?rev=3084&op=diff
==============================================================================
--- packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Changes (original)
+++ packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Changes Sat Jun 17 15:33:44 2006
@@ -1,4 +1,17 @@
Revision history for Perl extension MasonX::Interp::WithCallbacks.
+
+1.15 2006-05-26T23:02:03
+ - Added missing t/htdocs/alt.mc to MANIFEST and therefore to the
+ distribution. D'oh!
+
+1.14 2006-05-26T22:55:15
+ - Now passing the the interp object to callbacks via the new 'requster'
+ parameter the request() method of Params::CallbacRequest, introduced
+ in version 1.15 of that module.
+ - Added the comp_path() accessor. This so that callbacks can change it
+ if they want, by calling $cb->requester->comp_path($comp_path).
+ - Fixed CGI redirect tests to be compliant with the new "302 Found"
+ header created by CGI.pm. It used to be "302 Moved".
1.13 2004-11-19T02:37:50
- Makefile.PL no longer requires Apache::TestMB, since it may not
Modified: packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/MANIFEST?rev=3084&op=diff
==============================================================================
--- packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/MANIFEST (original)
+++ packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/MANIFEST Sat Jun 17 15:33:44 2006
@@ -16,6 +16,7 @@
t/09cgi.t
t/10pod.t
t/conf/extra.conf.in
+t/htdocs/alt.mc
t/htdocs/dhandler
t/lib/TestCallbacks.pm
t/lib/TieOut.pm
Modified: packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/META.yml?rev=3084&op=diff
==============================================================================
--- packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/META.yml (original)
+++ packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/META.yml Sat Jun 17 15:33:44 2006
@@ -1,22 +1,26 @@
---- #YAML:1.0
+---
name: MasonX-Interp-WithCallbacks
-version: 1.13
+version: 1.15
author:
- - David Wheeler <david at kineticode.com>
-abstract: |-
- Mason callback support via Params::CallbackRequest.
+ - 'David Wheeler <david at kineticode.com>'
+abstract: Mason callback support via Params::CallbackRequest.
license: perl
+resources:
+ license: http://dev.perl.org/licenses/
requires:
Class::Container: 0.09
HTML::Mason: 1.23
- Params::CallbackRequest: 1.11
+ Params::CallbackRequest: 1.15
+ Test::Simple: 0.17
+build_requires:
Test::Simple: 0.17
recommends:
Apache::TestMB: 0
-build_requires:
- Test::Simple: 0.17
provides:
MasonX::Interp::WithCallbacks:
file: lib/MasonX/Interp/WithCallbacks.pm
- version: 1.13
-generated_by: Module::Build version 0.2604
+ version: 1.15
+generated_by: Module::Build version 0.2801
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
Modified: packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Makefile.PL?rev=3084&op=diff
==============================================================================
--- packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Makefile.PL (original)
+++ packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/Makefile.PL Sat Jun 17 15:33:44 2006
@@ -17,15 +17,15 @@
# Save this 'cause CPAN will chdir all over the place.
my $cwd = Cwd::cwd();
- my $makefile = File::Spec->rel2abs($0);
- CPAN::Shell->install('Module::Build::Compat')
- or die " *** Cannot install without Module::Build. Exiting ...\n";
+ CPAN::Shell->install('Module::Build::Compat');
+ CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
+ or die "Couldn't install Module::Build, giving up.\n";
chdir $cwd or die "Cannot chdir() back to $cwd: $!";
}
eval "use Module::Build::Compat 0.02; 1" or die $@;
- use lib '_build/lib';
+
Module::Build::Compat->run_build_pl(args => \@ARGV);
require Apache::TestMB;
Module::Build::Compat->write_makefile(build_class => 'Apache::TestMB');
Modified: packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/README?rev=3084&op=diff
==============================================================================
--- packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/README (original)
+++ packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/README Sat Jun 17 15:33:44 2006
@@ -1,4 +1,4 @@
-MasonX/Interp/WithCallbacks version 1.13
+MasonX/Interp/WithCallbacks version 1.15
========================================
MasonX::Interp::WithCallbacks subclasses HTML::Mason::Interp in order to
@@ -52,7 +52,7 @@
COPYRIGHT AND LICENCE
-Copyright (C) 2003-2004 David Wheeler
+Copyright (C) 2003-2006 David Wheeler
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Modified: packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/lib/MasonX/Interp/WithCallbacks.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/lib/MasonX/Interp/WithCallbacks.pm?rev=3084&op=diff
==============================================================================
--- packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/lib/MasonX/Interp/WithCallbacks.pm (original)
+++ packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/lib/MasonX/Interp/WithCallbacks.pm Sat Jun 17 15:33:44 2006
@@ -8,13 +8,16 @@
use vars qw($VERSION @ISA);
@ISA = qw(HTML::Mason::Interp);
-$VERSION = '1.13';
+$VERSION = '1.15';
Params::Validate::validation_options
( on_fail => sub { HTML::Mason::Exception::Params->throw( join '', @_ ) } );
-use HTML::Mason::MethodMaker( read_only => [qw(cb_request)] );
+use HTML::Mason::MethodMaker(
+ read_only => [qw(cb_request)],
+ read_write => [qw(comp_path)],
+);
# We'll use this code reference to eval arguments passed in via httpd.conf
# PerlSetVar directives.
@@ -105,6 +108,7 @@
my ($self, %p) = @_;
# We have to grab the parameters and copy them into a hash.
my %params = @{$p{args}};
+ $self->{comp_path} = $p{comp};
# Grab the apache request object, if it exists.
my $apache_req = $p{apache_req}
@@ -112,20 +116,24 @@
|| $self->delayed_object_params('request', 'cgi_request');
# Execute the callbacks.
- my $ret = $self->{cb_request}->request(\%params, $apache_req ?
- (apache_req => $apache_req) :
- ());
+ my $ret = $self->{cb_request}->request(
+ \%params,
+ requester => $self,
+ $apache_req ? ( apache_req => $apache_req ) : (),
+ );
# Abort the request if that's what the callbacks want.
unless (ref $ret) {
$self->{cb_request}->clear_notes;
- HTML::Mason::Exception::Abort->throw
- ( error => 'Callback->abort was called',
- aborted_value => $ret );
+ HTML::Mason::Exception::Abort->throw(
+ error => 'Callback->abort was called',
+ aborted_value => $ret,
+ );
}
# Copy the parameters back -- too much copying!
$p{args} = [%params];
+ $p{comp} = $self->{comp_path};
# Get the request, copy the notes, and continue.
my $req = $self->SUPER::make_request(%p);
@@ -811,12 +819,45 @@
Params::CallbackRequest constructor and deleted from the
MasonX::Interp::WithCallbacks object. MasonX::Interp::WithCallbacks then
contains a Params::CallbackRequest object that it uses to handle the execution
-of all callbacks for each request. Thus MasonX::Interp::WithCallbacks adds a
-single accessor, C<cb_request()>, to return the Params::CallbackRequest
-object.
+of all callbacks for each request.
+
+=head3 cb_request
my $interp = MasonX::Interp::WithCallbacks->new;
my $cb_request = $interp->cb_request;
+
+Returns the Params::CallbackRequest object in use during the execution of
+C<make_request()>.
+
+=head3 comp_path
+
+ my $comp_path = $interp->comp_path;
+ $interp->comp_path($comp_path);
+
+Returns the component path resolved by Mason during the execution of
+C<handle_request()>. The cool thing is that it can be changed during the
+execution of callback methods:
+
+ sub change_path :Callback {
+ my $cb = shift;
+ my $interp = $cb->requester;
+ $inpter->comp_path($some_other_path);
+ }
+
+In this example, we have overridden the component path determined by the
+Mason resolver in favor of an alternate component, which will be executed,
+instead.
+
+=head2 Requester
+
+The MasonX::Interp::WithCallbacks object is available in all callback methods
+via the C<requester()> accessor:
+
+ sub access_interp :Callback {
+ my $cb = shift;
+ my $interp = $cb->requester;
+ # ...
+ }
=head2 Notes
@@ -860,7 +901,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright 2003-2004 by David Wheeler
+Copyright 2003-2006 by David Wheeler
This library is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
Modified: packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/05object.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/05object.t?rev=3084&op=diff
==============================================================================
--- packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/05object.t (original)
+++ packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/05object.t Sat Jun 17 15:33:44 2006
@@ -1,6 +1,6 @@
#!perl -w
-# $Id: 05object.t 682 2004-09-28 05:59:10Z theory $
+# $Id: 05object.t 2866 2006-05-26 22:54:37Z theory $
use strict;
use FindBin qw($Bin);
@@ -22,7 +22,7 @@
unless eval { require Attribute::Handlers }
and eval { require Class::ISA };
- plan tests => 130;
+ plan tests => 136;
}
##############################################################################
@@ -130,6 +130,17 @@
} else {
$params->{obj} = $self;
}
+}
+
+sub isa_interp : Callback {
+ my $self = shift;
+ main::isa_ok $self->requester, 'MasonX::Interp::WithCallbacks',
+ 'the requester object';
+}
+
+sub change_comp : Callback {
+ my $self = shift;
+ $self->requester->comp_path($self->value);
}
1;
@@ -348,6 +359,18 @@
# Check priority 0 sticks.
$interp->exec($comp, "$key|highest_cb" => undef);
$outbuf = '';
+
+ ##########################################################################
+ # Requester should be WithCallbacks object.
+ $interp->exec($comp, "$key|isa_interp_cb" => 1);
+ $outbuf = '';
+
+ ##########################################################################
+ # Changing the comp path should change the executed component.
+ $interp->exec($comp, "$key|change_comp_cb" => '/alt.mc');
+ is $outbuf, 'This is the alt component.',
+ 'The alt component should have executed';
+ $outbuf = '';
}
__END__
Modified: packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/09cgi.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/09cgi.t?rev=3084&op=diff
==============================================================================
--- packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/09cgi.t (original)
+++ packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/09cgi.t Sat Jun 17 15:33:44 2006
@@ -1,6 +1,6 @@
#!perl -w
-# $Id: 09cgi.t 682 2004-09-28 05:59:10Z theory $
+# $Id: 09cgi.t 2865 2006-05-26 22:35:27Z theory $
use strict;
use FindBin qw($Bin);
@@ -150,7 +150,7 @@
ok( $cgih->handle_request, "Handle redirection request" );
is( $outbuf, '', "Check redirection result" );
ok( my $out = $stdout->read, "Get contents of STDOUT" );
-like( $out, qr/Status: 302 Moved/, "Check Status header" );
+like( $out, qr/Status: 302 (?:Moved|Found)/, "Check Status header" );
like( $out, qr/Location: $url/, "Check Location header" );
clear_bufs;
@@ -160,7 +160,7 @@
"&$key|add_header_cb9=1";
ok( $cgih->handle_request, "Handle redirect w/o abort" );
ok( my $res = $stdout->read, "Get response headers" );
-like( $res, qr/Status: 302 Moved/, "Check for Status header" );
+like( $res, qr/Status: 302 (?:Moved|Found)/, "Check for Status header" );
like( $res, qr/Location: $url/, "Check for Location header" );
like( $res, qr/Age: 42/, "Check for age header" );
clear_bufs;
Added: packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/htdocs/alt.mc
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/htdocs/alt.mc?rev=3084&op=file
==============================================================================
--- packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/htdocs/alt.mc (added)
+++ packages/libmasonx-interp-withcallbacks-perl/branches/upstream/current/t/htdocs/alt.mc Sat Jun 17 15:33:44 2006
@@ -1,0 +1,1 @@
+% $m->print('This is the alt component.');
More information about the Pkg-perl-cvs-commits
mailing list