| 1 | ################################################################################ | ||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||
| 3 | # MODULE: Convert::Binary::C | ||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||
| 5 | ################################################################################ | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | # DESCRIPTION: Convert::Binary::C Perl extension module | ||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||
| 9 | ################################################################################ | ||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||
| 11 | # Copyright (c) 2002-2020 Marcus Holland-Moritz. All rights reserved. | ||||||||||||||||||||||||||||
| 12 | # This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 13 | # it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 14 | # | ||||||||||||||||||||||||||||
| 15 | ################################################################################ | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | package Convert::Binary::C; | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 61 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 61 | ▶ | use DynaLoader; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 61 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 61 | ▶ | use vars qw( @ISA $VERSION $AUTOLOAD ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 61 | @ISA = qw(DynaLoader); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 61 | $VERSION = '0.84'; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 61 | bootstrap Convert::Binary::C $VERSION; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # Unfortunately, XS AUTOLOAD isn't supported | ||||||||||||||||||||||||||||
| 31 | # by stable perl distributions before 5.8.0. | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | sub AUTOLOAD | ||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||
| 35 | 6227 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||
| 36 | 6227 | my $opt = $AUTOLOAD; | |||||||||||||||||||||||||||
| 37 | 6227 | ▶ | ref $self or croak "$self is not an object"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 6227 | $opt =~ s/.*://; | |||||||||||||||||||||||||||
| 39 | 6227 | ▶ | $opt =~ /^[A-Z]/ or croak "Invalid method $opt called"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 6226 | ▶ | @_ <= 1 or croak "$opt cannot take more than one argument"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 6225 | ▶ | unless (@_ or defined wantarray) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@_ or defined wantarray
MC/DC100%2/2
@_ or defined wantarray
@_
defined wantarray
Truth table100%3/3
A or B
A= @_B= defined wantarray
| |||||||||||||||||||||||||||||
| 42 | 21 | carp "Useless use of $opt in void context"; | |||||||||||||||||||||||||||
| 43 | 21 | return; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | 6204 | my @warn; | |||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||
| 47 | 6204 | ▶ | local $SIG{__WARN__} = sub { push @warn, $_[0] }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 48 | 6204 | $opt = eval { $self->configure( $opt, @_ ) }; | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | 6204 | for my $w (@warn) { | |||||||||||||||||||||||||||
| 51 | 4 | $w =~ s/\s+at.*?C\.pm.*//s; | |||||||||||||||||||||||||||
| 52 | 4 | carp $w; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | 6204 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 210 | $@ =~ s/\s+at.*?C\.pm.*//s; | |||||||||||||||||||||||||||
| 56 | 210 | croak $@; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | 5994 | $opt; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 61 | 1; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | __END__ | ||||||||||||||||||||||||||||