in reply to Re^3: Gzip compression issue?
in thread (SOLVED by Anonymous Monk) Gzip compression issue?

EEk! the || operators don't work like that? I've got my languages switched up then. Maybe the perl i'm using is modified as it seems to work correctly. I'll test if further assuming it doesn't work now. The last thing I want is my script serving up ANY file on my servers :O omg! I'm chewing through your code, myself not being proficient in perl. I thought CGI caused undue overhead? Chewing, chewing :) Thank-you so much for your further help. This gives me an example that I haven't seen via google
There isn't in existence

Replies are listed 'Best First'.
Re^5: Gzip compression issue?
by Anonymous Monk on Dec 25, 2011 at 16:56 UTC

    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

      Saved me the testing time, thanks :) I'd have used real life examples, hitting the webserver to see if things worked properly, taking much more time to debug. I definately am looking into better web servers, but i'm only planning atm. Until i'm going live, I don't need to worry about overhead, but its best to keep it low from the start. Thank-you again, you've answered everything I needed to know and more :) Happy holidays!

      PS: Yes, i've checked out some of those writings and continue to read through them

      There isn't in existence
Re^5: Gzip compression issue?
by Anonymous Monk on Dec 27, 2011 at 14:09 UTC

    See also B::Deparse

    $ cat junk int( $ext eq "jpg"||"gif"||"bmp") $ perl -MO=Deparse,-p junk int(((($ext eq 'jpg') or 'gif') or 'bmp')); junk syntax OK $ perl -le " print int( 'jpg' eq 'jpg' ) " 1 $ perl -le " print int( 'gif' ) " 0 $ perl -le " print int( 'bmp' ) " 0