[Melbourne-pm] Hash Containing Array

Gerd Berner gberner at intraspect.com.au
Sat Mar 21 18:03:23 PDT 2009


Hello all

I'm having a few problems with some basic object oriented methods.  My  
constructor and set method works fine, but I'm struggling to read the  
keys back from the object once it is created.  My methods are attached  
below along with a screen dump of the created object.  Any help would  
be greatly appreciated.


     sub new
     {
     my $class=shift;
     my $self = {};
     $self->{_DATASET}=undef;
     $self->{_RULE}=undef;
     $self->{_PRIVILEGE}=undef;
     $self->{_ACC_VIA_RULE}= {};
     $self->{_ACC_VIA_PRIV}= [];
     $self->{_CAN_UPDATE_RULE} =[];
     bless ($self,$class);
     return $self;
     }

     sub set_acc_via_rule
     {
     my $self = shift;
     my $key = shift;
     my @val = @_;
     foreach my $val (@val)
             {
             unshift @{$self->{_ACC_VIA_RULE}{$key}},$val;
             }
     return;
     }

     sub get_back_keys
     {
     my $self = shift;
     my ($key,$value);
     while (my ($key,$value) = each ($self->{_ACC_VIA_RULE}))
         {unshift @keys,$key;}
         return @keys;
     }

Type of arg 1 to each must be hash (not hash element) at  
acf2_dataset.pm line 122, near "})"

Regards

Gerd


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20090322/b0bf3aed/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture 2.png
Type: image/png
Size: 12877 bytes
Desc: not available
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20090322/b0bf3aed/attachment.png>


More information about the Melbourne-pm mailing list