Pat Rice wrote:
> Hi all
> getting the following error with html trees,
> I think its due to not using a global variable.
> 
> but when I try an "our" variable for the tree object I still hit the
> same issue, i htnk my problem is getting the orignal object.
> 
> 
> Any ideas ????
> 
> 
> Can't call method "as_text" on unblessed reference at ./lastTouched3.pl line 
> 77.
> 
> 
> 
> Code:
> 
>      65 my $TreeTest_SR_INCrementer;
>      66 my $SR_Number_as_text = "0.1.0.4.1.0";
>      67 my $counter =1;
>      68 foreach my $item_r ($tree->address("$address")->content_refs_list) {
>      69 #    next if ref $$item_r;
>      70 #    $$item_r =~ s/honour/honor/g;
>      71         $counter++;
>      72         print "\n in for each: $counter \n";
>      73
>      74         my $srIncrementer = "$SR_Number_as_text.$counter.0";
>      75         print "\n in for each: $srIncrementer\n";
>      76
>      77         $TreeTest_SR_INCrementer =$item_r->as_text;
>      78         print "\n sr = $TreeTest_SR_INCrementer";
>      79
>      80  }

The content_refs_list method returns a list of references to the child nodes of
the object. It's only useful if you want to modify text nodes in the tree,
otherwise you may as well use the content_list method, which simply returns a
list of the child nodes instead of references to them.

In simple terms, if you change content_refs_list to content_list in the code
above, then line 77 will work fine. If you retain content_refs_list then you
need to write

77         $TreeTest_SR_INCrementer =${$item_r}->as_text;

HTH,

Rob



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


Reply via email to