line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
24496
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
2
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
136
|
|
3
|
|
|
|
|
|
|
package Devel::REPL::Plugin::FindVariable; |
4
|
|
|
|
|
|
|
# ABSTRACT: Finds variables by name |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.003027'; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use Devel::REPL::Plugin; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
18
|
|
9
|
2
|
|
|
2
|
|
9647
|
use namespace::autoclean; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
21
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub find_variable { |
12
|
0
|
|
|
0
|
0
|
|
my ($self, $name) = @_; |
13
|
|
|
|
|
|
|
|
14
|
0
|
0
|
|
|
|
|
return \$self if $name eq '$_REPL'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# XXX: this code needs to live in LexEnv |
17
|
0
|
0
|
|
|
|
|
if ($self->can('lexical_environment')) { |
18
|
|
|
|
|
|
|
return \( $self->lexical_environment->get_context('_')->{$name} ) |
19
|
0
|
0
|
|
|
|
|
if exists $self->lexical_environment->get_context('_')->{$name}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
my $sigil = $name =~ s/^([\$\@\%\&\*])// ? $1 : ''; |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
my $default_package = $self->can('current_package') |
25
|
|
|
|
|
|
|
? $self->current_package |
26
|
|
|
|
|
|
|
: 'main'; |
27
|
0
|
0
|
|
|
|
|
my $package = $name =~ s/^(.*)(::|')// ? $1 : $default_package; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $meta = Class::MOP::Class->initialize($package); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Class::MOP::Package::has_package_symbol method *requires* a sigil |
32
|
0
|
0
|
0
|
|
|
|
return unless length($sigil) and $meta->has_package_symbol("$sigil$name"); |
33
|
0
|
|
|
|
|
|
$meta->get_package_symbol("$sigil$name"); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=encoding UTF-8 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Devel::REPL::Plugin::FindVariable - Finds variables by name |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 VERSION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
version 1.003027 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 AUTHOR |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Shawn M Moore, C<< <sartak at gmail dot com> >> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>). |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
61
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |