This is Info file pm.info, produced by Makeinfo version 1.68 from the input file bigpm.texi.  File: pm.info, Node: subs, Next: uny2k, Prev: strict, Up: Module List Perl pragma to predeclare sub names *********************************** NAME ==== subs - Perl pragma to predeclare sub names SYNOPSIS ======== use subs qw(frob); frob 3..10; DESCRIPTION =========== This will predeclare all the subroutine whose names are in the list, allowing you to use them without parentheses even before they're declared. Unlike pragmas that affect the $^H hints variable, the `use vars' and `use subs' declarations are not BLOCK-scoped. They are thus effective for the entire file in which they appear. You may not rescind such declarations with `no vars' or `no subs'. See `Pragmatic Modules', *Note Perlmodlib: (perl.info)perlmodlib, and `strict subs', *Note Strict: strict,.  File: pm.info, Node: uny2k, Next: utf8, Prev: subs, Up: Module List Removes y2k fixes ***************** NAME ==== uny2k - Removes y2k fixes SYNOPSIS ======== use uny2k; $year = (localtime)[5]; printf "In the year %d, computers will everything for us!\n", $year += 1900; DESCRIPTION =========== Y2K has come and gone and none of the predictions of Doom and Gloom came to past. As the crisis is over, you're probably wondering why you went through all that trouble to make sure your programs are "Y2K compliant". uny2k.pm is a simple module to remove the now unnecessary y2k fixes from your code. Y2K was a special case of date handling, and we all know that special cases make programs more complicated and slower. Also, most Y2K fixes will fail around 2070 or 2090 (depending on how careful you were when writing the fix) so in order to avert a future crisis it would be best to remove the broken "fix" now. uny2k will remove the most common y2k fixes in Perl: $year = $year + 1900; and $two_digit_year = $year % 100; It will change them back to their proper post-y2k values, 19100 and 100 respectively. AUTHOR ====== Michael G Schwern with apologies to Mark "I am not ominous" Dominous for further abuse of his code. SEE ALSO ======== y2k.pm, D'oh::Year  File: pm.info, Node: utf8, Next: variable, Prev: uny2k, Up: Module List Perl pragma to enable/disable UTF-8 in source code ************************************************** NAME ==== utf8 - Perl pragma to enable/disable UTF-8 in source code SYNOPSIS ======== use utf8; no utf8; DESCRIPTION =========== WARNING: The implementation of Unicode support in Perl is incomplete. See *Note Perlunicode: (perl.info)perlunicode, for the exact details. The `use utf8' pragma tells the Perl parser to allow UTF-8 in the program text in the current lexical scope. The `no utf8' pragma tells Perl to switch back to treating the source text as literal bytes in the current lexical scope. This pragma is primarily a compatibility device. Perl versions earlier than 5.6 allowed arbitrary bytes in source code, whereas in future we would like to standardize on the UTF-8 encoding for source text. Until UTF-8 becomes the default format for source text, this pragma should be used to recognize UTF-8 in the source. When UTF-8 becomes the standard source format, this pragma will effectively become a no-op. Enabling the utf8 pragma has the following effects: * Bytes in the source text that have their high-bit set will be treated as being part of a literal UTF-8 character. This includes most literals such as identifiers, string constants, constant regular expression patterns and package names. * In the absence of inputs marked as UTF-8, regular expressions within the scope of this pragma will default to using character semantics instead of byte semantics. @bytes_or_chars = split //, $data; # may split to bytes if data # $data isn't UTF-8 { use utf8; # force char semantics @chars = split //, $data; # splits characters } SEE ALSO ======== *Note Perlunicode: (perl.info)perlunicode,, *Note Bytes: bytes,  File: pm.info, Node: variable, Next: vars, Prev: utf8, Up: Module List Perl pragma to declare (scalar) variables without a leading `$'. **************************************************************** NAME ==== variable - Perl pragma to declare (scalar) variables without a leading `$'. SYNOPSIS ======== use variable spam => 17; use variable eggs => spam + 25; use variable "i"; # Makes "i" undefined. use variable arr => [qw /aap noot mies wim zus jet/]; print eggs, "\n"; # Print 42. eggs += 27; print eggs, "\n"; # Print 69. for (i = 0; defined (arr -> [i]); i ++) { print arr -> [i], " "; # Print aap noot mies wim zus jet. } DESCRIPTION =========== This simple module allows you to create scalar variables that do not need a leading `$'. This will make people coming from a C or a *Python* background feel more at home. NOTES ===== This module requires perl 5.6.0. The values given to the variables are evaluated in list context. You may wish to override this by using scalar. These variables do not directly interpolate into doublequotish strings, although you may do so indirectly. (See the perlref manpage for details about how this works.) print "The value of eggs is ${\eggs}.\n"; This only works for scalar variables, not arrays or hashes. Naming of variables follow the same rules as in `constant.pm'. Names must begin with a letter or underscore. Names beginning with a double underscore are reserved. Some poor choices for names will generate warnings, if warnings are enabled at compile time. Variable symbols are package scoped (rather than block scoped, as `use strict;' is. That is, you can refer to a variable from package Other as `Other::var'. As with all use directives, defining a variable happens at compile time. This, it's probably not correct to put a variable declaration inside of a conditional statement (like `if ($foo) {use variable ...}'). Omitting the value for a symbol gives it the value of undef. This isn't so nice as it may sound, though, because in this case you must either quote the symbol name, or use a big arrow `< =' >> with nothing to point to. It is probably best to declare these explicitly. use variable bacon => (); use variable ham => undef; The result from evaluating a list constant in a scalar context is not documented, and is not guaranteed to be any particular value in the future. In particular, you should not rely upon it being the number of elements in the list, especially since it is not *necessarily* that value in the current implementation. In the rare case in which you need to discover at run time whether a particular variable has been declared via this module, you may use this function to examine the hash `%variable::declared'. If the given variable name does not include a package name, the current package is used. sub declared ($) { use variable; # don't omit this! my $name = shift; $name =~ s/^::/main::/; my $pkg = caller; my $full = $name =~ /::/ ? $name : "${pkg}::$name"; $variable::declared {$full}; } BUGS ==== A variable with the name in the list `STDIN STDOUT STDERR ARGV ARGVOUT ENV INC SIG' is not allowed anywhere but in package `main::', for technical reasons. You can get into trouble if you use variables in a context which automatically quotes barewords (as is true for any subroutine call). For example, you can't say `$hash {variable}' because variable will be interpreted as a string. Use `$hash {variable ()}' or `$hash {+variable}' to prevent the bareword quoting mechanism from kicking in. Similarly, since the `< =' >> operator quotes a bareword immediately to its left, you have to say `< variable () =' 'value' >> (or simple use a comma in place of the big arrow) instead of `< variable =' 'value' >> REVISION HISTORY ================ $Log: variable.pm,v $ Revision 1.1 2000/05/31 19:38:56 abigail Initial revision. AUTHOR ====== This package was written by Abigail, . COPYRIGHT AND LICENSE ===================== This package is copyright 2000 by Abigail. This program is free and open software. You can redistribute it or modify it under the same terms as Perl itself. THANKS ====== The author wishes to thank EFNet's *#python* IRC channel for the inspiration to write this module. A lot of the code and documentation of `constant.pm' was cut and pasted in.  File: pm.info, Node: vars, Next: vga, Prev: variable, Up: Module List Perl pragma to predeclare global variable names (obsolete) ********************************************************** NAME ==== vars - Perl pragma to predeclare global variable names (obsolete) SYNOPSIS ======== use vars qw($frob @mung %seen); DESCRIPTION =========== NOTE: The functionality provided by this pragma has been superseded by our declarations, available in Perl v5.6.0 or later. See `our', *Note Perlfunc: (perl.info)perlfunc,. This will predeclare all the variables whose names are in the list, allowing you to use them under "use strict", and disabling any typo warnings. Unlike pragmas that affect the $^H hints variable, the `use vars' and `use subs' declarations are not BLOCK-scoped. They are thus effective for the entire file in which they appear. You may not rescind such declarations with `no vars' or `no subs'. Packages such as the AutoLoader and SelfLoader that delay loading of subroutines within packages can create problems with package lexicals defined using my(). While the vars pragma cannot duplicate the effect of package lexicals (total transparency outside of the package), it can act as an acceptable substitute by pre-declaring global symbols, ensuring their availability to the later-loaded routines. See `Pragmatic Modules', *Note Perlmodlib: (perl.info)perlmodlib,.  File: pm.info, Node: vga, Next: vpopmail, Prev: vars, Up: Module List Perl extension for svgalib-1.2.11 ********************************* NAME ==== vga - Perl extension for svgalib-1.2.11 SYNOPSIS ======== use vga; [script ...] DESCRIPTION =========== Perl interface to svgalib 1.2.11, which is an enhancement of VGAlib v.1.2. The main difference in usage is all the vgalib functions that took the form of vga_functionname are now accessed as vga::functionname (without the 'vga_') Things notably missing from the library: vga_modeinfo structure vga_getmodeinfo() (vga::getmodeinfo) vga_getmodename() (vga::getmodename) the pointer to video ram, graph_mem (\$vga::graphmem) and the function vga_getgraphmem() (vga::getgraphmem) Also, I realize the docs are kinda hacked. If there is any interest in this package, I will revamp it and reupload it to the CPAN. Here is a description of the basic library functions (from the original VGAlib v1.2 README): - Support for all standard VGA 16 and 256 color modes - Support for non-standard 256 color modes (including mode X) - Tseng ET4000 SVGA 256 color modes - Monochrome 640x480 mode - Text mode restoration - Handling of console I/O - Flipping between graphics mode and text mode - Restores text mode after CTRL-C interrupt - The ET4000 modes should now be more robust - Tools for creating your own video modes VGAlib requires the 0.96b kernel (or newer) and must be compiled with GCC 2.2.2 (or newer). To compile and install VGAlib just type make. This will also build the following programs: vgatest: a simple demonstration of the library and the various video modes dumpreg: dumps the current VGA registers to stdout, mainly used for debugging and creating new video modes runx : if you have problems with text mode restoration after running X386, then try to use runx instead of startx Remember that all programs using VGAlib must be run with setuid root (login as root and do a 'chmod +s prog-name'), otherwise you will get a "can't get I/O permissions" error. VGAlib does it's best to restore the text mode, but it may fail with some SVGA cards if you use a text mode with more than 80 columns. If you are having problems please try to use an 80 column text mode. Below is a short description of the functions in the library. Look at vgatest.c for examples on how to use these functions: - vga_setmode() is used to select the graphics mode or to restore the text mode. - vga_hasmode() tests if a given video mode is supported by the graphics card (use this function before using any of the ET4000 SVGA modes) - vga_clear() clears the graphics screen. This is also done by vga_setmode(). - vga_getxdim(), vga_getydim() and vga_getcolors() return the resolution and number of colors for the current mode. - vga_getpalette() and vga_getpalvec() returns the contents of one or more palette registers, respectively. - vga_setpalette() and vga_setpalvec() allows you to modify one or more palette registers, respectively. - vga_setcolor() determines the color for future calls of the drawing functions. - vga_drawpixel() and vga_drawline() draws a pixel or a line in the current color, respectively. - vga_drawscanline() draws one single horisontal line of pixels and has been optimized for the fastest possible output. - vga_screenoff() and vga_screenon() turns the screen refresh off and on. On some VGA's the graphics operations will be faster, if the screen is turned off during graphics output. - vga_flip() switches between graphics and text mode without destroying the screen contents. This makes it possible for your application to use both text and graphics output. - vga_gecth() waits for a character to be typed an returns the ASCII value. If you press ESC (the exact key can be changed with vga_setflipchar()), the text mode will be temporarily restored until you press another key. This allows you to switch to another virtual console and later return to your graphics application. - vga_setflipchar() changes the character that vga_getch() uses for flipping between graphics and text mode. - vga_dumpregs() dumps the current VGA register contents to stdout My main motivation for implementing the graphics/text flipping was to make debugging easier. If your program reaches a breakpoint while in graphics mode, you can switch to text mode with the gdb command print vga_flip() and later restore the graphics screen contents with the same command. It is usefull to define the following alias in gdb: in graphics mode, you can switch to text mode with the gdb command print vga_flip() and later restore the graphics screen contents with the same command. It is usefull to define the following alias in gdb: define flip print vga_flip() end Exported constants ================== ACCELFLAG_DRAWHLINELIST ACCELFLAG_DRAWLINE ACCELFLAG_FILLBOX ACCELFLAG_PUTBITMAP ACCELFLAG_PUTIMAGE ACCELFLAG_SCREENCOPY ACCELFLAG_SCREENCOPYBITMAP ACCELFLAG_SETBGCOLOR ACCELFLAG_SETFGCOLOR ACCELFLAG_SETMODE ACCELFLAG_SETRASTEROP ACCELFLAG_SETTRANSPARENCY ACCELFLAG_SYNC ACCEL_DRAWHLINELIST ACCEL_DRAWLINE ACCEL_FILLBOX ACCEL_PUTBITMAP ACCEL_PUTIMAGE ACCEL_SCREENCOPY ACCEL_SCREENCOPYBITMAP ACCEL_SETBGCOLOR ACCEL_SETFGCOLOR ACCEL_SETMODE ACCEL_SETRASTEROP ACCEL_SETTRANSPARENCY ACCEL_SYNC ALI ARK ATI BLITS_IN_BACKGROUND BLITS_SYNC CAPABLE_LINEAR CIRRUS DISABLE_BITMAP_TRANSPARENCY DISABLE_TRANSPARENCY_COLOR EGA ENABLE_BITMAP_TRANSPARENCY ENABLE_TRANSPARENCY_COLOR ET3000 ET4000 EXT_INFO_AVAILABLE G1024x768x16 G1024x768x16M G1024x768x16M32 G1024x768x256 G1024x768x32K G1024x768x64K G1152x864x16 G1152x864x16M G1152x864x16M32 G1152x864x256 G1152x864x32K G1152x864x64K G1280x1024x16 G1280x1024x16M G1280x1024x16M32 G1280x1024x256 G1280x1024x32K G1280x1024x64K G1600x1200x16 G1600x1200x16M G1600x1200x16M32 G1600x1200x256 G1600x1200x32K G1600x1200x64K G320x200x16 G320x200x16M G320x200x16M32 G320x200x256 G320x200x32K G320x200x64K G320x240x256 G320x400x256 G360x480x256 G640x200x16 G640x350x16 G640x480x16 G640x480x16M G640x480x16M32 G640x480x2 G640x480x256 G640x480x32K G640x480x64K G720x348x2 G800x600x16 G800x600x16M G800x600x16M32 G800x600x256 G800x600x32K G800x600x64K GLASTMODE GVGA6400 HAVE_BITBLIT HAVE_BLITWAIT HAVE_EXT_SET HAVE_FILLBLIT HAVE_HLINELISTBLIT HAVE_IMAGEBLIT HAVE_RWPAGE IS_DYNAMICMODE IS_INTERLACED IS_LINEAR IS_MODEX MACH32 MACH64 MON1024_43I MON1024_60 MON1024_70 MON1024_72 MON640_60 MON800_56 MON800_60 OAK RGB_MISORDERED ROP_AND ROP_COPY ROP_INVERT ROP_OR ROP_XOR S3 TEXT TVGA8900 UNDEFINED VGA VGA_AVAIL_ACCEL VGA_AVAIL_FLAGS VGA_AVAIL_SET VGA_CLUT8 VGA_EXT_AVAILABLE VGA_EXT_CLEAR VGA_EXT_PAGE_OFFSET VGA_EXT_RESET VGA_EXT_SET VGA_H VGA_KEYEVENT VGA_MOUSEEVENT __GLASTMODE AUTHOR ====== Scott VanRavenswaay (scottvr@netcomi.com) VGAlib: Tommy Frandsen (frandsen@diku.dk) svgalib: (you know who you are) =head1 SEE ALSO perl(1). vgalib docs.  File: pm.info, Node: vpopmail, Next: warnings, Prev: vga, Up: Module List Perl extension for the vpopmail package *************************************** NAME ==== vpopmail - Perl extension for the vpopmail package SYNOPSIS ======== use vpopmail; adddomain('vpopmail.com'); vadduser('username', 'vpopmail.com', 'p@ssw0rd', 'Test User', 0 ); if ( vauth_user('username', 'vpopmail.com', 'p@ssw0rd', undef) ) { print 'auth ok'; } vsetuserquota('username', 'vpopmail.com', '5M'); vdeluser('username', 'vpopmail.com') ); vdeldomain('vpopmail.com'); DESCRIPTION =========== Perl extension for the vpopmail package [ http://www.inter7.com/vpopmail ] AUTHOR ====== Sean P. Scanlon SEE ALSO ======== perl(1), [ http://www.inter7.com/vpopmail ].  File: pm.info, Node: warnings, Next: web, Prev: vpopmail, Up: Module List Perl pragma to control optional warnings **************************************** NAME ==== warnings - Perl pragma to control optional warnings SYNOPSIS ======== use warnings; no warnings; use warnings "all"; no warnings "all"; use warnings::register; if (warnings::enabled()) { warnings::warn("some warning"); } if (warnings::enabled("void")) { warnings::warn("void", "some warning"); } DESCRIPTION =========== If no import list is supplied, all possible warnings are either enabled or disabled. A number of functions are provided to assist module authors. use warnings::register Creates a new warnings category which has the same name as the module where the call to the pragma is used. warnings::enabled([$category]) Returns TRUE if the warnings category `$category' is enabled in the calling module. Otherwise returns FALSE. If the parameter, `$category', isn't supplied, the current package name will be used. warnings::warn([$category,] $message) If the calling module has not set `$category' to "FATAL", print `$message' to STDERR. If the calling module has set `$category' to "FATAL", print `$message' STDERR then die. If the parameter, `$category', isn't supplied, the current package name will be used. See `Pragmatic Modules', *Note Perlmod: (perl.info)perlmod, and `Pragmatic Modules', *Note Perllexwarn: (perl.info)perllexwarn,.  File: pm.info, Node: web, Next: wwwAdmin, Prev: warnings, Up: Module List A set of useful routines for many webworking purposes ***************************************************** NAME ==== Web - A set of useful routines for many webworking purposes SYSTEM REQUIREMENTS =================== This module was primarily made for UNIX/Linux-Systems. Parts of it cannot be used on other systems. E.g. the procedures for file locking demand systems that can use symlinks. If you use the modul on systems where symlinks cannot be used, fatal errors may happen. SYNOPSIS ======== use web; ABSTRACT ======== This perl module serves users with several useful routines for many purposes, like generating webpages, processing CGI scripts, working with XML datafiles and net-connections. It also uses own variants of routines, that was invented first in the famous libraries CGI.pm and cgi-lib.pl. INSTALLATION ============ If you don't have sufficient privileges to install web.pm in the Perl library directory, you can put web.pm into some convenient spot, such as your home directory, or in cgi-bin itself and prefix all Perl scripts that call it with something along the lines of the following preamble: use lib '/home/myname/perl/lib'; use web; DESCRIPTION =========== NLock ----- This routine allows to set a filelock across NFS-boundaries. The common used perl-routine flock() fails at this point, so this routine is a useable alternative for bigger file-systems. It uses the modular functions link() and unlink() to mark a file locked. In addition to this, it also gives the locked file a counter: A file that is locked for more than $web::MAX_LOCKTIME seconds will be freed by the next process that calls NLock() on this file. A calling process gets either 0 or 1 as a return value, where 1 is returned if the file-locking was successful. 0 is returned only if the process waits for more than $web::MAX_WAITLOCK seconds or if symlink() fails. Example 1: $filename = "data.txt"; NLock($filename); open(f1,"$filename"); # do something close f1; NUnlock($filename); Example 2: #!/local/bin/perl5 use web; $stat= &NLock("jump.pl"); print "Lock: stat= $stat\n"; $stat= &NLock("jump.pl"); print "Lock this file again: stat= $stat\n"; sleep 8; $stat= &NLock("jump.pl"); print "Lock this file again: stat= $stat\n"; $stat= &NUnlock("jump.pl"); print "Unlock: stat= $stat\n"; exit; NUnlock ------- This routine removes the filelock that was set with NLock(). See NLock(). NUnlockAll ---------- In using this command, you can remove all file-locks, that was set with NLock() and which wasn't removed before. It takes the list of file-locks out of the hash %web::lockliste. GetYearDay ---------- This routine can be used to calculate a day's position within the year in days. It returns -1 if the argument is no date. Example: $today = "$web::tag.$web::monat.$web::jahr" || "14.9.1999"; $number_of_days = GetYearDay($today); print "Date: $today; It is the ${number_of_days}th day in this year.\n"; GetWeekDay ---------- By using this routine you'll get the weekday of a given date, which is a number between 0 (for sunday) and 6 (for saturday). If the argument is wrong, -1 will be returned. Example: $today = "$web::tag.$web::monat.$web::jahr" || "14.9.1999"; $weekday = GetWeekDay($today); print "It is $web::wochentag[$weekday], $today.\n"; isLeapYear ---------- This function returns true, if the argument is a leapyear. If no argument is given, the current year is used. Example: $this_year = 1999; if (isLeapYear($this_year)) { print "It's leapyear.\n"; } else { print "No leapyear.\n"; } # Returns 'No leapyear.' GetDatebyYDay ------------- This is the opposite of the GetYearDay() routine. It calculates the date from a day's position within a year. It returns nothing if the argument is out of range [1..365]. Example: $num_of_yearday = 32; $date = GetDatebyYDay($num_of_yearday); print "The date is $date\n"; # Returns 'The date is 1.2.1999', if $web::jahr = 1999. Add_Days_to_Date ---------------- Adds a number of days to a given date. Notice, that it works for adding only. Negative daynumbers might lead to errors in case of a number smaller than -365. Example: $startdate = "1.11.1999"; $modi_days = 119; $enddate = Add_Days_to_Date($startdate,$modi_days); print " $startdate + $modi_days Day(s) = $enddate\n"; # Will return "28.2.2000". Get_Seconds ----------- Returns the number of seconds elapsed since midnight of a given time or 0 if the time format isn't valid (hour:minute:second). Example: $jetztzeit = $web::stunde.":".$web::minute.":".$web::sek; $textzeit = "12:00:00"; $diff_sekunden = abs(Get_Seconds($jetztzeit)-Get_Seconds($textzeit)); print "Time differs with $diff_sekunden seconds.\n"; GetPassedDaysbyMonth -------------------- Returns the number of days that have passed by the inputvalue, which represend the number of a month. Example: $month = 8; $passed_days = GetPassedDaysbyMonth($month); print "$passed_days days have passed, before the $month. month came\n"; Check_Name ---------- Sometimes you need to get file names or other data from the internet. Due to the fact that you'll never know who can touch the data, you need to make sure that no one can send special chars which allow the execution of system commands. CERT gave out a set of characters that are harmless. They are set in the variable $web::OKCHARS as "a-z, A-Z, 0-9 _-.@/". This routine will check the argument for other characters and remove them from the string. That way, you can take filenames from the web without being afraid that someone else sends a dangerous string. Example: $insecure_filename = $ENV{'QUERY_STRING'}; $secure_filename = Check_Name($ENV{'QUERY_STRING'}); if (length($secure_filename) != length($insecure_filename)) { print(PrintHeader); print "The query-string contains invalid signs."; exit; } else { open(f1,"<$secure_filename") || Fehlermeldung("File $secure_filename not found."); # do something close f1; } Using Check_Name(), query strings like "/tmp/something|+'/bin/term+-display+131.188.3.9" won't work. PrintHeader ----------- Returns the string "Content-type: text/html\n\n", if it wasn't returned before. Additionally it can reset cookies if there were some before on this domain or set new cookies by using a hash-reference. The additional parameters are: Arguments: 1 Activates the setting of cookies. If new cookies are defined by argument 3, these will be set. Otherwise the cookies as given by $ENV{'HTTP_COOKIES'} are used. 2 On default, PrintHeader() will return nothing, if it was called before. By setting this argument unlike 1 it will ignore previous calls. 3 A hash-reference, which defines the cookies to be set. 4 The path-value for the cookies. On default its set to "/". 5 The lifetime-value for cookies in days. On default its set to 30. ReadParse --------- Reads the query string and/or the standard input and returns them as a hash. If the content-type is marked as multipart, it allows file uploads as long the variable $web::allowuploads is true. In this case, the new file is stored under its name, or to be precise, what Check_Name() makes of its name. Example: %in = ReadParse; print(PrintHeader); print "
    \n"; foreach $key (keys %in) { print "
  • $key   $in{$key}
  • \n"; } print "
\n"; Fehlermeldung ------------- This routine can be used to print out error messages. It also replaces CgiDie() from cgi-lib.pl. In addition to the former CgiDie(), this routine can also take a layout file to produce a better designed output. It takes the error message, the error title and the file name of an optional layout file as arguments. This layout file is a common HTML file, but it can contain the strings #ZEIT#, #ERRORTEXT# and #TITEL#. These strings will be replaced with the arguments. In using the global variable $web::errorlayout_file you can predefine a layout-file till the end of the program. The routine checks for the environment variables HTTP_USER_AGENT and SERVER_NAME to see whether it was called from of a CGI script. If so, it also prints the content-type. To avoid file-locking problems, this routine also executes NUnlockAll. Example: if (not (-r "hallo.html")) { Fehlermeldung("Die Datei hallo.html konnte nicht gelesen werden. Bitte ueberpruefen Sie die Dateirechte.","Datei nicht lesbar"); } isURL ----- Checks if the argument has a valid URL syntax. Returns true if the syntax is ok. Example: $url = "http://www.xwolf.com"; if (isURL($url)) { print "Valid URL: $url\n"; } isMail ------ Checks if the argument's syntax is allowed for email addresses. Returns true if it looks ok. Notice that it doesn't check whether the email really exists! Example: $mail = 'xwolf@xwolf.com'; if (isMail($mail)) { print "Mail address $mail looks correct.\n"; } isDatum ------- Checks if the argument is a valid German date. The syntax for a date was set to: DD.MM.YYYY. isIP ---- Checks the given argument for a valid IP-syntax. It returns TRUE on success. (This routine was invoked by Rolf Rost, http://www.-i-netlab.de) isZeit ------ Checks if the argument is a valid time. The syntax of a time was set to: HH:MM:SS. Read_Parafile ------------- In Unix many people define configuration files in a way that variable names and arguments are divided by one or more tabs and comments are preceded by a '#'. Variable names start with the first char of a line. This routine allows reading such a file and returns its content within a hash. Comments of variables are saved into the hash too, but with the string $web::PARACOMMENT_SIGN as appendix (Notice that comments here are put after the variables, not before). If the file could not be read, the hash value 'status' is set to 400, otherwise it is set to 200. Example: $configfile = "config"; %CONFIG = Read_Parafile($configfile); if ($CONFIG{'status'}==400) { Fehlermeldung("Could not read the config file."); } foreach $key (keys %CONFIG) { if (not ($key =~ /$web::PARACOMMENT_SIGN/i)) { print "$key \t $CONFIG{$key}\n"; } } ReadLayout ---------- Reads a file and returns its content in an array. ReturnFlagContent ----------------- Returns everything between a given HTML flag. Example: $text = "Startseite"; $content = ReturnFlagContent("b",$text); print "$content\n"; # Prints 'Startseite' ReplaceText ----------- This function does two things: It replaces the string #TEXT# with a given string and sets a around every URL within the text. This routine was made mainly because a simple search and replace for s/#TEXT#/$newtext/gi needs a long time if $newtext contains linebreaks. Therefore, all linebreaks are first replaced with <_BR_>, then the text will be replaced and after this all <_BR_>'s are set to linebreaks again. It's a small and dirty trick, but it works. Example: $text = "Here\n is\n something\n many\n lines.\n Insert here: #TEXT#\n\n"; $insert = "This was inserted."; $text = ReplaceText($insert, $text); WriteLog -------- This routine puts a line into a file together with the time and the IP/host which the script was executed on. Example: WriteLog("debug.log","Files updated."); GetSentence ----------- This procedure was made as an additional search-procedure for textparsing. It will return the full sentence of a long text, if a the search-word is in it. Notice, that this function fails, if there are shortcuts of words and the sentence was defined as something between two dots. Example: use web; $text = "It's an old story of a lost world, calling itself the Realm of Magic. Duncan Idaho, the famous warrior killed one elven maid too much. The mortals gathered and formed a powerful group to kill him. But then something happened..."; $search = "Duncan"; print(GetSentence($text,$search)); # Returns "Duncan Idaho, the famous warrior killed # one elven maid too much" RemoveHTML ---------- RemoveHTML() will remove all HTML-Tags and Specifications out of a given string. Example: $asciitext = RemoveHTML($htmltext); HtmlTop ------- Returns a HTML head. Stolen out of cgi-lib.pl. Use with print(HtmlTop); HtmlBot ------- Returns the ending tags of a HTML-document. Stolen out of cgi-lib.pl. Use with print(HtmlBot); Redirect() ---------- Makes a redirection towards another URL. Example: Redirect("http://www.xwolf.com/"); # will tell the server to set the location to the given url. AUTHOR INFORMATION ================== Copyright 1999-2000 Wolfgang Wiese. All rights reserved. It may be used and modified freely, but I do request that this copyright notice remain attached to the file. You may modify this module as you wish, but if you redistribute a modified version, please attach a note listing the modifications you have made. Address bug reports and comments to: xwolf@xwolf.com CREDITS ======= Thanks very much to: Johannes Schritz (johannes@schritz.de) Gert Buettner (g.buettner@rrze.uni-erlangen.de) Manfred Abel (m.abel@rrze.uni-erlangen.de) Rolf Rost (rolfrost@yahoo.com)  File: pm.info, Node: wwwAdmin, Next: y2k, Prev: web, Up: Module List A system for configuring virtual Apache web servers *************************************************** NAME ==== wwwAdmin - A system for configuring virtual Apache web servers SYNOPSIS ======== # No options required, the system is managed via a menu wwwAdmin Apache Wizard Menu ================== Beim Start des Apache Wizard Menues werden folgende Optionen zur Verfuegung gestellt. 1) Host Menu ------------- Hier werden Hosts konfiguriert (siehe Host Administration) 2) Apache Wizard Preferences ----------------------------- Hier wird die globale Konfiguration mittels folgender Optionen festgelegt: U Base Directory of Apache Wizard Verzeichnis in dem die Daten ueber Hosts, Server, etc... abgelegt werden. Host Administration =================== Die Administration der Hosts ist vom gleichen Ablauf wie die Administration weiterer Punkte. Attribute eines Hosts --------------------- short descriptive name Eindeutiger Name, der dem Host zugeordnet ist. Falls Sie einen neuen Host anlegen wollen der den selben Namen hat wie ein bereits vorhandener, wird ein Fehler ausgeloest. Beispiel: wwwhost1 informative description Beschreibung des Hosts. Beispiel: My webserver machine architecture Die Host Architektur. Beispiel: linux-i586 DNS name or ip address Gueltige IP Adresse oder DNS name des Hosts. Falls eine ungueltiger DNS Name oder IP Adresse eingegeben wird, wird ein Fehler ausgeloest. Beispiel: iss12.neckar-alb.de 1) Create a new Host - Neuen Host anlegen. ------------------------------------------ Attribute fuer den neuen Host eingeben. Informationen ueber die Attribute befinden sich weiter unten. Danach erhalten sie folgende Auswahl 1. Save these settings Den neuen Host abspeichern 2. Return to Host menu/Top menu Zum Hostmenue bzw. zum Startmenue zurueckkehren 2) Modify an existing Host - Vorhandenen Host modifizieren ---------------------------------------------------------- Hier muessen Sie zuerst einen vorhanden Host auswaehlen, der geaendert werden soll. Danach wird dieser geladen und kann mittels der Eingabemaske, die auch zum Anlegen von Hosts verwendet wird, abgeandert und anschliessend gespeichert werden. Hier verhaelt sich bis auf die Hostauswahl alles genau wie beim Anlegen von Hosts. 3) Server Menu -------------- Hier gelangen Sie zum Server Menu. (Naehres siehe unten) 4) Delete an existing host - Einen Host loeschen ------------------------------------------------ Hier werden Sie mittels einer Auswahlliste gebeten eine Host auszuwaehlen. Anschliessend wird dieser geladen und dessen Daten werden angezeigt. Nun gibt es drei Moeglichkeiten fortzufahren. Yes, delete it Den Host loeschen, aber das Datenverzeichnis in dem sich die alle Daten die zu diesem Host gehoeren, nicht loeschen. Yes, delete it, including data directory Dasselbe wie oben, wobei aber das Datenverzeichnis auch geloescht wird. Return to Host Menu/Top Menu Zu dem Host Menu bzw. zu dem Anfangsmenue zurueckkehren ohne den Host oder dessen Datenverzeichnis zu loeschen. 98) Return to Top Menu ---------------------- Zum Startmenue zurueckkehren. Server Menu =========== Hier werden die WWW server konfiguriert. Beim Anlegen eines neuen Servers wird automatisch ein Virtueller Server angelegt der den angelegten WWW server beschreibt. Beim anlegen des Virtuellen Severs wird automatisch ein Directory angelegt, dass das Root Verzeichnis des virtuellen Servers beschreibt. Naeheres in der Sektion VirtualServer Menu und Directory Menu. Im folgenden werden nur noch die Attribute beschrieben. Die Menupunkte und deren Funktion ist analog zum Host Menu. Attribute eines Servers ----------------------- Server descriptive name. Eindeutiger Name des Servers (analog zu Hosts) Server DNS name or IP adress DNS Name oder IP Adresse des Servers, analog zu Hosts. Default directory for VirtualServers Standardprefix fuer die Rootverzeichnisse der virtuellen Sever. Zum Beispiel '/usr/local/www'. Beim Anlegen eines virtuellen Servers 'www.test.de' wird dann als root verzeichnis '/usr/local/www/www.test.de' vorgeschlagen.. Naeheres finden Sie in der Sektion VirtualServer Menue. Server administrator Email adresse des Webmasters des Webservers. HTTP, HTTPS Port Default HTTP bzw HTTPS Port der als Standard fuer die virtuellen Server verwendet wird. VirtualServer Menu ================== Hier werden die virtuellen Webserver administriert. Die Menuoptionen und der Verlauf ist analog zu dem Server Menu. Lediglich die Attributseingabe erfolgt in zwei Schritten, wobei nach dem ersten Schritt abgebrochen werden kann. Beim Anlegen eines neuen virtuellen Webservers wird automatisch ein Verzeichnis angelegt, dass das root Verzeichnis des angelegten virtuellen Webservers entspricht, Naehres finden sie im Abschnitt Directory Menu. Attribute eines virtuellen Webservers ------------------------------------- DNS name or IP address Gueltiger DNS name oder IP Adresse (siehe analoge Attribute fuer Hosts, Server) Server type Hier koennen Sie den Servertyp einstellen, die Auswahl besteht aus 'http', 'https' oder 'both'. Falls 'https' oder 'both' ausgewaehlt wird, hat das zur Folge das als HTTP version HTTP/1.0 automatisch eingestellt wird. Falls 'http' ausgewaehlt wird hat man die Moeglichkeit zwischen HTTP/1.0 oder HTTP/1.1 auszuwaehlen. Virtual WWW server root directory Das root Verzeichnis des virtuellen Webservers. Virtual WWW server admin Email adresse des Webmasters. HTTP port HTTP Port auf den der virtuelle Server hoeren soll, falls nichts eingegeben wird, wird der des Servers, zu dem dieser virtuelle Webserver gehoert, verwendet. HTTPS port Nur falls 'https' oder 'both' als 'Server type' ausgewaehlt wurde. Analog zu HTTP port. HTTP version Nur falls 'http' als 'Server type' ausgewaehlt wurde. Virtual WWW server interface number Eine eindeutige interface Nummer (Ganzzahl) des virtuellen Webservers. Die Eingabe kann leergelassen werden falls 'http' als 'Server type' und HTTP/1.1 als 'HTTP version' ausgwaehlt wurde. DirectoryIndex, Options Analog zu den entsprechenden Apache Konfigurationsoptionen (wird mit sinvollen defaults vorbelegt) Enable PCGI/EP/SSI Hier koennen Sie einstellen ob der virtuelle Webserver PCGI, EP oder SSI (Server Side Includes) unterstuetzen soll. Directory Menu ============== Hier werden die Verzeichnisse der virtuellen Webserver administriert. Attribute eines Directory. -------------------------- Directory pathname Eindeutiger Pfad des Directory, relativ zum root Verzeichnis des dazugehoerigen virtuellen Webservers. Directory redirect url Falls das Verzeichnis ein redirect beschreiben soll, muessen Sie hier die Redirect-Url (Die Url worauf dieses Directory redirected wird) angeben. User who owns that directory Falls Sie keine Redirect-Url eingegeben haben, muessen Sie hier einen gueltigen User eingeben, der der Besitzer dieses Verzeichnis sein soll. Group that owns that directory Optionale Eingabe einer gueltigen Gruppe, der dieses Verzeichnis gehoert. AUTHORS AND COPYRIGHT ===================== This module is Copyright (C) 1999 Jochen Wiedmann Am Eisteich 9 72555 Metzingen Germany Email: joe@ispsoft.de Phone: +49 7123 14887 and Amarendran R. Subramanian Grundstr. 32 72810 Gomaringen Germany Email: amar@ispsoft.de Phone: +49 7072 920696 All Rights Reserved. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.  File: pm.info, Node: y2k, Next: Module List, Prev: wwwAdmin, Up: Module List A simple module to detect y2k bugs ********************************** NAME ==== y2k - A simple module to detect y2k bugs SYNOPSIS ======== use y2k; $year = (localtime)[5]; print "19$year is a good year to die"; DESCRIPTION =========== Most Y2k bugs written in Perl are typically very easy to catch. This module catches them. The idea is simple, it provides its own loaded versions of localtime() and gmtime() which return trick years. If this year is used in a manner which is not "cross-decade compliant", your program will die with an error. This is a thin legacy wrapper around D'oh::Year. Use that instead. SEE ALSO ======== `D'oh::Year' in this node AUTHOR ====== Michael G Schwern