help re:[ic] TIPS AND TRICKS: Tree example

C.B. Currier interchange-users@interchange.redhat.com
Sat Mar 9 20:17:01 2002


Thanks, Mike,

Unfortunately ... it is defined and accessible.

My worry is, is the syntax of line 39 correct?
Between Perl & Interchange I am not so sure. Found several db pointer
errors that I have already fixed ($tdb = $db, etc.)

Mike Heins said:
> Quoting C.B. Currier (cbcurrier@spinrx.com):
>> Some of the code from the example does not seem to work:
>>
>> store /cgi-bin/store/tree_build.html Safe: Can't call method
>> "set_slice" on an undefined value at (eval 698) line 39.
>>
>> 30    my $db = $Db{menu_tree};
>> 31    $db->query('delete from menu_tree');
>> 32    my @flds = qw/parent_fld child_fld name category/;
>> 33    my $count++;
>> 34    for(@levels) {
>> 35        my $hash = $_;
>> 36	for(sort keys %$hash) {
>> 37            	my $rec = $hash->{$_};
>> 38           	 my $code = shift @$rec;
>> 39	$db->set_slice($code, \@flds, $rec);
>> 40	    $count++;
>> 41        }
>> 42    }
>> 43    return $count;>
>
> One wonders if you have a menu_tree database defined? If you don't,
> that would cause the error.
>
> --
> Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
> phone +1.513.523.7621      <mheins@redhat.com>
>
> Prove you aren't stupid.  Say NO to Passport.
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users