Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Re: browser and OS detection..

Expand Messages
  • Jeff 'japhy' Pinyan
    ... I think It d be easier to use a hash %res, and use $Resolution as the keys: $res{$Resolution}++; -- Jeff japhy Pinyan japhy@pobox.com
    Message 1 of 5 , Oct 28, 2003
    • 0 Attachment
      On Oct 28, Franki said:

      >if ($Resolution eq '560x420')
      > {$res560x420 +=1;}
      >elsif ($Resolution eq '640x480')
      > {$res640x480 +=1;}
      >elsif ($Resolution eq '800x600')
      > {$res800x600 +=1;}
      >elsif ($Resolution eq '2048x768')
      > {$res2048x768 +=1;}
      >elsif ($Resolution eq '2304x864')
      > {$res2304x864 +=1;}
      >else
      >{$res_others += 1;}
      >}

      I think It'd be easier to use a hash %res, and use $Resolution as the
      keys:

      $res{$Resolution}++;

      --
      Jeff "japhy" Pinyan japhy@... http://www.pobox.com/~japhy/
      RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
      <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
      [ I'm looking for programming work. If you like my work, let me know. ]
    • Franki
      ... Thanks Mr Japhy, I had considered that, but I wanted non Perl types to be able to add new resolutions easily. There are some benefits to doing it your
      Message 2 of 5 , Oct 28, 2003
      • 0 Attachment
        Jeff 'japhy' Pinyan wrote:

        > On Oct 28, Franki said:
        >
        >
        >>if ($Resolution eq '560x420')
        >> {$res560x420 +=1;}
        >>elsif ($Resolution eq '640x480')
        >> {$res640x480 +=1;}
        >>elsif ($Resolution eq '800x600')
        >> {$res800x600 +=1;}
        >>elsif ($Resolution eq '2048x768')
        >> {$res2048x768 +=1;}
        >>elsif ($Resolution eq '2304x864')
        >> {$res2304x864 +=1;}
        >>else
        >>{$res_others += 1;}
        >>}
        >
        >
        > I think It'd be easier to use a hash %res, and use $Resolution as the
        > keys:
        >
        > $res{$Resolution}++;
        >


        Thanks Mr Japhy,

        I had considered that, but I wanted non Perl types to be able to add new
        resolutions easily.
        There are some benefits to doing it your way.. new resolutions could be
        automatically added to the hash instead of being manually added to the
        elsif.. but regardless, the screen res part of the script is not the
        problem, its currently the fastest part.

        I'm about to start hacking on HTTP-BrowserDetect-0.97.tar.gz to add
        XP/2003 as well as firebird and all the other browsers that have come
        out since 2001.

        Thanks for the advice though, much appreciated.

        rgds

        Franki
        --
      Your message has been successfully submitted and would be delivered to recipients shortly.