stevan / promises-perl

An implementation of Promises in Perl
31 stars 29 forks source link

(in cleanup) Can't use an undefined value as an ARRAY reference at ...Promises.pm line 50. #76

Closed pmorch closed 5 years ago

pmorch commented 6 years ago

This code is found in Promises.pms _set_warn_on_unhandled_reject:

( ' at ', join ' line ', @{$self->{_caller}} ) x !! $self->{_caller}

But even if $self->{_caller} is undef, @{$self->{_caller}} is still evaluated.

To reproduce:

#!/usr/bin/perl -w
use strict;
use Promises;
my $p = Promises::rejected();

# Simulate a late loaded class using warn_on_unhandled_reject
Promises->import('warn_on_unhandled_reject' => [1]);

which gives the error:

(in cleanup) Can't use an undefined value as an ARRAY reference at ...Promises.pm line 50.