Try this simple form entry CGI. If this works add your real code into the subroutines

#!/usr/bin/perl use strict; use CGI; use CGI::Carp 'fatalsToBrowser'; # remove when finished testing use Net::LDAP; use IPC::System::Simple qw(system capture); # input # create CGI query object to get the SSO from URL my $q = new CGI; my $sso = $q->param( "sso" ); $sso =~ s/[^0-9]//g; # remove non digit # process my $msg; if ($sso){ # check LDPA my @entries = search_LDAP($sso); if (@entries == 1){ $msg = process_sso($sso,$entries[0]); } else { $msg = qq!<h2 style="color:red">ERROR: Wrong SSO [$sso] or User do +es not exist in OneAD LDAP </h2>!; } } else { $msg = q!<h2 style="color:red">ERROR : parameter sso is empty</h2>!; } # html page print $q->header(),$q->start_html('Application Management System'); print $msg; print qq!<hr/><form action="" method="post"> SSO : <input type="text" name="sso" value="$sso"/> <input type="submit"/> </form>!; print $q->end_html; sub search_LDAP { my $sso = shift; return ('test') } sub process_sso { my ($sso,$usr) = @_; my $msg = "<h2>Processing SSO $sso</h2>"; return $msg; }
poj

In reply to Re^7: Use CGI to run a Perl script via web server (updated) by poj
in thread Use CGI to run a Perl script via web server by suvajit123

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.