Damian Conway wrote:
> 
> 
>    > Where should this info be maintained? In a module in @INC (sort of like
>    > CPAN/MyConfig.pm)? Or in a special file that's only written to via a
>    > module install? Or in a block atop each module that's yanked out via
>    > MakeMaker? Or???
> 
> The parser needs to have it in a standard system-wide place.

Hmmm. I see what you mean, but why couldn't it be in @INC, first one
wins? The file could be named AutoUse.pm or something.

I would assume that 'use' would be done before 'autouse', so any 'use
lib' statements would already be taken into account? I'm probably
missing something super-obvious, so please point it out if so.

> I wasn't actually proposing it as a replacement mechanism for Exporter,
> but if that standard configuration file included the line:
> 
>         autouse STD::autouse { 1 }
> 
> then I suppose any other module could replace:
> 
>         @EXPORT = qw( foo bar );
> 
> with:
> 
>         autouse foo {1}
>         autouse bar {1}

What about making it into a 'use overload' style declaration to decrease
the tedium? No need for multi-value foreach necessarily:

   autouse foo => {1}, bar => {1};

> ...replace:
>
>         @EXPORT_OK = qw( only by request );
> 
> with:
> 
>         autouse only    {requested},
>                 by      {requested},
>                 request {requested},
>         ;
> 
> Hmmmm. Tidy, but too tedious perhaps?

Yeah, a little too tedious. For the EXPORT thingy it seems a different
pragma would be more fitting:

   use export always => [qw(you get this)],
              request => [qw(only by request)],
              tags => { cgi => [qw(param etc)] };

Then the key request would point to the applicable thingies. Just like
@EXPORT_OK but w/ a pragma.

I actually wasn't proposing that autouse replace @EXPORT either, but
this is may be a worthwhile brainstorming thread...

-Nate

Reply via email to