Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / MooseX / Declare / Syntax / Extending.pm
1 package MooseX::Declare::Syntax::Extending;
2
3 use Moose::Role;
4
5 use aliased 'MooseX::Declare::Context::Namespaced';
6
7 use namespace::clean -except => 'meta';
8
9 with qw(
10     MooseX::Declare::Syntax::OptionHandling
11 );
12
13 around context_traits => sub { shift->(@_), Namespaced };
14
15 sub add_extends_option_customizations {
16     my ($self, $ctx, $package, $superclasses) = @_;
17
18     # add code for extends keyword
19     $ctx->add_scope_code_parts(
20         sprintf 'extends %s',
21             join ', ',
22             map  { "'$_'" }
23             map  { $ctx->qualify_namespace($_) }
24                 @{ $superclasses },
25     );
26
27     return 1;
28 }
29
30 1;
31
32 __END__
33
34 =head1 NAME
35
36 MooseX::Declare::Syntax::Extending - Extending with superclasses
37
38 =head1 DESCRIPTION
39
40 Extends a class by a specified C<extends> option.
41
42 =head1 CONSUMES
43
44 =over
45
46 =item * L<MooseX::Declare::Syntax::OptionHandling>
47
48 =back
49
50 =head1 METHODS
51
52 =head2 add_extends_option_customizations
53
54   Object->add_extends_option_customizations (
55       Object   $ctx,
56       Str      $package,
57       ArrayRef $superclasses,
58       HashRef  $options
59   )
60
61 This will add a code part that will call C<extends> with the C<$superclasses>
62 as arguments.
63
64 =head1 SEE ALSO
65
66 =over
67
68 =item * L<MooseX::Declare>
69
70 =item * L<MooseX::Declare::Syntax::Keyword::Class>
71
72 =item * L<MooseX::Declare::Syntax::OptionHandling>
73
74 =back
75
76 =head1 AUTHOR, COPYRIGHT & LICENSE
77
78 See L<MooseX::Declare>
79
80 =cut