Maybe the perl i'm using is modified as it seems to work correctly.
No. You can see how its broken by giving a different extension, like this
#!/usr/bin/perl --
use Test::More ;
for my $ext ( qw/ jpg gif bmp PNG / ) {
my $isItTrue = int( $ext eq "jpg"||"gif"||"bmp");
is( $isItTrue, 1, "$ext" );
}
Test::More::done_testing();
__END__
ok 1 - jpg
not ok 2 - gif
# Failed test 'gif'
# at - line 5.
# got: '0'
# expected: '1'
not ok 3 - bmp
# Failed test 'bmp'
# at - line 5.
# got: '0'
# expected: '1'
not ok 4 - PNG
# Failed test 'PNG'
# at - line 5.
# got: '0'
# expected: '1'
1..4
# Looks like you failed 3 tests of 4.
I thought CGI caused undue overhead?
If the overhead bothers you, use CGI::Simple, or better yet, get a better webserver, like plackup
I highly recommend you start with beginning-perl book, or Tutorials |