List Info

Thread: Unblessed reference error




Unblessed reference error
user name
2006-05-25 11:46:49
Hi Greg,<br /><br />

You need to call SetNewValue() with an instance of an
ExifTool object.  ie)<br /><br />

<code>
#!/usr/bin/perl -w

use Image::ExifTool 'ImageInfo';
#use IO::File;
#use Time::Local;

my $exifTool = new Image::ExifTool;

$photodirectory =
"/Volumes/d\$/PhotoMaster/rawtest/";

opendir(DIRHANDLE, "$photodirectory") || die
"Cannot opendir $photodirectory: $!";
foreach $file (sort readdir(DIRHANDLE)) {
        my $info =
$exifTool->ImageInfo($photodirectory.$file);
        if (($file =~ /4892test.cr2/)|($file =~
/4892test.CR2/)) {
               
$exifTool->SetNewValue("ImageDescription",
"Gregs test");
               
$exifTool->WriteInfo($photodirectory.$file);
                foreach (keys %$info) {
                        if ($_ =~ /ObjectName/) {
                                print "$_:
$info->{$_}\n";
                        }
                }

        }
}
closedir(DIRHANDLE);

exit;
</code><br />

The $info hash returned by ImageInfo() is not the same as an
ExifTool object.  I hope this makes sense.<br /><br
/>

While I was making changes, I also called ImageInfo() with
the $exifTool object I created.  Also, I have a few other
comments about your script: 1) I have added the directory to
the filename in the WriteInfo() call, otherwise this call
won't find the file.  2) There is no writable
"Caption" tag.  You want to either  write
"ImageDescription" or "UserComment".
 3) I'm not sure why you're looking for the
"ObjectName" tag, but I don't think you'll
find it. 4) The $info you're looking at will be before the
new information you write.  If you want to read back the new
information you wrote, call ImageInfo() after
WriteInfo().<br /><br />

	- Phil


To write a respons, access
http://ww
w.cpanforum.com/response_form/2343

To see the full thread, access
http://www.cpan
forum.com/threads/2338

--
You are getting this messages from www.cpanforum.com
To change your subscription information visit http://www.cpanforum.
com/mypan/

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )