| 1 | |||||||||||||||||||
| 2 | # Copyright (c) 1999-2017 Rob Fugina <robf@fugina.com> | ||||||||||||||||||
| 3 | # Distributed under the terms of the GNU Public License, Version 3.0 | ||||||||||||||||||
| 4 | |||||||||||||||||||
| 5 | package X10::Macro; | ||||||||||||||||||
| 6 | |||||||||||||||||||
| 7 | 1 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 8 | |||||||||||||||||||
| 9 | 1 | ▶ | use X10::Event; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 10 | |||||||||||||||||||
| 11 | |||||||||||||||||||
| 12 | sub new | ||||||||||||||||||
| 13 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 14 | 0 | my $type = shift; | |||||||||||||||||
| 15 | |||||||||||||||||||
| 16 | 0 | my $self = bless { @_ }, $type; | |||||||||||||||||
| 17 | |||||||||||||||||||
| 18 | 0 | return $self; | |||||||||||||||||
| 19 | } | ||||||||||||||||||
| 20 | |||||||||||||||||||
| 21 | |||||||||||||||||||
| 22 | sub run | ||||||||||||||||||
| 23 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
run: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||
| 24 | 0 | my $self = shift; | |||||||||||||||||
| 25 | |||||||||||||||||||
| 26 | 0 | ▶ | return undef unless $self->{controller}; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 27 | |||||||||||||||||||
| 28 | # send a list of events (specified by string) | ||||||||||||||||||
| 29 | 0 | ▶ | if (exists $self->{events}) | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 30 | { | ||||||||||||||||||
| 31 | $self->{controller}->send( | ||||||||||||||||||
| 32 | 0 | map { new X10::Event($_) } @{$self->{events}} | |||||||||||||||||
| 33 | ); | ||||||||||||||||||
| 34 | } | ||||||||||||||||||
| 35 | # send a list of events returned by a perl sub | ||||||||||||||||||
| 36 | elsif (exists $self->{perleval}) | ||||||||||||||||||
| 37 | { | ||||||||||||||||||
| 38 | 0 | $self->{controller}->send($self->{perleval}->()); | |||||||||||||||||
| 39 | } | ||||||||||||||||||
| 40 | # run a perl sub | ||||||||||||||||||
| 41 | elsif (exists $self->{perlsub}) | ||||||||||||||||||
| 42 | { | ||||||||||||||||||
| 43 | 0 | $self->{perlsub}->(); | |||||||||||||||||
| 44 | } | ||||||||||||||||||
| 45 | else | ||||||||||||||||||
| 46 | { | ||||||||||||||||||
| 47 | 0 | return undef; | |||||||||||||||||
| 48 | } | ||||||||||||||||||
| 49 | |||||||||||||||||||
| 50 | 0 | return 1; | |||||||||||||||||
| 51 | } | ||||||||||||||||||
| 52 | |||||||||||||||||||
| 53 | sub controller | ||||||||||||||||||
| 54 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
controller: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||
| 55 | 0 | my $self = shift; | |||||||||||||||||
| 56 | |||||||||||||||||||
| 57 | 0 | ▶ | if (@_) | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 58 | { | ||||||||||||||||||
| 59 | 0 | $self->{controller} = shift; | |||||||||||||||||
| 60 | } | ||||||||||||||||||
| 61 | |||||||||||||||||||
| 62 | 0 | return $self->{controller}; | |||||||||||||||||
| 63 | } | ||||||||||||||||||
| 64 | |||||||||||||||||||
| 65 | sub description | ||||||||||||||||||
| 66 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 67 | 0 | my $self = shift; | |||||||||||||||||
| 68 | 0 | return $self->{description}; | |||||||||||||||||
| 69 | } | ||||||||||||||||||
| 70 | |||||||||||||||||||
| 71 | |||||||||||||||||||
| 72 | |||||||||||||||||||
| 73 | 1 | 1; | |||||||||||||||||
| 74 | |||||||||||||||||||