| 1 | package TUI::Views::Util; | ||||||||||
| 2 | # ABSTRACT: defines various utility functions for views | ||||||||||
| 3 | |||||||||||
| 4 | 133 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 133 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 133 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 133 | our $VERSION = '2.000003'; | |||||||||
| 9 | 133 | $VERSION =~ tr/_//d; | |||||||||
| 10 | 133 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||
| 11 | |||||||||||
| 12 | 133 | ▶ | use Exporter 'import'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 133 | our @EXPORT_OK = qw( | |||||||||
| 14 | message | ||||||||||
| 15 | ); | ||||||||||
| 16 | 133 | our %EXPORT_TAGS = ( | |||||||||
| 17 | all => \@EXPORT_OK, | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | 133 | ▶ | use TUI::toolkit qw( signature ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 133 | ▶ | use TUI::toolkit::Types qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | Maybe | ||||||||||
| 23 | :types | ||||||||||
| 24 | 133 | ); | |||||||||
| 25 | |||||||||||
| 26 | 133 | ▶ | use TUI::Drivers::Const qw( evNothing ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 133 | ▶ | use TUI::Drivers::Event; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | sub message { # $view|undef ($receiver|undef, $what, $command, $infoPtr) | ||||||||
|
Subroutine
message: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 30 | 0 | state $sig = signature( | |||||||||
| 31 | pos => [ | ||||||||||
| 32 | Maybe[Object], | ||||||||||
| 33 | PositiveOrZeroInt, | ||||||||||
| 34 | PositiveOrZeroInt, | ||||||||||
| 35 | Any, | ||||||||||
| 36 | ], | ||||||||||
| 37 | ); | ||||||||||
| 38 | 0 | my ( $receiver, $what, $command, $infoPtr ) = $sig->( @_ ); | |||||||||
| 39 | |||||||||||
| 40 | return undef | ||||||||||
| 41 | 0 | ▶ | unless $receiver; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | |||||||||||
| 43 | 0 | my $event = TEvent->new( | |||||||||
| 44 | what => $what, | ||||||||||
| 45 | message => { | ||||||||||
| 46 | command => $command, | ||||||||||
| 47 | infoPtr => $infoPtr, | ||||||||||
| 48 | }, | ||||||||||
| 49 | ); | ||||||||||
| 50 | |||||||||||
| 51 | 0 | $receiver->handleEvent( $event ); | |||||||||
| 52 | |||||||||||
| 53 | 0 | ▶ | if ( $event->{what} == evNothing ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | return $event->{message}{infoPtr}; | |||||||||
| 55 | } | ||||||||||
| 56 | else { | ||||||||||
| 57 | 0 | return undef; | |||||||||
| 58 | } | ||||||||||
| 59 | } #/ sub message | ||||||||||
| 60 | |||||||||||
| 61 | 133 | 1 | |||||||||
| 62 | |||||||||||
| 63 | __END__ | ||||||||||