Devel-Hints

 view release on metacpan or  search on metacpan

Hints.pm  view on Meta::CPAN

    LABEL:
    print cop_label();	    # 'LABEL'
    # cop_label is only settable on Perl 5.8 or below
    cop_label(0 => 'FOO');  # "goto FOO;" is valid after this point!

    print cop_file();	    # same as __FILE__
    print cop_filegv();	    # same as \$::{'_<' . __FILE__}
    print cop_stashpv();    # same as __PACKAGE__
    print cop_stash();	    # same as \%{__PACKAGE__ . '::'}
    print cop_seq();	    # an integer
    print cop_arybase();    # same as $[
    print cop_line();	    # same as __LINE__

    # cop_warnings() is only available to Perl 5.8 or below
    use warnings;
    print cop_warnings();   # same as compile-time ${^WARNING_BITS}

    # cop_io() is only available to Perl 5.7 and Perl 5.8
    use open IO => ':utf8';
    print cop_io();	    # same as compile-time ${^OPEN}

README  view on Meta::CPAN

        LABEL:
        print cop_label();      # 'LABEL'
        # cop_label is only settable on Perl 5.8 or below
        cop_label(0 => 'FOO');  # "goto FOO;" is valid after this point!

        print cop_file();       # same as __FILE__
        print cop_filegv();     # same as \$::{'_<' . __FILE__}
        print cop_stashpv();    # same as __PACKAGE__
        print cop_stash();      # same as \%{__PACKAGE__ . '::'}
        print cop_seq();        # an integer
        print cop_arybase();    # same as $[
        print cop_line();       # same as __LINE__

        # cop_warnings() is only available to Perl 5.8 or below
        use warnings;
        print cop_warnings();   # same as compile-time ${^WARNING_BITS}

        # cop_io() is only available to Perl 5.7 and Perl 5.8
        use open IO => ':utf8';
        print cop_io();         # same as compile-time ${^OPEN}

t/1-basic.t  view on Meta::CPAN


{
    no strict 'refs';
    package Bar;
    main::is_deeply(main::cop_stash(), \%{__PACKAGE__ . '::'}, 'cop_stash');
}

ok(cop_seq(), 'cop_seq');

no warnings 'deprecated';
$[ = 10;
is(cop_arybase(), 10, 'cop_arybase');

is(cop_line(), __LINE__, 'cop_line');

SKIP: {
    skip('cop_warnings() not available', 3) unless defined cop_warnings();

    use warnings;
    is(cop_warnings(0), 16, 'cop_warnings');

t/3-coderef.t  view on Meta::CPAN

{
    package Foo;
    use warnings;
    no warnings 'deprecated';
    use open IO => ':utf8';
    BEGIN {
        $warning_bits = ${^WARNING_BITS};
        $open = ${^OPEN};
    }

    $[ = 10;
    $line = __LINE__ + 3;

    $sub = sub {
        warn 'foo';
        reset 'X';
        my @a = (1..10);
        /blarg/ || warn 'foo';
        if (sub { 1 }->()) {
            warn 'foo';
        }



( run in 0.303 second using v1.01-cache-2.11-cpan-cc502c75498 )