Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^6: How do I pretend a reference isn't a reference

by clinton (Priest)
on Nov 06, 2008 at 11:52 UTC ( #721962=note: print w/replies, xml ) Need Help??

in reply to Re^5: How do I pretend a reference isn't a reference
in thread How do I pretend a reference isn't a reference

Well, my original example was defining the array @days at compile time, because that's going to be more efficient than:
sub day_of_week { my $self = shift; my @days = _('Mon'),_('Tues'),_('Wed'),_('Thurs'),_('Fri') +,_('Sat'),_('Sun'); return $days[ $self->{day_num} ]; }

To give another example, I have about 3,000 lines of YAML config data, which gets loaded into a hash during initialisation. Some of that data will contain strings-to-be-translated, eg:

status: a: _('Active') i: _('Inactive')

During init, I check all the scalar values in the config hash and, if they match the _('...') form, then I bless them into i18n::String. Doing this with tie wouldn't be feasible.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://721962]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2016-10-28 23:50 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (387 votes). Check out past polls.