Skip to content

Instantly share code, notes, and snippets.

@akarelas-pt

akarelas-pt/crash_3.pl

Last active Jun 4, 2019
Embed
What would you like to do?
this always crashes
#!/opt/perl-5.28.0/bin/perl
use v5.28;
use warnings;
use FindBin '$RealBin', '$RealScript';
use lib "$RealBin/local/lib/perl5", "$RealBin/lib";
use DateTime::Format::Strptime;
use Storable 'store', 'retrieve';
use Data::Dumper;
use Scalar::Util 'weaken';
my $foo = [
DateTime::Format::Strptime->new(
pattern => '%Y-%m-%d %H:%M',
time_zone => 'UTC',
),
{},
];
$foo->[1]{a}{b} = $foo->[1];
weaken $foo->[1]{a}{b};
print Dumper($foo->[1]);
store $foo, './big_array.dat';
retrieve './big_array.dat';
@akarelas-pt

This comment has been minimized.

Copy link
Owner Author

@akarelas-pt akarelas-pt commented Jun 4, 2019

Output:

$VAR1 = {
          'a' => {
                   'b' => $VAR1
                 }
        };
sv_upgrade from type 7 down to type 1 at /opt/perl-5.28.0/lib/5.28.0/x86_64-linux/Storable.pm line 414, at ./test.pl line 28.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment