| 1 | package Pipe::Tube::Split; | ||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 1 | ▶ | use 5.006; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | 1 | ▶ | use base 'Pipe::Tube'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | |||||||||||||||
| 8 | 1 | our $VERSION = '0.06'; | |||||||||||||
| 9 | |||||||||||||||
| 10 | 3 | ▶ | sub init { | ||||||||||||
|
Subroutine
init: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||
| 11 | 3 | my ($self, $expr) = @_; | |||||||||||||
| 12 | 3 | $self->logger("Receiving the split expression: $expr"); | |||||||||||||
| 13 | 3 | ▶ | if ("Regexp" eq ref $expr) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 14 | 1 | $self->{expr} = $expr; | |||||||||||||
| 15 | } elsif (not ref $expr) { | ||||||||||||||
| 16 | 2 | $self->{expr} = qr/\Q$expr/; | |||||||||||||
| 17 | } else { | ||||||||||||||
| 18 | 0 | die "Unrecognized type of parameter for split\n"; | |||||||||||||
| 19 | } | ||||||||||||||
| 20 | 3 | return $self; | |||||||||||||
| 21 | } | ||||||||||||||
| 22 | |||||||||||||||
| 23 | 12 | ▶ | sub run { | ||||||||||||
|
Subroutine
run: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||
| 24 | 12 | my ($self, @input) = @_; | |||||||||||||
| 25 | |||||||||||||||
| 26 | 12 | $self->logger("The grep expression: $self->{expr}"); | |||||||||||||
| 27 | 12 | return map { [ split /$self->{expr}/, $_ ] } @input; | |||||||||||||
| 28 | } | ||||||||||||||
| 29 | |||||||||||||||
| 30 | 1 | 1; | |||||||||||||
| 31 | |||||||||||||||