develooper Front page | perl.perl5.porters | Postings from November 2015

missing warnings unless $^P set?

Thread Next
From:
Ricardo Signes
Date:
November 25, 2015 02:40
Subject:
missing warnings unless $^P set?
Message ID:
20151125024021.GA2282@cancer.codesimply.com
Okay, so I made Xyzzy.pm:

  package Xyzzy;

  sub import { *{Foo} = sub { ... }; }

  1;

You'd expect this to issue redef warnings with -w, but:

  ~$ perl -w -e 'use Xyzzy; use Xyzzy;'
  (no output)

But!

  ~$ perl -w -e 'BEGIN { $^P = 1 } use Xyzzy; use Xyzzy;'
  Subroutine Xyzzy::Foo redefined at Xyzzy.pm line 4.

The value I put in $^P doesn't matter, as long as it's true.

-- 
rjbs

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About