| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: Interface for network-based interaction |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Pinto::Chrome::Net; |
|
4
|
|
|
|
|
|
|
|
|
5
|
12
|
|
|
12
|
|
72
|
use Moose; |
|
|
12
|
|
|
|
|
34
|
|
|
|
12
|
|
|
|
|
94
|
|
|
6
|
12
|
|
|
12
|
|
76052
|
use MooseX::StrictConstructor; |
|
|
12
|
|
|
|
|
36
|
|
|
|
12
|
|
|
|
|
130
|
|
|
7
|
12
|
|
|
12
|
|
39198
|
use MooseX::MarkAsMethods ( autoclean => 1 ); |
|
|
12
|
|
|
|
|
26
|
|
|
|
12
|
|
|
|
|
118
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
12
|
|
|
12
|
|
45262
|
use Pinto::Types qw(Io); |
|
|
12
|
|
|
|
|
34
|
|
|
|
12
|
|
|
|
|
150
|
|
|
10
|
12
|
|
|
12
|
|
71608
|
use Pinto::Util qw(itis); |
|
|
12
|
|
|
|
|
44
|
|
|
|
12
|
|
|
|
|
844
|
|
|
11
|
12
|
|
|
12
|
|
82
|
use Pinto::Constants qw(:protocol); |
|
|
12
|
|
|
|
|
26
|
|
|
|
12
|
|
|
|
|
984
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.14'; # VERSION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
extends qw( Pinto::Chrome::Term ); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has stdout => ( |
|
24
|
|
|
|
|
|
|
is => 'ro', |
|
25
|
|
|
|
|
|
|
isa => Io, |
|
26
|
|
|
|
|
|
|
required => 1, |
|
27
|
|
|
|
|
|
|
coerce => 1, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has stderr => ( |
|
31
|
|
|
|
|
|
|
is => 'ro', |
|
32
|
|
|
|
|
|
|
isa => Io, |
|
33
|
|
|
|
|
|
|
required => 1, |
|
34
|
|
|
|
|
|
|
coerce => 1, |
|
35
|
|
|
|
|
|
|
); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub diag { |
|
40
|
5
|
|
|
5
|
0
|
23
|
my ( $self, $msg, $opts ) = @_; |
|
41
|
|
|
|
|
|
|
|
|
42
|
5
|
|
50
|
|
|
26
|
$opts ||= {}; |
|
43
|
|
|
|
|
|
|
|
|
44
|
5
|
50
|
|
|
|
27
|
$msg = $msg->() if ref $msg eq 'CODE'; |
|
45
|
|
|
|
|
|
|
|
|
46
|
5
|
100
|
|
|
|
40
|
if ( itis( $msg, 'Pinto::Exception' ) ) { |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Show full stack trace if we are debugging |
|
49
|
4
|
50
|
|
|
|
46
|
$msg = $ENV{PINTO_DEBUG} ? $msg->as_string : $msg->message; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
5
|
|
|
|
|
24
|
chomp $msg; |
|
53
|
5
|
|
|
|
|
62
|
$msg = $self->colorize( $msg, $opts->{color} ); |
|
54
|
5
|
50
|
|
|
|
109
|
$msg .= "\n" unless $opts->{no_newline}; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Prepend prefix to each line (not just at the start of the message) |
|
57
|
|
|
|
|
|
|
# The prefix is used by Pinto::Remote to distinguish between |
|
58
|
|
|
|
|
|
|
# messages that go to stderr and those that should go to stdout |
|
59
|
5
|
|
|
|
|
67
|
$msg =~ s/^/$PINTO_PROTOCOL_DIAG_PREFIX/gmx; |
|
60
|
|
|
|
|
|
|
|
|
61
|
5
|
50
|
|
|
|
52
|
print { $self->stderr } $msg or croak $!; |
|
|
5
|
|
|
|
|
138
|
|
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub show_progress { |
|
67
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
return if not $self->should_render_progress; |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
$self->stderr->autoflush; # Make sure pipes are hot |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
0
|
|
|
|
|
print { $self->stderr } $PINTO_PROTOCOL_PROGRESS_MESSAGE . "\n" or croak $!; |
|
|
0
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub should_render_progress { |
|
79
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
return 0 if $self->verbose; |
|
82
|
0
|
0
|
|
|
|
|
return 0 if $self->quiet; |
|
83
|
0
|
|
|
|
|
|
return 1; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub edit { |
|
89
|
0
|
|
|
0
|
0
|
|
my ( $self, $document ) = @_; |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return $document; # TODO! |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
99
|
|
|
|
|
|
|
1; |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=pod |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=encoding UTF-8 |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=for :stopwords Jeffrey Ryan Thalhammer |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 NAME |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Pinto::Chrome::Net - Interface for network-based interaction |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 VERSION |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
version 0.14 |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 AUTHOR |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@stratopan.com> |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
126
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |