NAME

Win32::Script - system administrator`s library - for login and application startup scripts, etc

SYNOPSIS

 use Win32::Script;                # or use Win32::Script ':DEFAULT'
 $a =FileRead('c:\\autoexec.bat');
 FileDelete('-r','c:\\tmp\\*');
 FileEdit('c:\\autoexec.bat',sub{s/(SET *TMP *= *)/${1}c:\\tmp/i});
 use Win32::Script ':ALL';         # import from @EXPORT and @EXPORT_OK
 Print('Using','all','functions','from','@EXPORT','and','@EXPORT_OK');
 use Win32::Script ':ALL',':OVER'; # silently overwrite with imported

DESCRIPTION

At primary this module was written for system administrator needs in centralised administration of Win32 clients: logon and application startup scripts, etc. Later some functions useful in Windows NT server scripts was added. Now many functions may run on UNIX or may be developed for it. But area of Win32 servers and clients is very specific.

This module was made for several reasons:

- for useful functions does not (yet?) implemented as core perl functions.

- for more flexible and powerful functional style programming functions, than exists.

- to load used perl modules when required, with "eval('use ...')".

- to support scripting modes: printing of commands executed, die on errors.

This module calls for it`s functions many other modules from standard and site perl libraries and OS commands, and depends on their implementations and limitations. GUI functions implemented with Perl Tk.

Currently this module is implemented and tested on Win32 platform.

VARIABLES

 use vars qw($Interact $GUI $Echo $ErrorDie $Error $FileLog $Print %WScript);

 # example usage: $Win32::Script::Interact=0

 $Interact   =1;   # interact with user in functions as Prompt, Die, GUIMsg
 $GUI        =1;   # use GUI interaction instead of terminal in functions 
                   # as Die, GUIMsg
 $Echo       =1;   # print commands as 'set echo on' in DOS
 $ErrorDie   =0;   # die on error if 1, 2 inside Try
 $@ = $Error ='';  # last error occurred
 $FileLog    ='';  # log file name (LOG handle) for Echo, Print, errors...
 $Print      ='';  # external print routine reference

NOTE:

Some functions have not printout, and are not controlled by $Echo. Some functions are not controlled by $Echo due to used components.

RESULTS of FUNCTIONS

Some (boolean) functions returns TRUE to show success, or FALSE (0, '').

Returning values functions returns on error empty value: 0 or '' or ().

Undefined and negative results are escaped as possible for better functional programming style support. Values '0E0' or '0 but true' (numeric 0 and logical true) are not used.

Variable $@ or $Error may be used to distinguish erroneous empty values from normal.

CLASSES of FUNCTIONS

(see Exporter)

@EXPORT = qw(CPTranslate Die Echo FileACL FileCompare FileCopy FileCRC FileCwd FileDelete FileDigest FileEdit FileFind FileGlob FileHandle FileIni FileLnk FileMkDir FileNameMax FileNameMin FileRead FileSize FileSpace FileTrack FileWrite FTPCmd GUIMsg NetUse OLECreate OLEGet OrArgs Pause Platform Print Registry Run RunInf RunKbd SMTPSend StrTime UserEnvInit UserPath WMIService WScript);

@EXPORT_OK = qw(FileLog TrAnsi2Oem TrOem2Ansi Try(@) TryHdr);

%EXPORT_TAGS = ('ALL'=>[@EXPORT,@EXPORT_OK], 'OVER'=>[]);

Error processing functions

Try, TryHdr

File functions

FileACL, FileCompare, FileCopy, FileCRC, FileCwd, FileDelete, FileDigest, FileEdit, FileFind, FileGlob, FileHandle, FileIni, FileLnk, FileLog, FileMkDir, FileNameMax, FileNameMin, FileRead, FileSize, FileSpace, FileTrack, FileWrite

FTP functions

FTPCmd

Registry functions

Registry

Run & Misc functions

OrArgs, Run, RunInf, RunKbd, OLECreate, OLEGet, NetUse, Platform, WScript, WMIService, UserEnvInit, UserPath

Mail functions

SMTPSend

String functions

CPTranslate, TrAnsi2Oem, TrOem2Ansi, StrTime

Interactive functions

Die, GUIMsg, Pause, Print, Echo

Obsolete functions

TrAnsi2Oem, TrOem2Ansi

FUNCTIONS

CPTranslate ( fromCP, toCP, string,... ) -> $translatedString

Translates strings from codepage fromCP to codepage toCP, returns translated string or list of strings. Codepages may be 'oem', '866','ansi', '1251','koi' prone of koi8, '8859-5' prone of ISO 8859-5.

Die ( ?string,... )

Displays blank delimited strings to user and dies with error code 1. As a default message $@ is used. For GUI uses GUIMsg with text translated from 'oem' to 'ansi'. If $Interact == 0, does not waits for user response.

Echo ( text,... ) -> success

Prints given text list delimited with blanks and terminated with "\n". May be switched off with $Echo or redefined with $Print.

FileACL ( ?'-r+', fileMask, ?sub(...), user => access,... ) -> success

Sets access control list for directories and files matching fileMask and sub. Without given access control list, prints current, this behaviour may be changed. Uses FileFind, Win32::FileSecurity.

Options: 'r'ecurse subdirectories, '+' - add ACL entries instead of replacing them.

Sub parameters are like in FileFind.

Access: 'add' (not implemented), 'add&read', 'add&list' (not implemented), 'read', 'change', 'full', reference to array of array references [[directory low level rights],[file low level rights]].

FileCompare ( file1, file2 ) -> differs

Compares two files and returns 0 for identical files, 1 for unequal files, -1 when error. Uses File::Compare

FileCopy ( ?'-rdfi', fromFileMask, toPath ) -> success

Copies fromFileMask to toPath. On 'MSWin32' uses xcopy with switches H, R, K, E, Q, Z.

Options: 'r'ecurse subdirectories, 'd'irectory target hint, 'f'ile target hint, 'i'gnore errors - continue copying.

FileCRC (?'-adler', file) -> CRC

Calculates CRC of file or 0 if error. Uses Compress::Zlib.

Options: 'adler' or 'adler32' or '-a adler', 'crc32' (default).

FileCwd () -> cwd

eval('use Cwd; getcwd()')

FileDelete ( ?'-r', fileMask,... ) -> success

Deletes files and directories fileMask. Uses FileGlob.

Options: 'r'ecurse subdirectories.

FileDigest ( ?-digest, filename ) -> digest

Returns hex digest (default MD5) of file given. Uses Digest::MD5.

FileEdit ( ?'-im', file, ?fileTo, sub(section, @variables)) -> success

Edits given file with given sub using local variable $_ for text to edit. Uses FileRead, FileWrite, File::Copy.

Options: 'i'nplace edit in memory (default), 'i ext' - use temporary file with given extension, 'm'ultiline edit instead of evaluation sub for each row of file.

Parameters of sub: $_, $_[0] - section name (determined with '[' sign in row beginning), @_(1...) - temporary variables with lifetime of FileEdit execution.

FileFind ( ?'-i!dlmrs', fileMask,..., sub(\@stat,path,name)...) -> num_matches
FileFind ( ?'-i!dlmrs', fileMask,..., sub(\@stat,,,result)...) -> result

Finds files and directories with given mask and evaluates sub, locally setting $_ to filename. Returns number of sub agrees, or result if defined, or 0 on errors. There may be several subs and several filemasks for each sub, and they will be executed within one transaction of FileFind call. Uses FileGlob

Options: 'i'gnore stat errors, '!' - not, 'd'irectories, 'l'ow before deep scan, 'm'ountpoints, 'r'ecurse directories, 's'ymlinks.

Parameters of sub are local $_ with full current filename, $_[0] with reference to @stat array, $_[1] with path, $_[2] with filename, $_[3] as optional result storage (initially undefined). Sub can return undefined value in $_ to signal stop, determine directories with $_[0]->[2] & 0040000, prevent recursing by assigning $_[0]->[2] =0.

Options for FileFind and based on it functions as FileACL, FileSize should and should not be the same. FileFind defaulty recurses, other commands traditionally not. Set of FileFind options may be extended in future, but existing programs should be preserved, and so FileFind options should be negative instead of traditionally positive options of other commands. Based on FileFind functions are restricted, not using all possible FileFind features. All functions may be called from comprehensive FileFind to get all features.

FileGlob ( mask ) -> filelist

Globs filenames with mask and returns list of them such as standard function glob. On error returns empty list? When $^O eq 'MSWin32' own implementation with fragments from File::DosGlob is used, else glob is called.

Standard glob is not well on Win32 platforms, when working with filenames in foreign languages and calling external executable dosglob.exe should be placed in path.

File::DosGlob has some problems with non-english letters in filenames and long filenames.

FileHandle ( \*filehandle, sub(oldhandle) ) -> result
FileHandle ( filename, sub(oldhandle) ) -> result

Selects given filehandle, evals sub, selects previously selected handle. For filename, temporarily opens file with handle 'HANDLE', selects this handle, evals sub... Returns result of sub, or empty ('') if error.

FileIni ( ?'-', file, item,... ) -> success
FileIni ( ?'-', file) -> hash of items

Edits ini-file in Windows format with given items. Without items returns a hash structure $hash{section}->{name}=value. Uses FileRead, FileWrite.

Options: reserved for future use.

Format of items: '[sectionName]', ';comment', [name => value]; ['[sectionName]', op], [';comment', op], [name, value, op]

Operations: '+' - set (default), '-' -delete, 'i'nitial value, 'o'ptional value.

FileLnk (?'-mda', ?filename) -> Win32::Shortcut object
FileLnk (?'-mdac', filename, path, args, dir, description, show, hotkey, iconlocation, iconnumber ) -> Success
FileLnk (?'-mdac', filename, {-path=>path, -arg=>args, -dir=>dir, -desc=>description, -show=>show, -hot=>hotkey, -il=>iconlocation, -in=>iconnumber}) -> Success

Returns Win32::Shortcut object or creates Win32 shortcut file. Uses Win32::Shortcut. Filename may be absolute or relative to 'm'enu or 'd'esktop according to this options. Default filename extension is '.lnk'. Names of parameters for shortcut may be given above or may be names of properties of Win32::Shortcut object.

Options: 'm'enu relative filename, 'd'esktop relative filename, 'a'll users profile use instead of current user profile, 'c'reate shortcut file instead of update.

FileLog (logfile) -> success
FileLog () -> filename
FileLog (undef)

Sets or requests log file name, opens log file with LOG handle for errors, warnings, Echo, Print.

FileMkDir ( dir, ?mask) -> success

Executes standard mkdir call, uses optional access mask (0777 default).

FileNameMax ( fileMask, ?sub(fullName, $_=fileName, digits)) -> max || (name, max)

Finds filename with maximal number in it. Returns this number or list of full filename and number in list context. Numeric comparing is used. Sub may be used to translate filename to comparable value or ignore values. Uses FileGlob

FileNameMin ( fileMask, ?sub(fullName, $_=fileName, digits)) -> name || (name, min)

Finds filename with minimal number in it. Returns full name of this file or list of full filename and number in list context. Numeric comparing is used. Sub may be used to translate filename to comparable value or ignore values. Uses FileGlob

FileRead ( ?'-asb', file, ?sub ) -> list of rows || data

Reads given file into memory as array or list ('-a'), text scalar ('-s'), binary scalar ('-b'). Default, '-a' or '-b', is determined with wantarray.

If sub is defined, it is evaluated for each row read into local $_, and with '-a' option results of each evaluation are returned as a list, true is returned otherwise.

On error returns empty list or scalar, according to option '-a','-s','-b'.

FileSize ( ?opt, fileMask, ?sub ) -> size in bytes

Returns total size in bytes for directories and files matching fileMask and sub. Uses FileFind with given options (-i default), parameters of sub are the same.

FileSpace ( ?filesystem ) -> free disk space in bytes

Returns free disk space in bytes for specified dir. Users Win32::API('kernel32', 'GetDiskFreeSpaceEx'||'GetDiskFreeSpace'...) or `\%COMSPEC\% /c dir $dir`.

FileTrack ( ?'-it!cdrt', sourceDir, destDir, ?sub(\@stat,path,name)) -> arcDir

Tracks changed files matched 'sub' in 'sourceDir' into 'destDir'. Returns path to new archive directory inside 'destDir' or empty string if none archived. 'Sub' gets current filename in $_ and returns 'true' if match. Code and interface are like FileFind. Uses FileCopy, FileCRC, FileGlob.

Options: 'i'gnore errors, 't'est and track CRC, '!' - not, 'c'opy changed files, 'd'irectories, 'r'ecurse directories, 't'ime check.

FileWrite ( ?'-b', file, data,...) -> success

Writes given data into given file. Option '-b' chooses binary mode and binary write. Without '-b', each element of data list is printed with trailing "\n" added.

FTPCmd ( host, user, passwd, ?command, command, ?arguments) -> success
FTPCmd ( {-host=>host, -user=>user, -passwd=>passwd}, ?command, command, ?arguments) -> success
FTPCmd ( {-s=>host, -u=>user, -p=>passwd}, ?command, command, ?arguments) -> success

Executes FTP command. First command may be 'ascii','binary','ebcdic','byte'. Second command may be 'dir', 'ls', 'get', 'put', sub($ftp). Returns result of command executed, for 'dir' and 'ls' - list of values. Uses Net::FTP.

GUIMsg ( title, string,...)
GUIMsg ( text )

Popups given message to user. Uses Tk.

NetUse ( disk, resource ) -> success

Executes Windows commands 'net use disk /d' and 'net use disk resource'. Uses Run

OLECreate ( progid, ?destructor ) -> OLE object

Creates Win32::OLE object via Win32::OLE->new(@_) call

OLEGet ( moniker, ?destructor ) -> OLE object

Gets Win32::OLE object via Win32::OLE->GetObject(@_) call

OLEIn ( OLE object | OLEGet args | OLECreate args ) -> list of OLE objects

Win32::OLE::in(object) call to list OLE containers. Example: foreach my $e (OLEIn('WinNT://domain/computer')) {print $e->{Class},"\t",$e->{Name},"\n"}

OrArgs (sub, arg,...) -> succeeded arg
OrArgs (function string, arg,...) -> succeeded arg

Evaluates sub or function given with local $_ set to each arg until success. Returns successful arg. Example: OrArgs('-d','c:/home','c:/users') returns first existed directory.

Pause ( ?text,... ) -> response

Prints given text list delimited with blanks and terminated with "\n", reads row from STDIN and returns it.

Platform ( parameter ) -> value

Determine value of parameter: 'os', 'osname', 'win32', 'ver', 'patch', 'lang', 'prodid', 'windir', 'name', 'domain', 'host', 'hostdomain', 'user','userdomain'... Uses available environment variables, perl functions, OS commands, stored in registry values. 'windir' parameter may be used when Win32 'windir' environment variable is not available.

Prints given text list delimited with blanks and terminated with "\n". May be redefined with $Print.

Registry (?'-\\|/', key) -> value
Registry (?'-\\|/', key, ?type, value) -> success

Works with values in Windows registry: returns value for given key and name, sets given value, deletes if undefined value given. Uses Win32::TieRegistry, error processing is unsupported.

Option defines delimiter for key parts: '\\' (default), '|' or '/'.

Value name may be delimited with double delimiter ('key\\\\name') as recommended Win32::TieRegistry, or single delimiter ('key\\name') as also supported.

Last parts of key not present in registry are automatically created, that improves behaviour of Win32::TieRegistry.

Type may be 'REG_SZ' (default), 'REG_EXPAND_SZ', 'REG_BINARY', 'REG_MULTI_SZ', 'REG_DWORD'.

Run (command, ?arguments) -> success

Runs specified command with system call, returns !($? || $!). Shell is used as in system call - if command and arguments are in the same string. Last argument may be sub to print to program called.

RunInf (filename, ?section, ?reboot mode) -> run string

Generates command to run to install given inf-file on Windows. Default section name is 'DefaultInstall'. Default reboot mode is 128, not 132 as in Windows file association.

RunKbd (?timeout, title mask) -> window handle
RunKbd (?timeout, title mask, ?timeout, keyboard string) -> success
RunKbd (?timeout, title mask, '') -> success

Finds window with title mask (regexp) given and types keyboard string into it. Without keyboard string returns handle of window found. With empty keyboard string waits window to disappear. Find operation retries to be sucessful within timeout. Keyboard typing is delayed with timeout. Uses Win32::GuiTest. Special symbols in keyboard string: '~' -ENTER, '+' -SHIFT, '^' -CONTROL, '%' -ALT; () - grouping, {} - quote special characters; {BACKSPACE}, {BS}, {BKSP} - backkspace; {BREAK}, {CAPS}, {DELETE}, {DOWN}, {END}, {ENTER}, {ESCAPE}, {HELP}, {HOME}, {INSERT}, {LEFT}, {NUMLOCK}, {PGDN}, {PGUP}, {PRTSCR}, {RIGHT}, {SCROLL}, {PAUSE}; {F1} .. {F24}.

SMTPSend ( host, ?from, ?\@to, row,... ) - > success

Sends MIME message to SMTP host, catenating rows via "\n". If 'from' or 'to' argument undefined, values are searched within rows of message as 'From:', 'Sender:', 'To:'. If array reference 'to' occurs in place of of message row, it will be converted to 'To:' MIME string. Uses Net::SMTP.

StrTime ( ?mask, ?@time ) -> string

Converts given date-time array into string using given mask. Default mask is 'yyyy-mm-dd hh:mm:ss' or 'dd.mm.yy hh:mm:ss', constructs are 'yyyy', 'yy', 'mm', 'dd', 'hh', 'mm' or 'MM', 'ss'. Default time is 'localtime(time)'.

Try ( eval {...}, default ) -> result
Try ( eval {...}, \&catch ) -> result
Try ( sub {...}, ... ) -> result

Try-Catch construction. Function Try returns result of eval on success. If error occurred (determined by $@), it returns default value or result of catch evaluation.

TryHdr (subject, stage)
TryHdr (undef, stage)

Declare title and/or stage name of transaction to insert into $@ inside Try. May be used only inside Try(sub{},...).

UserEnvInit ( ?'-nhy', ?documents dirs )

Initiates user`s environment on Win32. Uses Win32::TieRegistry, cacls, reskit utilities winset, setx.

Default options are '-nhy', option '-y' redefines environment variables when they defined, options may be '-n', '-ny', '-h'.

Option 'n' sets on Win95 environment variables used on WinNT: 'OS', 'COMPUTERNAME', 'USERNAME'.

Option 'h' works if 'c:/Home' directory exists. It creates directory 'c:/Home/Username' if it not exists (WinNT ACL setting applied), sets value for $$Registry{'CUser\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\\\Personal'} to 'c:/Home/Username' or 'c:/Home/Work' (for systems with single user profile), sets 'My Pictures' based on 'Personal', sets 'HOME' environment variable to $ENV{USERPROFILE}, sets 'HOMEDOCS' environment variable to 'Personal'

UserPath (user) -> home dir
UserPath (user, subdir) -> home subdir

Returns path to user profile directory or subdirectory on Win32 or path to user home directory ($ENV{HOME}) or subdirectory on other platforms. User may be 'all' users, 'default', '' - current. Subdir on Win32 may be 'Desktop', 'Personal','Programs','Start Menu','Startup', and other Win32 registry names under 'Explorer / Shell Folders'. If Win32 subdir is not found for user, 'all users' profile' is used, and vice versa.

WMIService ( ?connect args ) -> Windows Management Instrumentation service object

Creates Windows Management Instrumentation service Win32::OLE object with OLECreate('WbemScripting.SWbemLocator')->ConnectServer(@_). Example: WMIService->ExecQuery("SELECT Name,FreeSpace FROM Win32_LogicalDisk"). OLEGet("winmgmts:..."), OLEGet("ADs:..."), OLEGet("WinNT:...") calls may be used instead. See also 'wbemtest.exe', Web Based Enterprise Management (WBEM).

WScript ( object ) -> Windows Script Host object
WScript ( ?undef, object, ?args ) -> Windows Script Host object

Creates or returns Windows Script Host Win32::OLE object - 'Shell', 'Network', 'Controller',... May be used also 'FSO' for 'Scripting.FileSystemObject' object. Object created will be stored within %WScript hash for future reuse, first undefined argument prohibits this. Last optional arguments are used for OLECreate call. Example: print WScript('Network')->ComputerName, "\t", WScript('FSO')->GetDrive('c:')->AvailableSpace, "\n". See also Win32::OLE::Browser for Windows Script Host Object Model.

VERSION

29/06/2007

Version 0.58 released

18/06/2007

Unicode Tk considered in GUIMsg and Die.

Source reformated to minimize size.

10/11/2004

FileIni corrected.

10/10/2004

Version 0.57 released

06/10/2004

Fixed

' *' replaced with '\s*' in all regexps.

02/06/2003

Fixed

FileCopy() - Win32::CopyFile destination path catenation delimiter doubling

05/05/2003

Version 0.56 released

29/04/2003

Fixed

FileCopy() - considered perl version, improved Win32::CopyFile condition

12/04/2003

Changed

FileCopy() - using Win32::CopyFile when possible

26/02/2003

Changed

FileCopy() - added Win32::GetOSVersion prior to reading this from Registry

UserEnvInit() - '/P' cacls key instead of '/G' for home directory owner

06/02/2003

Changed

UserEnvInit() - creates 'HOMEDOCS' environment variable; code restructured

23/01/2003

Changed

Platform('name') - eval{Win32::NodeName()} added, Platform('user') - eval{Win32::LoginName()} bracketed.

12-22/04/2002

Changed

FileSpace - Win32::API('kernel32', 'GetDiskFreeSpaceEx' ||'GetDiskFreeSpace'...) attempted before using 'dir' command.

WScript - May be used also 'FSO' for 'Scripting.FileSystemObject' object.

26/03/2002

Changed

NetUse - optimized again

New

OLEIn

30/11/2001

Changed

None

New

OLECreate, OLEGet, WScript, WMIService

15/11/2001

Changed

NetUse on Windows NT some optimization.

Platform('host') corrected to return full host name with domain. If Sys::Hostname returns string without dot signs, Net::Domain is catenated.

23/09/2001 - 27/09/2001

New

FileDigest

OrArgs

Module size reduced as sub delimiters

Changed

FileACL - blank names are now quoted in 'cacls' run

UserEnvInit - $ENV{HOME} changed to ENV{USERPROFILE}, 'My Pictures' set, alternative documents dirs may be specified as parameters

UserPath - all arguments are optional

Problems

CPTranslate and StrTime does not use current locale and supports only Russian.

24/11/2000 - 26/02/2001

Changed

FileACL - echo format changed.

FileDelete - '-i'gnore option added.

NetUse - WinNT specific code added.

StrTime - 'mm' is month placeholder, 'MM' or second 'mm' is minutes placeholder.

25/09-27/10/2000

Changed

Echo, Print - are exported by default (moved from @EXPORT_OK to @EXPORT).

FileACL - processed files are printed, not echoed; uses 'cacls.exe' when possible.

FileCopy - '-d' removed from 'cp'.

FileCopy - uses Run(...sub{}).

FileGlob - support for filenames with '()'.

FileLog - $SIG{__DIE__} dies if !defined($^S) too.

FileSpace - digit grouping symbol may be ','.

FileTrack - internal filehandle renamed from 'LOG' to 'TRACK'.

NetUse - invokes 'net use ... /Yes' on Win95.

Registry - supports unnamed registry values.

Run - last argument may be sub to print to program called.

UserPath - excludes blanks at the end of path as may be on WinNT.

31/07-15/09/2000

New

FileCwd

FileLnk

RunInf

RunKbd

UserPath

Changed

$ErrorDie - value 2 introduced and used inside Try because of $^S may be incorrect inside eval('string') or do(script).

FileCopy - used pipe to answer to xcopy before system call because of codepage translation problem in open(commandline) on Win32 and incorrect $? of wait of IPC::Open3 on Win95.

FileEdit - restored sub's parameter $_[0] with with section name, removed 28/02/2000.

FileFind, FileTrack - filenames with '?' are ignored only when $^O eq 'MSWin32'.

FileFind - options added: !'l'ow before deep scan, 'm'ountpoints, 's'ymlinks.

FileGlob - created own implementation for 'MSWin32' supporting non-english letters and long filenames instead of File::DosGlob.

FileHandle - uses caller's namespace for HANDLE.

FileTrack - added '!t' option to disable mtime checking.

FTPCmd - first parameter may be hash ref with host, username and password.

Pause - returns string entered as documented, instead of chomp result.

Platform - new parameter 'windir'.

16-17/06/2000, 03-05/07/2000, FileTrack and some corrections

New

FileTrack

Changed

FileCopy - translates '/' into '\' under Win32. FileFind - corrected regular expressions for options. Pause - chomp used.

08/05/2000, Log writing and some corrections

New

FileLog

Changed

FileFind - filepath and filename inserted into sub args after stat reference; FileMkDir - new default mode is 0777; StrTime - always 4-digit years after 2000

24/03/2000, Improved error processing

    Module Carp used, croak should be called instead of TryErr or die.

    Removed

    TryErr, TryEnd

    New

    TryHdr

12/02/2000 - 28/02/2000, Error processing and UNIX compatibility

    Error processing made with eval{} and $@, see Try. Variable $Error is syncronised with $@ and becomes optional.

    $^O (osname) introduced into some functions.

    New

    Echo, Try, TryEnd, TryErr, $@

    Changed

    Die, FileCopy ('cp -dpRf' for unix compatibility), FileEdit (removed parameter with section name), FileFind (backslash replaced with slash for unix compatibility, -i introduced), FileGlob (glob for unix compatibility), FileSize (options, -i FileFind option), FileSpace ('df -k' used for unix), Platform ($^O (osname) and getlogin), Print ($Echo dependence moved into Echo), SMTPSend

    Removed

    PrintErr and $PrintErr (use warn and $SIG{__WARN__} instead)

    Problems

    FileACL (failure Win32::FileSecurity on non-local users and groups), FileFind (failure stat on non-standard filenames, f.e. with '?')

    ToDo

    FileFind - review options and arguments. It should accept violating needs when deleting and creating. When creating, sub should see directories first, when deleting - contents first.

    FTPCmd, Platform, SMTPSend, - approve and test.

    Analysis of functions:

     p - 5 - platform (windows specific) realisation only, 2 - unix+win
     w - 3 - windows specific
     e -   - no error handling
        31 - total number of functions
    
                         pwe  
     CPTranslate           e  
     Die                   e
     Echo                  e
     FileACL             p
     FileCompare
     FileCopy            2
     FileCRC
     FileDelete          
     FileEdit            
     FileFind              
     FileGlob              e
     FileHandle            
     FileIni               
     FileMkDir
     FileNameMax           
     FileNameMin           
     FileRead                
     FileSize                
     FileSpace           p 
     FileWrite
     FTPCmd                   
     GUIMsg                  
     NetUse              pw
     Pause                
     Platform            ?
     Print                 e 
     Registry            pw
     Run
     SMTPSend
     StrTime               e
     UserEnvInit         pw

19/10 - 08/11/99, First documented release

Source changing

Functions sorted alphabetically.

New variables:

$Interact, $GUI, $Echo

Removed variables:

$noInteract (replaced with $Interact)

New functions:

CPTranslate, FileACL, FileHandle, FileMkDir, FileSize, FileSpace, Platform, SMTPSend

Changed functions:

FileCopy, FileFind, FileGlob, FileNameMax, FileNameMin, Registry

ToDo:

RetCodes - '0E0' for successful empty?

FileACL - debug and develop.

FileFind - corrected stat bug for filenames with sign '?'.

FileFind - review options and arguments.

FileFind - should accept violating needs when deleting and creating. When creating, sub should see directories first, when deleting - contents first.

FTPCmd - approve and test.

Platform - approve and test.

Print and PrintErr - should this functions be exported by default?

UserEnvInit - approve and test, especially for russian WinNT.

24/02/99 - 02/07/99, Corrections and Developments

Corrections and developments was made 02/07/99, 28/06/99, 23/06/99, 15/06/99, 01/04/99, 25/03/99, 23/03/99, 20/03/99, 19/03/99, 17/03/99, 15/03/99, 13/03/99, 12/03/99, 09/03/99, 06/03/99, 03/03/99, 02/03/99, 01/03/99, 27/02/99, 24/02/99

18/02/99 13:04, First release

A small module with a few functions was created and turned onto exploitation.

AUTHOR

Andrew V Makarow <makarow@mail.com>

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 1016:

You can't have =items (as at line 1020) unless the first thing after the =over is an =item

Around line 1034:

You can't have =items (as at line 1042) unless the first thing after the =over is an =item