[jifty-devel] Filehandles in actions

jpollack at gmail.com jpollack at gmail.com
Wed Mar 7 15:22:27 EST 2007


As an example of why one might need to know this, imagine you want to
do something with the uploaded file other than save it away.  Ie, it
seems wasteful and inelegant to make a temp file name, save $content
to that temp file, then reopen it and *then* pass that handle to
something like Archive::Zip, when Archive::Zip is able to deal with
handles directly.

Hope that makes sense,
Joshua

On 3/7/07, jpollack at gmail.com <jpollack at gmail.com> wrote:
> Thanks for your reply.  I had figured out earlier that I could access
> the contents of the file by stringifying what argument_value returned,
> or doing local $/; <$fh>, as you have.  What I'm curious as to,
> though, is what creates that $fh in the first place, and what is it?
> It's not a "normal" filehandle that I can determine.  Hence, perl
> functions that are meant to work with IO::Handle don't work.
>
> Looking at ref of $fh tells me that it is blessed as 'Fh'.  I am
> ignorant as to what type this is, and CPAN isn't helping.
>
> Thanks for your example though, making a cookbook entry is a good
> idea, and I'll reformat that into one once this is solved.
>
> On 3/7/07, Jesse Vincent <jesse at bestpractical.com> wrote:
> >
> >
> >
> > On Wed, Mar 07, 2007 at 02:03:22PM -0500, jpollack at gmail.com wrote:
> > > I'm having some bad luck using a render as 'upload' param in a Action.
> > > What data type, exactly, is returned from argument_value, when the
> > > param is an upload box?  I expected an IO::Handle, but no.  I've tried
> > > passing what it returns to Archive::Zip's readFromFileHandle, both
> > > straight, and after passing it through IO::File's fdopen.  Both don't
> > > work.
> > >
> >
> > Attached is sample code for how we do this in hiveminder. If you could
> > turn it into a recipe for the cookbook, I'd be grateful
> >
> > -jesse
> >
> > > Any ideas?
> > > Joshua
> > > _______________________________________________
> > > jifty-devel mailing list
> > > jifty-devel at lists.jifty.org
> > > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
> > >
> >
> > --
> >
> > _______________________________________________
> > jifty-devel mailing list
> > jifty-devel at lists.jifty.org
> > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
> >
> >
> >
>


More information about the jifty-devel mailing list