blib/lib/Seis/Str.pm untested

filter: Statementstmt 0.0% 0 / 57 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 29 Podpod 0.0% 0 / 22 totaltotal 0.0% 0 / 114 CC 4 SCAR 10.1
CC
4
Cov
0%
lines
6.0
IO
6.0
ords
6.0
CRAP 2.8
1 package Seis::Str;
2 use strict;
3 use warnings;
4 use utf8;
5 use 5.012_001;
6  
7 package # Hide from CPAN
8 Str;
9 use Data::Dumper ();
10 use feature 'fc';
11 use Encode ();
12  
13 sub uc:method { CORE::uc($_[0]) }
14 sub lc:method { CORE::lc($_[0]) }
15 sub fc:method { CORE::fc($_[0]) }
16 sub ord:method { CORE::ord($_[0]) }
17  
18 sub say { CORE::say($_[0]) }
19  
20 sub perl {
21 local $Data::Dumper::Terse = 1;
22 local $Data::Dumper::Useqq = 1;
23 local $Data::Dumper::Purity = 1;
24 local $Data::Dumper::Indent = 0;
25 Data::Dumper::Dumper($_[0]);
26 }
27 sub gist { Str::perl(@_) }
28  
29 sub clone { "$_[0]" }
30  
31 sub Bool { Bool::boolean($_[0]) }
32  
33 sub lines {
34 my ($self, $n) = @_;
35 my @lines = split /\n/, $self;
36 $n ? [@lines[0..$n-1]] : \@lines;
37 }
38  
39 # Generate new IO object.
40 # IO.new(ins => 0, chomp => Bool::True, path => "/tmp/")
41 sub IO {
42 if (@_==1) {
43 Seis::IO::Handle->_new($_[0]);
44 } else {
45 ...
46 }
47 }
48  
49 sub defined { 1 }
50  
51 sub fmt {
52 my ($self, $pattern) = @_;
53 sprintf($pattern, $self);
54 }
55  
56 sub WHAT {
57 my $self = shift;
58 Seis::Class->_new(name => 'Str');
59 }
60  
61 sub Int { int shift; }
62  
63 sub encode {
64 my ($self, $encoding) = @_;
65 Encode::encode($encoding, $self);
66 }
67  
68 sub Str { $_[0] }
69  
70 sub ords {
71 my @ret = map { ord($_) } split //, $_[0];
72 wantarray ? @ret : \@ret;
73 }
74  
75 sub rindex:method {
76 my ($self, $str) = @_;
77 CORE::rindex($self, $str);
78 }
79  
80 sub tc:method {
81 ucfirst($_[0]);
82 }
83  
84 # Create new IO::Path object
85 sub path {
86 IO::Path->new($_[0]);
87 }
88  
89 sub eval:method {
90 CORE::eval($_[0]);
91 }
92  
93 1;
94