Hi, I have doubt in cgi perl scripting. while i am using the Net::SCP program alone in perl it's working fine. if i am getting the ip and pwd through the html input values and i am trying to pass that values to the Nect::SCP program and i am trying to run it in web browser like running other cgi script but it's not scp the file and also not at all showing error for that. Can any one clarify my doubt's. Thanks in Advance...
=code is as follows. #########code1############ #!/usr/bin/perl print "Content-type:text/html\n\n"; print "<html>"; print "<head>"; print "</head>"; print "<body>"; print "<form name=frm method=post action=sshcgi.pl>"; print "<select name=ip>"; print "<option ip=1>1.4.1.7</option>"; print "<option ip=2>1.1.5.87</option>"; print "<option ip=3>22.6.15.1</option>"; print "</select>"; print "<input type=password name=password>"; print "<input type=submit name=submit value=Submit>"; print "</form>"; print "</body>"; print "</html>"; ################################## ##############code-2############## if($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN,$buf,$ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buf); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1 +))/eg; $in{$name} = $value; if($value =~ /^\d{2,3}\.\d{2,3}\.\d{2,3}\.\d{2,3}$/){ +$ip=$value;} elsif($value !~ /\d{2,3}\.\d{2,3}\.\d{2,3}\.\d{2,3}/ & +& $value !~ /Submit/){$pwd=$value; } } } chomp($ip,$pwd); use Net::SCP::Expect; $scpe= Net::SCP::Expect->new; $svr = "root\@$ip"; $user='root'; $file ='app_talkdetect.so'; $scpe->login("$user","$pwd"); $scpe->scp("$svr:/home/$file", "/home/"); print "....done\n"; ######################################
hi Error code in error_log for httpd is Mon Aug 11 11:17:36 2008 error client 1.4.1.7 pty_allocate(nonfatal): getpt(): No such file or directory at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/IO/Pty.pm line 24., referer: http://1.4.1.7/cgi-bin/ssh.pl Mon Aug 11 11:17:36 2008 error client 1.4.1.7 pty_allocate(nonfatal): openpty(): No such file or directory at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/IO/Pty.pm line 24., referer: http://1.4.1.7/cgi-bin/ssh.pl Mon Aug 11 11:17:36 2008 error client 1.4.1.7 pty_allocate(nonfatal): open(/dev/ptmx): Permission denied at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/IO/Pty.pm line 24., referer: http://1.4.1.7/cgi-bin/ssh.pl Mon Aug 11 11:17:36 2008 error client 1.4.1.7 Cannot open a pty at /usr/lib/perl5/site_perl/5.8.5/Net/SCP/Expect.pm line 172, referer: http://1.4.1.7/cgi-bin/ssh.pl

In reply to Net::SCP with cgi script doubt by sanku

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.