[8224] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1842 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 9 22:15:40 1998

Date: Mon, 9 Feb 98 19:00:23 -0800
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, 9 Feb 1998     Volume: 8 Number: 1842

Today's topics:
        Best way to test for binary data? jase@cadence.com
    Re: ca anybody explai me this from the perl faq? (Andrew M. Langmead)
    Re: creating new file with perl (David Efflandt)
    Re: Fork/Threads (Andrew M. Langmead)
    Re: getting rid of duplicate lines in a file (Andrew M. Langmead)
    Re: Good perl editor? (Dustin Mollo)
    Re: Happy with Perl? (I R A Aggie)
    Re: How to get a listing of the file that is linked? <tchrist@mox.perl.com>
    Re: MacPerl_not_even_newbie (Paul J. Schinder)
        Multithreaded server and communicating object processes (Jeeves)
    Re: Named Pipe problem (David Efflandt)
        Problems installing DBI on Win 95 (Scott D. Gregory)
    Re: quick .signature  hack <jefpin@bergen.org>
        reading in a file to an associative array <charlesb@ccmail.orst.edu>
    Re: returning the date <rra@stanford.edu>
    Re: returning the date (Clay Irving)
    Re: returning the date (Clay Irving)
    Re: RFC about ``Matt's Script Archive'' <friedman@uci.edu>
    Re: sorting hash by numeric values <jefpin@bergen.org>
        Yet Another Sorting Question(TM) <dfetter@shell4.ba.best.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 09 Feb 1998 19:01:06 -0600
From: jase@cadence.com
Subject: Best way to test for binary data?
Message-Id: <887071871.345440265@dejanews.com>

I've got a Perl script that reads incoming mail (and stuffs it into
a database). Today it encountered something strange: one particular
mail message began with the normal ASCII text, and then included a
bunch of raw binary data. (The sender had evidently inserted a binary
file into the message, perhaps on Unix with "cat" or redirection.)

As my script is reading each line of the message, what's the best
way it can determine that the data is raw binary? At first I thought
I could use "tr" to check and strip the 8th bit -- if it did so, I'd
be able to set a flag to note the binary data. But I don't think this
will work quite the way I want it to -- valid accented characters and
such might be in the message, and I don't want them to trigger the
binary data flag.

So right now, I'm just checking for the presence of a NULL character
(000 in octal). If found, I assume it's binary data. There's certainly
better ways to do this, so please let me know..! :-)

Thanks,

jase@cadence.com

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Tue, 10 Feb 1998 02:49:51 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: ca anybody explai me this from the perl faq?
Message-Id: <Eo56J3.2Hy@world.std.com>

Jahnel Klaus <jahnel@xarch.tu-graz.ac.at> writes:

One thing that can be incredibly eduacational is to run examples like
these in the debugger, then poke around and see the results.

>#    @blues = qw/azure cerulean teal turquoise lapis-lazuli/;

Take the array called "blues" and fill it with names of five different
shades of blue.

>#    undef %is_blue;

Make sure that the hash "is_blue" does not contain any elements.

>#   for (@blues) { $is_blue{$_} = 1 }

For each element in the "blues" (which we set to five different shades
of blue.) set and element in the "is_blue" hash that has the name of
the shade of blue as the key, and the value is one. (And since it is
not 0, "", or undef, will be a boolean true value if used in a boolean
context.)

-- 
Andrew Langmead


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

Date: Tue, 10 Feb 1998 01:20:56 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: creating new file with perl
Message-Id: <34e4ab20.8293201@flood.xnet.com>

steve@clara.net (Steve Rawlinson) wrote:

>>I've been using
>>    system "touch emailaddress.com";
>>
>>but this only works if I run the script inside the server, after I've
>>telneted...  It doesn't work when I run the script from the browser.
>
>Its probably a path or permission problem or both but you might want
>to try using 
>
>open(Out, ">>filename") ; 
>close Out ;
>
>instead since this is what touch does anyway. Remember the web daemon
>user will need write permission in the directory you're creating these
>files in.

You also need execute permission on a dir to create new files.  Not
sure why, but it doesn't work without it.

>steve


David Efflandt/Elgin, IL USA
efflandt@xnet.com    http://www.xnet.com/~efflandt/


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

Date: Tue, 10 Feb 1998 02:44:27 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Fork/Threads
Message-Id: <Eo56A3.M7M@world.std.com>

patrick@cre8tivegroup.com writes:

>This is the basic flow....

>open a log file.
>print an intro message to the log file.
>concurrently examine all sites, writing results to the log file.
>print concluding message to log file.
>close log file.

>I've tried fork() from the Camel book, but it forks the entire script, and not
>just the code I want it to (I get the intro message multiple times). I know
>threads are going to be part of 5.005,  but I want to "fake" implementation
>now.

I don't quite know what is wrong, (since there is no code to check.)
but here are some ideas.

1. Do you print the "intro" before forking the children?

2. Do you remember to "exit" when the child is done, so it doesn't
return and start executing the code you intend for the parent. (This
mistake can often manifest itself in a "sorcerers apprentice" type of
action where your children start forking off grandchildren which fork
of greatgrandchildren and so on.)

3. It is sometimes easiest if you have the parent open a pipe to the
children and have the children output their results back to the
parent. (which then select() on alll the children' s filehandles and
reads whichever one is ready.) This avoids file buffering and
concurrency issues.
-- 
Andrew Langmead


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

Date: Tue, 10 Feb 1998 02:28:00 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: getting rid of duplicate lines in a file
Message-Id: <Eo55Iq.EMG@world.std.com>

Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at> writes:

>Re: getting rid of duplicate lines in a file, Tim
><tim@hcirisc.cs.binghamton.edu> said:

>Tim> How would you go about getting a perl script to remove
>Tim> all duplicate lines in a file?  I basically want to do
>Tim> the equivalent of `cat filename | uniq > filename` but

>If you find yourself thinking about duplicates and
>uniqueness, then you'll want to use a hash to see if
>something has already been processed.

A hash does not do the same thing as the unix command "uniq" on
unsorted input. The "uniq" command only removes consecutive
duplicates.

The FAQ suggests a method that does mimic unique. 
<URL:http://www.perl.com/CPAN/doc/manual/html/pod/perlfaq4/
How_can_I_extract_just_the_uniqu.html>
-- 
Andrew Langmead


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

Date: 10 Feb 1998 01:17:32 GMT
From: dustin@sonic.net (Dustin Mollo)
Subject: Re: Good perl editor?
Message-Id: <6bo9rc$qr$1@ultra.sonic.net>

Don O'Neil (don@whtech.com) wrote:
: Does anyone know of a good windows or unix (X-Windows) based perl editor w/
: context sensitive coloring, auto indent, etc...??? I've tried Win Edit, but
: it does not have built in Perl syntax, I could add it, but that's a pain.
: I'm looking for something along the order of the editors that come w/ MS C
: and Borland C.

Have you looked at http://reference.perl.com yet???  Click the editors
section.

-Dustin


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

Date: Mon, 09 Feb 1998 20:35:56 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Happy with Perl?
Message-Id: <fl_aggie-0902982035560001@aggie.coaps.fsu.edu>

In article <6bnbrg$iec$1@blinx.lizard.org>, markl@blinx.lizard.org (Mark
Lewis) wrote:

+ is perl stable?  would it be a good idea to risk millions of pounds on
+ something that is unsupported?  what do you think?

You're talking about translating shell scripts to perl, and worrying
about the level of support? why, pray-tell, do you believe your shell
to be supported???

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: 10 Feb 1998 02:29:02 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to get a listing of the file that is linked?
Message-Id: <6boe1e$b8u$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, mgjv@comdyn.com.au (Martien Verbruggen) writes:
:I think he actually was looking for a way to get the timestamp of the
:file that the symlink was linked to.

:Short of figuring out what the link is referring to, and doing a stat
:on that file, I don't think you can do much. As far as I know, there's
:no way of doing it directly. But then, I might be wrong.

stat() goes through the link, lstat() doesn't.  So just stat() it.
It doesn't matter that it's a link.

I already posted my old flinx program.  Here's are a couple
other old programs that demo playing with inode info.

--tom

#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1998-02-09 19:26 MST by <tchrist@jhereg.perl.com>.
# Source directory was `/home/tchrist/scripts'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
# This format requires very little intelligence at unshar time.
# "if test", "echo", "mkdir", and "sed" may be needed.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#   1718 -rwxr-xr-x lst
#   6833 -rwxr-xr-x stat
#
echo=echo
if mkdir _sh16838; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= lst ==============
if test -f 'lst' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'lst' '(file already exists)'
else
  $echo 'x -' extracting 'lst' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'lst' &&
X#!/usr/bin/perl 
X
Xrequire 'find.pl';
Xrequire 'ctime.pl';
Xrequire 'getopts.pl';
Xrequire 'stat.pl';
X
X&Getopts('lusrcmi') || die <<DEATH;
XUsage: lst [-lmucsr] [dirs ...]
X
XOutput format:
X    -l	long listing
X
XSort on:
X    -m	use mtime (modify time) [DEFAULT]
X    -u	use atime (access time)
X    -c	use ctime (inode change time)
X    -s	use size for sorting
X
XOrdering:
X    -r	reverse sort
X
X    NB: You may only use select one sorting option at a time.
XDEATH
X    
X
Xunless ($opt_i || @ARGV) { @ARGV = ('.'); } 
X
Xif ($opt_c + $opt_u + $opt_s + $opt_m > 1) {
X    die "can only sort on one time or size";
X} 
X
X$IDX = $ST_MTIME; 	
X$IDX = $ST_ATIME if $opt_u; 
X$IDX = $ST_CTIME if $opt_c; 	
X$IDX = $ST_SIZE  if $opt_s; 	
X
X$TIME_IDX = $opt_s ? $ST_MTIME : $IDX;
X
Xif ($opt_i) {
X     *name = *_;  # $name is now an alias for $_
X     while (<>) { chop; &wanted; } 
X}  else {
X    &find(@ARGV);
X}
X
X@skeys = sort { $time{$b} <=> $time{$a} } keys %time;
X@skeys = reverse @skeys if $opt_r;
X
Xfor (@skeys) {
X    if ($opt_l) {
X	@stats = split(' ',$stat{$_});
X	chop($now = &ctime($stats[$TIME_IDX]));
X	printf "%6d %04o %6d %8s %8s %8d %s %s\n",
X		$stats[$ST_INO],
X		$stats[$ST_MODE] & 07777,
X		$stats[$ST_NLINK],
X		&user($stats[$ST_UID]),
X		&group($stats[$ST_GID]),
X		$stats[$ST_SIZE],
X		$now,
X		$_;
X    } else {
X	print "$_\n";
X    }
X} 
X
Xsub wanted {
X    @stats = stat($_);
X    -f _ || return;
X    $time{$name} = $stats[$IDX];
X    $stat{$name} = "@stats";
X} 
X
Xsub user {
X    local($uid)= shift;
X    $user{$uid} = (getpwuid($uid))[0] || "#$uid" 
X	unless defined $user{$uid};
X    return $user{$uid};
X} 
X
Xsub group {
X    local($gid)= shift;
X    $group{$gid} = (getgrgid($gid))[0] || "#$gid" 
X	unless defined $group{$gid};
X    return $group{$gid};
X} 
SHAR_EOF
  : || $echo 'restore of' 'lst' 'failed'
fi
# ============= stat ==============
if test -f 'stat' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'stat' '(file already exists)'
else
  $echo 'x -' extracting 'stat' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'stat' &&
X#!/usr/bin/perl
X#
X# Last edited: Mon Oct  5 11:48:02 1992 by Tim Wilson
X# $Id: stat,v 1.1 1992/10/05 10:53:13 tdw Exp $
X#
X# Stat(2) files and print results.
X#
X# Usage: stat [-?] [-l] [-n] [-h] [--] files...
X#
X#  -l: use lstat(2) instead of stat(2)
X#  -n: print output in numeric format (instead of readable format)
X#  -h: if in numeric format, also print header line
X#  -?: print help message
X#  --: remaining arguments are file names
X#
X######################################################################
X#
X# Copyright (C) 1992 T D Wilson.  All rights reserved.
X#
X# Permission to copy without fee all or part of this material is
X# granted provided that the copies are not made or distributed for
X# direct commercial advantage, the copyright notice and the title and
X# date appear, and notice is given that copying is by permission of
X# the author.  To copy otherwise, or to republish, requires specific
X# permission.
X#
X# T D Wilson makes no representations about the suitability of this
X# software for any purpose.  It is provided "as is" without express or
X# implied warranty.
X#
X######################################################################
X#
X# Modification summary:
X#   5 Oct 1992	Tim Wilson	Altered comments; posted to
X#				alt.sources.  Revision 1.1.
X#  11 Jul 1991	Tim Wilson	Created.
X#
X# Tim Wilson, University of Cambridge Computer Laboratory, UK.
X# tdw@cl.cam.ac.uk
X#
X
Xsub usage {
X	die "Usage: $progname [-l] [-n] [-h] [--] files...\n";
X}
X
Xsub Lstat {
X    ($st_dev,$st_ino,$st_mode,$st_nlink,$st_uid,$st_gid,$st_rdev,$st_size,
X	$st_atime,$st_mtime,$st_ctime,$st_blksize,$st_blocks) = lstat(shift(@_));
X}
X
Xrequire "stat.pl";
Xrequire "ctime.pl";
X
X######################################################################
X#
X# p_perm -- Return part permissions symbolically
X#
X#  perm:	Permissions.  Only the low three bits are significant
X#  extra:	Extra bit to be encoded with execute (suid, sgid, sticky)
X#  c:		Character to be used instead of `x' (`s' or `t')
X#
X# Returns -- three character string
X#
X# Side effects -- Output
X#
X######################################################################
X
Xsub p_perm {
X	local ($perm,$extra,$c) = @_;
X	local ($lower,$upper) = ($c, $c);
X	local ($result);
X	$lower =~ tr/ST/st/; # Guaranteed lower case `s' or `t'
X	$upper =~ tr/st/ST/; # Guaranteed upper case `S' or `T'
X
X	$result = ($perm & 04) ? "r" : "-";
X	$result .= ($perm & 02) ? "w" : "-";
X	# Want 2D array; do index arithmetic ourselves
X	$result .= ("-", "x", $upper, $lower)[!!$extra * 2 + ($perm & 01)];
X}
X
X
X######################################################################
X#
X# p_mode -- Return symbolic $st_mode (and/or memorized stat structure)
X#
X#  Arguments are global variables.  Ahem!
X#
X# Returns -- ten character string
X#
X# Side effects -- Output
X#
X######################################################################
X
Xsub p_mode {
X	local ($result);
X	# First letter according to type of file
X	TYPE: {
X		-p _ && do {$result = "p"; last TYPE;};
X		-c _ && do {$result = "c"; last TYPE;};
X		-d _ && do {$result = "d"; last TYPE;};
X		-b _ && do {$result = "b"; last TYPE;};
X		-l $file && do {$result = "l"; last TYPE;};# lstat problems
X		-f _ && do {$result = "-"; last TYPE;};
X		-S _ && do {$result = "s"; last TYPE;};
X		warn ("unknown type of file, mode %#o\n", $st_mode);
X		$result = "?";
X	}
X
X	$result .= &p_perm ($st_mode >> 6, -u _, "s");	# User
X	$result .= &p_perm ($st_mode >> 3, -g _, "s");	# Group
X	$result .= &p_perm ($st_mode >> 0, -k _, "t");	# Others
X}
X
X
X######################################################################
X#
X# uid, gid -- Convert numeric uid, gid to symbolic
X#
X#  arg:		numeric id
X#
X# Returns -- Name associated with id if found, else number
X#
X# Side effects -- Accesses /etc/passwd or replacement
X#
X######################################################################
X
Xsub uid {
X	local ($uid) = @_;
X	$uid{$uid} = getpwuid($uid)
X	    unless defined $uid{$uid};
X	$uid{$uid} = "#$uid" 
X	    unless defined $uid{$uid};
X	$uid{$uid};
X}
X
Xsub gid {
X	local ($gid) = @_;
X	$gid{$gid} = getgrgid($gid)
X	    unless defined $gid{$gid};
X	$gid{$gid} = "#$gid" 
X	    unless defined $gid{$gid};
X	$gid{$gid};
X}
X
X
X######################################################################
X#
X# verbstat -- Print $st_* variable (and/or remembered stat structure)
X#             in multiline verbose format
X#
X#  Arguments are global variables.  Ahem!
X#
X# Returns -- nothing
X#
X# Side effects -- Output
X#
X######################################################################
X
Xsub verbstat {
X	local ($atime, $mtime, $ctime) 
X		= (&ctime ($st_atime), &ctime ($st_mtime), &ctime ($st_ctime));
X	local ($mode) = &p_mode;
X
X	printf ("%s\n", $file);
X	printf ("\tdevice\t\t%#x\n", $st_dev);
X	printf ("\tinode\t\t%d\t\t%#x\n", $st_ino, $st_ino);
X	printf ("\tmode\t\t%s\t%#o\n", &p_mode, $st_mode);
X	printf ("\tnlink\t\t%d\n", $st_nlink);
X	printf ("\towner\t\t%s\n", &uid ($st_uid));
X	printf ("\tgroup\t\t%s\n", &gid ($st_gid));
X	printf ("\trdev\t\t%d\n", $st_rdev);
X	printf ("\tsize\t\t%d\n", $st_size);
X	chop ($atime);
X	chop ($mtime);
X	chop ($ctime);
X	printf ("\tatime\t\t%d %s\n\tmtime\t\t%d %s\n\tctime\t\t%d %s\n",
X		$st_atime, $atime, $st_mtime, $mtime, $st_ctime, $ctime);
X	printf ("\tblksize\t\t%d\n", $st_blksize);
X	printf ("\tblocks\t\t%d\n", $st_blocks);
X}
X
X
X######################################################################
X# Main program
X######################################################################
X
X$_ = $0;
X$progname = m|.*/([^/]+)| ? $1 : $_;
X
X
X$opt_lstat = 0;				# If true use lstat not stat
X$opt_header = 0;			# Add header line
X$opt_numeric = 0;			# One-line numeric format
X
X# No switch clustering with this simple parser
X
XSWITCH:
Xwhile ($_ = shift) {
X	/^-\?/ && &usage;			# stat -? ... gives usage
X	/^--$/ && last SWITCH;			# -- terminates switches
X	/^-l$/ && ($opt_lstat = 1, next SWITCH);
X	/^-h$/ && ($opt_header = 1, next SWITCH);
X	/^-n$/ && ($opt_numeric = 1, next SWITCH);
X
X	unshift (ARGV, $_);		# We are looking at the first file
X	last SWITCH;
X}
X
X($#ARGV < $[) && &usage;		# Must have at least one arg
X
X
X# Print out header if requested and numeric format
X
X$opt_numeric && $opt_header && print "dev ino mode nlink uid gid rdev size atime mtime ctime blksize blocks\n";
X
X
X# Stat remaining args and print result
X
Xforeach $file (@ARGV) {
X	if ($opt_lstat) {
X		&Lstat ($file);
X	} else {
X		&Stat ($file);
X	}
X
X	if (defined ($st_dev)) {
X		if ($opt_numeric) {
X			#       fn  dev ino md  nl ud gd rdv siz atm mtm ctm bks nbk
X			printf "%s %#x %#x %#o %d %d %d %#x %ld %ld %ld %ld %d %d\n",
X			$file,
X			$st_dev, $st_ino, $st_mode, $st_nlink, 
X			$st_uid, $st_gid,
X			$st_rdev, $st_size, 
X			$st_atime, $st_mtime, $st_ctime,
X			$st_blksize, $st_blocks;
X		} else {
X			&verbstat;
X		}
X	} else {
X		warn "$0: can't ", 
X		$opt_lstat ? "lstat" : "stat",
X		" $file: $!\n";
X	}
X}
X
X# End of stat
SHAR_EOF
  : || $echo 'restore of' 'stat' 'failed'
fi
rm -fr _sh16838
exit 0
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


	    "Perl is to sed as C is to assembly language."  -me


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

Date: Mon, 09 Feb 1998 20:13:53 -0500
From: schinder@leprss.gsfc.nasa.gov (Paul J. Schinder)
Subject: Re: MacPerl_not_even_newbie
Message-Id: <schinder-0902982013540001@schinder.clark.net>

In article <34DF3F95.3F87@schwaben.de>, Joergen.Lang@schwaben.de wrote:

}  This address might do some good...
}  
}  http://www.sasknet.com/~dalgl/MacPerlFAQ.html

Actually, that's an old and broken URL.  A working URL is:
<http://www.connection.co.uk/bob/perl/MacPerlFAQ.html>.

See also
<http://www.unimelb.edu.au/%7Essilcot/macperl-primer/home.html>
<http://www.ptf.com/macperl/ptf_book/>

and, of course, the one that anyone that's actually used MacPerl should
have already found by pulling down the Help menu:

<http://www.iis.ee.ethz.ch/~neeri/macintosh/perl.html>

}  
}  Good luck, 
}  
}  Joergen 
}  (also on a Mac - They're still alive ;-) )

-- 
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@leprss.gsfc.nasa.gov


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

Date: 10 Feb 1998 02:34:21 GMT
From: darlenem@PAS.DE.SPAM.flash.net (Jeeves)
Subject: Multithreaded server and communicating object processes...
Message-Id: <slrn6dvgel.4pu.darlenem@jeeves.flash.net>

I'm working on a medium-sized project that involves a multithreaded TCP server
whose client processes need to be able to communicate with each other. I'm
fairly new to UNIX and I know virtually nothing about IPC. The Camel Book
includes an example of a multithreaded TCP server (p 350) that I have used as a
starting point. What I need is each instance of a certain class to have its own
STDOUT and STDIN, which are redirected to sockets. I have no idea how to go
about doing this, but after many readings of Chapter 6, I wrote this in
the class's source file (irrelevant code omitted):

package Person;

my %fields = (
	HANDLE => undef,
);

# expects to receive a filehandle reference (returned from an accept()
# call in the server code) as a parameter

sub new {
	my $nym = shift;
	my $handle = shift;
	my $class = ref($nym) || $nym;
	my $self = { %fields, };
	open (STDIN, "<&$handle") or client_dies(); # probably wrong
	open (STDOUT,">&$handle") or client_dies(); # probably wrong
	...
	bless $self, $class;
	return $self;
}

As is probably obvious, I don't really know what I'm doing, except that I saw
something similar being used in a C server. The Person class is the only use of
OOP in the entire project (probably) and is unlikely to ever have any derived
classes or need inheritance. Perhaps a more knowledgable programmer could help
me out. One instance of Person needs to be able to call a subroutine (based on
some iput from its socket) which in turn sends some output to a different
instance.

Thanks,

Jeeves (darlenem@spamless.flash.net) 

-- 
---------------------------------------------------------------------
     J |  Copyright (c) 1997 Jeeves Industries Limited.
     J |  All rights reserved. Void where prohibited.
     J |  Some restrictions may apply. Limit 1 per customer.
 J   J |  Offer not valid in conjunction with any other offer.
  JJJ  |  Some sold separately. Not intended for children under 3.
---------------------------------------------------------------------
>From .cshrc:
alias rm 'rm -rf \!*'
alias hose kill -9 '`ps -augxww | grep \!* | awk \'{print $2}\'`'
alias kill 'kill -9 \!* ; kill -9 \!* ; kill -9 \!*'
alias renice 'echo Renice\?  You must mean kill -9.; kill -9 \!*'
=====================================================================


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

Date: Tue, 10 Feb 1998 01:14:45 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Named Pipe problem
Message-Id: <34e3a639.7037443@flood.xnet.com>

"Carl K. Cunningham" <ccu@sbk-ks.de> wrote:

>Hi folks, I'm having a bit of a problem with a named pipe, and could use
>some help. I have an itty-bitty perl program that will for example write
>sequential numbers into an existing named pipe:
>
>#---------------------------------------------
>#! /usr/bin/perl
>$Pipefile = "testfifo.txt" ;
>$a = 1 ;
>for (;;) {
>        open(TEST,$Pipefile) || die ;
>        select(TEST) ;
>        print(TEST $a,"\n") ;
>        close(TEST) ;
>        $a++ ;
>}   
>#---------------------------------------------

This does the same:

#! /usr/bin/perl
$Pipefile = "testfifo.txt" ;
$a = 1 ;
for (;;) {
        open(TEST,$Pipefile) || die;
        print TEST $a++,"\n";
        close TEST;
}   


>If I fire this up and acces the named pipe just using "cat", everything
>works dandy.
>
>If however I access it using something like:
>
>#---------------------------------------------
>#! /usr/bin/perl
>$Pipefile = "testfifo.txt" ;
> open(TEST,$Pipefile) || die ;
>
>while (<TEST>) {
>	print(STDOUT $_) ;
>	}
>   
>#---------------------------------------------

A shorter way to print all lines in file:

#! /usr/bin/perl
$Pipefile = "testfifo.txt" ;
open(TEST,$Pipefile) || die ;
print <TEST>;
close TEST;

>I get at time very unreliable results. In particular if I access the named
>pipe using a web server, I sometimes get a runaway process that keeps on
>writing to the pipe.

This could hang if you are trying to run them both at the same time
since the file could vaporize while reading it.  See file locking
(flock).


David Efflandt/Elgin, IL USA
efflandt@xnet.com    http://www.xnet.com/~efflandt/


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

Date: Tue, 10 Feb 1998 01:52:00 GMT
From: sgregory@crosslink.net (Scott D. Gregory)
Subject: Problems installing DBI on Win 95
Message-Id: <34dfae64.8976066@news.crosslink.net>


I am having the following problem installing DBI under Win 95.  I have
a Win 95 system, 32 megs RAM, P133.  I installed the
perl5.00402-bindist04-bc.zip distribution (can't remember where I got
it).  As far as I can tell it works fine.  I have installed this
distribution on Win NT 4 (including the DBI and DBD ODBC) without any
problems.   I am compiling with MS Visual C++ 5.0.

Below are the errors I am getting.  The first is the error when I run
"perl makefile.pl" and the second is when I run "nmake".

Any information on how to get this installed would be most helpful.

Thanks in advance,

Scott

********* "perl makefile.pl" error ***********************
MakeMaker (v5.42)
        NAME => q[DBI]
        PREREQ_PM => {  }
        VERSION_FROM => q[DBI.pm]
        clean => { FILES=>q[$(DISTVNAME)/] }
        dist => { DIST_DEFAULT=>q[clean distcheck disttest ci
tardist], COMPRESS
=>q[gzip -v9], SUFFIX=>q[gz], PREOP=>q[$(MAKE) -f Makefile.old
distdir] }
Using PERL=C:\PERL\BIN\perl

Warning: By default new modules are installed into your 'site_lib'
directories. Since site_lib directories come after the normal library
directories you must delete old DBI files and directories from your
'privlib' and 'archlib' directories and their auto subdirectories.
If you don't have an old version of the DBI installed you can ignore
this.
FIND: Parameter format not correct
Bad command or file name

Usage: xsubpp [-v] [-C++] [-except] [-prototypes] [-noversioncheck]
[-nolinenumb
ers] [-s pattern] [-typemap typemap]... file.xs
Writing Makefile for DBI


************** "nmake" error ***********************
Microsoft (R) Program Maintenance Utility   Version 1.62.7022
Copyright (C) Microsoft Corp 1988-1997. All rights reserved.

        C:\PERL\BIN\perl -Ic:\perl\lib -Ic:\perl\lib
C:\perl\lib\ExtUtils/xsubpp
  -typemap C:\perl\lib\ExtUtils\typemap DBI.xs >DBI.tc &&
C:\PERL\BIN\perl -Ic:\
perl\lib -Ic:\perl\lib -MExtUtils::Command -e mv DBI.tc DBI.c
Usage: xsubpp [-v] [-C++] [-except] [-prototypes] [-noversioncheck]
[-nolinenumb
ers] [-s pattern] [-typemap typemap]... file.xs
NMAKE : fatal error U1077: 'C:\PERL\BIN\perl.exe' : return code '0x2'
Stop.
	



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

Date: Sat, 7 Feb 1998 13:53:26 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: Mark Crane <mecran01@homer.louisville.edu>
Subject: Re: quick .signature  hack
Message-Id: <Pine.SGI.3.95.980207135233.17465C-100000@vangogh.bergen.org>

>In order to use multiple random sigs on Pine, I am trying to
>cobble a script together that will
>
>1. look at a file of quotes or sigs delimited by  multiple
>returns or some pre-chosen character string, like "$$$$"
>
>2. select a quote at random.
>
>3. write it to the file ".sig" 

I have the script you want, more or less.  It runs as an "Outgoing filter"
in Pine.  Email me and I'll send it to you.

--
| This is Tea Room England, they'll kick your face in so politely.
|                                                   - Chumbawamba

    Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
             techmaster@bergen.org | techmaster@mindless.com
        techie@continuum.eu.org | jpinyan at #perl on irc.ais.net

 &jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}



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

Date: Mon, 09 Feb 1998 17:11:45 -0800
From: Brian Charles <charlesb@ccmail.orst.edu>
Subject: reading in a file to an associative array
Message-Id: <34DFA950.4D8AF6A7@ccmail.orst.edu>

Hi,
    I have a file with name and email separated by  a '|'
I want to use a while loop to read it in as an associative array, the
name being the key and email the value. How do I do that? I'm used to
just scalar variables.
Brian




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

Date: 09 Feb 1998 16:55:43 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: returning the date
Message-Id: <m3zpk0b7n4.fsf@windlord.Stanford.EDU>

Tom Christiansen <tchrist@mox.perl.com> writes:
> In comp.lang.perl.misc, Wolfgang Denk <wd@denx.muc.de> writes:

>> How about 1998-04-23 then? At least this can be easily used to sort the
>> names in chronological order...

> The problem, my dear Wolfgang, is that some of us don't automatically
> intuit 1998-03-04 or 03-04-1998 to be in either March or April.

I can't say as I've ever met anyone who, when presented with YYYY-MM-DD,
interprets it as YYYY-DD-MM.  Is the latter used as a date format
*anywhere*?

(I personally prefer YYYY-MM-DD or YYYY.MM.DD myself simply because it
sorts right.)

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 9 Feb 1998 21:32:15 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: returning the date
Message-Id: <6boe7f$pft@panix.com>

In <34df356f.8488305@10.0.2.33> ron@farmworks.com (Ronald L. Parker) writes:

>On 9 Feb 1998 14:50:31 GMT, Tom Christiansen <tchrist@mox.perl.com>
>wrote:

>>I don't think you should use MM/DD/YYYY either.  Is that really MM/DD
>>or DD/MM?  ISO says DD/MM/YYYY, but as you see, that has the same problem.

>My understanding was that ISO is now squarely behind YYYY-MM-DD (or
>YYYYMMDD for those who need to save a couple of bytes), which has the
>advantages of not looking like anything we're used to (less chance for
>error) and of being sortable with a simple string comparison.

See:

  A Summary of the International Standard Date and Time Notation
  by Markus Kuhn 
  http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: 9 Feb 1998 21:36:06 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: returning the date
Message-Id: <6boeem$q0f@panix.com>

In <34DF4700.F4D3D0EE@us.oracle.com> Denis Goddard <dgoddard@us.oracle.com> writes:

>> My understanding was that ISO is now squarely behind YYYY-MM-DD

>... which, to me, seems "confusable" on the same logic that <tchrist>pointed
>out.

>A certain pretty big software company that I work with every day,
>(but my opinions aren't always theirs, I don't speak for them, etc),
>is squarely behind "-MON-" for the month part.

Heh. Number one advantage of YYYY-MM-DD in Markus Kuhn's "A Summary of the 
International Standard Date and Time Notation" is:

  Advantages of the ISO 8601 standard date notation compared to other 
  commonly used variants: 

  -  easily readable and writeable by software 
     (no 'JAN', 'FEB', ... table necessary) 

[...]

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: 10 Feb 1998 02:36:00 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: RFC about ``Matt's Script Archive''
Message-Id: <6boeeg$qoj@news.service.uci.edu>

[mailed, posted]

In article <6bndl9$3i0$1@csnews.cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:

<I have heard no end of criticisms about that set of programs.  I once
<looked at them myself and found them to be full of programming errors
<and undersights.  Could an expert perl programmer who has more recently
<examined them please comment on their robustness and style?

I was curious, so I took a look.  It's vintage perl4, in spite of the
last updated in May 1997 notice.  Global variables defined deep inside
of subroutines, no -w, and no 'use strict' of course.  local() abounds
in places where my() could have easily been substituted during that May
1997 update.  He doesn't check the return status on open()....

There's surely more, but why bother?

-- 
Eric D. Friedman
friedman@uci.edu


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

Date: Sat, 7 Feb 1998 18:35:58 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: Mick Farmer <mick@picus.dcs.bbk.ac.uk>
Subject: Re: sorting hash by numeric values
Message-Id: <Pine.SGI.3.95.980207183422.22392G-100000@vangogh.bergen.org>

>		push @out, printf "%6d%s", $count, $keyword;
Speaking of which... this line interests me...

Does push bind more tightly than printf?  As in, if you gave too many
arguments to printf, would they be used as elements to push() or just
discarded?  Just a thought...

--
| Here we are now, entertain us!
|                                                       - Nirvana

    Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
             techmaster@bergen.org | techmaster@mindless.com
        techie@continuum.eu.org | jpinyan at #perl on irc.ais.net

 &jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}



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

Date: 10 Feb 1998 02:24:08 GMT
From: David Fetter <dfetter@shell4.ba.best.com>
Subject: Yet Another Sorting Question(TM)
Message-Id: <6bodo8$f7l$1@nntp1.ba.best.com>

Kind people,

I was browsing through Effective Perl Programming today, having
searched through the Fine Manuals, the FAQ's and the Blue Camel Book,
and still, I am not finding how to do this trick in a simple,
consistent manner:

What I want to do a SQL-some maneuver like, given a 2-D rectangular
array (in general with empty spaces), sort by several fields, and
don't barf on emptiness.

Let's imagine, for a moment, that said array lives in a file that
looks like this:

field1:field2:field3:field4
a:foo:JAPH1:
b:bar::St. Paul
c::JAPH3:Ba'al-Zevuv
:baz:JAPH4:Larry Wall

The thing I'd like to do is:

select field1,field2,field3,field4
from table
order by field1, field2

Right now, I have a crude, inextensible hack that doesn't quite work
right--bombs when it runs across blanks in the key fields.

Which Fine Material should I be Reading to fix this?
-- 
            David Fetter         888 O'Farrell Street Apt E1205
   shackle@ren.glaci.com          San Francisco, CA 94109-7089 USA
  http://www.best.com/~dfetter     +1 415 567 2690 (voice)
print unpack ("u*",q+92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``+)

Christian Fundamentalism: The doctrine that there is an absolutely
powerful, infinitely knowledgeable, universe spanning entity that is
deeply and personally concerned about my sex life.


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

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 1842
**************************************

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