Dallycot

 view release on metacpan or  search on metacpan

lib/Dallycot/Context.pm  view on Meta::CPAN


use Promises qw(deferred);

#
# Contexts form a chain from the kernel on down
# The context for a statement has no parent, but is copied from the kernel's
#   context. Changes made are copied back to the kernel context info.
# Closures need to copy all of the info into a new context that is marked as
#   a closure.

has namespaces => ( is => 'ro', isa => 'HashRef', default => sub { +{} }, lazy => 1 );

has environment => ( is => 'ro', isa => 'HashRef', default => sub { +{} }, lazy => 1 );

has namespace_search_path => ( is => 'ro', isa => 'ArrayRef', default => sub { [] }, lazy => 1 );

has parent => ( is => 'ro', isa => 'Dallycot::Context', predicate => 'has_parent' );

has is_closure => ( is => 'ro', isa => 'Bool', default => 0 );

sub add_namespace {
  my ( $self, $ns, $href ) = @_;

  if ( ( $self->is_closure || $self->has_parent )
    && defined( $self->namespaces->{$ns} ) )



( run in 0.407 second using v1.01-cache-2.11-cpan-5f2e87ce722 )