File: MyPackage.pm

package info (click to toggle)
libfilter-eof-perl 0.04-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: perl: 1,083; makefile: 7
file content (26 lines) | stat: -rw-r--r-- 516 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package MyPackage;
use warnings;
use strict;

use Filter::EOF;

sub import {
    my ($class, @args) = @_;
    my $caller = scalar caller;

    # set the COMPILE_TIME package var to a false value
    # when the file was compiled
    Filter::EOF->on_eof_call(sub {
        no strict 'refs';
        ${ $caller . '::COMPILE_TIME' } = 0;
    });

    # set the COMPILE_TIME package var to a true value when
    # we start compiling it.
    {   no strict 'refs';
        ${ $caller . '::COMPILE_TIME' } = 1;
    }
}

1;