I'm working in a package namespace that is rather
far down the pipe: name1::name2::name3::name4
This is to prevent namespace pollution at the top
level, where it could conceivably collide with
other namespaces. 

The annoyance is that I'm working on a parsing grammar,
where every rule in the grammar gets its own namespace
under the name1::name2::name3::name4 umbrella.

and its rather annoying to have to say:

#############################################

package name1::name2::name3::name4::rule1;

sub parse { 
        name1::name2::name3::name4::rule2::parse
        and name1::name2::name3::name4::rule3::parse
        and name1::name2::name3::name4::rule4::parse;
}

package name1::name2::name3::name4::rule2;

sub parse { 
        name1::name2::name3::name4::rule5::parse
        and name1::name2::name3::name4::rule6::parse
}

#############################################

is there a subpackage function (OK, I know it
doesn't exist, but something like it) that would
declare a namespace under the CURRENT namespace?

so my module could say something like this:

package name1::name2::name3::name4;

subpackage rule1;

sub parse {
        rule2::parse
        and rule3::parse
        and rule4::parse;
}

subpackage rule2;

sub parse { 
        rule5::parse
        and rule6::parse;
}
        
Or something similar?
it's a bit of a drag having to put the entire
name in there every single time...

-- 
Greg London
x7541

Reply via email to