Summary
BNGUtils.pm — arguably the most foundational utility module in the BioNetGen Perl codebase — has been running without use strict since its creation. Line 2 of the file reads:
This means typos in variable names silently create new variables, undeclared variables don't raise errors, and symbolic references are unchecked throughout all 27 subroutines in this module.
Location
File: bng2/Perl2/BNGUtils.pm, line 2
Additionally, ComponentType.pm and HNauty.pm lack use strict entirely (not even a TODO comment).
Current behavior
package BNGUtils;
# TODO use strict;
# Perl Modules
use FindBin;
Impact
Without use strict:
- A typo like
$reuslt instead of $result silently creates a new variable initialized to undef
- Variables can be used without declaration via
my, making scope bugs invisible
- Symbolic references (e.g., using a string as a variable name) are allowed, which can cause hard-to-trace errors
Since BNGUtils provides core utilities used across the entire codebase (error handling, version info, math helpers, file I/O wrappers), any latent bugs here propagate everywhere.
How to verify
head -5 bng2/Perl2/BNGUtils.pm
# Also check which other files lack use strict:
grep -rL 'use strict;' bng2/Perl2/*.pm
Suggested fix
Uncomment and enable strict:
package BNGUtils;
use strict;
use warnings;
This will likely surface undeclared variable warnings that need to be fixed, but that's the point — those are latent bugs.
Summary
BNGUtils.pm— arguably the most foundational utility module in the BioNetGen Perl codebase — has been running withoutuse strictsince its creation. Line 2 of the file reads:# TODO use strict;This means typos in variable names silently create new variables, undeclared variables don't raise errors, and symbolic references are unchecked throughout all 27 subroutines in this module.
Location
File:
bng2/Perl2/BNGUtils.pm, line 2Additionally,
ComponentType.pmandHNauty.pmlackuse strictentirely (not even a TODO comment).Current behavior
Impact
Without
use strict:$reusltinstead of$resultsilently creates a new variable initialized toundefmy, making scope bugs invisibleSince
BNGUtilsprovides core utilities used across the entire codebase (error handling, version info, math helpers, file I/O wrappers), any latent bugs here propagate everywhere.How to verify
Suggested fix
Uncomment and enable strict:
This will likely surface undeclared variable warnings that need to be fixed, but that's the point — those are latent bugs.