Skip to content

Commit

Permalink
Helpful error message if instantiation is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel Horne committed Feb 10, 2021
1 parent 3304f8d commit 1b06272
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
9 changes: 7 additions & 2 deletions lib/FCGI/Buffer.pm
Expand Up @@ -102,9 +102,14 @@ Create an FCGI::Buffer object. Do one of these for each FCGI::Accept.

# FIXME: Call init() on any arguments that are given
sub new {
my $class = shift;
my $proto = shift;
my $class = ref($proto) || $proto;

return unless($class);
# Use FCGI::Buffer->new(), not FCGI::Buffer::new()
if(!defined($class)) {
carp(__PACKAGE__, ' use ->new() not ::new() to instantiate');
return;
}

my $buf = IO::String->new();

Expand Down
14 changes: 7 additions & 7 deletions t/vars.t
Expand Up @@ -5,12 +5,12 @@ use warnings;

use Test::Most;

if(not $ENV{RELEASE_TESTING}) {
plan(skip_all => 'Author tests not required for installation');
}

eval "use Test::Vars";
if(not $ENV{AUTHOR_TESTING}) {
eval 'use Test::Vars';

plan skip_all => "Test::Vars required for detecting unused variables" if $@;
plan(skip_all => 'Test::Vars required for detecting unused variables') if $@;

all_vars_ok();
all_vars_ok();
} else {
plan(skip_all => 'Author tests not required for installation');
}

0 comments on commit 1b06272

Please sign in to comment.