[cgiapp] Progress with my code

Jerry Kaidor jerry at tr2.com
Mon Aug 23 12:30:11 EDT 2010


Hello,

     When we last left our intrepid hero, he was struggling with
CGI::Authentication...

  OK, I got it working.  Multiple authentication databases, and a single
"global" one that awards global permissions.   And timeouts depending on
the IP address of the browser - long for the localnet, and short for the
Internet.

   I used NetAddr::IP to find out if the browser address was inside the
network defined by one of my interfaces.  That's not perfect: The
localnet is 10.xx.xx.xx, but there are routers on it that route to
wireless networks
starting with 192.168.  I'm thinking maybe to just call ANY RFC1918
compliant local address "local".  Internet gateways generally don't pass
such addresses, and my firewall specifically drops them on the external
interface, both for input and output.  Thinking about it....

   I have made good progress refactoring my code.  It is now much cleaner.
 I'm not sure what's more important: CGI::Application or
HTML::Template.  It was especially satisfying to see all that messy
HTML vanish out of my Perl code.  And the HTML in the templates is much
cleaner too, because I don't have to do any quote-escaping.   I think
the designer's decision to make HTML::Template "look like HTML" was a
good one.

   I discovered that it's possible to have multiple templates open at the
same time.  So I was able to use templates for individual areas on the
pages, individual rows in the data displays, even individual columns. 
I abandoned that last, though, because it just made things too slow,
probably because of the cost of all the template file open()s.

   In general, the new code is slower than the old.  The initial screen (
after login ) used to come up in about a second, now it takes two.  I
can tolerate that as long as the individual screens inside the
application are reasonably fast.

   So thank you all for your help!


                                  - Jerry Kaidor



More information about the cgiapp mailing list