summaryrefslogtreecommitdiff
path: root/lib/Enigmatic/Role/WithWiring.pm
blob: 063fb087af0c96a0d675ee05ff04b9c17d4896bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package Enigmatic::Role::WithWiring; 
use DAKKAR::p 'role';
 
requires 'BUILDARGS';
requires 'wiring';
 
around BUILDARGS => sub {
    my $orig  = shift;
    my $class = shift;
 
    if ( @_ == 1 && !ref $_[0] ) {
        return $class->$origwiring => $_[0] );
    }
    else {
        return $class->$orig(@_);
    }
};
 
__END__
 
=head1 AUTHOR
 
Gianni Ceccarelli <dakkar@thenautilus.net>
 
=head1 COPYRIGHT AND LICENSE
 
This software is copyright (c) 2011 by Gianni Ceccarelli.
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, version 3.
 
=cut