[Catalyst-commits] r11108 - in Catalyst-Plugin-Browser/trunk: .
lib/Catalyst/Plugin
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Mon Aug 10 22:41:31 GMT 2009
Author: rafl
Date: 2009-08-10 22:41:30 +0000 (Mon, 10 Aug 2009)
New Revision: 11108
Modified:
Catalyst-Plugin-Browser/trunk/Makefile.PL
Catalyst-Plugin-Browser/trunk/lib/Catalyst/Plugin/Browser.pm
Log:
Convert to a role that only applies a request class role.
Modified: Catalyst-Plugin-Browser/trunk/Makefile.PL
===================================================================
--- Catalyst-Plugin-Browser/trunk/Makefile.PL 2009-08-10 22:32:59 UTC (rev 11107)
+++ Catalyst-Plugin-Browser/trunk/Makefile.PL 2009-08-10 22:41:30 UTC (rev 11108)
@@ -5,8 +5,11 @@
name 'Catalyst-Plugin-Browser';
all_from 'lib/Catalyst/Plugin/Browser.pm';
-requires 'Catalyst::Runtime' => '5.7006';
-requires 'HTTP::BrowserDetect';
+requires 'Catalyst::Runtime' => '5.80004';
+requires 'CatalystX::RoleApplicator';
+requires 'Catalyst::TraitFor::Request::BrowserDetect';
+requires 'namespace::autoclean';
+requires 'Moose';
auto_install;
resources repository => 'http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Plugin-Browser/';
Modified: Catalyst-Plugin-Browser/trunk/lib/Catalyst/Plugin/Browser.pm
===================================================================
--- Catalyst-Plugin-Browser/trunk/lib/Catalyst/Plugin/Browser.pm 2009-08-10 22:32:59 UTC (rev 11107)
+++ Catalyst-Plugin-Browser/trunk/lib/Catalyst/Plugin/Browser.pm 2009-08-10 22:41:30 UTC (rev 11108)
@@ -1,25 +1,22 @@
package Catalyst::Plugin::Browser;
-use strict;
-use Catalyst::Request;
-use HTTP::BrowserDetect;
+use Moose::Role;
+use CatalystX::RoleApplicator ();
+use namespace::autoclean;
our $VERSION = '0.05';
-{
- package Catalyst::Request;
+after setup_finalize => sub {
+ my ($app) = @_;
- sub browser {
- my $self = shift;
+ # yeah, i know. sue me.
+ CatalystX::RoleApplicator->init_meta(for_class => $app);
- unless ( $self->{browser} ) {
- $self->{browser} = HTTP::BrowserDetect->new( $self->user_agent );
- }
+ $app->apply_request_class_roles(qw/
+ Catalyst::TraitFor::Request::BrowserDetect
+ /);
+};
- return $self->{browser};
- }
-}
-
1;
__END__
More information about the Catalyst-commits
mailing list