| 1 | # -*- mode: cperl; tab-width: 8; indent-tabs-mode: nil; basic-offset: 2 -*- | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # vim:ts=8:sw=2:et:sta:sts=2 | ||||||||||||||||||||||||||||||||||||||||||
| 3 | ######### | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # Author: rmp | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | package Ham::ADIF; | ||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Ham::ADIF::ADX; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Ham::ADIF::ADI; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | our $VERSION = q[2026.07.25]; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 10 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | my ($class, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | my $self = { $ref ? %{$ref} : () }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 10 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 10 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 4 | ▶ | sub parse_adi { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_adi: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 4 | my ($self, $filename, $schema) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 4 | return Ham::ADIF::ADI->new->parse_file($filename); | |||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | sub parse_adx { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_adx: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | my ($self, $filename, $schema) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | return Ham::ADIF::ADX->new->parse_file($filename, $schema); | |||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 5 | ▶ | sub parse_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_file: called CC=5 SCAR=16.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 5 | my ($self, $filename, $schema) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 5 | ▶ | if($schema || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$schema or $filename =~ /xml$/imsx or $filename =~ /adx$/imsx
$schema or $filename =~ /xml$/imsx
MC/DC33%1/3
$schema or $filename =~ /xml$/imsx or $filename =~ /adx$/imsx
$schema
$filename =~ /xml$/imsx
$filename =~ /adx$/imsx
Truth table50%2/4
A or B or C
A= $schemaB= $filename =~ /xml$/imsxC= $filename =~ /adx$/imsx
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | $filename =~ /xml$/smix || | ||||||||||||||||||||||||||||||||||||||||||
| 39 | $filename =~ /adx$/smix) { | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | return $self->parse_adx($filename, $schema); | |||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | ######### | ||||||||||||||||||||||||||||||||||||||||||
| 44 | # determine if we have ADI or ADX | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 4 | my $io = IO::File->new($filename, q[r]); | |||||||||||||||||||||||||||||||||||||||||
| 47 | 4 | my $firstline = <$io>; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 4 | ▶ | if($firstline =~ m{<[?]xml}smix) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | return $self->parse_adx($filename, $schema); | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 4 | return $self->parse_adi($filename); | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 56 | __END__ | ||||||||||||||||||||||||||||||||||||||||||