Steve Bertrand wrote:
I'm still trying to figure out references... in the below diff, the '+'
works ok as a passed-in hashref to an outside module, but the '-' does not.

$plan_status is *absolutely* a hashref, as I have created it as such by
hand (and verified it with Data::Dumper).

When I pass $plan_status without surrounding it with braces, I receive a
"not a HASH reference", but with the braces, the program continues normally.

What significance do the braces have here? Am I doing something wrong?

ISP % svn diff
Index: lib/ISP/GUI/Accounting.pm
===================================================================
--- lib/ISP/GUI/Accounting.pm   (revision 505)
+++ lib/ISP/GUI/Accounting.pm   (working copy)
@@ -116,7 +116,7 @@
        my $plan_status_select  = menu (
                name    => 'plan_status',
                values  => $plan_status_key,
-               labels  => $plan_status,
+               labels  => {$plan_status},
        );

        $self->pb_param( plan_status => $plan_status_select );

The braces create an anonymous hash and return a reference to that hash. If you had warnings enabled you would have received the warning:

Odd number of elements in anonymous hash at lib/ISP/GUI/Accounting.pm line 119.

So I'm guessing that $plan_status is not a hash reference.



John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to