diff options
| author | 2016-01-12 15:02:55 -0700 | |
|---|---|---|
| committer | 2016-01-12 15:02:55 -0700 | |
| commit | b89a5058c2e3737e1e51f77062333eb5cbbb9953 (patch) | |
| tree | 9a2e0ce331cf1cd536e3a6e350925bde329802cd /lib/ASM | |
| parent | aa1094eb3397b0b94e7cbd9261256948c3611b4c (diff) | |
Disable autovivification in Classes.pm and add some undef checks to reduce warnings.
Diffstat (limited to 'lib/ASM')
| -rw-r--r-- | lib/ASM/Classes.pm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/ASM/Classes.pm b/lib/ASM/Classes.pm index 1f0e3ef..2cd9793 100644 --- a/lib/ASM/Classes.pm +++ b/lib/ASM/Classes.pm @@ -1,5 +1,5 @@ package ASM::Classes; - +no autovivification; use strict; use warnings; use Text::LevenshteinXS qw(distance); @@ -48,9 +48,12 @@ sub new sub cloning { my ($chk, $id, $event, $chan, $rev) = @_; my $max = int($chk->{content}); - my @nicks = grep {($::sn{$_}->{host} eq $event->{host}) && (lc $chan ~~ $::sn{$_}->{mship})} keys %::sn; - # It's lines like these that make me love Perl no matter how much it drives dwfreed up a tree. - # Understanding how that line works is simple and is left as an exercise to the reader. + my @nicks = grep { + (defined($::sn{$_}->{host})) && + (defined($::sn{$_}->{mship})) && + ($::sn{$_}->{host} eq $event->{host}) && + (lc $chan ~~ $::sn{$_}->{mship}) + } keys %::sn; if ($#nicks >= $max) { return ASM::Util->commaAndify(@nicks); } |
