LWP::P...:socks4(3pm)

πŸ“¦
version 1.7 Β· 2 versions
  • 1.7 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.7 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– LWP::Protocol::socks β€” the manual page, but make it make sense πŸ’–

okay bestie, so this is the page for LWP::Protocol::socks (yes, that truncated LWP::P...:socks4(3pm) header you saw is just the terminal being dramatic β€” it lives in the User Contributed Perl Documentation, section 3pm). Sit down, grab a strawberry πŸ“, and let's get into it.


✨ NAME ✨

LWP::Protocol::socks β€” it adds support for the socks protocol and proxy facility. that's the whole job description, and it eats. πŸ’…


🌈 SYNOPSIS 🌈

use LWP::Protocol::socks;

one line. iconic. no cap.


πŸ¦‹ DESCRIPTION πŸ¦‹

so the vibe check here is: use this package when you wish to use a socks proxy for your connections. that's the moment. that's the use case.

it provides some essential hooks into the LWP system to implement a socks "scheme" β€” similar to http for describing your socks connection β€” and it can be used to proxy either http or https connections. both. slay.

the whole plan is to use LWP::UserAgent's proxy method to register your socks proxy, like so:

$ua->proxy([qw(http https)] => 'socks://socks.yahoo.com:1080');

and then? just use your $ua object as usual! that's it. that's the tea. 🫢


πŸ”₯ EXAMPLES πŸ”₯

here's the full little script, copy-paste ready, no thoughts just vibes:

#!/usr/local/bin/perl
use strict;
use LWP::UserAgent;

my $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5');
$ua->proxy([qw(http https)] => 'socks://socks.yahoo.com:1080');
my $response = $ua->get("http://www.freebsd.org");
print $response->code,' ', $response->message,"\n";
my $response = $ua->get("https://www.microsoft.com");
print $response->code,' ', $response->message,"\n";

not me noticing it declares my $response twice in the same scope 😭 that's between you and use strict, bestie, I'm just reporting the facts.


πŸ‘‘ SEE ALSO πŸ‘‘

  • URI::socks4
  • LWP::Protocol::socks

(yes it references itself, main character energy fr fr πŸ’€)


🌸 AUTHORS 🌸

Oleg G <oleg@cpan.org> β€” thank you for your service, king πŸ‘‘


and that's the whole page, bestie! this was documented in the User Contributed Perl Documentation, running under perl v5.34.0, dated 2022-06-15 β€” and remember, LWP::P...:socks4(3pm) was just the name getting squished by your terminal width. go proxy something. periodt. πŸ’–βœ¨

πŸ“¦ where this page comes from