blib/lib/UR/Namespace/Command/Test/Eval.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 33 SCAR 17.9
CC
2
Cov
0%
execute
6.0
help_brief
2.0
help_synopsis
2.0
CRAP 6.0
1  
2 package UR::Namespace::Command::Test::Eval;
3  
4 use strict;
5 use warnings;
6 use UR;
7 our $VERSION = "0.46"; # UR $VERSION;
8  
9 UR::Object::Type->define(
10 class_name => __PACKAGE__,
11 is => 'UR::Namespace::Command::Base',
12 has => [
13 bare_args => {
14 is_optional => 1,
15 is_many => 1,
16 shell_args_position => 1
17 }
18 ]
19 );
20  
21  
22 sub help_brief {
23 "Evaluate a string of Perl source";
24 }
25  
26 sub help_synopsis {
27 return <<'EOS';
28 ur test eval 'print "hello\n"'
29 ur test eval 'print "hello\n"' 'print "goodbye\n"'
30 ur test eval 'print "Testing in the " . \$self->namespace_name . " namespace.\n"'
31 EOS
32 }
33  
34 sub help_detail {
35 return <<EOS;
36 This command is for testing and debugging. It simply eval's the Perl
37 source supplied on the command line, after using the current namespace.
38  
39 A \$self object is in scope representing the current context.
40 EOS
41 }
42  
43 sub execute {
44 my $self = shift;
45 for my $src ($self->bare_args) {
46 eval "use Data::Dumper; use YAML; no strict; no warnings; \n" . $src;
47 if ($@) {
48 print STDERR "EXCEPTION:\n$@";
49 }
50 }
51 return 1;
52 }
53  
54 1;