My perl script no longer processes open statements correctly

Started by odog502, July 18, 2021, 07:24:01 PM

Previous topic - Next topic

odog502

I think this is more of a perl issue than an exiftool issue, so I'm posting in this section.

I have a perl script that uses exiftool.exe to rename image and video files and it has worked for years up until just a couple days ago.  What's strange is that I have not made any changes to my system.  Neither exiftool, the script nor my perl binaries were updated when this problem started.  I have it narrowed down to a single open statement

Line 62
open (FILEPROP, "exiftool \"$dir\\$files[$i]\" |") or die $!;

If I run that file handle through a while loop and print every line it produces nothing.  I don't get any errors.  Since the while loop doesn't even print blank lines it seems as if the file handle is empty.  I created a stripped down version of the script to test that open statement specifically.  The stripped down version works.

As part of my troubleshooting I updated exiftool from 11.33 to 12.29 and ActivePerl from 5.26 to 5.28 and there is no difference between the versions.  Ive tried running the script from both the command prompt and powershell with the same results.  I did the ol' computer restart as well.

Can someone tell me why Line 66 in the complete script produces nothing but line 22 in the stripped down script works just fine?  I have attached both.

Phil Harvey

I see nothing obvious.

But since you have have the problem surrounded, all you need to do is iterate by converging those two scripts until you find the specific difference that causes the problem.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

odog502

Thanks Phil, that helped me figure it out.  I started adding back in blocks of code.  When I ran it, things weren't making sense but that's when I noticed an alert in my task tray I hadn't noticed before.  Apparently my desktop security software was containing the script and running it in a "protected" mode.  Not sure why it thought the original script was sketchy but not the stripped down one, but in any case, I convinced it that its a "trusted" script and looks like things are working again.  Thanks for your input!