Merge
Tomas Doran (t0m) [Thu, 11 Jun 2009 09:29:30 +0000 (10:29 +0100)]
Makefile.PL
lib/Catalyst/Component/ACCEPT_CONTEXT.pm
t/preserve-object.t

index 05fd7fb..98ed9c9 100644 (file)
@@ -9,6 +9,9 @@ requires 'Catalyst';
 requires 'Scalar::Util';
 requires 'MRO::Compat';
 build_requires 'Devel::Cycle';
+
+resources respository => 'git://git.shadowcat.co.uk/catagits/Catalyst-Component-ACCEPT_CONTEXT';
+
 auto_install;
 WriteAll;
 
index 1a6f0a8..e77e4d7 100644 (file)
@@ -42,7 +42,7 @@ your model:
 Using this module is somewhat of a hack.  Changing the state of your
 objects on every request is a pretty braindead way of doing OO.  If
 you want your application to be brain-live, then you should use
-L<Catalyst::Component::InstancePerContext|Catalyst::Component::InstancePerContext>.
+L<Catalyst::Component::InstancePerContext>.
 
 Instead of doing this on every request (which is basically
 what this module does):
@@ -143,6 +143,16 @@ sub COMPONENT {
 
 Jonathan Rockway, C<< <jrockway at cpan.org> >>
 
+Patches contributed and maintained by:
+
+=over
+
+=item Rafael Kitover (Caelum)
+
+=item Tomas Doran (t0m) C<< <bobtfish@bobtfish.net> >>
+
+=back
+
 =head1 BUGS
 
 Please report any bugs or feature requests to
@@ -183,6 +193,12 @@ L<http://search.cpan.org/dist/Catalyst-Component-ACCEPT_CONTEXT>
 
 =back
 
+=head1 Source code
+
+The source code for this project can be found at:
+
+    git://git.shadowcat.co.uk/catagits/Catalyst-Component-ACCEPT_CONTEXT
+
 =head1 COPYRIGHT & LICENSE
 
 Copyright 2007 Jonathan Rockway.
index 23a174a..7b6d2c5 100644 (file)
@@ -1,19 +1,15 @@
 #!/usr/bin/env perl
-
 use strict;
 use warnings;
-use Test::More tests => 4;
-
-my $app = 'MyApp';
 
-my $foo = Foo->COMPONENT($app, { args => 'yes' });
-is $foo->{args}, 'yes', 'foo created';
-is $foo->context->app, 'oh yeah', 'got app';
+{
+    package MyApp;
+    use Moose;
+    use Catalyst;
+    no Moose;
 
-my $ctx = { ctx => 'it is' };
-my $foo2 = $foo->ACCEPT_CONTEXT($ctx);
-is $foo, $foo2, 'foo and foo2 are the same ref';
-is $foo->context->{ctx}, 'it is', 'got ctx';
+    sub _is_this_the_app { 'oh yeah' }
+}
 
 {
     package Foo;
@@ -23,8 +19,19 @@ is $foo->context->{ctx}, 'it is', 'got ctx';
         my $class = shift;
         return $class->next::method(@_);
     }
-
-    package MyApp;
-    use Catalyst;
-    sub app { 'oh yeah' }
 }
+
+use Test::More tests => 4;
+use Scalar::Util qw/refaddr/;
+
+my $app_class = 'MyApp';
+
+my $foo = Foo->COMPONENT($app_class, { args => 'yes' });
+is $foo->{args}, 'yes', 'foo created';
+is $foo->context->_is_this_the_app, 'oh yeah', 'got app';
+
+my $ctx = { };
+my $foo2 = $foo->ACCEPT_CONTEXT($ctx);
+is refaddr($foo), refaddr($foo2), 'foo and foo2 are the same ref';
+is refaddr($foo->context), refaddr($ctx), 'got ctx';
+