Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ASP

Output Filehandle

 

 

ModPerl asp RSS feed   Index | Next | Previous | View Threaded


sjohnston at vaultranet

May 24, 2004, 3:21 PM

Post #1 of 3 (1946 views)
Permalink
Output Filehandle

I am trying to use Text::xSV to output tab seperated data to the browser
(actually a Wyncs plugin). The xSV module can output to STDOUT or any
other File Handle. When I try to use STDOUT, the text doesn't show up.
Is there some other file handle I should use?

Thanks,
Stuart Johnston

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl


josh at chamas

May 24, 2004, 3:58 PM

Post #2 of 3 (1802 views)
Permalink
Re: Output Filehandle [In reply to]

Stuart Johnston wrote:
> I am trying to use Text::xSV to output tab seperated data to the browser
> (actually a Wyncs plugin). The xSV module can output to STDOUT or any
> other File Handle. When I try to use STDOUT, the text doesn't show up.
> Is there some other file handle I should use?
>

No exactly, Apache::ASP does a select() to redirect print() calls
to a RESPONSE file handle really tied to the $Response object.

You could try something like this:

tie *RESPONSE, 'Apache::ASP::Response', $self->{Response};
print RESPONSE ...

or even using *Apache::ASP::RESPONSE directly...

BUT I would really not recommend this approach as there are no
guarantees in the Apache::ASP API for this method to exist.

What you should do is simply write this out to a temp file and
then output that directly to the browser after its created
by reading it in, and writing it using $Response->Write.

Regards,

Josh
________________________________________________________________________
Josh Chamas, Founder | NodeWorks - http://www.nodeworks.com
Chamas Enterprises Inc. | NodeWorks Directory - http://dir.nodeworks.com
http://www.chamas.com | Apache::ASP - http://www.apache-asp.org


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl


jjhelm at att

May 24, 2004, 10:56 PM

Post #3 of 3 (1839 views)
Permalink
RE: Output Filehandle [In reply to]

Or, if you're running a sufficiently recent version of perl, you can use

open HANDLE, '>', \$somevar;
#call xSV here
close HANDLE;

$Response->Write($somevar);

Bascially, you open a handle to an in-memory variable to write to. This
saves having to use a temp file. I know 5.8.0 supports this. Not sure
if it's in any of the 5.6.X versions.

--Jim

> -----Original Message-----
> From: Josh Chamas [mailto:josh [at] chamas]
> Sent: Monday, May 24, 2004 3:59 PM
> To: Stuart Johnston
> Cc: Apache-ASP List
> Subject: Re: Output Filehandle
>
>
> Stuart Johnston wrote:
> > I am trying to use Text::xSV to output tab seperated data
> to the browser
> > (actually a Wyncs plugin). The xSV module can output to
> STDOUT or any
> > other File Handle. When I try to use STDOUT, the text
> doesn't show up.
> > Is there some other file handle I should use?
> >
>
> No exactly, Apache::ASP does a select() to redirect print() calls
> to a RESPONSE file handle really tied to the $Response object.
>
> You could try something like this:
>
> tie *RESPONSE, 'Apache::ASP::Response', $self->{Response};
> print RESPONSE ...
>
> or even using *Apache::ASP::RESPONSE directly...
>
> BUT I would really not recommend this approach as there are no
> guarantees in the Apache::ASP API for this method to exist.
>
> What you should do is simply write this out to a temp file and
> then output that directly to the browser after its created
> by reading it in, and writing it using $Response->Write.
>
> Regards,
>
> Josh
> ______________________________________________________________
> __________
> Josh Chamas, Founder | NodeWorks - http://www.nodeworks.com
> Chamas Enterprises Inc. | NodeWorks Directory -
http://dir.nodeworks.com
http://www.chamas.com | Apache::ASP - http://www.apache-asp.org


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl

ModPerl asp RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.