Venus
view release on metacpan or search on metacpan
lib/Venus/Space.pm view on Meta::CPAN
my $class = $self->package;
no warnings 'redefine';
*{"${class}::${name}"} = $code if $code;
return *{"${class}::${name}"}{"CODE"};
}
sub routines {
my ($self) = @_;
no strict 'refs';
my $class = $self->package;
return [
sort grep *{"${class}::$_"}{"CODE"},
grep /^[_a-zA-Z]\w*$/, keys %{"${class}::"}
];
}
sub scalar {
my ($self, $name, @data) = @_;
no strict 'refs';
my $class = $self->package;
no warnings 'once';
${"${class}::${name}"} = $data[0] if @data;
return ${"${class}::${name}"};
}
sub scalars {
my ($self) = @_;
no strict 'refs';
my $class = $self->package;
return [
sort grep defined ${"${class}::$_"},
grep /^[_a-zA-Z]\w*$/, keys %{"${class}::"}
];
}
sub scrub {
my ($self) = @_;
return $self if $self->unloaded;
my $package = $self->package;
no strict 'refs';
my $skip = qr/\A(
AUTOLOAD|BEGIN|CHECK|DESTROY|END|EXPORT|EXPORT_OK|EXPORT_TAGS|
IMPORT|INIT|ISA|UNITCHECK|VERSION|
import|unimport|
[^:]+::
)\z/x;
for my $name (grep !/$skip/, keys %{"${package}::"}) {
undef *{"${package}::${name}"};
}
delete $INC{$self->format('path', '%s.pm')};
return $self;
}
sub sibling {
my ($self, @args) = @_;
return $self->parent->append(@args);
}
sub siblings {
my ($self) = @_;
my %list;
my $path;
my $type;
$path = quotemeta $self->parent->path;
$type = 'pm';
my $regexp = qr/$path\/[^\/]+\.$type/;
for my $item (keys %INC) {
$list{$item}++ if $item =~ /$regexp$/;
}
my %seen;
for my $dir (@INC) {
next if $seen{$dir}++;
my $re = quotemeta $dir;
map { s/^$re\///; $list{$_}++ }
grep !$list{$_}, glob "$dir/@{[$self->path]}/*.$type";
}
my $class = $self->class;
return [
map $class->new($_),
map {s/(.*)\.$type$/$1/r}
sort keys %list
];
}
sub splice {
my ($self, $offset, $length, @list) = @_;
my $class = $self->class;
my $parts = $self->parts;
( run in 1.996 second using v1.01-cache-2.11-cpan-d8267643d1d )