Tie-Symbol

 view release on metacpan or  search on metacpan

lib/Tie/Symbol.pm  view on Meta::CPAN


sub TIEHASH {
    my ( $class, $namespace ) = @_;

    $namespace //= 'main';

    my $classname = ref $class || $class;

    my $self = { ns => "$namespace", };

    bless $self => $classname;
}

sub FETCH {
    my ( $self, $name, $force ) = @_;
    return $self->{$name} if ( not $force and scalar caller eq __PACKAGE__ );
    my $namespace = $self->namespace;
    if ( my ( $sigil, $label ) = ( $name =~ m{^([\$\@\%\&])(.+)$} ) ) {
        my $type     = $sigils{$sigil};
        my $symbol   = *{"${namespace}::${label}"} // return;
        my $referent = *{$symbol}{$type} // return;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 3.106 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-d29e8ade9f55 )