houseabsolute / DateTime-Locale

Localization support for DateTime.pm
https://metacpan.org/release/DateTime-Locale/
Other
3 stars 12 forks source link

Locale objects return references to internal data structures, not copies #10

Open autarch opened 8 years ago

autarch commented 8 years ago

Migrated from rt.cpan.org #65717 (status was 'new')

Requestors:

From felipe@cpan.org on 2011-02-14 17:20:29:

use DateTime;
my $cldr = DateTime::Locale->load('en');
my $weekdays = $cldr->day_format_abbreviated();
my $sun = pop @$weekdays;
print join ',', @{$cldr->day_format_abbreviated()};

Shouldn't the DateTime::Locale methods return a copy of the array?

It doesn't seem right that manipulating the return of day_format_abbreviated() should affect the result of future invocations of that function.

ccntrq commented 4 years ago

In #26 the performance impact of fixing this by returning a copy of the data was discussed. We concluded that the performance hit is not worth it. The behavior described here hast been documented in 272bcae930bab894acfedcc830b88bf22d1e9e1b.

I think this is closable. @autarch?

autarch commented 4 years ago

The issue it describes is still a thing, so I'll leave it open.