[cgiapp] Progress with my code
Ron Savage
ron at savage.net.au
Mon Aug 23 19:47:58 EDT 2010
Hi Jerry
On Mon, 2010-08-23 at 09:30 -0700, Jerry Kaidor wrote:
> 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....
Have a look at section 2 PREAMBLE in:
http://www.isi.edu/~bmanning/dsua.html
Is there a module on CPAN which tells you an address is/is not in one of these ranges? Probably.
If not, feel free to write one :-)).
> 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.
Consider Text::XSlate
http://search.cpan.org/~gfuji/Text-Xslate-0.1058/
http://search.cpan.org/~sgraham/Template-Benchmark-1.07/lib/Template/Benchmark.pm
--
Ron Savage
http://savage.net.au/
Ph: 0421 920 622
More information about the cgiapp
mailing list