New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data::Dumper: cannot handle ref type 10 #13603
Comments
From agalama@mailfish.de$ perl -MData::Dumper -E 'say Dumper(\pos())' $ perl -MData::Dumper -E 'say $Data::Dumper::VERSION' $ perl --version This is perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-linux-thread-multi Copyright 1987-2013, Larry Wall Perl may be copied only under the terms of either the Artistic License or the Complete documentation for Perl, including FAQ lists, should be found on |
From @garuI'm probably way out of my league here, but it looks like Data::Dumper perl -MDDP -E 'my $x = \pos(); p $x' perl -MDDP -E '$_ = q(foo); if(m/o/g) { $x = \pos(); p $x }' Even when pos() is set, $VAR1 still behaves weirdly: perl -MData::Dumper -E '$_ = q(foo); if(m/o/g) { $x = \pos(); warn Dumper($x) }' The pure Perl version fails similarly, but with a less cryptic error message: perl -MData::Dumper -E '$Data::Dumper::Useperl=1; say Dumper(\pos())' If the fix is just treating it as a regular SCALAR ref, I can try and Cheers, garu On Sat, Feb 15, 2014 at 1:56 PM, Anand Galama <perlbug-followup@perl.org> wrote:
|
The RT System itself - Status changed from 'new' to 'open' |
From @demerphqOn 15 February 2014 19:18, breno <garu@cpan.org> wrote:
I think that it is going to be somewhere between difficult and Consider the following from blead: $ ./perl -Ilib -MDevel::Peek -e'my $str="foobar"; Dump $x=[\$str, You will need to decode the MAGIC attached to the LVALUE and also peek Yves |
From @demerphqOn 17 February 2014 12:54, demerphq <demerphq@gmail.com> wrote:
Sorry, this was mistaken and I should have removed it before sending.
-- |
From perl5-porters@perl.orgYves Orton wrote:
You can use B. The hard part is in deciding how to dump the LVALUEs Do you output \pos(do { my $x = 'xxxxx' })? Or \pos('xxxxx')? Either way, that becomes somewhat meaningless since pos() will be So do we output do { my |
From @demerphqOn 17 February 2014 15:28, Father Chrysostomos <sprout@cpan.org> wrote:
I think the point here is referential integrity. If I have a data structure [ \$str, \pos($str) ] then I think the Which means that serializing it as you describe is for me a non-starter. consider this: perl -le'my $str= "foo"; $str=~/./gc; my $x=[ \$str, \pos($str) ]; I would expect that that should do the same as if we did this the dumped output: $ perl -le'my $str= "foo"; $str=~/./gc; my $x=[ \$str, \pos($str) ]; IOW, the important part is we serialize it such that the original Also I think using pos() as the example for this is less than useful. I would start with using substr() refs. Which IMO should be much less my $str= "foo"; and I then do ${$VAR1->[1]}= "Q"; then printing out ${$VAR1->[0]} should output: "fQo" If it doesn't then I would consider referential integrity to be broken. Yves -- |
From @tseeOn 02/17/2014 03:46 PM, demerphq wrote:
[snip discussion of referential integrity] Agreed. But taking a step back, is this really something that DD should be able Shouldn't it instead do one of two things: a) Die with an intelligible error message. or b) Copy-serialize or some other cop-out? --Steffen |
From @demerphqOn Monday, 17 February 2014, Steffen Mueller <smueller@cpan.org> wrote:
In the sense of round tripping data i agree. But from the sense of dumping
its a tough call regardless. we are basically leaking internal abstractions. yves -- |
From mail@steffen-mueller.netOn 02/17/2014 08:47 PM, demerphq wrote:
Fair. FTR, I am not at all a fan of the fact that DD output is evalable.
Agreed. My stance is that making DD handle *any* Perl data structure and --Steffen |
From @timbunceOn Tue, Feb 18, 2014 at 09:21:47AM +0100, Steffen Mueller wrote:
Perhaps that guarantee should be officially loosened in the docs. Tim. |
From @demerphqOn 18 February 2014 09:42, Tim Bunce <Tim.Bunce@pobox.com> wrote:
Unless Purity is enabled there is no such guarantee as far as I know. $ perl -MData::Dumper -e'my ($x,$y); $x=\$y; $y=\$x; print Dumper($x,$y);' Is an example of a seemingly correct dump which is actually under cheers, -- |
From @demerphqOn 18 February 2014 10:40, demerphq <demerphq@gmail.com> wrote:
And if they are disabled you will be able to eval it, but it wont Cheers, perl -Mre=debug -e "/just|another|perl|hacker/" |
From @demerphqOn 18 February 2014 09:21, Steffen Mueller <mail@steffen-mueller.net> wrote:
See my reply to Tim. I am not convinced it is guaranteed that is evalable.
Yeah, I agree generally. Or Devel::Peek. But that has not received the Yves -- |
Migrated from rt.perl.org#121254 (status was 'open')
Searchable as RT121254$
The text was updated successfully, but these errors were encountered: