| 1 | package TUI::Menus::StatusItem; | ||||||||||
| 2 | # ABSTRACT: Class linking text, hot key, and command for use on a status line | ||||||||||
| 3 | |||||||||||
| 4 | 42 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 42 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 42 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 42 | our $VERSION = '2.000002'; | |||||||||
| 9 | 42 | $VERSION =~ tr/_//d; | |||||||||
| 10 | 42 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||
| 11 | |||||||||||
| 12 | 42 | ▶ | use Exporter 'import'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 42 | our @EXPORT = qw( | |||||||||
| 14 | TStatusItem | ||||||||||
| 15 | new_TStatusItem | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 42 | ▶ | use TUI::toolkit; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 42 | ▶ | use TUI::toolkit::Types qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | Maybe | ||||||||||
| 21 | is_Object | ||||||||||
| 22 | :types | ||||||||||
| 23 | 42 | ); | |||||||||
| 24 | |||||||||||
| 25 | sub TStatusItem() { __PACKAGE__ } | ||||||||||
| 26 | 6 | ▶ | sub new_TStatusItem { __PACKAGE__->from(@_) } | ||||||||
|
Subroutine
new_TStatusItem: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 27 | |||||||||||
| 28 | # public attributes | ||||||||||
| 29 | 42 | has next => ( is => 'rw' ); | |||||||||
| 30 | 0 | ▶ | has text => ( is => 'rw', default => sub { die 'required' } ); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 31 | 0 | ▶ | has keyCode => ( is => 'rw', default => sub { die 'required' } ); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 32 | 0 | ▶ | has command => ( is => 'rw', default => sub { die 'required' } ); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 33 | |||||||||||
| 34 | 7 | ▶ | sub BUILDARGS { # \%args (%args) | ||||||||
|
Subroutine
BUILDARGS: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 35 | 7 | state $sig = signature( | |||||||||
| 36 | method => 1, | ||||||||||
| 37 | named => [ | ||||||||||
| 38 | text => Str, { alias => 'aText' }, | ||||||||||
| 39 | keyCode => PositiveOrZeroInt, { alias => 'key' }, | ||||||||||
| 40 | command => PositiveOrZeroInt, { alias => 'cmd' }, | ||||||||||
| 41 | next => Maybe[Object], { default => undef }, | ||||||||||
| 42 | ], | ||||||||||
| 43 | caller_level => +1, | ||||||||||
| 44 | ); | ||||||||||
| 45 | 7 | my ( $class, $args ) = $sig->( @_ ); | |||||||||
| 46 | 7 | return { %$args }; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 6 | ▶ | sub from { # $obj ($aText, $key, $cmd, |$aNext) | ||||||||
|
Subroutine
from: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 50 | 6 | state $sig = signature( | |||||||||
| 51 | method => 1, | ||||||||||
| 52 | pos => [ | ||||||||||
| 53 | Str, | ||||||||||
| 54 | PositiveOrZeroInt, | ||||||||||
| 55 | PositiveOrZeroInt, | ||||||||||
| 56 | Maybe[Object], { default => undef }, | ||||||||||
| 57 | ], | ||||||||||
| 58 | ); | ||||||||||
| 59 | 6 | my ( $class, @args ) = $sig->( @_ ); | |||||||||
| 60 | 6 | return $class->new( text => $args[0], keyCode => $args[1], | |||||||||
| 61 | command => $args[2], next => $args[3] ); | ||||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 8 | ▶ | sub DEMOLISH { # void ($in_global_destruction) | ||||||||
|
Subroutine
DEMOLISH: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||
| 65 | 8 | my ( $self, $in_global_destruction ) = @_; | |||||||||
| 66 | 8 | ▶ | assert ( @_ == 2 ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 67 | 8 | ▶ | assert ( is_Object $self ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 68 | 8 | undef $self->{text}; | |||||||||
| 69 | 8 | return; | |||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | 42 | 1 | |||||||||
| 73 | |||||||||||
| 74 | __END__ | ||||||||||