Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Trying to create IO::Socket::SecureSocks

by esskar (Deacon)
on Mar 01, 2004 at 22:41 UTC ( [id://333083]=perlquestion: print w/replies, xml ) Need Help??

esskar has asked for the wisdom of the Perl Monks concerning the following question:

I'm rather new to perl OO but does this make any sense?
package IO::Socket::SecureSocks; use strict; use IO::Socket::Socks; use IO::Socket::SSL; use vars qw(@ISA $VERSION); require Exporter; @IO::Socket::Socks::ISA = qw(Exporter IO::Socket::SSL); @ISA = qw(Exporter IO::Socket::Socks); $VERSION = "0.1"; 1;
I'm trying to do SOCKSS (SOCKS over SSL)

Replies are listed 'Best First'.
Re: Trying to create IO::Socket::SecureSocks
by saintmike (Vicar) on Mar 01, 2004 at 22:57 UTC
    Modifying variables in packages other than your own (like you're doing with @IO::Socket::Socks::ISA) is frowned upon. Also, it's not quite clear what you're trying to accomplish -- what's IO::Socket::SecureSocks supposed to do, which methods do you want to inherit from IO::Socket::Socks/IO::Socket::SSL?
Re: Trying to create IO::Socket::SecureSocks
by esskar (Deacon) on Mar 01, 2004 at 23:05 UTC
    well, i want to establish a socks connection over a secure wire to a SSL Socks Server. I know how to do like POP3 over SSL (i.e. POP3S) or POP3 over a Socks socket. Now i want to be able to communicate POP3 over a SSL Socks Socket. Since IO::Socket::Socks is the best choice to do SOCKS and IO::Socket::SSL the best to do SSL i have to combine them somehow. The thing is: Socks.pm derives from IO::Socket::INET by doing just
    @ISA = qw(Exporter IO::Socket::INET);
    changing this to
    @ISA = qw(Exporter IO::Socket::SSL);
    would do the job...
      I see. Basically, what you want is "use class IO::Socket::Socks, but not quite." - though one.

      You could potentially get lucky with Class::Prototyped, see Randal's article in Linux-Magazine.

      update: code snippet retracted

      ... or how about this:

      package IO::Socket::SecureSocks; use strict; use warnings; use IO::Socket::Socks; use IO::Socket::SSL; sub new { my $self = IO::Socket::SSL->new(@_); bless $self, "IO::Socket::Socks"; } 1;

      This creates a IO::Socket::SSL object, and then reblesses it into the IO::Socket::Socks class. It assumes that you know that IO::Socket::Socks inherits the constructor from its base class, so it's still somewhat kludgy :).

      --saintmike

        Why not just "use base( 'IO::Socket::Socks' );", then just add/override methods as you need?

        Update: Oops! Example used modules I was working on for work that day, rather than the modules in question. Fixed that.

Re: Trying to create IO::Socket::SecureSocks
by Roger (Parson) on Mar 01, 2004 at 22:58 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://333083]
Approved by Roger
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-26 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found