line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IPerl; |
2
|
|
|
|
|
|
|
$IPerl::VERSION = '0.007'; |
3
|
2
|
|
|
2
|
|
110671
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
63
|
|
4
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
57
|
|
5
|
2
|
|
|
2
|
|
298
|
use Moo; |
|
2
|
|
|
|
|
8052
|
|
|
2
|
|
|
|
|
18
|
|
6
|
|
|
|
|
|
|
with qw( MooX::Singleton ); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $REPL; |
9
|
|
|
|
|
|
|
our $current_msg; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has helpers => ( is => 'rw', default => sub { +{} } ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub helper { |
14
|
18
|
|
|
18
|
1
|
57
|
my ($class, $name, $cb) = @_; |
15
|
18
|
|
|
|
|
50
|
my $self = $class->instance; |
16
|
|
|
|
|
|
|
warn (qq{Helper "$name" already exists, replacing.}) |
17
|
18
|
50
|
|
|
|
174
|
if exists $self->helpers->{$name}; |
18
|
18
|
|
|
|
|
41
|
$self->add_helper($name => $cb); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub add_helper { |
22
|
18
|
|
|
18
|
0
|
35
|
my ($self, $name, $cb) = @_; |
23
|
18
|
|
|
|
|
38
|
$self->helpers->{$name} = $cb; |
24
|
|
|
|
|
|
|
{ |
25
|
2
|
|
|
2
|
|
1626
|
no strict 'refs'; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
80
|
|
|
18
|
|
|
|
|
28
|
|
26
|
2
|
|
|
2
|
|
13
|
no warnings 'redefine'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
191
|
|
27
|
18
|
|
|
|
|
23
|
*{"IPerl::$name"} = $cb; |
|
18
|
|
|
|
|
118
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub load_plugin { |
32
|
5
|
|
|
5
|
0
|
2333
|
my ($class, $plugin_name) = @_; |
33
|
5
|
|
|
|
|
18
|
my $plugin_package = "Devel::IPerl::Plugin::$plugin_name"; |
34
|
2
|
|
|
2
|
|
11
|
{ no strict; eval "require $plugin_package"; } |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
97
|
|
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
314
|
|
35
|
5
|
|
|
|
|
47
|
$plugin_package->register( $class ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=encoding UTF-8 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
IPerl |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 VERSION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
version 0.007 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 METHODS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 helper |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
IPerl->helper( $name, $coderef ) |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Register helper callback. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 AUTHOR |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Zakariyya Mughal <zmughal@cpan.org> |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Zakariyya Mughal. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
71
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |