2 package Moose::Meta::Role;
8 use Scalar::Util 'blessed';
10 use Devel::GlobalDestruction 'in_global_destruction';
12 our $VERSION = '1.14';
13 $VERSION = eval $VERSION;
14 our $AUTHORITY = 'cpan:STEVAN';
16 use Moose::Meta::Class;
17 use Moose::Meta::Role::Attribute;
18 use Moose::Meta::Role::Method;
19 use Moose::Meta::Role::Method::Required;
20 use Moose::Meta::Role::Method::Conflicting;
21 use Moose::Util qw( ensure_all_roles );
22 use Class::MOP::MiniTrait;
24 use base 'Class::MOP::Module',
25 'Class::MOP::Mixin::HasAttributes',
26 'Class::MOP::Mixin::HasMethods';
28 Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait');
30 ## ------------------------------------------------------------------
32 ## I normally don't do this, but I am doing
33 ## a whole bunch of meta-programmin in this
34 ## module, so it just makes sense. For a clearer
35 ## picture of what is going on in the next
36 ## several lines of code, look at the really
37 ## big comment at the end of this file (right
40 ## ------------------------------------------------------------------
42 my $META = __PACKAGE__->meta;
44 ## ------------------------------------------------------------------
48 # since roles are lazy, we hold all the attributes
49 # of the individual role in 'statis' until which
50 # time when it is applied to a class. This means
51 # keeping a lot of things in hash maps, so we are
52 # using a little of that meta-programmin' magic
53 # here an saving lots of extra typin. And since
54 # many of these attributes above require similar
55 # functionality to support them, so we again use
56 # the wonders of meta-programmin' to deliver a
57 # very compact solution to this normally verbose
63 name => 'excluded_roles_map',
64 attr_reader => 'get_excluded_roles_map' ,
66 add => 'add_excluded_roles',
67 get_keys => 'get_excluded_roles_list',
68 existence => 'excludes_role',
72 name => 'required_methods',
73 attr_reader => 'get_required_methods_map',
75 remove => 'remove_required_methods',
76 get_values => 'get_required_method_list',
77 existence => 'requires_method',
82 my $attr_reader = $action->{attr_reader};
83 my $methods = $action->{methods};
85 # create the attribute
86 $META->add_attribute($action->{name} => (
87 reader => $attr_reader,
91 # create some helper methods
92 $META->add_method($methods->{add} => sub {
93 my ($self, @values) = @_;
94 $self->$attr_reader->{$_} = undef foreach @values;
95 }) if exists $methods->{add};
97 $META->add_method($methods->{get_keys} => sub {
99 keys %{$self->$attr_reader};
100 }) if exists $methods->{get_keys};
102 $META->add_method($methods->{get_values} => sub {
104 values %{$self->$attr_reader};
105 }) if exists $methods->{get_values};
107 $META->add_method($methods->{get} => sub {
108 my ($self, $name) = @_;
109 $self->$attr_reader->{$name}
110 }) if exists $methods->{get};
112 $META->add_method($methods->{existence} => sub {
113 my ($self, $name) = @_;
114 exists $self->$attr_reader->{$name} ? 1 : 0;
115 }) if exists $methods->{existence};
117 $META->add_method($methods->{remove} => sub {
118 my ($self, @values) = @_;
119 delete $self->$attr_reader->{$_} foreach @values;
120 }) if exists $methods->{remove};
123 $META->add_attribute(
125 reader => 'method_metaclass',
126 default => 'Moose::Meta::Role::Method',
129 $META->add_attribute(
130 'required_method_metaclass',
131 reader => 'required_method_metaclass',
132 default => 'Moose::Meta::Role::Method::Required',
135 $META->add_attribute(
136 'conflicting_method_metaclass',
137 reader => 'conflicting_method_metaclass',
138 default => 'Moose::Meta::Role::Method::Conflicting',
141 $META->add_attribute(
142 'application_to_class_class',
143 reader => 'application_to_class_class',
144 default => 'Moose::Meta::Role::Application::ToClass',
147 $META->add_attribute(
148 'application_to_role_class',
149 reader => 'application_to_role_class',
150 default => 'Moose::Meta::Role::Application::ToRole',
153 $META->add_attribute(
154 'application_to_instance_class',
155 reader => 'application_to_instance_class',
156 default => 'Moose::Meta::Role::Application::ToInstance',
159 # More or less copied from Moose::Meta::Class
163 return Class::MOP::get_metaclass_by_name($pkg)
164 || $class->SUPER::initialize(
166 'attribute_metaclass' => 'Moose::Meta::Role::Attribute',
175 my $meta = blessed $pkg ? $pkg : Class::MOP::class_of($pkg);
177 my %existing_classes;
179 %existing_classes = map { $_ => $meta->$_() } qw(
182 wrapped_method_metaclass
183 required_method_metaclass
184 conflicting_method_metaclass
185 application_to_class_class
186 application_to_role_class
187 application_to_instance_class
191 return $self->SUPER::reinitialize(
201 if (blessed $_[0] && ! $_[0]->isa('Moose::Meta::Role::Attribute') ) {
202 my $class = ref $_[0];
203 Moose->throw_error( "Cannot add a $class as an attribute to a role" );
205 elsif (!blessed($_[0]) && defined($_[0]) && $_[0] =~ /^\+(.*)/) {
206 Moose->throw_error( "has '+attr' is not supported in roles" );
209 return $self->SUPER::add_attribute(@_);
212 sub _attach_attribute {
213 my ( $self, $attribute ) = @_;
215 $attribute->attach_to_role($self);
218 sub add_required_methods {
223 if (!blessed($method)) {
224 $method = $self->required_method_metaclass->new(
228 $self->get_required_methods_map->{$method->name} = $method;
232 sub add_conflicting_method {
236 if (@_ == 1 && blessed($_[0])) {
240 $method = $self->conflicting_method_metaclass->new(@_);
243 $self->add_required_methods($method);
246 ## ------------------------------------------------------------------
250 # the before/around/after method modifiers are
251 # stored by name, but there can be many methods
252 # then associated with that name. So again we have
253 # lots of similar functionality, so we can do some
254 # meta-programmin' and save some time.
257 foreach my $modifier_type (qw[ before around after ]) {
259 my $attr_reader = "get_${modifier_type}_method_modifiers_map";
261 # create the attribute ...
262 $META->add_attribute("${modifier_type}_method_modifiers" => (
263 reader => $attr_reader,
264 default => sub { {} }
267 # and some helper methods ...
268 $META->add_method("get_${modifier_type}_method_modifiers" => sub {
269 my ($self, $method_name) = @_;
270 #return () unless exists $self->$attr_reader->{$method_name};
271 my $mm = $self->$attr_reader->{$method_name};
275 $META->add_method("has_${modifier_type}_method_modifiers" => sub {
276 my ($self, $method_name) = @_;
278 # for now we assume that if it exists,..
279 # it has at least one modifier in it
280 (exists $self->$attr_reader->{$method_name}) ? 1 : 0;
283 $META->add_method("add_${modifier_type}_method_modifier" => sub {
284 my ($self, $method_name, $method) = @_;
286 $self->$attr_reader->{$method_name} = []
287 unless exists $self->$attr_reader->{$method_name};
289 my $modifiers = $self->$attr_reader->{$method_name};
292 # check to see that we aren't adding the
293 # same code twice. We err in favor of the
294 # first on here, this may not be as expected
295 foreach my $modifier (@{$modifiers}) {
296 return if $modifier == $method;
299 push @{$modifiers} => $method;
304 ## ------------------------------------------------------------------
305 ## override method mofidiers
307 $META->add_attribute('override_method_modifiers' => (
308 reader => 'get_override_method_modifiers_map',
309 default => sub { {} }
313 # these are a little different because there
314 # can only be one per name, whereas the other
315 # method modifiers can have multiples.
318 sub add_override_method_modifier {
319 my ($self, $method_name, $method) = @_;
320 (!$self->has_method($method_name))
321 || Moose->throw_error("Cannot add an override of method '$method_name' " .
322 "because there is a local version of '$method_name'");
323 $self->get_override_method_modifiers_map->{$method_name} = $method;
326 sub has_override_method_modifier {
327 my ($self, $method_name) = @_;
329 # for now we assume that if it exists,..
330 # it has at least one modifier in it
331 (exists $self->get_override_method_modifiers_map->{$method_name}) ? 1 : 0;
334 sub get_override_method_modifier {
335 my ($self, $method_name) = @_;
336 $self->get_override_method_modifiers_map->{$method_name};
339 ## general list accessor ...
341 sub get_method_modifier_list {
342 my ($self, $modifier_type) = @_;
343 my $accessor = "get_${modifier_type}_method_modifiers_map";
344 keys %{$self->$accessor};
347 sub reset_package_cache_flag { (shift)->{'_package_cache_flag'} = undef }
348 sub update_package_cache_flag {
350 $self->{'_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name);
355 ## ------------------------------------------------------------------
358 $META->add_attribute('roles' => (
359 reader => 'get_roles',
360 default => sub { [] }
364 my ($self, $role) = @_;
365 (blessed($role) && $role->isa('Moose::Meta::Role'))
366 || Moose->throw_error("Roles must be instances of Moose::Meta::Role");
367 push @{$self->get_roles} => $role;
368 $self->reset_package_cache_flag;
371 sub calculate_all_roles {
377 $_->calculate_all_roles
378 } @{ $self->get_roles });
382 my ($self, $role) = @_;
384 || Moose->throw_error("You must supply a role name to look for");
385 my $role_name = blessed $role ? $role->name : $role;
386 # if we are it,.. then return true
387 return 1 if $role_name eq $self->name;
388 # otherwise.. check our children
389 foreach my $role (@{$self->get_roles}) {
390 return 1 if $role->does_role($role_name);
395 sub find_method_by_name { (shift)->get_method(@_) }
397 ## ------------------------------------------------------------------
399 ## ------------------------------------------------------------------
402 my ($self, $other, %args) = @_;
405 || Moose->throw_error("You must pass in an blessed instance");
407 my $application_class;
408 if ($other->isa('Moose::Meta::Role')) {
409 $application_class = $self->application_to_role_class;
411 elsif ($other->isa('Moose::Meta::Class')) {
412 $application_class = $self->application_to_class_class;
415 $application_class = $self->application_to_instance_class;
418 Class::MOP::load_class($application_class);
419 return $application_class->new(%args)->apply($self, $other, \%args);
422 sub composition_class_roles { }
425 my ($class, @role_specs) = @_;
427 require Moose::Meta::Role::Composite;
429 my (@roles, %role_params);
430 while (@role_specs) {
431 my ($role, $params) = @{ splice @role_specs, 0, 1 };
435 : Class::MOP::class_of($role);
437 my $actual_role = $requested_role->_role_for_combination($params);
438 push @roles => $actual_role;
440 next unless defined $params;
441 $role_params{$actual_role->name} = $params;
444 my $c = Moose::Meta::Role::Composite->new(roles => \@roles);
445 return $c->apply_params(\%role_params);
448 sub _role_for_combination {
449 my ($self, $params) = @_;
454 my ( $role, $package_name, %options ) = @_;
456 $options{package} = $package_name;
458 (ref $options{attributes} eq 'HASH')
459 || confess "You must pass a HASH ref of attributes"
460 if exists $options{attributes};
462 (ref $options{methods} eq 'HASH')
463 || confess "You must pass a HASH ref of methods"
464 if exists $options{methods};
466 my (%initialize_options) = %options;
467 delete @initialize_options{qw(
475 my $meta = $role->initialize( $package_name => %initialize_options );
477 $meta->_instantiate_module( $options{version}, $options{authority} );
480 $meta->add_method('meta' => sub {
481 $role->initialize(ref($_[0]) || $_[0]);
484 if (exists $options{attributes}) {
485 foreach my $attribute_name (keys %{$options{attributes}}) {
486 my $attr = $options{attributes}->{$attribute_name};
487 $meta->add_attribute(
488 $attribute_name => blessed $attr ? $attr : %{$attr} );
492 if (exists $options{methods}) {
493 foreach my $method_name (keys %{$options{methods}}) {
494 $meta->add_method($method_name, $options{methods}->{$method_name});
498 Class::MOP::weaken_metaclass($meta->name)
499 if $meta->is_anon_role;
507 for my $meta (Class::MOP::get_all_metaclass_instances) {
508 next if $meta->name eq $self->name;
509 next unless $meta->isa('Moose::Meta::Class')
510 || $meta->isa('Moose::Meta::Role');
511 push @consumers, $meta->name
512 if $meta->does_role($self->name);
517 # anonymous roles. most of it is copied straight out of Class::MOP::Class.
518 # an intrepid hacker might find great riches if he unifies this code with that
519 # code in Class::MOP::Module or Class::MOP::Package
522 # this should be sufficient, if you have a
523 # use case where it is not, write a test and
525 my $ANON_ROLE_SERIAL = 0;
528 # we need a sufficiently annoying prefix
529 # this should suffice for now, this is
530 # used in a couple of places below, so
531 # need to put it up here for now.
532 my $ANON_ROLE_PREFIX = 'Moose::Meta::Role::__ANON__::SERIAL::';
536 no warnings 'uninitialized';
537 $self->name =~ /^$ANON_ROLE_PREFIX/;
540 sub create_anon_role {
541 my ($role, %options) = @_;
542 my $package_name = $ANON_ROLE_PREFIX . ++$ANON_ROLE_SERIAL;
543 return $role->create($package_name, %options);
547 # this will only get called for
548 # anon-roles, all other calls
549 # are assumed to occur during
550 # global destruction and so don't
551 # really need to be handled explicitly
555 return if in_global_destruction(); # it'll happen soon anyway and this just makes things more complicated
557 no warnings 'uninitialized';
558 return unless $self->name =~ /^$ANON_ROLE_PREFIX/;
560 # XXX: is this necessary for us? I don't understand what it's doing
563 # Moose does a weird thing where it replaces the metaclass for
564 # class when fixing metaclass incompatibility. In that case,
565 # we don't want to clean out the namespace now. We can detect
566 # that because Moose will explicitly update the singleton
567 # cache in Class::MOP.
568 #my $current_meta = Class::MOP::get_metaclass_by_name($self->name);
569 #return if $current_meta ne $self;
571 my ($serial_id) = ($self->name =~ /^$ANON_ROLE_PREFIX(\d+)/);
573 foreach my $key (keys %{$ANON_ROLE_PREFIX . $serial_id}) {
574 delete ${$ANON_ROLE_PREFIX . $serial_id}{$key};
576 delete ${'main::' . $ANON_ROLE_PREFIX}{$serial_id . '::'};
580 #####################################################################
582 ## This is Moose::Meta::Role as defined by Moose (plus the use of
583 ## MooseX::AttributeHelpers module). It is here as a reference to
584 ## make it easier to see what is happening above with all the meta
586 #####################################################################
589 # metaclass => 'Array',
590 # reader => 'get_roles',
591 # isa => 'ArrayRef[Moose::Meta::Role]',
592 # default => sub { [] },
594 # 'push' => 'add_role',
598 # has 'excluded_roles_map' => (
599 # metaclass => 'Hash',
600 # reader => 'get_excluded_roles_map',
601 # isa => 'HashRef[Str]',
603 # # Not exactly set, cause it sets multiple
604 # 'set' => 'add_excluded_roles',
605 # 'keys' => 'get_excluded_roles_list',
606 # 'exists' => 'excludes_role',
610 # has 'required_methods' => (
611 # metaclass => 'Hash',
612 # reader => 'get_required_methods_map',
613 # isa => 'HashRef[Moose::Meta::Role::Method::Required]',
615 # # not exactly set, or delete since it works for multiple
616 # 'set' => 'add_required_methods',
617 # 'delete' => 'remove_required_methods',
618 # 'keys' => 'get_required_method_list',
619 # 'exists' => 'requires_method',
623 # # the before, around and after modifiers are
624 # # HASH keyed by method-name, with ARRAY of
625 # # CODE refs to apply in that order
627 # has 'before_method_modifiers' => (
628 # metaclass => 'Hash',
629 # reader => 'get_before_method_modifiers_map',
630 # isa => 'HashRef[ArrayRef[CodeRef]]',
632 # 'keys' => 'get_before_method_modifiers',
633 # 'exists' => 'has_before_method_modifiers',
634 # # This actually makes sure there is an
635 # # ARRAY at the given key, and pushed onto
636 # # it. It also checks for duplicates as well
637 # # 'add' => 'add_before_method_modifier'
641 # has 'after_method_modifiers' => (
642 # metaclass => 'Hash',
643 # reader =>'get_after_method_modifiers_map',
644 # isa => 'HashRef[ArrayRef[CodeRef]]',
646 # 'keys' => 'get_after_method_modifiers',
647 # 'exists' => 'has_after_method_modifiers',
648 # # This actually makes sure there is an
649 # # ARRAY at the given key, and pushed onto
650 # # it. It also checks for duplicates as well
651 # # 'add' => 'add_after_method_modifier'
655 # has 'around_method_modifiers' => (
656 # metaclass => 'Hash',
657 # reader =>'get_around_method_modifiers_map',
658 # isa => 'HashRef[ArrayRef[CodeRef]]',
660 # 'keys' => 'get_around_method_modifiers',
661 # 'exists' => 'has_around_method_modifiers',
662 # # This actually makes sure there is an
663 # # ARRAY at the given key, and pushed onto
664 # # it. It also checks for duplicates as well
665 # # 'add' => 'add_around_method_modifier'
669 # # override is similar to the other modifiers
670 # # except that it is not an ARRAY of code refs
671 # # but instead just a single name->code mapping
673 # has 'override_method_modifiers' => (
674 # metaclass => 'Hash',
675 # reader =>'get_override_method_modifiers_map',
676 # isa => 'HashRef[CodeRef]',
678 # 'keys' => 'get_override_method_modifier',
679 # 'exists' => 'has_override_method_modifier',
680 # 'add' => 'add_override_method_modifier', # checks for local method ..
684 #####################################################################
695 Moose::Meta::Role - The Moose Role metaclass
699 This class is a subclass of L<Class::MOP::Module> that provides
700 additional Moose-specific functionality.
702 It's API looks a lot like L<Moose::Meta::Class>, but internally it
703 implements many things differently. This may change in the future.
707 C<Moose::Meta::Role> is a subclass of L<Class::MOP::Module>.
715 =item B<< Moose::Meta::Role->initialize($role_name) >>
717 This method creates a new role object with the provided name.
719 =item B<< Moose::Meta::Role->combine( [ $role => { ... } ], [ $role ], ... ) >>
721 This method accepts a list of array references. Each array reference
722 should contain a role name or L<Moose::Meta::Role> object as its first element. The second element is
723 an optional hash reference. The hash reference can contain C<-excludes>
724 and C<-alias> keys to control how methods are composed from the role.
726 The return value is a new L<Moose::Meta::Role::Composite> that
727 represents the combined roles.
729 =item B<< $metarole->composition_class_roles >>
731 When combining multiple roles using C<combine>, this method is used to obtain a
732 list of role names to be applied to the L<Moose::Meta::Role::Composite>
733 instance returned by C<combine>. The default implementation returns an empty
734 list. Extensions that need to hook into role combination may wrap this method
735 to return additional role names.
737 =item B<< Moose::Meta::Role->create($name, %options) >>
739 This method is identical to the L<Moose::Meta::Class> C<create>
742 =item B<< Moose::Meta::Role->create_anon_role >>
744 This method is identical to the L<Moose::Meta::Class>
745 C<create_anon_class> method.
747 =item B<< $metarole->is_anon_role >>
749 Returns true if the role is an anonymous role.
751 =item B<< $metarole->consumers >>
753 Returns a list of names of classes and roles which consume this role.
757 =head2 Role application
761 =item B<< $metarole->apply( $thing, @options ) >>
763 This method applies a role to the given C<$thing>. That can be another
764 L<Moose::Meta::Role>, object, a L<Moose::Meta::Class> object, or a
765 (non-meta) object instance.
767 The options are passed directly to the constructor for the appropriate
768 L<Moose::Meta::Role::Application> subclass.
770 Note that this will apply the role even if the C<$thing> in question already
771 C<does> this role. L<Moose::Util/does_role> is a convenient wrapper for
772 finding out if role application is necessary.
776 =head2 Roles and other roles
780 =item B<< $metarole->get_roles >>
782 This returns an array reference of roles which this role does. This
783 list may include duplicates.
785 =item B<< $metarole->calculate_all_roles >>
787 This returns a I<unique> list of all roles that this role does, and
788 all the roles that its roles do.
790 =item B<< $metarole->does_role($role) >>
792 Given a role I<name> or L<Moose::Meta::Role> object, returns true if this role
795 =item B<< $metarole->add_role($role) >>
797 Given a L<Moose::Meta::Role> object, this adds the role to the list of
798 roles that the role does.
800 =item B<< $metarole->get_excluded_roles_list >>
802 Returns a list of role names which this role excludes.
804 =item B<< $metarole->excludes_role($role_name) >>
806 Given a role I<name>, returns true if this role excludes the named
809 =item B<< $metarole->add_excluded_roles(@role_names) >>
811 Given one or more role names, adds those roles to the list of excluded
818 The methods for dealing with a role's methods are all identical in API
819 and behavior to the same methods in L<Class::MOP::Class>.
823 =item B<< $metarole->method_metaclass >>
825 Returns the method metaclass name for the role. This defaults to
826 L<Moose::Meta::Role::Method>.
828 =item B<< $metarole->get_method($name) >>
830 =item B<< $metarole->has_method($name) >>
832 =item B<< $metarole->add_method( $name, $body ) >>
834 =item B<< $metarole->get_method_list >>
836 =item B<< $metarole->find_method_by_name($name) >>
838 These methods are all identical to the methods of the same name in
839 L<Class::MOP::Package>
845 As with methods, the methods for dealing with a role's attribute are
846 all identical in API and behavior to the same methods in
847 L<Class::MOP::Class>.
849 However, attributes stored in this class are I<not> stored as
850 objects. Rather, the attribute definition is stored as a hash
851 reference. When a role is composed into a class, this hash reference
852 is passed directly to the metaclass's C<add_attribute> method.
854 This is quite likely to change in the future.
858 =item B<< $metarole->get_attribute($attribute_name) >>
860 =item B<< $metarole->has_attribute($attribute_name) >>
862 =item B<< $metarole->get_attribute_list >>
864 =item B<< $metarole->add_attribute($name, %options) >>
866 =item B<< $metarole->remove_attribute($attribute_name) >>
870 =head2 Required methods
874 =item B<< $metarole->get_required_method_list >>
876 Returns the list of methods required by the role.
878 =item B<< $metarole->requires_method($name) >>
880 Returns true if the role requires the named method.
882 =item B<< $metarole->add_required_methods(@names) >>
884 Adds the named methods to the role's list of required methods.
886 =item B<< $metarole->remove_required_methods(@names) >>
888 Removes the named methods from the role's list of required methods.
890 =item B<< $metarole->add_conflicting_method(%params) >>
892 Instantiate the parameters as a L<Moose::Meta::Role::Method::Conflicting>
893 object, then add it to the required method list.
897 =head2 Method modifiers
899 These methods act like their counterparts in L<Class::MOP::Class> and
900 L<Moose::Meta::Class>.
902 However, method modifiers are simply stored internally, and are not
903 applied until the role itself is applied to a class.
907 =item B<< $metarole->add_after_method_modifier($method_name, $method) >>
909 =item B<< $metarole->add_around_method_modifier($method_name, $method) >>
911 =item B<< $metarole->add_before_method_modifier($method_name, $method) >>
913 =item B<< $metarole->add_override_method_modifier($method_name, $method) >>
915 These methods all add an appropriate modifier to the internal list of
918 =item B<< $metarole->has_after_method_modifiers >>
920 =item B<< $metarole->has_around_method_modifiers >>
922 =item B<< $metarole->has_before_method_modifiers >>
924 =item B<< $metarole->has_override_method_modifier >>
926 Return true if the role has any modifiers of the given type.
928 =item B<< $metarole->get_after_method_modifiers($method_name) >>
930 =item B<< $metarole->get_around_method_modifiers($method_name) >>
932 =item B<< $metarole->get_before_method_modifiers($method_name) >>
934 Given a method name, returns a list of the appropriate modifiers for
937 =item B<< $metarole->get_override_method_modifier($method_name) >>
939 Given a method name, returns the override method modifier for that
940 method, if it has one.
948 =item B<< Moose::Meta::Role->meta >>
950 This will return a L<Class::MOP::Class> instance for this class.
956 See L<Moose/BUGS> for details on reporting bugs.
960 Stevan Little E<lt>stevan@iinteractive.comE<gt>
962 =head1 COPYRIGHT AND LICENSE
964 Copyright 2006-2010 by Infinity Interactive, Inc.
966 L<http://www.iinteractive.com>
968 This library is free software; you can redistribute it and/or modify
969 it under the same terms as Perl itself.