| 1 | package Finance::InteractiveBrokers::API; | ||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||
| 3 | # Finance::InteractiveBrokers::API - Convenience functions for IB API | ||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||
| 5 | # Copyright (c) 2010-2013 Jason McManus | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | # Full POD documentation after __END__ | ||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Carp qw( croak confess ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | ### | ||||||||||||||||||||||||||||
| 15 | ### Variables | ||||||||||||||||||||||||||||
| 16 | ### | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use vars qw( @ISA @EXPORT_OK $VERSION $TRUE $FALSE $KEEP $DELETE $REQUIRED ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | BEGIN | ||||||||||||||||||||||||||||
| 20 | 3 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 3 | require Exporter; | |||||||||||||||||||||||||||
| 22 | 3 | @ISA = qw( Exporter ); | |||||||||||||||||||||||||||
| 23 | 3 | @EXPORT_OK = qw( api_version ); | |||||||||||||||||||||||||||
| 24 | 3 | $VERSION = '0.04'; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 3 | *TRUE = \1; | |||||||||||||||||||||||||||
| 28 | 3 | *FALSE = \0; | |||||||||||||||||||||||||||
| 29 | 3 | *KEEP = \0; | |||||||||||||||||||||||||||
| 30 | 3 | *DELETE = \1; | |||||||||||||||||||||||||||
| 31 | 3 | *REQUIRED = \2; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 3 | our %our_args = ( | |||||||||||||||||||||||||||
| 34 | version => $DELETE | $REQUIRED, | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | # IB API method and event data structures, keyed by version | ||||||||||||||||||||||||||||
| 38 | 3 | my $DEFAULT_API_VERSION = '9.64'; | |||||||||||||||||||||||||||
| 39 | 3 | my $methods = {}; | |||||||||||||||||||||||||||
| 40 | 3 | my $events = {}; | |||||||||||||||||||||||||||
| 41 | 3 | my $methods_arr = { | |||||||||||||||||||||||||||
| 42 | '9.64' => [ | ||||||||||||||||||||||||||||
| 43 | # Our add-ons | ||||||||||||||||||||||||||||
| 44 | qw( | ||||||||||||||||||||||||||||
| 45 | processMessages | ||||||||||||||||||||||||||||
| 46 | setSelectTimeout | ||||||||||||||||||||||||||||
| 47 | ), | ||||||||||||||||||||||||||||
| 48 | # Official API | ||||||||||||||||||||||||||||
| 49 | # XXX: API Docs and source code differ (I use the source code names): | ||||||||||||||||||||||||||||
| 50 | # Docs C++ headers | ||||||||||||||||||||||||||||
| 51 | # ------------------------------------------- | ||||||||||||||||||||||||||||
| 52 | # reqIDs() reqIds() | ||||||||||||||||||||||||||||
| 53 | # setLogLevel() setServerLogLevel() | ||||||||||||||||||||||||||||
| 54 | qw( | ||||||||||||||||||||||||||||
| 55 | eConnect | ||||||||||||||||||||||||||||
| 56 | eDisconnect | ||||||||||||||||||||||||||||
| 57 | isConnected | ||||||||||||||||||||||||||||
| 58 | reqCurrentTime | ||||||||||||||||||||||||||||
| 59 | serverVersion | ||||||||||||||||||||||||||||
| 60 | setServerLogLevel | ||||||||||||||||||||||||||||
| 61 | checkMessages | ||||||||||||||||||||||||||||
| 62 | TwsConnectionTime | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | reqMktData | ||||||||||||||||||||||||||||
| 65 | cancelMktData | ||||||||||||||||||||||||||||
| 66 | calculateImpliedVolatility | ||||||||||||||||||||||||||||
| 67 | cancelCalculateImpliedVolatility | ||||||||||||||||||||||||||||
| 68 | calculateOptionPrice | ||||||||||||||||||||||||||||
| 69 | cancelCalculateOptionPrice | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | placeOrder | ||||||||||||||||||||||||||||
| 72 | cancelOrder | ||||||||||||||||||||||||||||
| 73 | reqOpenOrders | ||||||||||||||||||||||||||||
| 74 | reqAllOpenOrders | ||||||||||||||||||||||||||||
| 75 | reqAutoOpenOrders | ||||||||||||||||||||||||||||
| 76 | reqIds | ||||||||||||||||||||||||||||
| 77 | exerciseOptions | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | reqAccountUpdates | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | reqExecutions | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | reqContractDetails | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | reqMktDepth | ||||||||||||||||||||||||||||
| 86 | cancelMktDepth | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | reqNewsBulletins | ||||||||||||||||||||||||||||
| 89 | cancelNewsBulletins | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | reqManagedAccts | ||||||||||||||||||||||||||||
| 92 | requestFA | ||||||||||||||||||||||||||||
| 93 | replaceFA | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | reqHistoricalData | ||||||||||||||||||||||||||||
| 96 | cancelHistoricalData | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | reqScannerParameters | ||||||||||||||||||||||||||||
| 99 | reqScannerSubscription | ||||||||||||||||||||||||||||
| 100 | cancelScannerSubscription | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | reqRealTimeBars | ||||||||||||||||||||||||||||
| 103 | cancelRealTimeBars | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | reqFundamentalData | ||||||||||||||||||||||||||||
| 106 | cancelFundamentalData | ||||||||||||||||||||||||||||
| 107 | ), | ||||||||||||||||||||||||||||
| 108 | ], | ||||||||||||||||||||||||||||
| 109 | }; | ||||||||||||||||||||||||||||
| 110 | 3 | $methods_arr->{'9.65'} = $methods_arr->{'9.64'}; | |||||||||||||||||||||||||||
| 111 | $methods_arr->{'9.66'} = [ | ||||||||||||||||||||||||||||
| 112 | 3 | @{ $methods_arr->{'9.65'} }, | |||||||||||||||||||||||||||
| 113 | qw( | ||||||||||||||||||||||||||||
| 114 | reqMarketDataType | ||||||||||||||||||||||||||||
| 115 | ), | ||||||||||||||||||||||||||||
| 116 | # UNDOCUMENTED | ||||||||||||||||||||||||||||
| 117 | qw( | ||||||||||||||||||||||||||||
| 118 | reqGlobalCancel | ||||||||||||||||||||||||||||
| 119 | ), | ||||||||||||||||||||||||||||
| 120 | ]; | ||||||||||||||||||||||||||||
| 121 | 3 | $methods_arr->{'9.67'} = $methods_arr->{'9.66'}; | |||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 3 | my $events_arr = { | |||||||||||||||||||||||||||
| 124 | '9.64' => [ | ||||||||||||||||||||||||||||
| 125 | qw( | ||||||||||||||||||||||||||||
| 126 | winError | ||||||||||||||||||||||||||||
| 127 | error | ||||||||||||||||||||||||||||
| 128 | connectionClosed | ||||||||||||||||||||||||||||
| 129 | currentTime | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | tickPrice | ||||||||||||||||||||||||||||
| 132 | tickSize | ||||||||||||||||||||||||||||
| 133 | tickOptionComputation | ||||||||||||||||||||||||||||
| 134 | tickGeneric | ||||||||||||||||||||||||||||
| 135 | tickString | ||||||||||||||||||||||||||||
| 136 | tickEFP | ||||||||||||||||||||||||||||
| 137 | tickSnapshotEnd | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | orderStatus | ||||||||||||||||||||||||||||
| 140 | openOrder | ||||||||||||||||||||||||||||
| 141 | nextValidId | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | updateAccountValue | ||||||||||||||||||||||||||||
| 144 | updatePortfolio | ||||||||||||||||||||||||||||
| 145 | updateAccountTime | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | updateNewsBulletin | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | contractDetails | ||||||||||||||||||||||||||||
| 150 | contractDetailsEnd | ||||||||||||||||||||||||||||
| 151 | bondContractDetails | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | execDetails | ||||||||||||||||||||||||||||
| 154 | execDetailsEnd | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | updateMktDepth | ||||||||||||||||||||||||||||
| 157 | updateMktDepthL2 | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | managedAccounts | ||||||||||||||||||||||||||||
| 160 | receiveFA | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | historicalData | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | scannerParameters | ||||||||||||||||||||||||||||
| 165 | scannerData | ||||||||||||||||||||||||||||
| 166 | scannerDataEnd | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | realtimeBar | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | fundamentalData | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | deltaNeutralValidation | ||||||||||||||||||||||||||||
| 173 | ), | ||||||||||||||||||||||||||||
| 174 | # These are in the headers, but apparently not documented | ||||||||||||||||||||||||||||
| 175 | qw( | ||||||||||||||||||||||||||||
| 176 | openOrderEnd | ||||||||||||||||||||||||||||
| 177 | accountDownloadEnd | ||||||||||||||||||||||||||||
| 178 | ) | ||||||||||||||||||||||||||||
| 179 | ], | ||||||||||||||||||||||||||||
| 180 | }; | ||||||||||||||||||||||||||||
| 181 | 3 | $events_arr->{'9.65'} = $events_arr->{'9.64'}; | |||||||||||||||||||||||||||
| 182 | $events_arr->{'9.66'} = [ | ||||||||||||||||||||||||||||
| 183 | 3 | @{ $events_arr->{'9.65'} }, | |||||||||||||||||||||||||||
| 184 | qw( | ||||||||||||||||||||||||||||
| 185 | marketDataType | ||||||||||||||||||||||||||||
| 186 | ), | ||||||||||||||||||||||||||||
| 187 | ]; | ||||||||||||||||||||||||||||
| 188 | $events_arr->{'9.67'} = [ | ||||||||||||||||||||||||||||
| 189 | 3 | @{ $events_arr->{'9.66'} }, | |||||||||||||||||||||||||||
| 190 | qw( | ||||||||||||||||||||||||||||
| 191 | commissionReport | ||||||||||||||||||||||||||||
| 192 | ), | ||||||||||||||||||||||||||||
| 193 | ]; | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | # Cram them into a hash for O(1) lookup time | ||||||||||||||||||||||||||||
| 196 | 3 | for my $ver ( keys( %$methods_arr ) ) | |||||||||||||||||||||||||||
| 197 | { | ||||||||||||||||||||||||||||
| 198 | 12 | $methods->{$ver} = { map { $_ => 1 } @{ $methods_arr->{$ver} } }; | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | 3 | for my $ver ( keys( %$events_arr ) ) | |||||||||||||||||||||||||||
| 201 | { | ||||||||||||||||||||||||||||
| 202 | 12 | $events->{$ver} = { map { $_ => 1 } @{ $events_arr->{$ver} } }; | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | ### | ||||||||||||||||||||||||||||
| 206 | ### Constructor | ||||||||||||||||||||||||||||
| 207 | ### | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | sub new | ||||||||||||||||||||||||||||
| 210 | 6 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 211 | 6 | my( $class, @args ) = @_; | |||||||||||||||||||||||||||
| 212 | 6 | ▶ | croak( "$class requires an even number of params" ) if( @args & 1 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | 6 | my $self = { | |||||||||||||||||||||||||||
| 215 | version => $DEFAULT_API_VERSION, # IB API version | ||||||||||||||||||||||||||||
| 216 | }; | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 6 | bless( $self, $class ); | |||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 6 | my @leftover = $self->initialize( @args ); | |||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | # Make sure we received a valid API version | ||||||||||||||||||||||||||||
| 223 | confess( 'API version \'' . $self->api_version . '\' is unknown;' . | ||||||||||||||||||||||||||||
| 224 | " usable versions are: " . | ||||||||||||||||||||||||||||
| 225 | join( ' ', $self->versions ) . "\n" ) | ||||||||||||||||||||||||||||
| 226 | 6 | ▶ | unless( exists( $methods->{$self->api_version} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 5 | return( $self ); | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | sub initialize | ||||||||||||||||||||||||||||
| 232 | 6 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
initialize: called CC=8 SCAR=22.8
Pod
documented
| |||||||||||||||||||||||||||||
| 233 | 6 | my( $self, %args ) = @_; | |||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | # Cycle through the args, grab what's for us, and delete if appropriate | ||||||||||||||||||||||||||||
| 236 | 6 | for( keys( %args ) ) | |||||||||||||||||||||||||||
| 237 | { | ||||||||||||||||||||||||||||
| 238 | 5 | ▶ | if( exists( $our_args{lc $_} ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | { | ||||||||||||||||||||||||||||
| 240 | 5 | $self->{lc $_} = $args{$_}; | |||||||||||||||||||||||||||
| 241 | delete( $args{$_} ) | ||||||||||||||||||||||||||||
| 242 | 5 | ▶ | if( $our_args{lc $_} & $DELETE ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | # Check all required args | ||||||||||||||||||||||||||||
| 247 | 6 | for( keys( %our_args ) ) | |||||||||||||||||||||||||||
| 248 | { | ||||||||||||||||||||||||||||
| 249 | 6 | ▶ | if( $our_args{$_} & $REQUIRED ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 250 | { | ||||||||||||||||||||||||||||
| 251 | confess( "$_ is a required argument" ) | ||||||||||||||||||||||||||||
| 252 | if( ( not exists $self->{lc $_} ) or | ||||||||||||||||||||||||||||
| 253 | 6 | ▶ | ( not defined $self->{lc $_} ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $$self{lc $_} and defined $$self{lc $_}
MC/DC0%0/2
exists $$self{lc $_} and defined $$self{lc $_}
exists $$self{lc $_}
defined $$self{lc $_}
Truth table33%1/3
A and B
A= exists $$self{lc $_}B= defined $$self{lc $_}
| |||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | 6 | return( %args ); | |||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | ### | ||||||||||||||||||||||||||||
| 261 | ### Class methods | ||||||||||||||||||||||||||||
| 262 | ### | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | sub api_versions | ||||||||||||||||||||||||||||
| 265 | 3 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
api_versions: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 266 | 3 | return( sort keys( %$methods ) ); | |||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | ### | ||||||||||||||||||||||||||||
| 270 | ### Methods | ||||||||||||||||||||||||||||
| 271 | ### | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | sub methods | ||||||||||||||||||||||||||||
| 274 | 8 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
methods: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 275 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | 8 | return( @{ $methods_arr->{$self->api_version} } ); | |||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | sub events | ||||||||||||||||||||||||||||
| 281 | 8 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
events: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 282 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 8 | return( @{ $events_arr->{$self->api_version} } ); | |||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | sub everything | ||||||||||||||||||||||||||||
| 288 | 4 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
everything: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 289 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | 4 | return( ( ( $self->methods() ), ( $self->events() ) ) ); | |||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | ### | ||||||||||||||||||||||||||||
| 295 | ### Predicates | ||||||||||||||||||||||||||||
| 296 | ### | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | sub is_method | ||||||||||||||||||||||||||||
| 299 | 511 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
is_method: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 300 | 511 | my( $self, $name ) = ( shift, shift ); | |||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | 511 | ▶ | return $FALSE unless( defined( $name ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | 507 | ▶ | return( exists( $methods->{$self->api_version}->{$name} ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 305 | ? $TRUE | ||||||||||||||||||||||||||||
| 306 | : $FALSE ); | ||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | sub is_event | ||||||||||||||||||||||||||||
| 310 | 314 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
is_event: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 311 | 314 | my( $self, $name ) = ( shift, shift ); | |||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 314 | ▶ | return $FALSE unless( defined( $name ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | 310 | ▶ | return( exists( $events->{$self->api_version}->{$name} ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 316 | ? $TRUE | ||||||||||||||||||||||||||||
| 317 | : $FALSE ); | ||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | sub in_api | ||||||||||||||||||||||||||||
| 321 | 331 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
in_api: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 322 | 331 | my( $self, $name ) = ( shift, shift ); | |||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | 331 | ▶ | return $FALSE unless( defined( $name ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 327 | ▶ | return( ( $self->is_method( $name ) or $self->is_event( $name ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->is_method($name) or $self->is_event($name)
MC/DC100%2/2
$self->is_method($name) or $self->is_event($name)
$self->is_method($name)
$self->is_event($name)
Truth table100%3/3
A or B
A= $self->is_method($name)B= $self->is_event($name)
| |||||||||||||||||||||||||||||
| 327 | ? $TRUE | ||||||||||||||||||||||||||||
| 328 | : $FALSE ); | ||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | ### | ||||||||||||||||||||||||||||
| 332 | ### Accessors | ||||||||||||||||||||||||||||
| 333 | ### | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | sub api_version | ||||||||||||||||||||||||||||
| 336 | 848 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
api_version: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 337 | 848 | my $self = shift; | |||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | 848 | return( $self->{version} ); | |||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | ### | ||||||||||||||||||||||||||||
| 343 | ### Method aliases | ||||||||||||||||||||||||||||
| 344 | ### | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | 3 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 347 | 3 | *version = *api_version; | |||||||||||||||||||||||||||
| 348 | 3 | *versions = *api_versions; | |||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | 3 | 1; | |||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | __END__ | ||||||||||||||||||||||||||||