in reply to Re^2: Getting rid of "new" (wrong target; perl6)
in thread Getting rid of "new"

I was addressing module authors more than module users. That looks like a nice module for when using modules that don't already support factories [well, the last example -- the prior ones would need to be written as Munger()->new( ... ) to meet my best practices but still wouldn't meet my preference]. Note that your module wouldn't work for a module that actually did get rid of all class methods. (:

Oh, and that last example would need to be use aliased 'alias'; to meet my best practices. I suspect your module doesn't support that, so I doubt I'll be using it until that gets fixed. :)

- tye        

Replies are listed 'Best First'.
Re^4: Getting rid of "new" (aliased.pm)
by bart (Canon) on Jul 07, 2006 at 19:19 UTC
    Oh, and that last example would need to be use aliased 'alias'; to meet my best practices. I suspect your module doesn't support that, so I doubt I'll be using it until that gets fixed. :)
    To be honest, the name alias conflicts with a function in the module Data::Alias by xmath, which IMO is much more interesting, to get the rights to use the name.

    I wish perl5 had an easy way to import stuff into names of your own choice.

      It'd be a moderately simple change to Exporter to support:

      use aliased qw( aliasMod=alias ); use Data::Alias qw( aliasData=alias ); use Lexical::Alias qw( lexAlias=alias );

      and one that I've long expected to happen. But you'd have to get aliased.pm to support being passed an argument destined for Exporter.pm, of course.

      - tye        

      I wish perl5 had an easy way to import stuff into names of your own choice

      If only more module authors started using Sub::Exporter...

      -xdg

      Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re^4: Getting rid of "new" (aliased.pm)
by Ovid (Cardinal) on Jul 08, 2006 at 10:58 UTC

    The &alias subroutine is only exported if you don't specify an import list to aliased. That's because it's from a patch by Schwern and lately he's been thinking that exporting things by default is sometimes OK. Since he's the only person who wanted the lexical aliased functionality and it only gets exported if this functionality is requested, I wasn't too worried about it.

    Cheers,
    Ovid

    New address of my CGI Course.