Subject: | various small fixes patched |
Hi,
Thanks for this module, it's exactly what I want :-)
I've attached a patch against Image::Epeg 0.06 which fixes some build problems and other things. It now builds out of the box for me on Debian unstable and Debian woody.
The patch makes the following fixes (listed here in the order they can be found in the patch):
Epeg.pm: minor code simplification (no change to behaviour), and a correction to the POD NAME section to prevent a warning from MakeMaker.
Epeg.xs: removed indentation from before preprocessor directives, because that's not strictly allowed in ANSI C (although compilers tend to ignore it), and removed path from the Epeg.h include. Instead of the path we rely on the right compiler directives being found from the epeg-config program in Makefile.PL.
Makefile.PL: run epeg-config to find the right include and library options to use, rather than hard-coding them.
t/epeg_basic.t: make a test slightly more strict, just in case, and avoid running 'rm' in case someone tries to build this on Windows or something.
hope that helps,
qef
diff -ur Epeg.orig/Epeg.pm Epeg/Epeg.pm
--- Epeg.orig/Epeg.pm 2005-05-27 00:39:06.000000000 +0100
+++ Epeg/Epeg.pm 2005-06-08 17:40:24.637196106 +0100
@@ -148,7 +148,7 @@
{
my $self = shift;
my $data = Image::Epeg::_epeg_get_data( $self->img );
- return defined $data ? $data : undef;
+ return $data;
}
@@ -168,7 +168,7 @@
=head1 NAME
-Epeg - Thumbnail jpegs at lightning speed
+Image::Epeg - Thumbnail jpegs at lightning speed
=head1 SYNOPSIS
diff -ur Epeg.orig/Epeg.xs Epeg/Epeg.xs
--- Epeg.orig/Epeg.xs 2005-04-27 18:30:14.000000000 +0100
+++ Epeg/Epeg.xs 2005-06-08 17:57:57.252919748 +0100
@@ -1,11 +1,11 @@
#ifdef __cplusplus
extern "C"
{
- #endif
- #include "EXTERN.h"
- #include "perl.h"
- #include "XSUB.h"
- #ifdef __cplusplus
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#ifdef __cplusplus
}
#endif
@@ -17,7 +17,7 @@
// Epeg Headers
//
-#include </usr/local/include/Epeg.h>
+#include <Epeg.h>
static int
diff -ur Epeg.orig/Makefile.PL Epeg/Makefile.PL
--- Epeg.orig/Makefile.PL 2005-04-17 06:13:53.000000000 +0100
+++ Epeg/Makefile.PL 2005-06-08 17:21:41.683698393 +0100
@@ -1,6 +1,9 @@
+use warnings;
+use strict;
use ExtUtils::MakeMaker;
-$ROOT = "/usr/local";
+my $cflags = qx(epeg-config --cflags);
+my $libs = qx(epeg-config --libs);
WriteMakefile
(
@@ -11,7 +14,7 @@
(ABSTRACT_FROM => 'Epeg.pm',
AUTHOR => 'Michael Curtis (mcurtis@yahoo-inc.com)') : ()),
'LIBS' => [''],
- 'LIBS' => "-L$ROOT/lib -lepeg" . "$LDLIBS",
+ 'LIBS' => $libs,
'DEFINE' => '',
- 'INC' => ''
+ 'INC' => $cflags,
);
diff -ur Epeg.orig/t/epeg_basic.t Epeg/t/epeg_basic.t
--- Epeg.orig/t/epeg_basic.t 2005-05-03 19:33:05.000000000 +0100
+++ Epeg/t/epeg_basic.t 2005-06-08 17:49:20.601348436 +0100
@@ -16,7 +16,7 @@
# Test 1: new( [reference] )
my $epeg = new Image::Epeg( \$f );
-print defined $epeg ? "ok\n" : "nok\n";
+print ref $epeg && ref $epeg eq 'Image::Epeg' ? "ok\n" : "nok\n";
# Test 2: get_width()
print $epeg->get_width() == 640 ? "ok\n" : "nok\n";
@@ -54,6 +54,6 @@
my $data = $epeg->get_data();
print $data && length($data) == 1083 ? "ok\n" : "nok\n";
-system "rm t/test2.jpg";
+unlink "t/test2.jpg" or die "error deleting output: $!";
exit 0;