in reply to 'require Carp;' has differnet meanings under 'use warnings;'?

So thanks to arturo and tye I got to the bottom of this.

The reason for the difference is that 'require' is a runtime directive whereas 'use' is a compile time directive. Now since I left off the parens on the croak the croak needs to be defined for perl not to get confused. So the way to solve this problem is either use the parens (best choice I would say) or to wrap the require statements in a BEGIN block.

*sigh* So many subtleties, so little time...

BTW: tye provided a little quote in the CB that I think is useful so Ill repeat

Thanks all.

Yves / DeMerphq
--
When to use Prototypes?
Advanced Sorting - GRT - Guttman Rosler Transform

  • Comment on Re: 'require Carp;' has differnet meanings under 'use warnings;'?

Replies are listed 'Best First'.
Re: Re: 'require Carp;' has differnet meanings under 'use warnings;'?
by Juerd (Abbot) on Mar 13, 2002 at 15:46 UTC

    So the way to solve this problem is either use the parens (best choice I would say) or to wrap the require statements in a BEGIN block.

    Is there a reason for not wanting to use Carp, instead of require it? If it's the importing, you could simply supply an empty list:

    use Carp ();

    U28geW91IGNhbiBhbGwgcm90MTMgY
    W5kIHBhY2soKS4gQnV0IGRvIHlvdS
    ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
    geW91IHNlZSBpdD8gIC0tIEp1ZXJk