如何禁用模块Image :: EXIF中的警告 [英] How to disable the warning in module Image::EXIF
本文介绍了如何禁用模块Image :: EXIF中的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
美好的一天! 当您运行此脚本时:
Good day! When you run this script:
#!/usr/bin/perl
use strict;
use warnings;
use Image::EXIF;
my $exif = new Image::EXIF($ARGV[0] || 'image3.jpg');
显示警告(并非所有图片都显示警告.):
displayed a warning (a warning is not at all the pictures.):
(null):未知的TIFF字段类型;丢弃(未知)
(null): unknown TIFF field type; discarding (Unknown)
是否可以禁止显示此警告?
Is it possible to suppress this warning?
推荐答案
查看该模块的源代码,它具有XS本机部分,被调用的c函数如下所示(在文件"exifutil.c中") "):
Looking at the source code of that module, it has a XS native part, and the c function that is called looks like this (at file "exifutil.c"):
void exifwarn2(const char *msg1, const char *msg2)
{
fprintf(stderr, "%s: %s (%s)\n", progname, msg1, msg2);
}
如您所见,它会打印到STDERR,因此您可以在调用Image :: EXIF构造函数之前正确处理STDERR. 这个问题可能会为您提供帮助.
As you can see, it prints to STDERR, so you can handle STDERR properly before the call to the Image::EXIF constructor. This SO question may helps you.
这篇关于如何禁用模块Image :: EXIF中的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文