From 43788b3f793da6fd4936861f3090d03fff70f604 Mon Sep 17 00:00:00 2001 From: Shawn Laffan Date: Thu, 7 Apr 2016 08:16:46 +1000 Subject: [PATCH 1/5] Avoid compilation failures due to changes in the Readonly library. We were probably doing it wrong before and this has picked up a bug. --- lib/Biodiverse/Metadata/Export.pm | 6 ++++-- lib/Biodiverse/Metadata/Indices.pm | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Biodiverse/Metadata/Export.pm b/lib/Biodiverse/Metadata/Export.pm index 3d0f66864..1c8dde718 100644 --- a/lib/Biodiverse/Metadata/Export.pm +++ b/lib/Biodiverse/Metadata/Export.pm @@ -4,7 +4,6 @@ use warnings; use 5.016; use Carp; -use Readonly; use Scalar::Util qw /reftype/; use Readonly; @@ -13,7 +12,7 @@ our $VERSION = '1.1'; use parent qw /Biodiverse::Metadata/; -Readonly my %methods_and_defaults = ( +Readonly my %methods_and_defaults => ( parameters => {}, format_choices => [], format_labels => {}, @@ -51,6 +50,9 @@ sub get_sub_name_from_format { no autovivification; my $check_name = $args{format_label} // $args{format}; + croak "neither 'format_label' nor 'format' argument is not defined\n" + if !defined $check_name; + my $check_sub_name = "export_$check_name"; my $format_labels = $self->get_format_labels; diff --git a/lib/Biodiverse/Metadata/Indices.pm b/lib/Biodiverse/Metadata/Indices.pm index f21b3ec29..1c6f4efd6 100644 --- a/lib/Biodiverse/Metadata/Indices.pm +++ b/lib/Biodiverse/Metadata/Indices.pm @@ -10,7 +10,7 @@ use parent qw /Biodiverse::Metadata/; our $VERSION = '1.1'; -Readonly my %methods_and_defaults = ( +Readonly my %methods_and_defaults => ( name => 'no_name', description => 'no_description', uses_nbr_lists => 1, @@ -32,7 +32,7 @@ __PACKAGE__->_make_access_methods (\%methods_and_defaults); -Readonly my %dep_types = ( +Readonly my %dep_types => ( pre_calc_global => 1, pre_calc => 1, post_calc => 1, From b88175404b577c409c6767844e3bac0e61850f81 Mon Sep 17 00:00:00 2001 From: Shawn Laffan Date: Thu, 14 Apr 2016 09:07:16 +1000 Subject: [PATCH 2/5] Convert more google code URLs to point to their current location. --- etc/site_pair_sampler/bin/sample_parameters_phylo.txt | 2 +- etc/site_pair_sampler/bin/sample_parameters_simplest.txt | 2 +- etc/site_pair_sampler/bin/sample_parameters_species.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/site_pair_sampler/bin/sample_parameters_phylo.txt b/etc/site_pair_sampler/bin/sample_parameters_phylo.txt index 85ba64d97..f30d684f1 100644 --- a/etc/site_pair_sampler/bin/sample_parameters_phylo.txt +++ b/etc/site_pair_sampler/bin/sample_parameters_phylo.txt @@ -17,7 +17,7 @@ # Blank lines are also ignored. # # # # Help is available at: # -# https://code.google.com/p/biodiverse/wiki/SitePairSampler # +# https://purl.org/biodiverse/wiki/SitePairSampler # # # # Dan Rosauer August 2013 to May 2014 # ################################################################################ diff --git a/etc/site_pair_sampler/bin/sample_parameters_simplest.txt b/etc/site_pair_sampler/bin/sample_parameters_simplest.txt index 549feffe7..70102e539 100644 --- a/etc/site_pair_sampler/bin/sample_parameters_simplest.txt +++ b/etc/site_pair_sampler/bin/sample_parameters_simplest.txt @@ -17,7 +17,7 @@ # Blank lines are also ignored. # # # # Help is available at: # -# https://code.google.com/p/biodiverse/wiki/SitePairSampler # +# https://purl.org/biodiverse/wiki/SitePairSampler # # # # Dan Rosauer August 2013 to May 2014 # ################################################################################ diff --git a/etc/site_pair_sampler/bin/sample_parameters_species.txt b/etc/site_pair_sampler/bin/sample_parameters_species.txt index d5ddf4c0f..9a559a560 100644 --- a/etc/site_pair_sampler/bin/sample_parameters_species.txt +++ b/etc/site_pair_sampler/bin/sample_parameters_species.txt @@ -17,7 +17,7 @@ # Blank lines are also ignored. # # # # Help is available at: # -# https://code.google.com/p/biodiverse/wiki/SitePairSampler # +# https://purl.org/biodiverse/wiki/SitePairSampler # # # # Dan Rosauer August 2013 and March 2014 # ################################################################################ From 72fc5aba2b42f502a9e611cf6efe7b68cb3fcbd7 Mon Sep 17 00:00:00 2001 From: Shawn Laffan Date: Thu, 14 Apr 2016 09:08:12 +1000 Subject: [PATCH 3/5] Use defined-or. --- lib/Biodiverse/SpatialConditions.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Biodiverse/SpatialConditions.pm b/lib/Biodiverse/SpatialConditions.pm index 804f41c9b..ed0e7b8c6 100644 --- a/lib/Biodiverse/SpatialConditions.pm +++ b/lib/Biodiverse/SpatialConditions.pm @@ -2581,7 +2581,7 @@ sub get_polygons_from_shapefile { my $field_val = $args{field_val}; - my $cache_name = join ':', 'SHAPEPOLYS', $file, ($field || $NULL_STRING), (defined $field_val ? $field_val : $NULL_STRING); + my $cache_name = join ':', 'SHAPEPOLYS', $file, ($field // $NULL_STRING), ($field_val // $NULL_STRING); my $cached = $self->get_cached_value($cache_name); return (wantarray ? @$cached : $cached) if $cached; From 2ccedb43698c74c9ef25b076292792a79e96e122 Mon Sep 17 00:00:00 2001 From: Shawn Laffan Date: Thu, 14 Apr 2016 09:09:36 +1000 Subject: [PATCH 4/5] require Spreadsheet:: modules to avoid reload warnings for Spreadsheet::SXC. These lines are only there for the benefit of PAR::Packer when it searches for dependent modules so we don't need to call "use". --- lib/Biodiverse/BaseData.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Biodiverse/BaseData.pm b/lib/Biodiverse/BaseData.pm index 71fdbba6d..5f33a0fbf 100644 --- a/lib/Biodiverse/BaseData.pm +++ b/lib/Biodiverse/BaseData.pm @@ -22,10 +22,10 @@ use Spreadsheet::Read 0.60; # these are here for PAR purposes to ensure they get packed # Spreadsheet::Read calls them as needed # (not sure we need all of them, though) -use Spreadsheet::ReadSXC qw //; -use Spreadsheet::ParseExcel qw //; -use Spreadsheet::ParseXLSX qw //; -use Spreadsheet::XLSX qw //; +require Spreadsheet::ReadSXC; +require Spreadsheet::ParseExcel; +require Spreadsheet::ParseXLSX; +require Spreadsheet::XLSX; use English qw { -no_match_vars }; From 903cf423aa51e332d72370603f9db47f5c38516d Mon Sep 17 00:00:00 2001 From: Shawn Laffan Date: Thu, 14 Apr 2016 09:10:10 +1000 Subject: [PATCH 5/5] Minor update to comments. --- lib/Biodiverse/ReadNexus.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Biodiverse/ReadNexus.pm b/lib/Biodiverse/ReadNexus.pm index ef677d963..6c400428a 100644 --- a/lib/Biodiverse/ReadNexus.pm +++ b/lib/Biodiverse/ReadNexus.pm @@ -598,6 +598,7 @@ sub parse_newick { my $node_count = $args{node_count} // croak 'node_count arg not passed (must be scalar ref)'; my $translate_hash = $args{translate_hash} || $self->get_param ('TRANSLATE_HASH'); + # clunky that we need to do this - was convenient once, but not now my $use_element_properties = $self->get_param ('USE_ELEMENT_PROPERTIES'); my $element_properties = $use_element_properties ? ($args{element_properties} || $self->get_param ('ELEMENT_PROPERTIES')) @@ -613,7 +614,7 @@ sub parse_newick { my $progress_bar = $args{progress_bar}; if (!$progress_bar) { - $est_node_count = $string =~ tr/,(//; # tr shortcuts to count items matching /(,/ + $est_node_count = $string =~ tr/,(//; # tr shortcuts to count items matching /,(/ $est_node_count ||= 1; #say "Estimated node count is $est_node_count"; $tree->set_cached_value (ESTIMATED_NODE_COUNT => $est_node_count);