X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSquirrel.pm;h=f73f8670fc6547511d3eb4a935b1b3bc385708bb;hb=1b9e472d8c7e704eced9b2ea83194f83f0265018;hp=039b7e4ac1442c96c85251d18c44f1b26baefade;hpb=103ad0e3c4ee7115e49ae896f7f4d8afd2e72c16;p=gitmo%2FMouse.git diff --git a/lib/Squirrel.pm b/lib/Squirrel.pm index 039b7e4..f73f867 100644 --- a/lib/Squirrel.pm +++ b/lib/Squirrel.pm @@ -1,22 +1,21 @@ -#!/usr/bin/perl - package Squirrel; - use strict; use warnings; sub _choose_backend { if ( $INC{"Moose.pm"} ) { return { + backend => 'Moose', import => \&Moose::import, unimport => \&Moose::unimport, - } + }; } else { require Mouse; return { + backend => 'Mouse', import => \&Mouse::import, unimport => \&Mouse::unimport, - } + }; } } @@ -31,14 +30,21 @@ sub _handlers { } sub import { - goto $_[0]->_handlers->{import}; + require Carp; + Carp::carp("Squirrel is deprecated. Please use Any::Moose instead. It fixes a number of design problems that Squirrel has."); + + my $handlers = shift->_handlers; + unshift @_, $handlers->{backend}; + goto &{$handlers->{import}}; } sub unimport { - goto $_[0]->_handlers->{unimport}; + my $handlers = shift->_handlers; + unshift @_, $handlers->{backend}; + goto &{$handlers->{unimport}}; } -__PACKAGE__ +1; __END__ @@ -56,6 +62,11 @@ Squirrel - Use L, unless L is already loaded. is => "rw", ); +=head1 DEPRECATION + +L is deprecated. L provides the same functionality, +but better. :) + =head1 DESCRIPTION L and L are TEH BEST FRENDS, but if L isn't there @@ -65,7 +76,8 @@ When your own code doesn't actually care whether or not you use L or L you can use either, and let your users decide for you. This lets you run with minimal dependencies and have a faster startup, but if -L is already in use you get all the benefits of using that. +L is already in use you get all the benefits of using that +(transformability, introspection, more opportunities for code reuse, etc). =cut