Hey guys,

I'm wondering what's the best way to initialize an object with some
database data during apache startup and providing this object (with the
data) globally to all mason components. I'm currently doing this in my
ApacheHandler package:

[...]

package HTML::Mason::Commands {
  use vars qw($my_global_object);
}

[...]

my $the_object = My::Class->new();
# new connects to the database, fetches some stuff
# and stores it in $self

[...]

sub handler {
  [...]
  $HTML::Mason::Commands::my_global_object = $the_object;
  [...]
}

Is this okay or does anybody know of a better way? Could this cause any
issues regarding the database handle used in My::Class?

Thanx for your help!

Tobias




_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to