in reply to Catalyst: accessing maketext from a model
I have a little test script running, the setup for which is this:package MyApp::Maketext; use strict; use warnings; use parent qw(CatalystX::I18N::Maketext); 1;
I am then trying two different ways to get a handle to the maketext() method:#!/usr/bin/perl use strict; use warnings; use FindBin qw( $Bin ); use lib "$Bin/../lib"; use TopTable::Maketext; use Path::Class::Dir; my $dir = Path::Class::Dir->new( "$Bin/..", "root", "locale" ); TopTable::Maketext->load_lexicon( locales => ["en_GB"], # Required directories => [$dir], # Required gettext_style => 0, # Optional, Default 1 );
Gives the following result: Can't call method "maketext" on an undefined value at bin\maketext-demo.pl line 23. If I swap ->get_handle to ->new:my $lang = TopTable::Maketext->get_handle; printf "%s\n", $lang->maketext( "menu.title.news" );
I get the following:my $lang = TopTable::Maketext->new; printf "%s\n", $lang->maketext( "menu.title.news" );
I'm at a bit of a loss as to what to try next! Thank you so much in advance for any pointers anyone can give.maketext doesn't know how to say: menu.title.news as needed at bin\maketext-demo.pl line 23.
|
|---|