Show and Tell with Role::Tiny and CGI::Application::Dispatch
Jim Bacon did his presentation remotely through Google Hangouts. This worked somewhat better than expected. He presented a difficult problem of adapting an API in a system that was not designed for it. The constraints imposed by the original system made a simple solution impractical.
The requirements prevented upgrading all endpoints for each version. Getting
access to prefix required subclassing CGI::Application::Dispatch
.
Additionally, the original design had embedded the authentication in a base
class. The new API version needed a different authentication scheme. The base
class/authentication thing pre-dates him, so he does not know why it was done
that way.
In order to update the authentication mechanism depending on the version and to
prevent problems with the new API using the old endpoints, Jim had to modify
the way the base classes worked. Made a new base class that is not versioned.
Applying a role on the fly, to apply the appropriate base functionality. Don't
use Role::Tiny::apply_role_to_class
. It will keep adding roles in
a persistent environment.
The presentation triggered a good discussion on various implications of this design.
UTF-8 and Perl
Next, Todd Rinaldo described his adventures in Unicode and UTF-8.
Working on the Perl compiler. B::C almost everything has a flag for utf-8 support. Rather than adding yet another presentation on-line about the subject, Todd pointed to Nick Patch's presentation. He also referenced the Perl tutorial on utf-8 (perlunitut, etc. does a very good job of explaining this stuff.) Although the material is out there, sometimes it's useful to have someone walk through it.
He explained some of the fun of bit encodings. We had a discussion of bits and encodings. He pointed out a particular problem he had stumbled across using JSON. You must downgrade JSON strings before using them for filesystem work. Also remember that UTF-8 is not the only encoding. A particular nasty is UTF-7, which almost matches ASCII. There is such a thing as utf-7 XSS attacks.
We had 11 people attending this month. As always, we'd like to thank HostGator, LLC for providing the meeting space and food for the group.