Skip to content

Instantly share code, notes, and snippets.

View wolfjohns's full-sized avatar

Wolf Johnson wolfjohns

View GitHub Profile
@wolfjohns
wolfjohns / search_airports2
Created March 28, 2022 14:44
geekuni Topic 7 q10
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dump 'pp';
use feature 'say';
use Getopt::Long;
use Text::CSV qw(csv);
@wolfjohns
wolfjohns / csv_arr_of_hashes_return.pl
Last active March 29, 2022 16:42
geekuni Topic 7 q11
#!/usr/bin/env perl
use strict;
use warnings;
use Text::CSV qw(csv);
use Data::Dumper qw(Dumper);
my $filename = 'iata_airports.csv';
my $matching = $ARGV[0];
my @matches;
@wolfjohns
wolfjohns / findairport_airport_20_search.t
Created April 28, 2022 15:44
Topic8_unit_tests_ex10
#!/usr/bin/perl
use strict;
use warnings;
use Test::More;
#use_ok('Some::Module'); # This should be the module you're testing
use_ok('Airport::Data');
ok(1, '1 is always true');
is(1, "1", '1 is "1" according to "is"');
@wolfjohns
wolfjohns / gist:0cc1f3e32a67ee398b76151cf9ededa7
Created May 9, 2022 19:59
example of perl subroutine taking arguments
sub get_latlong_matching_airports {
my ($parm1, $parm2, $parm3, $parm4) = @_;
my %args = (
airports => $parm1,
lat => $parm2,
long => $parm3,
max => $parm4,
# @_ # this I was not sure of how it worked in the subroutine with defined keys but undefined values
);
@wolfjohns
wolfjohns / Search.pm
Created May 12, 2022 18:06
lib/Airport/Search.pm
package Airport::Search;
use strict;
use warnings;
use Data::Dump 'pp';
use feature 'say';
use List::Util qw(min max);
my $airport_data = Airport::Data::parse_airports("t/data/airports1.csv");
sub get_name_matching_airports {