| Well, not too much goodies at this time ;-) But I expect to add some useful samples soon. And design... Oh-h, later... may be. Win32::DUN.pmThis little module provides few methods to check DialUp entries, to dial, to hang up, to autodial with manual confirmation or without, to autodial random provider from your list. It's kinda perl wraper of nice Win95/NT console application rasdial.exe by Claudio Fahey that is wide spread in freeware archives on the net. I also included it into the full package. .Win32::Registry.pm is needed.
Testing connectionThese are somehow related problems - testing whether you are online or not and detecting current domain-name/ip-address.I'll try to make short summary here. Old good chat2.php by Randal Schwartz offers:
AFAIK this returns current ip-address on UNIX and NT machines but not on Win95 unless you have for example cygwin32 tools with hostname.exe installed. The other solution that works on Win95 also (I found it somewhere in comp.lang.perl.* conferences):
Or in the form of subroutine that returns both - current host-name and ip-address:
OK. This subroutine returns undef if offline, so the easiest way to detect connection would be:
This is just shortened GetLocalAddr. I experienced some problem with this subroutine. It detects on/offline well while used alone. But after some real up/download and disconnection it freezes until new connection will be established. So, this is not good for automated projects. NOTE: Some times ago Aldo Calpini gave his version of the same routine that will detect the situation when the computer has more then one ip-address:
Next sample is what I used in my Win32::DUN.pm. That CheckConnect routine uses external Win32 console application rasdial.exe and gives valuable answer only to detect offline. But if any DialUp session is in progress it can't detect whether connection is already established or not. Usage:
The last solution is to establish socket connection with some trusted service, say Microsoft or Yahoo. There is more then one way... ;) Here is one working sample that uses Randal Schwartz's chat2.php (with few modifications it works on Win95 also):
To my experience this is the best one to detect connection. It works very stable without any delays. But sure I'd not say that this is a clean solution. Again, I hope Aldo or somebody will port native Win32 API calls for this case too. Win32::LFN.pmWin32::GetShortPathName that comes with current Win32 ports of Perl 5 provides the conversion from Long File Names (LFN) to DOS-style short names. The idea of this module was to provide backward conversion.In addition it gives full attributes set for file/directory. The module is completelly rewritten to improve speed and to match the changes in core Perl. Perl 5.006 and ActiveState port as of build 514 include new built-in functions Win32::GetLongPathName() and Win32::GetFullPathName(). So, this version of Win32::LFN is probably the last and is intended for those who use older perl ports. The module now has the functions with the same names and functionality: Win32::LFN::GetLongPathName() and Win32::LFN::GetFullPathName(). The old functions still remain for the backward compartibility but they are also rewritten using much faster API call. Win32::API.pm by Aldo Calpini is needed.
Ru::Text.pmThis module provides some basic conversions of russian text in various encodings. It replaces default functionality of uc, lc, ucfirst, lcfirst to work with russian letters too (in chosen encoding) and builds few methods for regular expressions to make life easier.It is possible to change encoding-mode and work with few different encodings in the same program. ALT, windows-1251, windows-1251, windows-1251, MAC (Cyrillic) codepages are supported now. Perl 5.000 or better and Tie::Scalar.pm are needed. NOTE: Please, don't distribute this module as plain text - by mail or by Copy/Paste from browser or editor. It contains binary data that will definitely be corrupted.
Win32::DriveInfo.pmWith this module you can get total/free space on Win32 drives, volume names, architecture, filesystem type, drive attributes, list of all available drives and free drive-letters. Additional function to determine Windows version info.Win32::API.pm by Aldo Calpini is needed.
Net::NetTime.pm v.0.02With this module you can get current time from SNTP-servers(rfc1769) and TIME-servers(rfc868) via UDP or TCP. Time is returning in the form of the версия для печати time() function. It's designed for the faster and most stable delivery of time for both core Perl and Win32-Perl applications.Timeouts are semi-functional even on Win32, so it seems much that you application will not wait forever. In most cases it works really fast. Module is in early development stage. Updated chat2.php is included to the distribution.
Win32::Process.pm v.0.061This is v.0.06 that comes with the libwin-0.15 (or 0.151) with few small additions. New version is fully backward compartible.Now you can open child window minimized, that is handy for GUI, or maximized that is handy for Win32::Console, Norton Commander, FAR and other interfaces. The other additional option is to open new console with the customized title instead of "PERL". Also one handy constant STILL_ACTIVE is added that helps monitoring exitcode in base parent cycle. For those of you who ever wondered what's that magic value - 259: it's STILL_ACTIVE status code (equal to STATUS_PENDING). For more take a look at the POD docs and Win32API docs. Binaries are also available, but note - GSAR version is compiled on Win95. As of 0.06 the same dll seem to work on both Win95 and NT but this fact has not been confirmed. ActiveState binaries for 5xx builds are compiled on NT (thanks to Jenda Krynicky!) If you want much more control on processes take a look at Win32::IProc by Amine Moulay Ramdane. NOTE: As of 0.06 the parent process can get child's pid as unsigned long with the use of GetProcessID() function. But $$ magic var returns pid as signed long, 32 bits both. The conversion rule is:
$unsigned_pid = unpack "L",pack "l",$$; |