Monks,

I need to grab the computer name from a machine who views my CGI page. I can do this with javascript and vbscript in an html file. However I cannot (do not know how to) pull these into my Perl code. Here is the code that I have to get the computername:
Javascript:
<HTML> <HEAD> <TITLE>Getting User Information. </TITLE> <Script Language="Jscript"> var objNet = new ActiveXObject("WScript.Network"); var strInfo = objNet.ComputerName document.write(strInfo); </Script> </HEAD> </HTML>
Vbscript:
<html> <body> <script language="vbscript"> <!-- Set objNetwork = CreateObject("WScript.Network") document.write(objNetwork.computername) //--> </script> </body> </html>


I understand that CGI(Perl) is a server side language and VBscript and javascript are client side. Is there a way I can include these scripts in my CGI and assign the computername to a variable that Perl can recognize?

When I use:
foreach $key (sort(keys %ENV)) #displays the environment variables { print "$key = $ENV{$key}\n"; }

It only displays my AIX servers name and IP address for REMOTE_USER not the client machine that is viewing the page.

It would be greatly appreciated if someone could shed some light on my situation.

Thanks in advance,
Krt6

Edited by Chady -- added code tags.


In reply to Using CGI (Perl) and javascript at the same time by krt6

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.