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