Re: Obsoleting require 'Some/Module.pm'

2005-12-19 Thread Darren Duncan

At 2:58 PM +0200 12/19/05, Gaal Yahas wrote:

Can we make this work?

 my $mod = Some::Module;
 require $mod;

It's a very simple patch to pugs. While we're at it, does anybody see a
compelling reason to leave in the Perl 5 semantics of require $file?

snip

I would very much appreciate such a feature myself, since I always or 
primarily use Perlish names when loading modules.  With such a 
change, I would be able to say:


require $module_name;

... and have it DWIM, which in my mind is the same as require Foo;, 
and I would no longer have to say:


eval require $module_name;;
die if $!;

... as I do now.

I like to save string evals for when I'm actually using arbitrary 
runtime generated Perl code which is in a variable.


-- Darren Duncan


Re: Obsoleting require 'Some/Module.pm'

2005-12-19 Thread Sam Vilain
On Mon, 2005-12-19 at 14:58 +0200, Gaal Yahas wrote:
 Can we make this work?
 
  my $mod = Some::Module;
  require $mod;

What about casting it to a package;

  require ::{$mod};

(not sure if the syntax is quite right)

Sam.