You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Scott Beuker <sc...@sjrb.ca> on 2003/10/16 20:58:58 UTC

MP1 to MP2 porting problem (using spreadsheet::writeexcel)

Hi,

With MP1 I was able to do the following in order to enable
Spreadsheet::WriteExcel to work properly:

 tie *XLS, 'Apache';
 binmode(XLS);
 my $workbook = Spreadsheet::WriteExcel->new(\*XLS);

But with MP2 I get the error 'Can't locate object method "TIEHANDLE" via
package "Apache"'. I have been searching and there seem to be many people
havint the same issue as myself. The closest thing I could find to an answer
was in the archives for this mailing list at
[http://www.gossamer-threads.com/archive/mod_perl_C1/modperl_F7/%5BMP2%5D_Ca
nt_dup_STDOUT_P55017/]. But although the response points towards using
"Apache::RequestIO", it does not mention how it would be utilized nor can I
find any documentation on how it would be utilized elsewhere (and my own
efforts to figure it out are proving futile).

If anyone could offer some insight, it would be greatly appreciated.

Thank you,
Scott Beuker

Re: MP1 to MP2 porting problem (using spreadsheet::writeexcel)

Posted by Stas Bekman <st...@stason.org>.
Scott Beuker wrote:
> Hi,
> 
> With MP1 I was able to do the following in order to enable
> Spreadsheet::WriteExcel to work properly:
> 
>  tie *XLS, 'Apache';
>  binmode(XLS);
>  my $workbook = Spreadsheet::WriteExcel->new(\*XLS);
> 
> But with MP2 I get the error 'Can't locate object method "TIEHANDLE" via
> package "Apache"'. I have been searching and there seem to be many people
> havint the same issue as myself. The closest thing I could find to an answer
> was in the archives for this mailing list at
> [http://www.gossamer-threads.com/archive/mod_perl_C1/modperl_F7/%5BMP2%5D_Ca
> nt_dup_STDOUT_P55017/]. But although the response points towards using
> "Apache::RequestIO", it does not mention how it would be utilized nor can I
> find any documentation on how it would be utilized elsewhere (and my own
> efforts to figure it out are proving futile).
> 
> If anyone could offer some insight, it would be greatly appreciated.

When submitting bug reports, please follow the guidelines from
http://perl.apache.org/bugs/. I can't tell what version you are using, make 
sure you are using the latest one (1.99_10).

You need to load:

   use Apache::RequestIO ();

to use "TIEHANDLE"

% lookup TIEHANDLE
There is more than one class with method 'TIEHANDLE'
try one of:
         use Apache::RequestIO ();
         use Apache::Filter ();

% alias lookup
/usr/bin/perl -MApache2 -MModPerl::MethodLookup -e print_method

starting from 1.99_10 , you could probably also do:

open my $fh, ">:Apache" or die $!;
binmode($fh)
my $workbook = Spreadsheet::WriteExcel->new($fh);

or even just:

binmode(STDOUT);
my $workbook = Spreadsheet::WriteExcel->new(\*STDOUT);

this is untested, and it certainly won't work unless your perl was built with 
perlio:

perl -V:useperlio
useperlio='define';

the latter example requires 'SetHandler perl-script', whereas the former will 
work under 'SetHandler modperl' as well.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com