Here's my a program to test my localization class:package Hello::Locale; use strict; use Encode qw(encode); require Locale::Maketext::Lexicon; use base qw( Locale::Maketext); our %Lexicon = ( _AUTO => 1 ); sub get_handle { my $class = shift; my( $lang, $enc ) = @_; my $self = $class->SUPER::get_handle($lang); $self->{encoding} = $enc; $self; } sub maketext { my $self = shift; my @params = @_; my $result = encode( $self->encoding(), $self->SUPER::maketext( @p +arams)); $result; } sub load { my $self = shift; my %params = @_; Locale::Maketext::Lexicon->import( { $self->language_tag() => [ %p +arams], _decode => 1}); 1; } package Hello::Locale::ru; use Hello::Locale; use base qw( Hello::Locale); our %Lexicon = (); our $LEXICON_LOADED = 1; 1;
And here's a result:#!/usr/local/bin/perl use strict; use Hello::Locale; use Data::Dumper; my $filename = shift; my $lh = Hello::Locale->get_handle("ru","KOI8-R"); $lh->load( Messages => $filename); no strict 'refs'; print Dumper( $lh ); print "Lexicon loaded\n" if ${ref($lh)."\::LEXICON_LOADED"} ; print Dumper( %{ref($lh)."\::Lexicon" } );
Now, if i add before a call to $lh->maketext('ok') before print Dumper( %{ref($lh)."\::Lexicon" } ); line - it works and no core dumping. In short, with 5.8.6 i was able to access %subclass::Lexicon before calling $superclass->maketext('anything'), but with 5.24.1 i can't, as if %Lexicon is not exists before $superclass->maketext('anything') call. Is it normal?% ./test.pl file.msg $VAR1 = bless( { 'encoding' => 'KOI8-R', 'blacklist' => { 'get_handle' => 1, 'new' => 1, 'encoding' => 1, 'language_tag' => 1, 'init' => 1, 'failure_handler_auto' => 1, '_ambient_langprefs' => 1, '_langtag_munging' => 1, '_die_pointing' => 1, 'maketext' => 1, '_compile' => 1, '_try_use' => 1, '__ANON__' => 1, 'whitelist' => 1, 'fallback_languages' => 1, '_lex_refs' => 1, 'blacklist' => 1, 'fail_with' => 1, '_add_supers' => 1, 'fallback_language_classes' => 1 } }, 'Hello::Locale::ru' ); Lexicon loaded Segmentation fault (core dumped)
In reply to Core dump while trying to access %Lexicon in Locale::Maketext subclass by alexander_lunev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |