xml-axkit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Chamberlain <michael.chamberl...@btinternet.com>
Subject Re: really simple question
Date Wed, 18 May 2005 07:40:57 GMT
We're talkijng about this yeah? (see below).

I suspect what's happening (since I wrote that bit of code to stop  
the double
fetch of the provider string.. is that get_fh() is now working - and  
code
elsewhere is failing because it wasn't expecting this.

get_fh is broke in old axkits, if you read the old log carefully,  
it's always fails
and always fell back to get_strref - the fault being in the c code to  
which it
was bound...

Mike.

sub get_xml_info{
     my ($self, $media, $pref_style ) = @_;

     # This is where the sniffing of the xml content happens.

     my $r = $self->apache_request();
     my @ret;
     eval{
         my $fh = $self->get_fh();
         my $pos = eval { tell $fh; };
         if($@) {
             # fh is not seekable, thus we must slurp file at this  
point.
             undef $@;
             local($/) = undef;
             my $string = <$fh>;
             $r->pnotes('xml_string', $string);
             @ret = parse_xml_info( $r, undef, \$string, $media,  
$pref_style);
         } else {
             # seekable.
             @ret = parse_xml_info( $r, $fh, undef, $media,  
$pref_style);
             seek $fh, 0, $pos;
         }
     };
     if($@) {
         my $str_ref = $self->get_strref();
         $r->pnotes('xml_string', ${$str_ref});
         @ret = parse_xml_info( $r, undef, $str_ref, $media,  
$pref_style);
     }
     return @ret;
}

On 16 May 2005, at 08:01, S. Woodside wrote:

> The following code in Provider.pm get_xml_info():
>
>         if($@) {
>                 my $str_ref = $self->get_strref();
>                 $r->pnotes('xml_string', ${$str_ref});
>                 @ret = parse_xml_info( $r, undef, $str_ref, $media,  
> $pref_style);
>         }
>         return @ret;
>
> Now if I add a debug statement like this:
>         AxKit::Debug(10, "SIMON get_xml_info str_ref = ".${$str_ref});
> I get what I'd expect, e.g. the XML document printed out.
>
> But if I add this:
>         AxKit::Debug(10, "SIMON get_xml_info pnotes('xml_string') =  
> ".$r->pnotes('xml_string'));
> then I get nothing. What am I doing wrong?
>
> simon
>
>


Mime
View raw message