From 1224cc691900a9461e29708b847d46b2ea81a96d Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Tue, 16 Jan 2018 16:20:47 +0100 Subject: [PATCH] TT#30507 option to set forcearray statically Change-Id: I038a9dfbb0d14a8882a4ee0fe38bbd60ffb78f5e --- lib/Data/HAL.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Data/HAL.pm b/lib/Data/HAL.pm index e852d7b..f16a695 100644 --- a/lib/Data/HAL.pm +++ b/lib/Data/HAL.pm @@ -17,6 +17,9 @@ use Types::Standard qw(ArrayRef Bool HashRef InstanceOf Str); our $VERSION = '1.000'; +our $__forcearray = undef; +our $__forcearray_underneath = undef; + my $uri_from_str = sub { my ($val) = @_; return $val->$_isa('Data::HAL::URI') ? $val : Data::HAL::URI->new( @@ -37,6 +40,8 @@ has('_forcearray_underneath', is => 'rw', isa => HashRef ); #{ all => 1 } means sub BUILD { my ($self) = @_; $self->_expand_curies unless $self->_recursing; + $self->_forcearray($__forcearray) if defined $__forcearray; + $self->_forcearray_underneath($__forcearray_underneath) if defined $__forcearray_underneath; return; }