Compiling a package into a namespace

Simon Wistow simon at
Mon Apr 14 20:42:57 BST 2008

On Fri, Apr 11, 2008 at 08:03:30PM +0100, Dave Cantrell said:
> It's more a case of "you're not telling us enough" :-)

You're right. And as such I will explain, just in case any one still 

So, I'm playing around with a super simple framework. it's not even a 
framework really more a sort of 'better' PHP. It's called Fiasco and 
some ideas which I wrote about it (slightly out of date but you get the 
gist) are here

So, what I want to do is have a directory that lies under the arbitary 


in that directory is a tree that looks like

    |-- c
And when you call /myapp/a.html then gets called. Similarly with 
/myapp/b.html or /myapp/c/b.html

Now this doable if I force namespaces but I'd really rather not do that. 
Also, you may have noticed that there are two 'b's I'd really like it if 
there was no package in c/ because then someone could really easily 
just do

	mv c d

and then 


would just work.

However then you have some odd problems if you want to inherit 

I'm sort of leaning towards maybe having a sort of mini DSL or helper 
functions that do the loading and the name frobbing for you. Actually 
what I'd really like is some way of making it *not* look like a Perl 
package so that you'd do this slightly contrived example

% cat c/
# load a normal Perl modules
# inherit from centrally installed Perl module
# inherit from the base previous 'b' down the directory tree
# inherit from a specific module on another branch

# do some stuff

# Helper is some utility functions that aren't meant to be seen
my $helper = class('helper');
my @stuff  = $helper->load_stuff;

# $this is automatically 
my $user   = $this->user;
return { stuff => [@stuff], user => $user };

but it's possible that just going too far.

More information about the mailing list