So I am creating my own perl module to manage a Big-IP F5 load balancer. I realize theres already a module for it, but it sucks, and it doesn't have many features, if you want it done right, do it yourself! right?

Anyways, heres my WORKING example of how to do it, without just using subroutines in the same file.

#!/usr/bin/perl use strict; use Data::Dumper; use SOAP::Lite; use UNIVERSAL 'isa'; my $user = "xxxx"; my $pass = "xxxx"; my $host = "xxxx"; $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0; sub newF5 { my ($server, $user, $pass) = (@_); my $proxy_uri = sprintf("https://%s:443/iControl/iControlPortal.cg +i", $server); my $soap = SOAP::Lite->proxy($proxy_uri); sub SOAP::Transport::HTTP::Client::get_basic_credentials { return $user => $pass; } return $soap; } sub getActivePartition { my ($soap) = (@_); my $soapResponse = $soap->uri("urn:iControl:Management/Partition") +->get_active_partition(); #$self->checkResponse($soapResponse); my $partition = $soapResponse->result; return $partition; } my $connection = newF5($host, $user, $pass); print getActivePartition($connection)."\n";

Now that works just fine, but I cant get it to work when I put it in a .pm file and try to use it as a module. Code is below.

PERL MODULE (File: ./BigIP/F5/F5.pm)

package BigIP::F5; #use strict; use SOAP::Lite; use UNIVERSAL 'isa'; use Data::Dumper; $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0; sub new { my ($server, $user, $pass) = (@_); my $proxy_uri = sprintf("https://%s:443/iControl/iControlPortal.cg +i", $server); my $soap = SOAP::Lite->proxy($proxy_uri); sub SOAP::Transport::HTTP::Client::get_basic_credentials { return $user => $pass; } return $soap; } sub getActivePartition { my ($self, $soap) = (@_); my $soapResponse = $soap->uri("urn:iControl:Management/Partition") +->get_active_partition(); #$self->checkResponse($soapResponse); my @partition = @{$soapResponse->result}; return @partition; } 1;

Example of using the perl module

#!/usr/bin/perl #use strict; use Data::Dumper; use lib "./"; use BigIP::F5; my $user = "xxxx"; my $pass = "xxxx"; my $host = "xxxx"; my $connection = BigIP::F5->new($host, $user, $pass); my $partition = BigIP::F5->getActivePartition($connection); print $partition."\n";

That doesn't work, the error I get is: 500 Can't connect to BigIP::F5:443 (Bad service '443') at /BigIP/F5.pm line 50

I cant figure out what the problem is, i know the un/pw works because the first example works, its just not in the perl module.

Any ideas?


In reply to Creating my own perl module, having issues with SOAP tho by jhyland87

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.