Skip to content

Refs-to-refs not handled correctly (or at least as I expected) #41

@jimav

Description

@jimav

[Edit: See next comment for a related problem where refs-to-refs aren't readonly]

If the thing being Readonly::Cloned is a ref-to-scalar, you get back the scalar, without the reference:

#!/usr/bin/perl
use strict; use warnings; use feature 'say';
use Data::Dumper;
use Readonly ();

my $foo = 42;
my $original = \$foo;
my $copy = Readonly::Clone($original);

say Data::Dumper->new([$original,$copy],["original","copy"])->Dump;

RESULTS:

$original = \42;
$copy = 42;

I'm assuming Readonly::Clone() is intended to have the same API as Clone::clone().

Using Readonly 2.05 with Perl v5.34.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions