Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
This is an example of how imports in Perl do *not* work.
#! /usr/bin/perl
use strict;
use warnings qw(all);
package Foo;
BEGIN {
*Foo::pseudoimport = sub { printf "Cool beans!\n" };
}
sub fancysub {
pseudoimport();
}
sub normalsub {
printf "Boring beans.\n";
}
CHECK {
undef *Foo::pseudoimport;
}
package Main;
my $obj = bless {}, 'Foo';
$obj->normalsub;
$obj->fancysub;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.