Hi Corion,

It also seems to be possible that you add the following to Filter::signatures's import: warnings->unimport('experimental::signatures') if $] >= 5.020;

Test code:

bar.pl:

#!/usr/bin/env perl use warnings; use strict; use Foo; use feature 'signatures'; foo(9,10); sub foo($x,$y) { print $x+$y,"\n"; }

Foo.pm:

#!perl package Foo; use warnings; use strict; sub import { warnings->unimport('experimental::signatures') if $] >= 5.020; } 1;

Foo.pm with Exporter:

#!perl package Foo; use warnings; use strict; use parent 'Exporter'; sub import { warnings->unimport('experimental::signatures') if $] >= 5.020; __PACKAGE__->export_to_level(1, @_); } 1;

Hope this helps,
-- Hauke D


In reply to Re: Optionally / safely disabling a warning category for a complete package by haukex
in thread Optionally / safely disabling a warning category for a complete package by Corion

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.