ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-web
perl-win32-web
Re: Getting Workstation Name
by Andre Andreev other posts by this author
Dec 31 2000 9:10PM messages near this date
view in the new Beta List Site
Re: Getting Workstation Name | (no subject)
This is a piece one of my programs.
I wrote it to perform a software inventory.
Piece below runs a Windows function GetComputerNameA using Win32::API
module.
Make sure you have Win32::API  module downloaded on your machine (see
ActivePerl Documentation came with ActivePerl).

use Win32API::Registry;
use Win32::TieRegistry;
use Win32::API;

print "Getting computer name...\n";

$GetComputerName = new Win32::API("kernel32", "GetComputerNameA", [P, P],
N);
$lpBuffer = " " x 16;

$N=pack ("c4", 16,0,0,0);

$return = $GetComputerName-> Call($lpBuffer,$N);

$TempPath = $lpBuffer;
$TempPath = substr($TempPath,0,ord $N);

print  "Name is '$TempPath'\n";

print "Getting software ...\n";
...............
...............

----- Original Message -----
From: "Jenda Krynicky" <Jenda@[...].cz> 
To: <perl-win32-web@[...].com> 
Sent: Saturday, December 30, 2000 6:10 PM
Subject: Re: Getting Workstation Name


>  > I'm wanting to trap the name of the workstation that hit my web page so
>  > that I know who made a change.  I can get the IP address by using the
>  > $ENV{REMOTE_ADDR} environment variable, but with DHCP a user's IP
>  > address could change.  Is there a way using Perl to get that?
> 
>  Well, the name could be in $ENV{REMOTE_HOST}, but it's not
>  guarantied. If you do not find it there you will have to do a reverse
>  DNS lookup for the address in $ENV{REMOTE_ADDR}. (use Net::DNS :)
> 
>  Jenda
> 
> 
>  == Jenda@[...].cz == http://Jenda.McCann.cz ==
>              FUCK THE ARMY!
>                         Myself
>  _______________________________________________
>  Perl-Win32-Web mailing list
>  Perl-Win32-Web@[...].com
>  http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
> 

_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web@[...].com
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
Thread:

Jenda Krynicky
Andre Andreev

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved