Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

beckheng (7386)

  (email not shown publicly)

Journal of beckheng (7386)

Tuesday February 27, 2007
03:13 AM

Be careful of using array reference under mod_perl

[ #32516 ]
I store some value with an array reference like :
$self->{stash}->{css_files} = ['a.css', 'b.css'];
I append another css file after with push function, so the array expand more and more.

So I must be avoid to using array reference in config variables.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I don't know of any problem with using array references in mod_perl. Can you explain what's giving you trouble? Maybe we can help.
    • Any help is luck for me.
      These three script show what happens.
      -------configuration file(

      package PBB::Packages::MyConfigTest;

      use strict;

      @PBB::Packages::MyConfigTest::ISA = qw(Exporter);
      %PBB::Packages::MyConfigTest::stash = (

          "p_type" => "text/html",
          "p_charset" => "UTF-8",
          "p_theme" => "gnome-default",
          "css_files" => ["aa.js", "bb.js"],


      -------startup file(


      use lib qw(/path/myprj)

      use Perl qw(others us);
      • I don't understand. Didn't you want the array to expand? If you were trying to replace it, just set it directly instead of using push:

        $t->{stash}->{css_files} = ['a.js', 'b.js'];

        There are several other things in this code that I would suggest changing, but this forum isn't the best place to do a code review. If you'd like more advice on your code, please post it on the mod_perl mailing list, or on [].