Net::S...Compat(3pm)

πŸ“¦
version 1.93 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Net::SFTP::Foreign::Compat β€” bestie, it's an Adapter for Net::SFTP compatibility πŸ’– (and yeah, it lives in the 3pm part of the manual, aka User Contributed Perl Documentation, so you're in the right place 🫢)


🌸 SYNOPSIS 🌸

okay so here's the whole vibe, literally just copy-paste energy:

    use Net::SFTP::Foreign::Compat;
    my $sftp = Net::SFTP::Foreign::Compat->new($host);
    $sftp->get("foo", "bar");
    $sftp->put("bar", "baz");

    use Net::SFTP::Foreign::Compat ':supplant';
    my $sftp = Net::SFTP->new($host);

see how the second one just... says Net::SFTP? that's the :supplant tag doing its thing, we'll get there πŸ¦‹


πŸ’… DESCRIPTION πŸ’…

So this package is a wrapper around Net::SFTP::Foreign that hands you an API that's (mostly) compatible with the API of Net::SFTP. that's it, that's the whole job. it's giving translator, it's giving bridge, it's giving "I got you bestie, you don't have to rewrite your code" πŸ’–

The methods on this package are identical to the ones in Net::SFTP β€” with one teeny tiny exception: you gotta use Net::SFTP::Foreign::Attributes::Compat objects instead of Net::SFTP::Attributes. that's the one swap, no cap. πŸ”₯

And now the iconic part: if you use the :supplant tag, this module also installs wrappers on the Net::SFTP and Net::SFTP::Attributes packages. which means? zero other parts of your program need to be modified in order to move from Net::SFTP to Net::SFTP::Foreign. no editing, no find-and-replace, no tears. main character migration energy πŸ‘‘


πŸŽ€ Setting defaults πŸŽ€

So there's this hash β€” %Net::SFTP::Foreign::DEFAULTS β€” and you can use it to set default values for Net::SFTP::Foreign methods that get called under the hood but are otherwise not accessible through the Net::SFTP API. sneaky? a little. useful? absolutely πŸ’…

Here's the entries it currently supports:

  • new => \@opts β€” extra options passed to the Net::SFTP::Foreign constructor. ✨
  • get => \@opts β€” extra options passed to the Net::SFTP::Foreign::get method.
  • put => \@opts β€” extra options passed to the Net::SFTP::Foreign::put method.
  • ls => \@opts β€” extra options passed to the Net::SFTP::Foreign::ls method.

like, that's the whole list. four entries. short and slay 🌈


Copyright (c) 2006-2008, 2011 Salvador FandiΓ±o

All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

okay so real talk: that's the legal bit and you should not skip it, even though it's the least fun paragraph on the page. respect the author, respect the license, periodt πŸ’œ

and that's a wrap, bestie!! πŸŽ€ this page came to you from perl v5.32.0, dated 2021-01-23, and it's the Net::S...Compat(3pm) page you just read all the way through β€” proud of you fr fr πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from