[7575] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1201 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 20 16:11:57 1997

Date: Mon, 20 Oct 97 13:00:41 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 20 Oct 1997     Volume: 8 Number: 1201

Today's topics:
     ANNOUNCE Date::Manip-5.20 (Sullivan N. Beck)
     ANNOUNCE: Bit::Vector 5.0 BETA 1 (Steffen Beyer)
     ANNOUNCE: CDB_File 0.7 is available (Tim Goodwin)
     Announce: Preliminary release of Taint.pm (0.09) <rootbeer@teleport.com>
     ANNOUNCE: Term::Gnuplot v. 0.4 released (Ilya Zakharevich)
     FileExtra 1.01 - linktree & manifest <pritikin@mindspring.com>
     Re: guestbook in "Learning Perl", 2nd Ed. (Faust Gertz)
     Re: How do I collect email address using perl? <usenet-tag@qz.little-neck.ny.us>
     Re: How do I match the first word in a string? <joshb@kadence.kom>
     How to process signals with a daemon? akaleem@ibm.net
     ObjStore 1.17 <pritikin@mindspring.com>
     Re: Undef in my list -- syntax suggestion (Andrew M. Langmead)
     Re: What's wrong with my script ???? (Faust Gertz)
     Re: Why this behaviour with complex data structure? (Toutatis)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 20 Oct 1997 19:25:40 GMT
From: sbeck@cise.ufl.edu (Sullivan N. Beck)
Subject: ANNOUNCE Date::Manip-5.20
Message-Id: <62gb7k$fkg$1@news1.teleport.com>


I just added the newest version of Date::Manip to PAUSE.  It'll be at your
nearest CPAN site within a couple of days.  This incorporates a number of
bug fixes as well as adding full support for ISO 8601 date formats.  Support
for ISO 8601 introduces some incompatibilities with respect to the previous
version.

Here's the README file:
========

Copyright (c) 1995-1997 Sullivan Beck. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

For information on installing Date::Manip, see the INSTALL file included in
the distribution.

Please send questions or bug reports to me rather than posting them to
a newsgroup since I may miss them there, but read the next paragraph
before you automatically start firing off email to me!

If you have questions about Date::Manip, refer to the Date::Manip man page
included as pod documentation in the Manip.pm file.  Don't know what I'm
talking about?  Read the perlpod man page.  Alternately, an online version
of the Date::Manip man page is included in my home page given below.
PLEASE read the man page thoroughly before posting any questions about
Date::Manip to a newsgroup or emailing me.  If you've done this, I'll be
glad to answer any questions not covered in the man page.


Notes for version 5.20:
  Added ISO 8601 date formats.
  Added ParseDateString for speed.
  Changed week handling to meet ISO 8601 standards.
  Added %J and %K UnixDate formats.
  Added some speedups (more to come).
  Added more Parse formats:
     last day in mmm in YY             "last day of October"
     dofw                              "Friday" (Friday of current week)
     Nth                               "12th", "1st" (day of current month)

  
  Version 5.20 has some incompatibilities with previous versions:
    Some old formats were removed since they conflicted with ISO 8601
       formats.  MM-DD-YY (conflicts with YY-MM-DD), YYMMDD (conflicts
       with YYYYMM).
    Weekdays are now numbered 1-7 (mon-sun) instead of 0-6 (sun-sat)
    By default the week now starts with Monday instead of Sunday to meet
       ISO 8601.  The FirstDay variable can be set to 7 to set Sunday as
       the first day.
    By default, the 1st week of the year contains Jan 4 (ISO 8601).  See
       the Jan1Week1 variable for overriding this.

  ############################################################################
  If you would like to stay informed about future versions of this module,
  and especially if you are interested in beta testing future versions,
  please let me know by email at:
    sbeck@cise.ufl.edu

  The newest version (which should be considered a beta version) is available
  through my home page:
    http://www.qtp.ufl.edu/~beck
  Feel free to try it out.

  The current (non-beta) version of this module is available from you nearest
  CPAN site and is NOT available from my home page.  I will announce new
  (non-beta) releases in comp.lang.perl.misc and comp.lang.perl.announce.  
  ############################################################################


This is a set of routines designed to make any common date/time
manipulation easy to do.  Operations such as comparing two times,
calculating a time a given amount of time from another, or parsing
international times are all easily done.

Date::Manip deals only with the Gregorian calendar (the one currently in
use).  The Julian calendar defined leap years as every 4th year.  The
Gregorian calendar improved this by making every 100th year NOT a leap
year, unless it was also the 400th year.  The Gregorian calendar has been
extrapolated back to the year 1000 AD and forward to the year 9999 AD.
Note that in historical context, the Julian calendar was in use until 1582
when the Gregorian calendar was adopted by the Catholic church.  Protestant
countries did not accept it until later; Germany and Netherlands in 1698,
British Empire in 1752, Russia in 1918.  Note that the Gregorian calendar
is itself imperfect.  Each year is on average 26 seconds too long, which
means that every 3,323 years, a day should be removed from the calendar.
No attempt is made to correct for that.

Date::Manip is therefore not equipped to truly deal with historacle dates,
but should be able to perform (virtually) any operation dealing with a
modern time and date.

Among other things, Date::Manip allow you to:

1.  Enter a date and be able to choose any format conveniant

2.  Compare two dates, entered in widely different formats to determine
    which is earlier

3.  Extract any information you want from ANY date using a format string
    similar to the Unix date command

4.  Determine the amount of time between two dates

5.  Add a time offset to a date to get a second date (i.e. determine the
    date 132 days ago or 2 years and 3 months after Jan 2, 1992)

6.  Work with dates with dates using international formats (foreign month
    names, 12/10/95 referring to October rather than December, etc.).

Each of these tasks is trivial (one or two lines at most) with this package.

Although the word date is used extensively here, it is actually somewhat
misleading.  Date::Manip works with the full date AND time (year, month,
day, hour, minute, second, and will ignore fractional seconds).

In the documentation below, US formats are used, but in most (if not all)
cases, a non-English equivalent will work equally well.

EXAMPLES:

1.  Parsing a date from any conveniant format

  $date=&ParseDate("today");
  $date=&ParseDate("1st thursday in June 1992");
  $date=&ParseDate("05/10/93");
  $date=&ParseDate("12:30 Dec 12th 1880");
  $date=&ParseDate("8:00pm december tenth");
  if (! $date) {
    # Error in the date
  }

2.  Compare two dates

  $date1=&ParseDate($string1);
  $date2=&ParseDate($string2);
  if ($date1 lt $date2) {
    # date1 is earlier
  } else {
    # date2 is earlier (or the two dates are identical)
  }

3.  Extract information from a date.

  print &UnixDate("today","The time is now %T on %b %e, %Y.");
  =>  "The time is now 13:24:08 on Feb  3, 1996."

4.  The amount of time between two dates.

  $date1=&ParseDate($string1);
  $date2=&ParseDate($string2);
  $delta=&DateCalc($date1,$date2,\$err);
  => 0:0:DD:HH:MM:SS   the days, hours, minutes, and seconds between the two
  $delta=&DateCalc($date1,$date2,\$err,1);
  => YY:MM:DD:HH:MM:SS  the years, months, etc. between the two

  Read the documentation in the man page for an explanation of the difference.

5.  To determine a date a given offset from another.

  $date=&DateCalc("today","+ 3hours 12minutes 6 seconds",\$err);
  $date=&DateCalc("12 hours ago","12:30 6Jan90",\$err);

  It even works with business days:

  $date=&DateCalc("today","+ 3 business days",\$err);

6.  To work with dates in another language.

  &Date_Init("Language=French","DateFormat=non-US");
  $date=&ParseDate("1er decembre 1990");

NOTE: Some date forms do not work as well in languages other than English,
but this is not because DateManip is incapable of doing so (almost nothing
in this module is language dependent).  It is simply that I do not have the
correct translation available for some words.  If there is a date form that
works in English but does not work in a language you need, let me know and
if you can provide me the translation, I will fix DateManip.

For documentation on all of the date manipulation routines, read the
man page.

AUTHOR

Sullivan Beck (sbeck@cise.ufl.edu)



------------------------------------------------------------------------------
Sullivan Beck                      http://www.cise.ufl.edu/~sbeck/
 sbeck@cise.ufl.edu  | This space reserved for some saying demonstrating great
 PH : (352) 392-1057 | wisdom, wit, or insight.  I'll fill it in just as soon
 Fax: (352) 392-1220 | as I have any of the above.
------------------------------------------------------------------------------




------------------------------

Date: 20 Oct 1997 19:25:05 GMT
From: sb@sdm.de (Steffen Beyer)
Subject: ANNOUNCE: Bit::Vector 5.0 BETA 1
Message-Id: <62gb6h$fk7$1@news1.teleport.com>

Dear Perl users,

I am glad to be able to announce the first beta release of version 5.0
of my "Bit::Vector" module:

                    =====================================
                      Package "Bit::Vector" Version 5.0
                    =====================================
                      for Perl version 5.000 and higher

It is available from http://www.engelschall.com/u/sb/download/ or from
any CPAN ftp server (look for "Bit-Vector-5.0b1.tar.gz").

The coding of the new methods (see below for a list) is now complete;
the module passes all regression tests, but more test scripts and a
more complete documentation are still lacking.


What does it do:
----------------

This module is useful for a large range of different tasks:

  -  For example for implementing sets and performing set operations
     (like union, difference, intersection, complement, check for subset
     relationship etc.),

  -  as a basis for many efficient algorithms (the complexities of the
     methods in this module are usually either O(1) or O(n/b), where
     "b" is the number of bits in a machine word on your system),
     like the "Sieve of Erathostenes" (for calculating prime numbers),

  -  for using shift registers (for instance for cyclic redundancy
     checksums) of arbitrary length,

  -  to calculate "look-ahead", "first" and "follow" character sets
     for parsers and compiler-compilers,

  -  for graph algorithms,

  -  for efficient storage and retrieval of status information,

  -  for performing text generation depending on logical expressions,

  -  for big integer arithmetic,

  -  for manipulations of chunks of bits of arbitrary size,

and more.

A large number of import/export methods allow you to access individual
bits, contiguous ranges of bits, machine words, arbitrary chunks of
bits, lists (arrays) of chunks of bits or machine words and a whole
bit vector at once (for instance for blockread/-write to and from
a file).

You can also import and export the contents of a bit vector in binary,
hexadecimal and decimal representation as well as "newsrc" style
enumerations.

Note that this module is especially designed for efficiency, which is
also the reason why its methods are implemented in C.

To further increase execution speed, the module doesn't use bytes as its
basic storage unit, but rather uses machine words, assuming that a machine
word is the most efficiently handled size of all scalar types on all
machines (that's what the ANSI C standard proposes and assumes anyway).

In order to achieve this, it automatically determines the number of bits
in a machine word on your system and then adjusts its internal configuration
constants accordingly.

The greater the size of this basic storage unit, the better the complexity
(= execution speed) of the methods in this module (but also the greater the
average waste of unused bits in the last word).


Important note:
---------------

Note that the C library at the core of this module ("BitVector.c") can
also be used stand-alone (i.e., without Perl).

To do so, link the output file "BitVector.o" (which is produced when you
build this module or when you just compile "BitVector.c") with your
application.

Note however that this C library does not perform any bounds checking;
this is your application's duty.

See the file "Vector.xs" in this distribution for an example of how
this can be done.


Example applications:
---------------------

See the module "Set::IntegerRange" for an easy-to-use module for sets
of integers.

See the module "Math::MatrixBool" for an implementation of boolean
matrices.

(Both modules are available from "http://www.engelschall.com/u/sb/download/"
or from any CPAN ftp server.)

A tool relying crucially on this "Bit::Vector" module is "Slice" (see
also "http://www.engelschall.com/sw/slice/"), a tool for generating
varying document versions out of a single master file. (This tool was
written by Ralf S. Engelschall).

This tool is itself part of another tool (by the same author), "WML"
(= "Website Meta Language"), which allows you to generate and maintain
large web sites (see also "http://www.engelschall.com/sw/wml/"). Among
many other features, it allows you to define your own HTML tags which
will be expanded either at generation or at run time, depending on your
choice.


New features in version 5.0:
----------------------------

In version 5.0, the following new methods have been added:

  -  Word_Bits()
  -  Long_Bits()
  -  Primes()
  -  Interval_Copy()
  -  Interval_Substitute()
  -  to_Bin()
  -  from_bin()
  -  to_Dec()
  -  from_dec()
  -  Insert()
  -  Delete()
  -  add()
  -  subtract()
  -  Negate()
  -  Absolute()
  -  Sign()
  -  Multiply()
  -  Divide()
  -  GCD()
  -  Block_Store()
  -  Block_Read()
  -  Word_Size()
  -  Word_Store()
  -  Word_Read()
  -  Word_List_Store()
  -  Word_List_Read()
  -  Word_Insert()
  -  Word_Delete()
  -  Chunk_Store()
  -  Chunk_Read()
  -  Chunk_List_Store()
  -  Chunk_List_Read()
  -  Transpose()

The following methods have been re-implemented in C (instead of Perl):

  -  Version()
  -  Shadow()
  -  Clone()
  -  to_Enum()       (previously named "to_ASCII")
  -  from_enum()     (previously named "from_ASCII")

The following methods have been renamed:

  -  to_String()      -->    to_Hex()
  -  from_string()    -->    from_hex()
  -  to_ASCII()       -->    to_Enum()
  -  from_ASCII()     -->    from_enum()

(Aliases for the old names are still available but deprecated!)

And finally, the following methods are gone:

  -  lexorder()
  -  new_from_String()

A patch utility is available in the module's distribution to upgrade your
existing applications and to provide substitutes for the two methods that
are gone.


Legal issues:
-------------

This module and its distribution with all its parts is

Copyright (c) 1995, 1996, 1997 by Steffen Beyer. All rights reserved.

Please read the file "LICENSE" in the module's distribution for details
about the exact terms under which this package may be used and distributed.


Prerequisites:
--------------

Perl version 5.000 or higher, a C compiler capable of the ANSI C standard (!)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Author's note:
--------------

If you have any questions, suggestions or need any assistance, please
let me know!

Also, if there is anything you would like to do with this module which
the module doesn't provide yet, please let me know! If it fits the module's
overall concept, I'll implement it as soon as possible. Frequently this is
only a matter of a few days.

I hope you will find this module beneficial!

Yours,
--
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi




------------------------------

Date: 20 Oct 1997 19:28:24 GMT
From: tgoodwin@cygnus.co.uk (Tim Goodwin)
Subject: ANNOUNCE: CDB_File 0.7 is available
Message-Id: <62gbco$fod$1@news1.teleport.com>

An updated version of the CDB_File module is now available.  It includes
these enhancements:

    o empty data values are now supported;
    o minor portability and documentation fixes.

CDB_File is a Perl interface to Dan Bernstein's cdb package, which
implements Constant DataBases.  The cdb package is similar to the DBM
family of databases (DBM, NDBM, GDBM, DB, etc.) except that a cdb file
cannot be changed once it has been created.  The resulting savings in
space and time make cdb files ideal for databases that are read many
more times than they are written, such as password databases.  The
CDB_File-0.7 distribution includes a complete and unmodified copy of
release 0.55 of cdb.

CDB_File-0.7.tar.gz is available now from CPAN.  It is considered an
alpha release.  Please contact me, Tim Goodwin <tgoodwin@cygnus.co.uk>,
with any problems, questions, or suggestions

Tim.
-- 
Tim Goodwin | "Gateways are designed for the purpose of losing information;
Cygnus, UK  | some do better than others." -- Dave Crocker




------------------------------

Date: 20 Oct 1997 19:26:53 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Announce: Preliminary release of Taint.pm (0.09)
Message-Id: <62gb9t$fn1$1@news1.teleport.com>

                           Taint.pm
		Tom Phoenix <rootbeer@teleport.com>

Perl has the ability to mark data as 'tainted', as described
in the perlsec(1) manpage. Perl will prevent tainted data
from being used for some operations, and you may wish to add
such caution to your own code. The routines in this module
provide convenient ways to taint data and to check data for
taint.

  ******************************************************
  *                                                    *
  * This is a trial version of this module.   Beware!  *
  * Some features may change before the final release. *
  *                                                    *
  * This module is not (yet) released under the same   *
  * standard licenses which are used for Perl itself.  *
  * (See copyright within the module's POD docs.)      *
  *                                                    *
  ******************************************************

SYNOPSIS
       use Taint;
       warn "Oops"
         if tainted $foo, @bar;      # Test for tainted data
       kill $foo, @bar;              # before using it

       use Taint qw(taint);
       taint @some_vars;             # Intentionally taint data

REQUIRES
    This should work with any Perl system which can use MakeMaker
    (that is, I believe at least Unix, Win32, VMS), and it should
    be easy (if not trivial) to port to other Perl systems. It uses
    no C code.

AUTHOR
     Tom Phoenix, <rootbeer@teleport.com>

AVAILABILITY
    You should find the latest version of this module on
    CPAN in (something like) this location.

	http://www.perl.com/CPAN/authors/Tom_Phoenix/
    
    Please don't rely upon an old version of this module.

SPECIAL NOTE
    There is a different Taint module available in the 
    CPAN directory for Dan Sugalski. Please compare and
    contrast these modules' approaches so that we may all
    reach a consensus about how this module should act.

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!





------------------------------

Date: 20 Oct 1997 19:26:15 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: ANNOUNCE: Term::Gnuplot v. 0.4 released
Message-Id: <62gb8n$fkn$1@news1.teleport.com>

The difference with the old (unsupported) release is that we include
all the needed files from gnuplot.3.5 distribution.  This means that
the installation should be turnkey (at least on the systems where no
additional defines/libraries are needed, should be true on *nix and
OS/2, may be true on may others).

Anyway, even if your system needs additional defines, it is the matter
of moving the corresponding chunks from system-specific makefiles to
Makefile.PL. 

Below is the POD docs,  current location is on
      ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl/modules
should propagate to CPAN in a couple of days.

Enjoy,
Ilya

=head1 NAME

Term::Gnuplot - lowlevel graphics using gnuplot drawing routines.

=head1 USAGE

  use Term::Gnuplot ':ALL';
  list_terms();
  change_term('dumb') or die "Cannot set terminal.\n";
  init();
  graphics();
  $xmax = xmax();
  $ymax = ymax();
  linetype(-2);
  move(0,0);
  vector($xmax-1,0);
  vector($xmax-1,$ymax-1);
  vector(0,$ymax-1);
  vector(0,0);
  justify_text(LEFT);
  put_text(h_char()*5, $ymax - v_char()*3,"Terminal Test, Perl");
  $x = $xmax/4;
  $y = $ymax/4;
  $xl = h_tic()*5;
  $yl = v_tic()*5;
  linetype(2);
  arrow($x,$y,$x+$xl,$y,1);
  arrow($x,$y,$x+$xl/2,$y+$yl,1);
  arrow($x,$y,$x,$y+$yl,1);
  arrow($x,$y,$x-$xl/2,$y+$yl,0);
  arrow($x,$y,$x-$xl,$y,1);
  arrow($x,$y,$x-$xl,$y-$yl,1);
  arrow($x,$y,$x,$y-$yl,1);
  arrow($x,$y,$x+$xl,$y-$yl,1);
  text();
  Term::Gnuplot::reset();

=head1 EXPORTS

None by default.

=head2 Exportable

  change_term test_term init_terminal
  LEFT CENTRE RIGHT 
  name description xmax ymax v_char h_char v_tic h_tic
  init scale graphics linetype move vector point text_angle
  justify_text put_text arrow text

=head2 Export tags

C<:ALL> for all stuff, C<:SETUP> for the first row above, C<:JUSTIFY>
for the second, C<:FIELDS> for the third, C<:METHODS> for the rest.

=head1 SEMANTIC

Below I include the contents of the file F<term/README> from gnuplot
distribution. It explains the meaning of the above methods. All is
supported under Perl but the C<options> method. The discription below
includes underscores, that are deleted in the perl interface.

The only functions that are not included are C<change_term($newname)>,
test_term() and init_terminal(), that should be
self-explanatory. Currently it is impossible to find names of
supported terminals, this would require patch to gnuplot.

=head1 gnuplot F<term/README>

DOCUMENTATION FOR GNUPLOT TERMINAL DRIVER WRITERS

By Russell Lang 1/90

Information on each terminal device driver is contained in term.c and
the term/*.trm files.  Each driver is contained in a .trm file and is 
#include'd into term.c.  Each driver has a set of initialisers in 
term.c for term_tbl[], an array of struct termentry.

Here is the definition of the struct termentry from plot.h:

  struct termentry {
  char *name;
  char *description;
  unsigned int xmax,ymax,v_char,h_char,v_tic,h_tic;
  FUNC_PTR
  options,init,reset,text,scale,graphics,move,vector,linetype,
	put_text,text_angle,justify_text,point,arrow;
  };

Here's a brief description of each variable:

The char *name is a pointer to a string containing the name
of the terminal.  This name is used by the 'set terminal' and 
'show terminal' commands.  
The name must be unique and must not be confused with an abbreviation 
of another name.  For example if the name "postscript" exists, it is
not
possible to have another name "postscript2".
Keep the name under 15 characters.

The char *description is a pointer to a string containing a
description of the terminal, which is displayed in response
to the 'set terminal' command.  
Keep the description under 60 characters.

xmax is the maximum number of points in the x direction.  
The range of points used by gnuplot is 0 to xmax-1.

ymax is the maximum number of points in the y direction.  
The range of points used by gnuplot is 0 to ymax-1.

v_char is the height of characters, in the same units as xmax and
ymax.
The border for labelling at the top and bottom of the plot is 
calculated using v_char.  
v_char is used as the vertical line spacing for characters.

h_char is the width of characters, in the same units as xmax and ymax.
The border for labelling at the left and right of the plot is 
calculated using h_char.  
If the _justify_text function returns FALSE, h_char is used to justify 
text right or centre.  If characters are not fixed width, then the 
_justify_text function must correctly justify the text.

v_tic is the vertical size of tics along the x axis, 
in the same units as ymax.

h_tic is the horizontal size of tics along the y axis, 
in the same units as xmax.


Here's a brief description of what each term.c function does:

_options()  Called when terminal type is selected.  
This procedure should parse options on the command line.  A list of
the 
currently selected options should be stored in term_options[] in a
form 
suitable for use with the set term command.  term_options[] is used by 
the save command.  Use options_null() if no options are available. 

_init()  Called once, when the device is first selected.  This
procedure
should set up things that only need to be set once, like handshaking
and
character sets etc...

_reset()  Called when gnuplot is exited, the output device changed or
the terminal type changed.  This procedure should reset the device, 
possibly flushing a buffer somewhere or generating a form feed.

_scale(xs,ys) Called just before _graphics(). This takes the x and y
scaling factors as information. If the terminal would like to do its
own scaling, it returns TRUE. Otherwise, it can ignore the information
and return FALSE: do_plot will do the scaling for you. null_scale is
provided to do just this, so most drivers can ignore this function
entirely. The Latex driver is currently the only one providing its own
scaling.

_graphics()  Called just before a plot is going to be displayed.  This
procedure should set the device into graphics mode.  Devices which
can't
be used as terminals (like plotters) will probably be in graphics mode 
always and therefore won't need this.

_text()  Called immediately after a plot is displayed.  This procedure 
should set the device back into text mode if it is also a terminal, so
that commands can be seen as they're typed.  Again, this will probably
do nothing if the device can't be used as a terminal.

_move(x,y)  Called at the start of a line.  The cursor should move to
the
(x,y) position without drawing.

_vector(x,y)  Called when a line is to be drawn.  This should display
a line
from the last (x,y) position given by _move() or _vector() to this new
(x,y)
position.

_linetype(lt)  Called to set the line type before text is displayed or
line(s) plotted.  This procedure should select a pen color or line
style if the device has these capabilities.  

lt is an integer from -2 to 0 or greater.  

An lt of -2 is used for the border of the plot.

An lt of -1 is used for the X and Y axes.  

lt 0 and upwards are used for plots 0 and upwards.

If _linetype() is called with lt greater than the available line
types, 
it should map it to one of the available line types.
Most drivers provide 9 different linetypes (lt is 0 to 8).

_put_text(x,y,str)  Called to display text at the (x,y) position, 
while in graphics mode.   The text should be vertically (with respect 
to the text) justified about (x,y).  The text is rotated according 
to _text_angle and then horizontally (with respect to the text)
justified according to _justify_text.

_text_angle(ang)  Called to rotate the text angle when placing the y
label.
If ang = 0 then text is horizontal.  If ang = 1 then text is
vertically
upwards.  Returns TRUE if text can be rotated, FALSE otherwise.

_justify_text(mode)  Called to justify text left, right or centre.

If mode = LEFT then text placed by _put_text is flushed left against
(x,y).

If mode = CENTRE then centre of text is at (x,y).  

If mode = RIGHT then text is placed flushed right against (x,y).

Returns TRUE if text can be justified
Returns FALSE otherwise and then _put_text assumes text is flushed
left;
justification of text is then performed by calculating the text width
using strlen(text) * h_char.

_point(x,y,point)  Called to place a point at position (x,y).
point is -1 or an integer from 0 upwards.  
6 point types (numbered 0 to 5) are normally provided.  
Point type -1 is a dot.
If point is more than the available point types then it should 
be mapped back to one of the available points.
Two _point() functions called do_point() and line_and_point() are 
provided in term.c and should be suitable for most drivers.  
do_point() draws the points in the current line type.
If your driver uses dotted line types (generally because it is
monochrome), you should use line_and_point() which changes to 
line type 0 before drawing the point.  line type 0 should be solid.

_arrow(sx,sy,ex,ey,head)  Called to draw an arrrow from (sx,sy) to
(ex,ey).
A head is drawn on the arrow if head = TRUE.
An _arrow() function called do_arrow() is provided in term.c which
will
draw arrows using the _move() and _vector() functions.  
Drivers should use do_arrow unless it causes problems.

The following should illustrate the order in which calls to these
routines are made:

  _init()
    _scale(xs,ys)
    _graphics()
      _linetype(lt)
      _move(x,y)
      _vector(x,y)
        _point(x,y,point)
      _text_angle(angle)
      _justify(mode)
      _put_text(x,y,text)
      _arrow(sx,sy,ex,ey)
    _text()
    _graphics()
      .
      .
    _text()
  _reset()

=head1 Using Term::Gnuplot from C libraries

The interface of this module to B<gnuplot> version 3.5 is going via a
translation layer in F<Gnuplot.h>.  It isolates low-level drawing
routines from B<gnuplot> program.  (In doing this unsupported job it
does
some nasty thing, in particular it cannot be included in more than one
C compilation unit.)

This header file knows nothing about B<gnuplot> except that there is
an API
call C<term = change_term(name)>, and there is an (indexed by C<term>)
array C<term_tbl> of tables of methods.

This means that any C library which uses the API provided by
F<Gnuplot.h> does not I<need> to be even linked with B<gnuplot>,
neither it I<requires> include files of B<gnuplot>.  It can establish
a runtime-link with any plotting library which supports (or can be
coerced to support) the above interface.

To enable this I<dynamic> link to plotting libraries make sure that
preprocessor macro C<DYNAMIC_GNUPLOT> is defined when you include
F<Gnuplot.h>.  At runtime call C<set_term_funcp(&change_term,
term_tbl)> before doing any drawing, and the link will be established.

To facilitate this the C<Term::Gnuplot> Perl module provides two Perl
routines change_term_address() and term_tbl_address() which return
addresses of B<gnuplot>s routine/table as integers.  Thus the external
library which wants to use Term::Gnuplot at runtime can put this in
F<.xs> file:

  typedef int (*FUNC_PTR)();
  #define set_gnuterm(a,b) \
     set_term_funcp((FUNC_PTR)(a),(struct termentry *)(b))
  ...

  void
  set_gnuterm(a,b)
    IV a
    IV b

and define this

  sub link_gnuplot {
    eval 'use Term::Gnuplot 0.4; 1' or die;
    set_gnuterm(Term::Gnuplot::change_term_address(), 
            Term::Gnuplot::term_tbl_address());
  }

in F<.pm> file.  

Now if it needs to do plotting, it calls link_gnuplot(), then does the
plotting - without a need to interact with B<gnuplot> at compile/link
time, and having the additional burden of low-level plotting code
loaded in the executable.

=head1 LIMITATIONS

options() call is not implemented, since it will pull all the
B<gnuplot> code with it.  Some hand-made substitute parser of options
setting may be needed...




------------------------------

Date: 20 Oct 1997 19:27:46 GMT
From: Joshua Pritikin <pritikin@mindspring.com>
Subject: FileExtra 1.01 - linktree & manifest
Message-Id: <62gbbi$fnh$1@news1.teleport.com>

Attempt at the definitive linktree and manifest implementations. 

                                 -*-

File::LinkTree - Creates symlink trees.  Also can prune bad links and
unused directories.

File::Manifest - A more user oriented version of ExtUtils::Manifest.
Supports multiple checksum algorithms with built-in support for MD5.

Command line programs linktree, prunetree, and manifest provide
interfaces to the libraries.

                                 -*-

Hopefully, this package will eventually be rolled into a File::*
bundle.

                                 -*-

Requires File::Recurse (part of File::Tools module).




------------------------------

Date: Mon, 20 Oct 1997 19:42:06 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: guestbook in "Learning Perl", 2nd Ed.
Message-Id: <344bb342.59868@news.wwa.com>

On 20 Oct 1997 14:38:17 -0400, mdennist@dekalb.dc.peachnet.edu
(Michael L Denniston,CD108C SCIE,299-4097,3) wrote:

>I am trying to modify the guestbook program given on p. 198 of the new 
>addition of Learning Perl by Schwartz & Christianson.  I am concerned 
>about security for my cgi-bin directory which is being run under my user 
>name.  Consequently I want to check for meta-characters and other nasties 
>being entered into my guestbook.  

It would be better to run perl -T and to read and understand  _The
World Wide Web Security FAQ_
(http://www.genome.wi.mit.edu/WWW/faqs/) than just to check for
meta-characters.

>The Perl syntax for the checking 
>routine is not a problem, I just cannot seem to find the right variable 
>to check.  I suspect that I am not as familiar with some of the objects 
>used in this program as I ought to be.

Then please ask about the specific stuff you don't understand.  The
point of that chapter is not to give you a nifty guest book script,
but for you to learn and understand something.  If you haven't
already, please read the book from cover to cover and then try to play
with the last chapter.

> E-mail preferred.

I prefer Usenet, but often do use both.


HTH

Faust Gertz
Philosopher at Large

"If only you had plead guilty!  We can manage the guilty - it is 
the innocent who escape us, who cause nothing but anarchy" -- 
 Jean Cocteau's _Bacchus_


------------------------------

Date: 20 Oct 1997 19:40:11 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: How do I collect email address using perl?
Message-Id: <eli$9710201501@qz.little-neck.ny.us>

In article <62al8m$7pv@news.jhu.edu>, guess <56160@udel.edu> wrote:
> This is for a school project.
> Your help is greatly appreciated.

Well, I seem to recall a 128 byte limit from one of the RFCs, this
makes it doable, if tricky.

Something like

foreach ( ord(" ")..ord("~") ) { push @print,chr($_) }
for ( $i = 1; $i < 126; $i++ ) {
 $address = "";
 for ( $j = 0; $j < $i; $j++ ) { # Build local part
  foreach $char ( @print ) {
   $address .= $char;
  }
 }
 $address .= '@';
 for ( $j = 0; $j < $i; $j++ ) { # Build host part
  foreach $char ( @print ) {
   $address .= $char;
  }
 }
 print "Address: $address\n";
}

Except that you need to take some special effort to escape the special
characters in the local part, and the host part should probably be
limited to valid hostnames rather than valid host part strings.

You should begin by reading the BNF for generating addresses in RFC 822.

Elijah
------
HTH. HAND.



------------------------------

Date: Mon, 20 Oct 1997 11:48:26 -0700
From: "Josh Baudhuin" <joshb@kadence.kom>
Subject: Re: How do I match the first word in a string?
Message-Id: <62g91l$b7u$1@news.cadence.com>

You're confusing the search pattern with the entire string.
Just do:
($foo) = ($foo =~ /^(\w+)/);
or
$foo =~ s/^(\w+).*/\1/;

Brian Kendig wrote in message ...
>This should be simple, but it's got me stumped.  I'm trying to assign
>the first word of a string to a variable, but it's not working.  This code:
>
>  $foo = "Hi There";
>  ($foo) =~ /^(\w+)/;
>  print "$foo\n";
>
>outputs "Hi There" instead of "Hi".  I've also tried these, individually:
>
>  $foo =~ /^(\w+)/;
>  ($foo) =~ /^([^ ]+)/;
>  $foo ~= s/^(\w+)/\1/;
>
>But, no luck with any of them; $foo remains unchanged.  What am I doing
>wrong?
>
>--
>_/_/_/   Be insatiably curious.                 Je ne suis fait comme aucun
>/_/_/    Ask "why" a lot.                de ceux que j'ai vus; j'ose croire
>_/_/                           n'etre fait comme aucun de ceux qui
existent.
>  /    Brian Kendig         Si je ne vaux pas mieux, au moins je suis
autre.
> /    bskendig@netcom.com                                       -- Rousseau
>     http://people.netscape.com/brian/




------------------------------

Date: Mon, 20 Oct 1997 19:06:52 GMT
From: akaleem@ibm.net
Subject: How to process signals with a daemon?
Message-Id: <344bab7a.2094721@news-s01.ny.us.ibm.net>

Hello:

I am looking for some help in debugging a daemon using perl 5. Once
the daemon is running it is NOT processing signal like USR1...

I have code that makes the program a daemon and then I am executing my

own function once I get a system signal.  The system signals function 
works fine as long as I run it separately with making it a daemon.

Any help is greatly appreciated.

Thanks in advance.


------------------------------

Date: 20 Oct 1997 19:24:20 GMT
From: Joshua Pritikin <pritikin@mindspring.com>
Subject: ObjStore 1.17
Message-Id: <62gb54$fja$1@news1.teleport.com>

Name           DSLI  Description                                  Info
-----------    ----  -------------------------------------------- -----
ObjStore       Rm+O  ObjectStore OODBMS Interface                 JPRIT

Interface to ObjectStore OODBMS (http://www.odi.com).  Stores perl
data directly in the database without flattening of either nested or
cyclic structures.  ** Includes INTERACTIVE PERL SHELL for examining and
editing arbitrary databases. **  Virtual memory mechanism is used to
make
access nearly as fast as memory mapped files.

Available via http://www.perl.com/CPAN/modules/by-module/ObjStore

           << This is the relational database killer app! >>


Perl-ObjectStore mailing list:

majordomo@parallax.co.uk   "subscribe perl-objectstore
you@your.company.com"


see ./INSTALL for installation instructions
see ./UPGRADE for directions on evolving databases from prior releases
see ./TODO for list of things to do
see ./CHANGES for perspective


### RECENT CHANGES ###


** 10-10-97 Released 1.17

- PERL / OBJECTSTORE SHELL !!

- First-class cursors for all persistent types.

- osp_copy script to copy databases.  Source code included.

- Support for cross database references.

- Simplified API for 'open'.

- Sets depreciated.  The interface is there, but they are
re-implemented with hashes.




------------------------------

Date: Mon, 20 Oct 1997 18:49:27 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Undef in my list -- syntax suggestion
Message-Id: <EID5MG.D69@world.std.com>

adelton@fi.muni.cz (Honza Pazdziora) writes:

>I wonder if anyone else also thinks that allowing undef in my
>definition would be nice to have. I do parsing of binary data and
>quite often I would need something like

>my ($a, undef, $b) = unpack "CCC", "ABC";

You can say:

my ($a, $b);
($a, undef, $b) = unpack "CCC", "ABC";

The problem is that you can't declare the built in function "undef" as
being a lexical variable.

In the general case (of selecting certain items out of a list being
returned from a function or subroutine) I feel is a cleaner way is to
take a slice of the list being returned from unpack.

my ($a, $b) = (unpack "CCC", "ABC")[0,2];

That way, you show that you aren only using certain element out of the
list. (Instead of implying that you are taking all of them and then
throwing away the ones you don't want.

or in this specific case (of selecting certain bytes out of unpack)
you might want to take a look at the "x" template format character.

my ($a, $b) = (unpack "CxC", "ABC");

(Hey Doug, I got it right this time.)


-- 
Andrew Langmead


------------------------------

Date: Mon, 20 Oct 1997 18:53:33 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: What's wrong with my script ????
Message-Id: <344ca739.2173437@news.wwa.com>

On Mon, 20 Oct 1997 07:56:21 GMT, bslee@pl.jaring.my (B.S.LEE) wrote:

>I have written a perl cgi script and I try to test it on my server but
>it can't run. I really can't figure out what's wrong with my script. I
>keep getting the error message as below:-

Besides the already mentioned errors, the FAQ would tell you that
other problems with your script are that you didn't "use strict;" or
run perl -w (or at least you didn't show us that you did).  Also, you
attempt to reinvent the wheel instead of using a module like CGI.pm
for parsing the form data.  I would add that any CGI script worth
writing is worth writing to run with taint checking enabled.


Streben nach Wahrheit

Faust Gertz
Philosopher at Large


------------------------------

Date: 20 Oct 1997 19:16:18 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: Why this behaviour with complex data structure?
Message-Id: <toutatis-ya023180002010972116100001@news.euro.net>

Robert Telka <telka@nortel.ca> wrote:

> However, upon examining the hash, for every addition to the hash,
> I find that 2 keys are added!
>  - one key is the department, having value reference to array
>  - second key is the reference of the array, value ???
> 
> Take a peek at the snipet and output included below.

[...]
>   foreach $key (%hash)
>   { print "Key: $key\n\tValue: @{$hash{$key}}\n\n";

Make that foreach $key (keys %hash) ...
                        ^^^^

-- 
Toutatis


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 1201
**************************************

home help back first fref pref prev next nref lref last post