At 15:46 14.03.2002 -0300, [EMAIL PROTECTED] wrote:
>im using mod_perl with a module which stores all the configurations, and
>embperl for displaying the wepages
>
>a sub in this .pm has to return a hash with the configurations
>
>but that hash is inside another general hash called configurations, this is
>because each user of the program has its own configurations
>
>the sentence im using to return the value is this
>
>
>code:
>--------------------------------------------------------------------------------
>| return %Actions::Vars::config{$conf}; |
>-----------------------------------------------------------------------------------------
>
>
>being Actions::Vars:: the name of the package, config the general hash and
>$conf the name of the subhash
>
>remember that i need the entire subhash.. not values from it
>
>this isn�t working, and because im not very expreinced with perl i searched
>across with all the documentations i could find and never an example of
>something like this
>
>if you could help i�ll greatly apreciate it
Hi,
You should read the perllol documentation. It has got lots of information
about what you're talking about. This isn't a mod_per specific issue.
First of all:
the subhash you are referring to is just a value of the
%Action::Vars::config has. So you retrieve it like this:
$hashref = $Actions::Vars::config{$conf}
Now, that gives you a hash reference, from which you can access values
using $hashref->{key} ou $$hashref{key}.
If you want to retrieve the hash in normal form, like this:
my %conf = get_conf($conf);
You need to access all the values of the sub-hash.
So you get:
return %{$Actions::Vars::config{$conf}};
and then you can do:
my %hash = get_conf($conf); (or whatever)
This is actualle equivalent to:
my $hashref = $Actions::Vars::config{$conf};
my %hash = %$hashref;
Again, see perllol, it'll give you insight into this matter.
--
Per Einar Ellefsen
[EMAIL PROTECTED]