File: eval-my-variables.t

package info (click to toggle)
libcgi-compile-perl 0.27-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 248 kB
  • sloc: perl: 372; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 390 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!perl

use Test::More tests => 2 * 6;
use CGI::Compile;

for my $var (qw/self VERSION data path dir self/) {
    my $sub = eval {
        my $script = 'use strict; $'.$var;
        CGI::Compile->compile(\$script);
    };

    my $exc = 'Global symbol "\$'.$var.'" requires explicit package name';
    like $@, qr/$exc/, 'exception '.$var;
    is $sub, undef, 'compilation failed '.$var;
}