| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
7996
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
82
|
|
|
2
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
129
|
|
|
3
|
|
|
|
|
|
|
package Devel::REPL::Plugin::Nopaste; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: #nopaste to upload session's input and output |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.003027'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use Devel::REPL::Plugin; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
19
|
|
|
9
|
2
|
|
|
2
|
|
11529
|
use Moose::Util::TypeConstraints 'enum'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
26
|
|
|
10
|
2
|
|
|
2
|
|
1118
|
use namespace::autoclean; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
28
|
|
|
11
|
2
|
|
|
2
|
|
212
|
use Scalar::Util qw(blessed); |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
1367
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub BEFORE_PLUGIN { |
|
14
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
|
15
|
1
|
|
|
|
|
4
|
$self->load_plugin('Turtles'); |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has complete_session => ( |
|
19
|
|
|
|
|
|
|
traits => ['String'], |
|
20
|
|
|
|
|
|
|
is => 'rw', |
|
21
|
|
|
|
|
|
|
isa => 'Str', |
|
22
|
|
|
|
|
|
|
lazy => 1, |
|
23
|
|
|
|
|
|
|
default => '', |
|
24
|
|
|
|
|
|
|
handles => { |
|
25
|
|
|
|
|
|
|
add_to_session => 'append', |
|
26
|
|
|
|
|
|
|
}, |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has paste_title => ( |
|
30
|
|
|
|
|
|
|
is => 'rw', |
|
31
|
|
|
|
|
|
|
isa => 'Str', |
|
32
|
|
|
|
|
|
|
lazy => 1, |
|
33
|
|
|
|
|
|
|
default => 'Devel::REPL session', |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has 'nopaste_format' => ( |
|
37
|
|
|
|
|
|
|
is => 'rw', |
|
38
|
|
|
|
|
|
|
isa => enum( [qw[ comment_code comment_output ]] ), |
|
39
|
|
|
|
|
|
|
lazy => 1, |
|
40
|
|
|
|
|
|
|
default => 'comment_output', |
|
41
|
|
|
|
|
|
|
); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
before eval => sub { |
|
44
|
|
|
|
|
|
|
my $self = shift; |
|
45
|
|
|
|
|
|
|
my $line = shift; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
if ( $self->nopaste_format() eq 'comment_code' ) { |
|
48
|
|
|
|
|
|
|
# prepend each line with # |
|
49
|
|
|
|
|
|
|
$line =~ s/^/# /mg; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
$self->add_to_session($line . "\n"); |
|
53
|
|
|
|
|
|
|
}; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
around eval => sub { |
|
56
|
|
|
|
|
|
|
my $orig = shift; |
|
57
|
|
|
|
|
|
|
my $self = shift; |
|
58
|
|
|
|
|
|
|
my $line = shift; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my @ret = $orig->($self, $line, @_); |
|
61
|
|
|
|
|
|
|
my @ret_as_str = map { |
|
62
|
|
|
|
|
|
|
if (!defined($_)) { |
|
63
|
|
|
|
|
|
|
''; |
|
64
|
|
|
|
|
|
|
} elsif (blessed($_) && $_->can('stringify')) { |
|
65
|
|
|
|
|
|
|
$_->stringify(); |
|
66
|
|
|
|
|
|
|
} else { |
|
67
|
|
|
|
|
|
|
$_; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
} @ret; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
if ( $self->nopaste_format() eq 'comment_output' ) { |
|
72
|
|
|
|
|
|
|
# prepend each line with # |
|
73
|
|
|
|
|
|
|
map { $_ =~ s/^/# /mg } @ret_as_str; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$self->add_to_session(join("\n", @ret_as_str) . "\n\n"); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
return @ret; |
|
79
|
|
|
|
|
|
|
}; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub command_nopaste { |
|
82
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
83
|
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
require App::Nopaste; |
|
85
|
0
|
|
|
|
|
|
return App::Nopaste->nopaste( |
|
86
|
|
|
|
|
|
|
text => $self->complete_session, |
|
87
|
|
|
|
|
|
|
desc => $self->paste_title(), |
|
88
|
|
|
|
|
|
|
lang => "perl", |
|
89
|
|
|
|
|
|
|
); |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub command_pastetitle { |
|
93
|
0
|
|
|
0
|
0
|
|
my ( $self, undef, $title ) = @_; |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
$self->paste_title( $title ); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__END__ |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=pod |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=encoding UTF-8 |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 NAME |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Devel::REPL::Plugin::Nopaste - #nopaste to upload session's input and output |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 VERSION |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
version 1.003027 |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 COMMANDS |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This module provides these commands to your Devel::REPL shell: |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 #nopaste |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
The C<#nopaste> sends a transcript of your session to a nopaste |
|
121
|
|
|
|
|
|
|
site. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 #pastetitle |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
The C<#pastetitle> command allows you to set the title of the paste on |
|
126
|
|
|
|
|
|
|
the nopaste site. For example: |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
C<#pastetitle example of some code> |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
defaults to C<'Devel::REPL session'>. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 CONFIGURATION |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 nopaste_format |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
The format sent to the nopaste server can be adjusted with the |
|
137
|
|
|
|
|
|
|
C<nopaste_format> option. By default, the output of each perl |
|
138
|
|
|
|
|
|
|
statement is commented out, and the perl statements themselves are |
|
139
|
|
|
|
|
|
|
not. This can be reversed by setting the C<nopaste_format> attribute |
|
140
|
|
|
|
|
|
|
to C<comment_code> like this in your re.pl file: |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
C<< $_REPL->nopaste_format( 'comment_code' ); >> |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
The default of commenting out the output would be set like this: |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
C<< $_REPL->nopaste_format( 'comment_output' ); >> |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
These options can be set during a L<Devel::REPL> session, but only affect |
|
149
|
|
|
|
|
|
|
the future parts of the session, not the past parts. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=over 4 |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item Andrew Moore - C<< <amoore@cpan.org> >> |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=back |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 AUTHOR |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Shawn M Moore, C<< <sartak at gmail dot com> >> |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>). |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
168
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |