Can't locate object method "dir" via package "Net::FTP" at

I’ve been running into an issue while migrating code from old Windows 2008 R2 servers and an older Perl distro there to new Windows 2019 servers with Perl -v showing v5.28.1. I installed from the MSI, and I’ve attempted uninstalling, rebuilding my project and re-installing several times but it seems as if Net::FTP is incomplete or broken perhaps? I’ve searched here and elsewhere on the internet and cannot find anywhere where anyone has run into this before.

Also, Net::SMTP appears broken as well - it’s requiring a Port to be specified when that is clearly optional - and even if I do specify a port it dies anyway complaining about the port not being specified. Am I the only one using Net::FTP and Net::SMTP in v5.28.1?

I have to say - the instabilities I’m encountering with the latest Perl builds that require the State build projects vs using ppm are shocking. Also since when is the ~~ operator experimental? We’ve used that for years without issue. Either we’re doing something very wrong here or the ActiveState distro is in a sad state. Grasping at straws at this point.

Hi bjschulte,

I know it requires the libnet package as well, so you might want to check that. I setup a project with just those two packages you could try with your code: https://platform.activestate.com/Build-All-The-Things/Custom-Perl-5.28.1-Windows

Let me know how it goes.

Cheers,

-JR

1 Like

Ok, I will give a whirl with that included. You’re the first to respond of course, I thank you for reaching out. Either way, I’ll let you know my results. I was starting to completely lose faith in the new ActiveState distro method because everything just used to WORK and in this method smart match (which was standard) is experimental, Net::SMTP has issues where it require a port even when you provide one, and Net::FTP doesn’t seem to even have dir() implemented according to the errors. 8 years ago all of this just “worked” without issue.

I needed Switch and a few others, so lacking a lot of time as a first stab I attempted simply adding libnet into mine and I’m still getting the same result. Later today or tomorrow I’ll try your build with a small test script isolating it to see if I get a better result with your build.

Jeff - I got around to trying your build and making a smaller sample script. I uninstalled my build, verified that Perl was completely gone. Installed your build. Attempted the same operation in a stripped down smaller script, same result. Unless I’m mistaken, it doesn’t appear as though dir is implemented at all in Net::FTP.

Net::FTP=GLOB(0x25d27b0)<< 200 Type set to I
Can’t locate object method “dir” via package “Net::FTP” at E:\PerlTest\ftp_test.pl line 75.

So now that we’ve established that dir() is not even implemented in Net::FTP - what happens next? Do we report a bug, how does that work? I’ve got 3-4 other modules with similar issues in the new Active State distro with issues that seem along the same path that I need to report. This all simply used to work, now it is all simply broken.

Yes that is strange, dir is definitely part of Net::FTP. I will check with the build team here and see if there is a missing dependency or some other issue they may be aware of. Thanks for taking a crack at a stripped down build to isolate the issue.

Cheers,

-JR

1 Like

Through further testing I’ve found that the delete method is also not present. Without dir and delete it essentially renders Net::FTP unusable.

I’ve reproduced your findings. I hope to have an answer soon. Thanks!

Thank you Jeff! I’m going to open a separate ticket on Net::SMTP. I’ve found issues there as well.

OK turns out that Net::FTP and libnet both have ftp.pl and one is older than the other. So we only need libnet which is the most modern version. I have reproduced that using just libnet the example code works fine in that it can find dir() and delete()). So if you remove Net::FTP and you have libnet you are good.

1 Like

Jeff - 100% this is the fix. Thus I’m assuming that Net-FTP and Net-SMTP explicitly shouldn’t be used anymore? Will that be fixed or will it simply be replaced with libnet? I’m just realizing I asked you the same question in 2 different threads. :thinking: