On 10/30/21 19:08, Ralph Mellor wrote:
I don't understand what you are thinking.
Hi Ralph,
That is because I have not made myself clear enough.
Or maybe you are trying to expand to something greater
than I am asking. That is a hazard when dealing with
mensches that love to be helpful: scope creep
First what this code does. It is a wrapper for Cobain
Backup, which is an extremely powerful (and abandoned)
program for backing up file on Windows.
I ABSOLUTELY WILL NOT USE BACKUP PROGRAMS THAT USE
PROPRIETARY ARCHIVES.
Cobian does keep a database of its prior backups,
removing old ones as new ones are created. The
number of old ones is configurable.
Problem and why the wrapper:
1) Cobian's backup archive database will not operate with
revolving backup media. Only one flash drive inserted
at a time protects you from ransonware.
2) Even when not working with non-removable backup media,
the database corrupts after about a month.
Solution, tell Cobian to always backup to a single spot.
My programs does the rotating of prior backups. I currently
have two programs. One for FTP backups written in Perl 5
and one for regular media, written in Perl 6.
What I want to do is to combine the two into Perl 6.
The ONLY thing stopping me is that the FTP client in
Perl 6 is terrible. I could not get it to work
properly. I had to re-code everything in Perl 5.
I was not a happy camper.
My original question was, did they fix Perl 6's FTP module
yet? The answer I got back was "no". I think you
misunderstood the question thinking that I was asking
if one existed yet or not. Yes, I do know there is
one, that is why I wanted to know if it was fixed yet.
LibCurl: I wrote my own Linux based interface for Curl.
It would be trivial to modify it to also support
Windows.
An aside: I wrote the Curl interface because the Perl 6's
web interface has all kinds of issues that Curl gets
around with ease.
The thing you are missing about Curl is that you have
to know what you want before invoking it. This I can
not do. I have to ask FTP for information and preceding
according to what response I get back. Ten calls to ftp
can very easily balloon into 500 in a microsecond.
All based on the response back from each call. Curl
is therefore not an option.
For instance, ftp has a command to recursively delete
directories. Now theoretical meets real world. The
command only works "some" of the time. That is because
ftp does not recognize some file names with particular
characters in it. Firefox's files are a complete pain
in the ass when it comes to this.
So I throw the "theoretical" delete at the directory
tree first, then check the result. It usually
does not work.
When it does not work, I have to drill
through all the directories and sub-directories
to find who would not delete, rename them to something that will delete,
then delete them. And double check that they are really gone.
Here is where "inline" falls apart for me. I still
have to maintain the perl 5 code that operates ftp.
The is no such thing as code that is perfect and does
not require maintenance.
For instance, what if Firefox comes up with a few
more screwy character in their file naming that ftp
chokes on? I have to update the perl 5
code wrapped in "Inline" to fix it. So I still
would have to maintenance both Perl 5 and Perl 6
on my customer's machines.
And that is not all that can go wrong. The unexpected
is to be expected. Then I have to debug and find out
what is happening. All in "write only" Perl 5.
Aside: I have through shear force of will top downed
my perl 5 code.
sub RmdirAndLoop ( $$$ );
# needed for recursive looping
sub RmdirAndLoop ( $$$ ) {
my $Target = $_[0]; # directory to clean out
my $Depth = $_[1]; # what level subdirectory you are on
my $MaxDepth = $_[2]; # Limit as to how far to dig down
Perl 5 sends your subs a single array of associative
pointers with the addresses of your variable in it.
What a pain in the ass!
Most other Perl 5 code I have seen is simply "stream
of conscience" code with no Top Down organization
whatsoever. In other words, "write only"
What I am after is no perl 5 on my customers' machines.
I only want to maintain Perl 6 code. Not both.
Inline requires I have Perl 5 installed on the machine
to compile. Have I mentioned that Perl 5 is a
pain in the ass to maintain?
As far as porting Perl 5 to Perl 6 code. I find the
process kind of fun. The only draw back is once in
Perl 6 and I have so much more capability "scope
creep" starts to become an all consuming issue.
OOP: Perl 5 and Perl 6 are night and day different.
use Net::FTP;
$ftp = Net::FTP->new("$FtpServer", Passive=>1 )
or die "Cannot connect to $FtpServer: $@";
# Log on to the FTP site
$ftp->login("$Username", "$Password")
or die "Cannot login ", $ftp->message;
What the h--- is that every year I have to look at it.
Okay, you may be able to follow that after not seeing
it for a year, but not me. I have to figure it out
each time.
So here is the deal, I need someone would tell me
where to find how to open, close, write, and read
from a network connection with Perl 6.
And the module I would write for ftp would be
human readable.
$ftp = Net::FTP->new("$FtpServer", Passive=>1 )
would be replaced with
$FtpNetworkSocket = OpenFtp ( Str $FtpServer, Bool $ Passive = True );
So basically at this point, the only thing I am
asking of you is how to open, close, read, and write
to a network connection. I have a copy of the FTP
RFC and I can take it from there. I think I
will have a total blast the coding for a network
connection.
And YES I tried googling it. I get back 1,000,000
hits on how to connect my Roku video streaming device
my local area network. AAAHHHHHH! !!!
An aside on OOP. In Perl 6, it is like I have discovered
the holy grail. I have the ability to create my own
custom database structures and make functions call based
on the structure. And it is human readable! I am in hog
heaven.
In Perl 5, ya you can do the same thing. Good
luck with that. You will tear all your hair out
trying to figure it out and maintaining it. The
times I have had to deal with it, I though I had
died and gone to coding hell.
I encourage anyone who has not figured out OOP in
Perl 6 yet to jump on it. I have a simple write up
on it available for the asking. Perl 6's (Raku's)
OOP is EASY, regardless what you have been told by
others. Hey, I figured it out!