Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Not a fan of this change. What's wrong with saying $foo->require or die $@; That's not too much to type. It breaks this kind of useful idiom: $this->require or $that->require or die "No alternatives found: $@"; and it breaks this kind of portability even more

    if ( $better->require )
    {
       $better->frobnicate;
    }
    else
    {
        $default->frobnicate;
    }

    It also makes it difficult to write a custom error message - I have to wrap the call in an eval, and so we're back where we starte

    • I have to wrap the call in an eval, and so we're back where we started before UNIVERSAL::require.

      No we're not. Now you're wrapping it in eval{}, not in eval "". That's a big win.
      --
      rjbs
      • Coincidentaly, this is what Module::Load does -- analogous to 'require', but not doing the silly bareword vs string differentiation:

        use Module::Load;

        my $module = 'Data:Dumper';
        load Data::Dumper; # loads that module
        load 'Data::Dumper'; # ditto
        load $module # tritto


        You can read the docs here [cpan.org]