OK, i give up:

What am i doing wrong:


#############################################
# test.pl
use strict;
use warnings;
use Test::More tests => 2;

my $test_string = 'overrode function';

{
    no warnings qw(once);
    *CORE::GLOBAL::glob = sub {
        $test_string;
    };

    *CORE::GLOBAL::print = sub {
        $test_string;
    };
}

is( glob, $test_string, 'overrode glob' );
is( print, $test_string, 'overrode print' );

#############################################

% perl test.pl
1..2
Subroutine CORE::GLOBAL::glob redefined at test.pl line 11.
ok 1 - overrode glob
Use of uninitialized value in print at test.pl line 19.
not ok 2 - overrode print
#   Failed test 'overrode print'
#   at test.pl line 19.
#          got: '1'
#     expected: 'overrode function'
# Looks like you failed 1 test of 2.



-------------------------------------------------------
Matisse Enzer <[EMAIL PROTECTED]>
http://www.matisse.net/  - http://www.eigenstate.net/



Reply via email to