Skip to content


Calling exists() on args array in the Mojo::Base constructor #195

alistratov opened this Issue · 1 comment

2 participants


In the Mojo::Base, line 55, method new():

exists $_[0] ? exists $_[1] ? {@_} : {%{$_[0]}} : {},

Calling exists() on array values is deprecated since perl 5.12.
Additionally, if we send undefined value for the first member in the constructor's args list (so, exists $_[1] will be false), we will get an error.

Sample code:

use strict;
use warnings;

package Sample;
use Mojo::Base -base;
has 'one';
has 'two';

package main;
my $a = Sample->new( one => undef, two => 2 );


Can't use string ("one") as a HASH ref while "strict refs" in use at /usr/local/share/perl/5.10.1/Mojo/ line 55.

Thanks, improved. e33986e

@kraih kraih closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.