- eliminate the old IIM_new(), IIM_DESTROY() names from Imager's
internals, those names only matter for the XS interface.
+ - improve error reporting when PERL_INITIALIZE_IMAGER_CALLBACKS finds
+ the API level compiled into a loadable module such as
+ Imager::File::GIF doesn't match that of Imager. Previously it
+ could be difficult to determine exactly which module was failing to
+ load.
+ https://rt.cpan.org/Ticket/Display.html?id=77173
+
Imager 0.90 - 30 Apr 2012
===========
return 1;
}
else {
- my $work = $@ || "Unknown error loading $file";
+ my $work = $@ || "Unknown error";
chomp $work;
$work =~ s/\n?Compilation failed in require at .*Imager\.pm line .*\z//m;
$work =~ s/\n/\\n/g;
+ $work =~ s/\s*\.?\z/ loading $file/;
$file_load_errors{$file} = $work;
$$error = $work;
return 0;
#define IMAGER_MIN_API_LEVEL IMAGER_API_LEVEL
#endif
-#define PERL_INITIALIZE_IMAGER_CALLBACKS \
+#define PERL_INITIALIZE_IMAGER_CALLBACKS_NAME(name) \
do { \
imager_function_ext_table = INT2PTR(im_ext_funcs *, SvIV(get_sv(PERL_FUNCTION_TABLE_NAME, 1))); \
if (!imager_function_ext_table) \
croak("Imager API function table not found!"); \
if (imager_function_ext_table->version != IMAGER_API_VERSION) { \
- croak("Imager API version incorrect loaded %d vs expected %d", \
- imager_function_ext_table->version, IMAGER_API_VERSION); \
+ croak("Imager API version incorrect loaded %d vs expected %d in %s", \
+ imager_function_ext_table->version, IMAGER_API_VERSION, (name)); \
} \
if (imager_function_ext_table->level < IMAGER_MIN_API_LEVEL) \
- croak("API level %d below minimum of %d", imager_function_ext_table->level, IMAGER_MIN_API_LEVEL); \
+ croak("API level %d below minimum of %d in %s", imager_function_ext_table->level, IMAGER_MIN_API_LEVEL, (name)); \
} while (0)
+#define PERL_INITIALIZE_IMAGER_CALLBACKS PERL_INITIALIZE_IMAGER_CALLBACKS_NAME(__FILE__)
+
/* just for use here */
#define im_extt imager_function_ext_table
...
BOOT:
+ /* any release with the API */
PERL_INITIALIZE_IMAGER_CALLBACKS;
+ /* preferred from Imager 0.91 */
+ PERL_INITIALIZE_IMAGER_CALLBACKS_NAME("My::Module");
=head1 DESCRIPTION
BOOT:
PERL_INITIALIZE_IMAGER_CALLBACKS;
+From Imager 0.91 you can supply your module name to improve error
+reporting:
+
+ BOOT:
+ PERL_INITIALIZE_IMAGER_CALLBACKS_NAME("My::Module");
+
=back
=head2 foo.c