[cgiapp] Using HTTP chunked transfer with CGI::App?

2010-06-18 Thread Des Herriott
Hi,

I'm working on a CGI::Application app which needs to run some potentially
slow tasks, and I want to keep the user updated about its progress.
The runmodes I'm using:

- show_request_form - display the initial request form
- show_preview - once the user has entered their data, display
 a list of the work that will be done
- submit_request - carry out the actual work

The submit_request runmode will run several tasks, some of which could
be quite slow.  The overall run time of this runmode could be 20-30
seconds, so I want to keep the user updated after each task is completed.
It seems like HTTP chunked transfer is what I need here, but I'm having
trouble understanding how to make it work with CGI::App.  Since CGI::App
runmodes basically constructs the entire page and return it, I can't see
a way to return one chunk of the page at a time.

Am I missing something, is there perhaps a useful a plugin to
progressively render some output, or is this just not going to work?

Thanks,

-- 
Des Herriott
des.herri...@gmail.com

#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




[cgiapp] Authentication cant find my driver

2010-06-18 Thread Jerry Kaidor
Hello,

  Really stuck here


I'm trying to create a new driver for CAP::Authentication.  When I run
my program, it says:
--- snip --
Error executing class callback in prerun stage: Driver MULTI_DBI can not
be found at
/usr/lib/perl5/site_perl/5.10.0/CGI/Application/Plugin/Authentication.pm
line 1096.
- endsnip ---

   I put my driver ( MULTI_DBI.pm ) in the same directory as the existing
drivers.  It has the same ownership and permissions as the existing
drivers.
It has the same structure as the existing drivers, with the exception that
instead of subclassing Driver, it subclasses Driver::DBI.  I tried to
change it to subclassing Driver instead, but no luck.  I changed MULTI_DBI
to MULTIDBI on the off chance that it didn't like the underscore, no luck.

   Grepping around, I can't find any list of drivers in Authentication.pm
or Driver.pm.

   Is there some giant perl-wide list ( besides @INC ) of all the files
that are available to require()?

   - Jerry Kaidor



#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Authentication cant find my driver

2010-06-18 Thread Cees Hek
On Sat, Jun 19, 2010 at 12:51 AM, Jerry Kaidor  wrote:
>    I'm trying to create a new driver for CAP::Authentication.  When I run
> my program, it says:
> --- snip --
> Error executing class callback in prerun stage: Driver MULTI_DBI can not
> be found at
> /usr/lib/perl5/site_perl/5.10.0/CGI/Application/Plugin/Authentication.pm
> line 1096.
> - endsnip ---
>
>   I put my driver ( MULTI_DBI.pm ) in the same directory as the existing
> drivers.  It has the same ownership and permissions as the existing
> drivers.

What does your 'package' line at the top of your module look like?  It
should be:

package CGI::Application::Plugin::Authentication::Driver::MULTI_DBI;

Cheers,

Cees

#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Authentication cant find my driver

2010-06-18 Thread Jerry Kaidor
And just for yuks, I said:



require 
'/usr/lib/perl5/site_perl/5.10.0/CGI/Application/Plugin/Authentication/Driver/DBI.pm'

...at the top of my application

  and it found it.

Then I changed it to

require 
'/usr/lib/perl5/site_perl/5.10.0/CGI/Application/Plugin/Authentication/Driver/MULTIDBI.pm'

and it DIDN'T find it.

   So apparently there IS some sort of Perl system-wide list of files and
packages besides @INC.  Can't be @INC because my file is in the same
directory.  Right?

  - Jerry Kaidor



> Hello,
>
>   Really stuck here
>
>
> I'm trying to create a new driver for CAP::Authentication.  When I run
> my program, it says:
> --- snip --
> Error executing class callback in prerun stage: Driver MULTI_DBI can not
> be found at
> /usr/lib/perl5/site_perl/5.10.0/CGI/Application/Plugin/Authentication.pm
> line 1096.
> - endsnip ---
>
>I put my driver ( MULTI_DBI.pm ) in the same directory as the existing
> drivers.  It has the same ownership and permissions as the existing
> drivers.
> It has the same structure as the existing drivers, with the exception that
> instead of subclassing Driver, it subclasses Driver::DBI.  I tried to
> change it to subclassing Driver instead, but no luck.  I changed MULTI_DBI
> to MULTIDBI on the off chance that it didn't like the underscore, no luck.
>
>Grepping around, I can't find any list of drivers in Authentication.pm
> or Driver.pm.
>
>Is there some giant perl-wide list ( besides @INC ) of all the files
> that are available to require()?
>
>- Jerry Kaidor
>
>
>
> #  CGI::Application community mailing list  
> ####
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
> ####
> ##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
> ##  Wiki:  http://cgiapp.erlbaum.net/ ##
> ####
> 
>



#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Authentication cant find my driver

2010-06-18 Thread Jerry Kaidor

>
> What does your 'package' line at the top of your module look like?  It
> should be:
>
> package CGI::Application::Plugin::Authentication::Driver::MULTI_DBI;
>
*** Yes, it is exactly that.

  - Jerry




#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




[cgiapp] Using HTTP chunked transfer with CGI::App?

2010-06-18 Thread Nicholas Bamber
Hi Des,
I would suggest that you look into AJAX and try to handle rather more on 
the client/javascript side. If you will permit I will give some hints on 
how I would approach it. There are alternatives but I primarily use the 
YUI framework for javascript stuff.

1.) The CGI::Application part should largely just initiate the process.
2.) You need a second back-end process (not strictly part of the web 
application) to do the actual work.
3.) Your CGI::Application should support a run mode that returns a 
progress report. This would not be a web page in the normal sense. The 
MIME type should probably be "application/json" rather than "text/html" 
and you should wrap it with the JSON perl module.
4.) The YUI connection manager provides a good AJAX framework. 
http://developer.yahoo.com/yui/connection/. Using the connection manager 
the client side gets the JSON data described in 4. and parses it using 
http://developer.yahoo.com/yui/json/ .
5.) You do the actual display using 
http://developer.yahoo.com/yui/progressbar/ .

If that is all too javascript heavy for you then you should be able to 
at least do 1. and 2. Then your web page should display the status and 
put in some automatic refresh in the headers until the work is complete.

The one thing you really cannot do is leave the browser wating whilst 
the work completes.

Nicholas


> Message: 1
> Date: Fri, 18 Jun 2010 14:40:06 +0100
> From: Des Herriott 
> Subject: [cgiapp] Using HTTP chunked transfer with CGI::App?
> To: cgiapp@lists.erlbaum.net
> Message-ID:
>   
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi,
>
> I'm working on a CGI::Application app which needs to run some potentially
> slow tasks, and I want to keep the user updated about its progress.
> The runmodes I'm using:
>
> - show_request_form - display the initial request form
> - show_preview - once the user has entered their data, display
>  a list of the work that will be done
> - submit_request - carry out the actual work
>
> The submit_request runmode will run several tasks, some of which could
> be quite slow.  The overall run time of this runmode could be 20-30
> seconds, so I want to keep the user updated after each task is completed.
> It seems like HTTP chunked transfer is what I need here, but I'm having
> trouble understanding how to make it work with CGI::App.  Since CGI::App
> runmodes basically constructs the entire page and return it, I can't see
> a way to return one chunk of the page at a time.
>
> Am I missing something, is there perhaps a useful a plugin to
> progressively render some output, or is this just not going to work?
>
> Thanks,
>
>   

#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Authentication cant find my driver

2010-06-18 Thread Ron Savage
Hi Jerry

On Fri, 2010-06-18 at 08:14 -0700, Jerry Kaidor wrote:
> And just for yuks, I said:
> 
> 
> 
> require 
> '/usr/lib/perl5/site_perl/5.10.0/CGI/Application/Plugin/Authentication/Driver/DBI.pm'
> 
> ...at the top of my application
> 
>   and it found it.
> 
> Then I changed it to
> 
> require 
> '/usr/lib/perl5/site_perl/5.10.0/CGI/Application/Plugin/Authentication/Driver/MULTIDBI.pm'
> 
> and it DIDN'T find it.

Correct. The '_' is missing from MULTI_DBI.

>So apparently there IS some sort of Perl system-wide list of files and
> packages besides @INC.  Can't be @INC because my file is in the same
> directory.  Right?

I don't think that's the problem...

-- 
Ron Savage
http://savage.net.au/
Ph: 0421 920 622


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Authentication cant find my driver

2010-06-18 Thread Jerry Kaidor
> Hi Jerry
>>
> Correct. The '_' is missing from MULTI_DBI.

*** Yes, I was back and forth on that underscore.  I just put it back in,
because it didn't make any difference.


>
>>So apparently there IS some sort of Perl system-wide list
> I don't think that's the problem...

*** I don't think so, either.
  I tried the following experiment:

1.  Saved MULTI_DBI.pm somewhere else.
2.  Copied DBI.pm to MULTI_DBI.pm

   Then it worked!  Well, didn't really work, because DBI.pm doesn't
have to code to do what I wanted.  But it got past the "can't find the
driver" error.

   I think that there is a subtlety in this line of MULTI_DBI.pm:

--- snip 
use base qw(CGI::Application::Plugin::Authentication::Driver::DBI);
--- endsnip 

   Either it is not finding the DBI driver, or the DBI driver is unable
to find something that IT needs.  I've seen similar before in other
systems:  file A needs library B, it can't find it, and the system
complains that it can't find file A, even though it's right in front of
your face.

   I had to leave it for now and get some real work done for my business.

- Jerry Kaidor




>
> --
> Ron Savage
> http://savage.net.au/
> Ph: 0421 920 622
>
>
> #  CGI::Application community mailing list  
> ####
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
> ####
> ##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
> ##  Wiki:  http://cgiapp.erlbaum.net/ ##
> ####
> 
>



#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####