Skip Menu |

This queue is for tickets about the Config-JFDI CPAN distribution.

Report information
The Basics
Id: 88921
Status: new
Priority: 0/
Queue: Config-JFDI

People
Owner: Nobody in particular
Requestors: bokutin [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.0065
Fixed in: (no value)



Subject: Modification of a read-only value attempted
% prove -I lib t/9bug-readonly.t t/9bug-readonly.t .. 1/? Modification of a read-only value attempted at /usr/home/bokutin/code/reading/Config-JFDI-0.065/lib/Config/JFDI.pm line 199. # Tests were run but no plan was declared and done_testing() was not seen. t/9bug-readonly.t .. Dubious, test returned 2 (wstat 512, 0x200) All 2 subtests passed Test Summary Report ------------------- t/9bug-readonly.t (Wstat: 512 Tests: 2 Failed: 0) Non-zero exit status: 2 Parse errors: No plan found in TAP output Files=1, Tests=2, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.33 cusr 0.05 csys = 0.41 CPU) Result: FAIL https://github.com/doy/data-visitor/blob/master/t/callback.t#L67
Subject: bug-readonly.patch
diff --git a/lib/Config/JFDI.pm b/lib/Config/JFDI.pm index db80a3c..cef0bdb 100644 --- a/lib/Config/JFDI.pm +++ b/lib/Config/JFDI.pm @@ -19,6 +19,7 @@ use Hash::Merge::Simple; use Sub::Install; use Data::Visitor::Callback; use Clone qw//; +use Scalar::Util qw/ readonly /; has package => qw/ is ro isa Str /; @@ -161,6 +162,7 @@ sub load { my $visitor = Data::Visitor::Callback->new( plain_value => sub { return unless defined $_; + return $_ if readonly($_); $self->substitute($_); } ); diff --git a/t/9bug-readonly.t b/t/9bug-readonly.t new file mode 100644 index 0000000..a8d471a --- /dev/null +++ b/t/9bug-readonly.t @@ -0,0 +1,23 @@ +use strict; +use warnings; +use Test::Most; + +use Config::JFDI; + +my $config; + +$config = Config::JFDI->new( + name => 'scalar-noref', + path => 't/assets', +); +ok $config->get->{key}; +is $config->get->{key}, 'value'; + +$config = Config::JFDI->new( + name => 'scalar-ref', + path => 't/assets', +); +ok $config->get->{key}; +is ${$config->get->{key}}, 'value'; + +done_testing; diff --git a/t/assets/scalar-noref.pl b/t/assets/scalar-noref.pl new file mode 100644 index 0000000..1c08704 --- /dev/null +++ b/t/assets/scalar-noref.pl @@ -0,0 +1,3 @@ +{ + key => 'value', +}; diff --git a/t/assets/scalar-ref.pl b/t/assets/scalar-ref.pl new file mode 100644 index 0000000..068d333 --- /dev/null +++ b/t/assets/scalar-ref.pl @@ -0,0 +1,3 @@ +{ + key => \'value', +};