| 1 | package TUI::Objects::StringCollection; | ||||||||||
| 2 | # ABSTRACT: Implement a string collection for the framework. | ||||||||||
| 3 | |||||||||||
| 4 | 28 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 28 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 28 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 28 | our $VERSION = '2.000003'; | |||||||||
| 9 | 28 | $VERSION =~ tr/_//d; | |||||||||
| 10 | 28 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||
| 11 | |||||||||||
| 12 | 28 | ▶ | use Exporter 'import'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 28 | our @EXPORT = qw( | |||||||||
| 14 | TStringCollection | ||||||||||
| 15 | new_TStringCollection | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 28 | ▶ | use Storable; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 28 | ▶ | use TUI::toolkit; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 28 | ▶ | use TUI::toolkit::Types qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | is_Str | ||||||||||
| 22 | :types | ||||||||||
| 23 | 28 | ); | |||||||||
| 24 | |||||||||||
| 25 | 28 | ▶ | use TUI::Objects::Const qw( ccNotFound ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 28 | ▶ | use TUI::Objects::SortedCollection; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | sub TStringCollection() { __PACKAGE__ } | ||||||||||
| 29 | sub name() { 'TStringCollection' }; | ||||||||||
| 30 | 2 | ▶ | sub new_TStringCollection { __PACKAGE__->from(@_) } | ||||||||
|
Subroutine
new_TStringCollection: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 31 | |||||||||||
| 32 | 28 | extends TSortedCollection; | |||||||||
| 33 | 28 | with: *DOES = TStreamable->can('DOES'); | |||||||||
| 34 | |||||||||||
| 35 | 6 | ▶ | sub compare { # $cmp ($key1, $key2) | ||||||||
|
Subroutine
compare: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 36 | 6 | state $sig = signature( | |||||||||
| 37 | method => Object, | ||||||||||
| 38 | pos => [Str, Str], | ||||||||||
| 39 | ); | ||||||||||
| 40 | 6 | my ( $self, $key1, $key2 ) = $sig->( @_ ); | |||||||||
| 41 | 6 | return $key1 cmp $key2; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 3 | ▶ | sub writeItem { # void ($item, $os) | ||||||||
|
Subroutine
writeItem: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 45 | 3 | state $sig = signature( | |||||||||
| 46 | method => Object, | ||||||||||
| 47 | pos => [Item, Object], | ||||||||||
| 48 | ); | ||||||||||
| 49 | 3 | my ( $self, $item, $os ) = $sig->( @_ ); | |||||||||
| 50 | 3 | ▶ | assert ( Storable::is_storing ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 3 | ▶ | $os->put( defined $item ? "$item" : undef ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 3 | return; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 3 | ▶ | sub readItem { # $item ($is) | ||||||||
|
Subroutine
readItem: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 56 | 3 | state $sig = signature( | |||||||||
| 57 | method => Object, | ||||||||||
| 58 | pos => [Object], | ||||||||||
| 59 | ); | ||||||||||
| 60 | 3 | my ( $self, $is ) = $sig->( @_ ); | |||||||||
| 61 | 3 | ▶ | assert ( Storable::is_retrieving ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 3 | my $item = $is->get(); | |||||||||
| 63 | 3 | ▶ | return defined $item ? "$item" : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 28 | 1 | |||||||||
| 67 | |||||||||||
| 68 | __END__ | ||||||||||