You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Scott Alexander <al...@webmail.humak.edu> on 2000/05/11 08:29:00 UTC
Best way?
Hi,
I have in every script
my $user_language = library::language($user, $dbh) ;
# is it finnish, english or swedish
my %output = library::load_language($user_language) ;
# ties %output to a dbm
%output holds all the different outputs needed for each language
then for my subs which are in a package library I pass a reference
library::menu($db, \%output) ; #passes a reference to sub menu
%output never gets modified only read.
I am using mod_perl. Is this the most efficient way of doing things?
I discovered the mistake I had when I turned on use strict in my library
package. Before this I didn't pass %output to each sub ... to be honest I really
didn't understand how each sub new the values in %output. After turning on use
strict I had to pass \%output because %output was empty in the subs.
hope this makes sense.
Scott
----------------------------------------
Scott Alexander tietoverkkosuunnittelija
scott.alexander@humak.edu
gsm: +358 (0)40 7505640