Perl Tutorials - Herong's Tutorial Examples - v6.01, by Dr. Herong Yang
Imager::File::PNG - PNG File Format
This section provides a tutorial example on how to install Imager::File::PNG Perl module using CPAN Shell. Installation failed with 'lpng' library missing.
Note that the Perl Imager module only supports bmp, ico, pnm, raw, sgi and tga image file formats.
If you try to write an image in PNG file format, you will get an error:
herong$ perl Imager-Convert-Format.pl sample.png format 'png' not supported - formats bmp, ico, pnm, raw, sgi, tga available for reading - Can't locate Imager/File/PNG.pm at Imager-Convert-Format.pl line 11.
To support PNG file format, you need to install the Imager::File::PNG module as suggested in the error message.
herong$ perl -MCPAN -e shell cpan[1]> install Imager::File::PNG Running install for module 'Imager::File::PNG' Running make for T/TO/TONYC/Imager-File-PNG-0.94.tar.gz Fetching with LWP: http://cpan.mirrors.ovh.net/.../id/T/TO/TONYC/Imager-File-PNG-0.94.tar.gz ... CPAN.pm: Building T/TO/TONYC/Imager-File-PNG-0.94.tar.gz PNG: building independently PNG: Generic: includes not found - libraries not found ... PNG: base (+libz): includes not found - libraries not found ... PNG: Checking if the compiler can find them on its own Warning (mostly harmless): No library found for -lpng PNG: Test code failed: Can't link/include 'png.h', 'stdio.h', 'png' OS unsupported: PNG libraries or headers not found Warning: No success on command[/usr/bin/perl Makefile.PL] 'YAML' not installed, will not store persistent state TONYC/Imager-File-PNG-0.94.tar.gz /usr/bin/perl Makefile.PL -- NOT OK Running make test Make had some problems, won't test Running make install Make had some problems, won't install
Looks like the required "lpng" library is missing. So installation of Imager::File::PNG failed.
Table of Contents
Data Types: Values and Variables
Expressions, Operations and Simple Statements
Name Spaces and Perl Module Files
Hard References - Addresses of Memory Objects
Objects (or References) and Classes (or Packages)
Typeglob and Importing Identifiers from Other Packages
String Built-in Functions and Performance
File Handles and Data Input/Output
Open Directories and Read File Names
File System Functions and Operations
Imager - Create and Save Image
Imager - Draw Graphical Elements
Imager - Convert Image File Format
►Imager::File::PNG - PNG File Format
Install LIBPNG from Source Code
Install Imager::File::PNG Manually
Install PerlMagick from Source Code
Socket Communication Over the Internet
XML::Simple Module - XML Parser and Generator
SOAP::Lite - SOAP Server-Client Communication Module
Perl Programs as IIS Server CGI Scripts
CGI (Common Gateway Interface)
XML-RPC - Remote Procedure Call with XML and HTTP
RPC::XML - Perl Implementation of XML-RPC
Integrating Perl with Apache Web Server
CGI.pm Module for Building Web Pages
LWP::UserAgent and Web Site Testing
Converting Perl Script to Executable Binary