[San-Diego-pm] module idea

Chris Grau chris at chrisgrau.com
Tue Oct 3 23:38:45 PDT 2006


On Tue, Oct 03, 2006 at 06:23:32PM -0700, Daniel Risse wrote:
> I must admit, I was also caught up with inspiration after seeing
> Damian's talk.

s/inspiration/derangement/

>                 Specifically, seeing source filters gave me a cool
> idea to combat something I have been annoyed with for a while now.

Combat, eh?  That's just the aikido talking.

> I spend a lot of time writing for a mod_perl web server.  I read and
> have done a few tests to see that importing symbols can take up
> unnecessary memory.  My tests showed about 100k for each symbol
> imported.

There's a bit about that in "Practical mod_perl," which is at the
office, so I can't reference it right now.

> Now it's not difficult to load a module and make fully qualified calls
> the functions it provide, but it's annoying.  Well, after a bit of
> tinkering this afternoon, I have a functional prototype to make this
> more efficient, and still the same ease of use.

Laziness.  I like.

> For example, you could write code like this:
> 
> use absolutify;
> use Readonly qw( Readonly );
> Readonly my $FOO => 1;
> 
> And the absolute module would install a source filter, so what would
> be compiled would instead be:
> 
> use absolutify;
> use Readonly ();
> Readonly::Readonly my $FOO => 1;
> 
> I believe this should be pretty handy and easy to use.  The interface
> certainly seems sufficiently advanced.  What do people think about
> this idea?

Slick.  I would probably use a different name, Sub::Explicit or
something (name idea taken from Perl's error message[0]).  That's mostly
personal preference, I suppose.  The lowercase makes it look like a
pragma, which is probably what you were going for.

So how do you go about doing the filtering?  How easy would it be for me
to trip up your module by throwing qw// or qw{} at it instead of qw()?

I think it's cool.  How long until I can get it from the CPAN? :)

-chris

[0] Global symbol "$FOO" requires explicit package name at - line 2.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/san-diego-pm/attachments/20061003/1fc317ef/attachment.bin 


More information about the San-Diego-pm mailing list