slots

 view release on metacpan or  search on metacpan

lib/slots.pm  view on Meta::CPAN

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
our $AUTHORITY = 'cpan:STEVAN';
 
sub import {
    shift;
    my $pkg   = caller(0);
    my $meta  = MOP::Util::get_meta( $pkg );
    my %slots = @_;
 
    $meta->add_slot( $_, $slots{ $_ } ) for keys %slots;
 
    MOP::Util::defer_until_UNITCHECK(sub {
        MOP::Util::inherit_slots( MOP::Util::get_meta( $pkg ) )
    });
}
 
1;
 
__END__
 
=pod

lib/slots.pm  view on Meta::CPAN

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
    }
 
=head1 DESCRIPTION
 
This is a very simple pragma which takes a set of key/value
arguments and assigns it to the C<%HAS> package variable of
the calling class.
 
This module will also detect superclasses and insure that
slots are inherited correctly, this wil occur during the
next available UNITCHECK phase.
 
=head1 AUTHOR
 
Stevan Little <stevan@cpan.org>
 
=head1 COPYRIGHT AND LICENSE
 
This software is copyright (c) 2017, 2018 by Stevan Little.
 
This is free software; you can redistribute it and/or modify it under



( run in 0.377 second using v1.01-cache-2.11-cpan-a5abf4f5562 )