Context-Set

 view release on metacpan or  search on metacpan

lib/Context/Set/Union.pm  view on Meta::CPAN

package Context::Set::Union;
use Moose;

extends qw/Context::Set/;

has 'contexts' => ( is => 'ro' , isa => 'ArrayRef[Context::Set]' , required => 1);

=head2 name

Dies all the time. Using name makes no sense on a Context::Set::Union

=cut

sub name{
  my ($self) = @_;
  return;
}

=head1 NAME

Context::Set::Union - A union of Contexts.

=cut

=head2 fullname

See superclass.

=cut

sub fullname{
  my ($self) = @_;
  return 'union('.join(',', map{ $_->fullname() } @{$self->contexts} ).')';
}

=head2 is_inside

Only operates on the parent context in order.

=cut

sub is_inside{
  my ($self,$name) = @_;

  foreach my $context  ( @{$self->contexts()} ){
    if( $context->is_inside($name) ){
      return 1;
    }
  }
}

=head2 has_property

See superclass Context::Set.

=cut

sub has_property{
  my ($self, $prop_name) = @_;
  if( exists $self->properties()->{$prop_name} ){
    return 1;
  }
  ## Try to hit the property in the contexts.
  foreach my $context  ( @{$self->contexts()} ){
    if( $context->has_property($prop_name) ){
      return 1;



( run in 1.541 second using v1.01-cache-2.11-cpan-39bf76dae61 )