[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mason
Subject:    Re: [Mason] non-Mason aware object output to browser - how?
From:       Randy Harmon <rjharmon () uptimecomputers ! com>
Date:       2000-02-23 19:20:07
[Download RAW message or body]


Of course you could give a callback to your object:

	$report->generate_output( sub { $m->out( shift ) } );

...assuming you don't mind adding that interface to your object.

Randy

On Tue, Feb 08, 2000 at 02:00:48PM -0700, Ken Miller wrote:
> So, here I am creating a set of objects to generate some reports within
> Mason.  I figure I'll use Mason to collect the query details, generate a
> result set, instantiate a report object, and go
> 
> 	my $report = new Report::InvoiceDetail( $customer, $result_set );
> 	$report->generate_output;
> 
> from inside a Mason object to insert the details into the output page.
> 
> Well, not quite.  The data is "printed" and not "mc_out'd", so the ordering
> of the output is not correct.
> 
> How does one go about solving this?  I want a generic interface, so I can
> run batch procedures to generate reports, as well as interactive output via
> Mason; however, I don't want to be coupled to Mason (or Apache) for output.
> 
> Please don't suggest saving the output in a string, and returning it to
> Mason - these reports can get quite large (100s of pages long), and so
> would consume memory at a tremendous rate.  I would also like to avoid
> writing the report to the filesystem, and returning a handle (or filename)
> to the calling process to use (unclean, but perhaps the only solution).
> 
> I'm sure it has to do with how TIE'd filehandles are used, and how mc_out
> works differently than print from within a Mason page.
> 
> Perhaps I need to add a third paramter to the object instantiation above,
> namely a file handle?
> 
> Or, this could be a typical case of 'can't see the forest for the trees':
> the solution may be right in front of me, but I'm looking too hard. :-)
> 
> Thoughts?
> 
> 
> Cheers!
> 
> 	-klm.
> 
> -------------------------------------------
> Ken Miller, Consultant
> Shetland Software Services Inc.
> 
> 
> _______________________________________________
> Mason maillist  -  Mason@netizen.com.au
> http://netizen.com.au/mailman/listinfo/mason

_______________________________________________
Mason maillist  -  Mason@netizen.com.au
http://netizen.com.au/mailman/listinfo/mason

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic