blib/lib/Devel/REPL/Plugin/Selenium.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 43 CC 1 SCAR 6.9
CC
1
Cov
0%
selenium_lex_env
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Devel::REPL::Plugin::Selenium;
2 {
3 $Devel::REPL::Plugin::Selenium::VERSION = '1.36';
4 }
5
6 use Devel::REPL::Plugin;
7 use Data::Dumper;
8 use namespace::clean -except => [ 'meta' ];
9
10 has 'selenium' => (isa => 'Object', is => 'rw');
11  
12 sub selenium_lex_env {
13 my $self = shift;
14  
15 my $class = ref($self->selenium);
16 my $code = "my \$sel;\n" . Data::Dumper->Dump([$self->selenium], ['sel']);
17 $code .= "delete \$sel->{_ua};\n";
18 $code .= "use $class; bless \$sel, '$class';";
19 return $code;
20 }
21  
22 around 'read' => sub {
23 my $orig = shift;
24 my ($self, @args) = @_;
25 my $line = $self->$orig(@args);
26 return $line unless $line =~ m/\S/;
27  
28 if ($line =~ m/^js:\s*(.+)/) {
29 $line = "get_eval(q|$1|)";
30 }
31 $line =~ s/^(jQuery|\$)\((.+)/get_eval(q|window.jQuery($1)|)/;
32 $line = "\$sel->$line";
33 warn $line;
34 return $line;
35 };
36  
37 1;
38  
39 __END__