Skip to content

Instantly share code, notes, and snippets.

@dallaylaen
Created June 27, 2018 13:47
Show Gist options
  • Save dallaylaen/18fdc07147fb8840b9696fcb82cbe603 to your computer and use it in GitHub Desktop.
Save dallaylaen/18fdc07147fb8840b9696fcb82cbe603 to your computer and use it in GitHub Desktop.
require a script w/o side effects
#!perl
use strict;
use warnings;
return 1 if caller; # before parsing args, output, input etc
print foo(); # side effect!
sub foo {
return 42;
};
#!perl
use strict;
use warnings;
use Test::More;
use lib ".";
require "foo.pl";
is foo(), 42, "Foo is fine";
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment