Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / i486-linux-gnu-thread-multi / Squirrel.pm
CommitLineData
3fea05b9 1package Squirrel;
2use strict;
3use warnings;
4
5sub _choose_backend {
6 if ( $INC{"Moose.pm"} ) {
7 return {
8 backend => 'Moose',
9 import => \&Moose::import,
10 unimport => \&Moose::unimport,
11 };
12 } else {
13 require Mouse;
14 return {
15 backend => 'Mouse',
16 import => \&Mouse::import,
17 unimport => \&Mouse::unimport,
18 };
19 }
20}
21
22my %pkgs;
23
24sub _handlers {
25 my $class = shift;
26
27 my $caller = caller(1);
28
29 $pkgs{$caller} ||= $class->_choose_backend;
30}
31
32sub import {
33 require Carp;
34 Carp::carp("Squirrel is deprecated. Please use Any::Moose instead. It fixes a number of design problems that Squirrel has.");
35
36 my $handlers = shift->_handlers;
37 unshift @_, $handlers->{backend};
38 goto &{$handlers->{import}};
39}
40
41sub unimport {
42 my $handlers = shift->_handlers;
43 unshift @_, $handlers->{backend};
44 goto &{$handlers->{unimport}};
45}
46
471;
48
49__END__
50
51=pod
52
53=head1 NAME
54
55Squirrel - Use Mouse, unless Moose is already loaded. (DEPRECATED)
56
57=head1 SYNOPSIS
58
59 use Squirrel;
60
61 has goggles => (
62 is => "rw",
63 );
64
65=head1 DEPRECATION
66
67C<Squirrel> is deprecated. C<Any::Moose> provides the same functionality,
68but better. :)
69
70=head1 DESCRIPTION
71
72L<Moose> and L<Squirrel> are THE BEST FRIENDS, but if L<Moose> isn't there
73L<Squirrel> will hang out with L<Mouse> as well.
74
75When your own code doesn't actually care whether or not you use L<Moose> or
76L<Mouse> you can use either, and let your users decide for you.
77
78This lets you run with minimal dependencies and have a faster startup, but if
79L<Moose> is already in use you get all the benefits of using that
80(transformability, introspection, more opportunities for code reuse, etc).
81
82=head1 SEE ALSO
83
84L<Any::Moose>
85
86=cut
87
88