cosmicperl has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,
  I've been needing to do this for a while and recent events have made it a necessity. I have a product coded in Perl (CGI) which get installed on all kinds of servers, IIS, Apache, Win32, Linux, BSD, etc. As it's installed in all kinds of setups I've got it coded to act differently on different servers depending on the environment and modules available.

I need to generate two types of graphics
  1. One of those authentication images to block automated calls
  2. Some Bar and Pie charts to show statistics
My main concern is doing this without the need for the end user to install perl modules. A lot of these guys are on shared hosting with very inflexible hosts. If I can just include the Perl module in with my package that'll be good enough, but I know a lot have to be added into Perl properly for them to work.

So I guess what I really asking for is some advice onthe best and most common modules to use, and if there are any modules in the core that would fit the bill.

Thanks in advance!

Lyle

Replies are listed 'Best First'.
Re: Image generation
by biosysadmin (Deacon) on Aug 25, 2005 at 22:37 UTC
    There's a Perl module named PAR that should be able to help you. The basic idea is that it allows you to bundle your programs with all of the necessary modules and code into an executable. It's really cool, although the file sizes can get pretty big, which might be an issue for some people with limited web hosting packages.

    Check out the project homepage for more information.

Re: Image generation
by chester (Hermit) on Aug 25, 2005 at 23:01 UTC
    I think the authentication image you're referring to is called a "captcha". Authen::Captcha may be useful. There are tons of CPAN modules to do pie charts, like Chart::Pie. None of which I've used myself.

    I've had good experiences with PAR; you don't even have to have Perl installed to run a pp-generated executable.

      The BIG downside to "captcha"-like technologies is that it limits access to those who can use image-oriented interfaces. That excludes the whole blind population, or those who use text-only browsers for other reasons. (That also means the US Government can't buy or use your methods, since they can't legally exclude a disabled population so cavalierly.) Before you dismiss that group out of whim, ask yourself if there is any other way to accomplish your goals.

      For every perceived problem, there is a solution that is obvious, easy, and wrong.

      --
      [ e d @ h a l l e y . c c ]

Re: Image generation
by ait (Hermit) on Aug 25, 2005 at 23:10 UTC
    For graphics I've used GD and is usually installed in many ISPs
      I see that all those suggested modules need the GD module. What about on Win32? ActivePerl doesn't have gd by default. Does Win32 have a different system for doing it?

      Lyle
        In fact it appears that ActiveState don't even have gd.pm available for their Perl 5.8, there is only a module for 5.6.
        Does anyone have a solution?

        Lyle
Re: Image generation
by johnnywang (Priest) on Aug 26, 2005 at 05:43 UTC
    I just recently installed GD on two of my linux boxes. It seems mostlikely you need to install libpng, zlib, gd and then the perl GD package. I found it much easier, on linux, just to download the source of all these, and build them directly (total takes about 5 minutes once downloaded). On win32 with ActiveX just do: "ppm install http://theoryx5.uwinnipeg.ca/ppms/GD.ppd"
      You also need GD::Graph
      to plot pies and bars(there are some other alternatives to this module).