Hi,

http://perl.apache.org/guide/perl.html#my_Scoped_Variable_in_Nested_S
advises not to use external "my $variables"
from subroutines. I have
the following subroutine in my CGI-script, which I would like to keep
mod_perl-kosher, just in case:

################################################################################
# Sort %hoh-values by the 'sort'-parameter or by default ("MHO")               #
################################################################################

sub mysort
{
    my $param = $query -> param ('sort') || 'MHO'; # XXX global $query,
                                                   # not mod_perl clean?
    return $a -> {$param} cmp $b -> {$param};
}

This subroutine is called later as:

    for my $href (sort mysort values %$hohref)
    {
...
    }

Is using the "outside" $query dangerous here and how would you handle it?

Thank you
Alex

PS: Is there something to be aware of, when using the new "our" keyword?

Reply via email to