Thanks to kennethk I rewrote the script using CGI params. It is much cleaner now but I am struggling with how to call the subroutines. Can someone tell me if I am doing this correctly? Thanks, EI
#!/iiidb/software/tpp/perl/bin/perl -wT use Net::LDAP; use Net::LDAPS; use strict; use CGI qw(unescape); use CGI::Carp qw(fatalsToBrowser); #This subroutine gets the data from the form sub from_form { my $data = param('username'); my $password = param('password'); my $campus = param('campus'); } #This checks the domain. Still need to get it to invoke the right ser +ver. sub domain { if ($campus = param('campus') =~ m/ccsu/) { return &LDAP_CCSU } elsif ($campus = param('campus') =~ m/ecsu/) { return &LDAP_ECSU } elsif ($campus = param('campus') =~ m/wcsu/) { return &LDAP_WCSU } elsif ($campus = param('campus') =~ m/southernct/) { return &LDAP_SCSU } else { print "Not a valid domain \n."; } } sub LDAP_CCSU { my @m_sLDAPServer = ("",""); my @m_nPort = ("",""); my @m_bUseLDAPS = ("1",""); my @m_sBindBase = ("BIND_BASE= ",""); my @m_sBindPassword = ("",""); my @m_sBindUser = ("",""); my @m_bUseOneBind = ("1"); my @m_sSearchAttribute = ("",""); my @m_sSearchBase = ("",""); my @m_sIDAttribute = ("",""); } sub LDAP_ECSU { my @m_sLDAPServer = ("",""); my @m_nPort = ("",""); my @m_bUseLDAPS = ("1",""); my @m_sBindBase = ("BIND_BASE= ",""); my @m_sBindPassword = ("",""); my @m_sBindUser = ("",""); my @m_bUseOneBind = ("1"); my @m_sSearchAttribute = ("",""); my @m_sSearchBase = ("",""); my @m_sIDAttribute = ("",""); } sub LDAP_SCSU { my @m_sLDAPServer = ("",""); my @m_nPort = ("",""); my @m_bUseLDAPS = ("1",""); my @m_sBindBase = ("BIND_BASE= ",""); my @m_sBindPassword = ("",""); my @m_sBindUser = ("",""); my @m_bUseOneBind = ("1"); my @m_sSearchAttribute = ("",""); my @m_sSearchBase = ("",""); my @m_sIDAttribute = ("",""); } sub LDAP_WCSU { my @m_sLDAPServer = ("",""); my @m_nPort = ("",""); my @m_bUseLDAPS = ("1",""); my @m_sBindBase = ("BIND_BASE= ",""); my @m_sBindPassword = ("",""); my @m_sBindUser = ("",""); my @m_bUseOneBind = ("1"); my @m_sSearchAttribute = ("",""); my @m_sSearchBase = ("",""); my @m_sIDAttribute = ("",""); } my $m_bUseLDAPPassword = 1; my $m_bTryMillenniumAfterBadVerify = 0; my @m_nTimeOut = (3,3); my $m_sLDAPVersion = 3; # # Input variables are stored in the following variables # my $m_sUserName = "$username$campus"; my $m_sUserId = "$password"; my $m_sPassword = ""; my $m_sServer= ""; my $m_hLDAP; my $m_whichServer = 0; #Identifies which server to query by index, eit +her 0 or 1 my $m_hSearchMessage; my $m_bVerbose = 0; #my $m_bVerbose = 1; my $m_nTimeOut = 3; my $m_sOriginalUserId; my $m_sResult = "Failed"; my $m_sLogMessage = ""; my $m_sIIIDB = "";

In reply to Re^3: LDAP Script Question by eiglesias
in thread LDAP Script Question by eiglesias

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.