[11829] in Perl-Users-Digest
Perl-Users Digest, Issue: 5429 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 20 13:07:31 1999
Date: Tue, 20 Apr 99 10:00:20 -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 Tue, 20 Apr 1999 Volume: 8 Number: 5429
Today's topics:
2nd YAPC CFP: Cheap Perl Conf. in the Eastern US <lenzo@cs.cmu.edu>
Re: [Q] Please help with eval problem <ebohlman@netcom.com>
Re: accepting input with space seemas@my-dejanews.com
Re: Books <cmcurtin@interhack.net>
Re: CGI programmer wanted <cassell@mail.cor.epa.gov>
Re: CGI/Telnet?? <cassell@mail.cor.epa.gov>
DBD::Ingres <mccrebsi@ina.com>
Determining File system type for Find2Perl <sherwood@math.ualberta.ca>
Re: FAQ 3.26: Why don't perl one-liners work on my DOS/ <cassell@mail.cor.epa.gov>
Getting file creation date using perl <robert@chackmore.demon.co.uk>
Re: Getting file creation date using perl <tchrist@mox.perl.com>
Re: Help! CGI::Cookie script works fine, but problem wh <cassell@mail.cor.epa.gov>
Re: how old is perl 5 (M.J.T. Guy)
Re: Is it possible to have "..." appear while processin <wells@cedarnet.org>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 20 Apr 1999 11:24:34 -0400
From: "Kevin A. Lenzo" <lenzo@cs.cmu.edu>
To: groups@lists.panix.com
Subject: 2nd YAPC CFP: Cheap Perl Conf. in the Eastern US
Message-Id: <371C9C32.519D03A9@cs.cmu.edu>
************** 2nd CALL FOR PARTICIPATION *****************
Yet Another Perl Conference (YAPC) '99
http://www.cs.cmu.edu/~lenzo/yapc/
Thursday and Friday, June 24-25, 1999
at
Carnegie Mellon University
Pittsburgh, Pennsylvania
** Abstract submission deadline: May 1, 1999
** Registration deadline: May 15, 1999 (US$60)
Yet Another Perl Conference (YAPC) is an inexpensive ($60) perl
users and developers conference, with a mix of tutorials and
technical talks. The conference is set in Pittsburgh,
Pennsylvania, and so is relatively accessible from both the East
and the Midwest.
YAPC began as a grassroots users conference, from discussions
among Perl Mongers, and has grown from there. We would like
to invite you to join us for two days of Perl, people, and
demonstrations, at a price that shouldn't hurt your wallet.
A number of members of the Perl community are contributing to this
event, including:
* Larry Wall, on whatever he'd like to talk about :)
* Peter Braam, on The InterMezzo Distributed File System
* Mark-Jason Dominus, with a half-day Regex Tutorial and the
Perl Hardware Store
* Jonathan Eisenzopf, Demystifying XML
* Joseph Hall, on Idiomatic Perl and Object-Oriented Perl
* Chris Nandor, on MacPerl and the Elements of the Wild
* Randal Schwartz, giving a whole-day Llama course on learning
Perl, and Reducing Business Risk using Perl
* ... and YOU! See the CALL FOR PAPERS below!
Look to the main web page for more details --
http://www.cs.cmu.edu/~lenzo/yapc/
** Dorm rooms **
A limited number of inexpensive dorm rooms are available at
Carnegie Mellon, that will be given preferentially to students,
but more generally on a first-come basis. This is to further
reduce the cost for those with limited resources, especially
students, who we are trying to encourage the most.
You can ask to be considered for dorm space on the Registration
page, which is available from the main page at the top of this
announcement.
Registration information is available from the main page at
http://www.cs.cmu.edu/~lenzo/yapc/
*********** CALL FOR PAPERS ***********
Potential presenters should submit a 200-300 word abstract to
lenzo+abstract@cs.cmu.edu
in plain ASCII text or HTML by April 30th for consideration.
We would like that your materials be available online, but
it is not required. If you have materials to include in
the proceedings, or course notes, please let us know your
requirements the abstract. If you have any special presentation
needs, please include them also.
Topics are unlimited, but some suggestions include:
* Groupware, Agents, and Bots
* Perl for Speech and Language
* Text and Document Processing
* Machine Learning in Perl
* HTML, XML, and Markup Languages
* CGI and Web programming in Perl
* Internet Programming
* Database Interation and Access with Perl
* Scientific Computing (e.g. with PDL)
* Practical Perl Programming
* Module guts and usage on any particular Module.
* Tutorials of all stripes: Modules, Objects, CPAN
* Visionary or position papers on Perl, the past,
the present, and the future
* Anything cool :)
Conference fees will be waived for presenters at yapc, so
another way to reduce your costs is to give a good talk
on something you're excited about.
** YAPC '99 ** http://www.cs.cmu.edu/~lenzo/yapc/ ********
***************** CALL FOR PARTICIPATION ******************
------------------------------
Date: Tue, 20 Apr 1999 15:11:18 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: [Q] Please help with eval problem
Message-Id: <ebohlmanFAHu6u.38n@netcom.com>
Mark Newman <qa3653@email.mot.com> wrote:
: Just to clarify this a little bit (based on some email that I received):
: This (obviously) is a little snippet of test code. My main goal is to
: dynamically create the variable name (an array) in a loop, and then
: modify
: the contents of that loop. That is why I am using the eval command
: instead
: of a simple hash, or array.
: If I do this using separate arrays, it will result in approximately 50
: separate loops,
: all doing basically the same thing, just with different array names.
So don't do it using separate arrays. Do it using a hash of arrays.
------------------------------
Date: Tue, 20 Apr 1999 16:28:00 GMT
From: seemas@my-dejanews.com
Subject: Re: accepting input with space
Message-Id: <7fi9u8$vfp$1@nnrp1.dejanews.com>
Thanks for your reply,
in my application I can accept space in input if the whole thing is quoted:
e.g: "firstname lastname"
so basically, I want to accept
firstname lastname
as input and pass it on as
"firstname lastname"
How can I do that.
Seema
In article <i3egf7.n53.ln@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> seemas@my-dejanews.com wrote:
>
> : I'm a newbie to perl/cgi programming. How can I accept a firstname+lastname
> : set with a space in the middle and pass it on as one quoted value.
>
> The same way that you would accept input without a space.
>
> Spaces in the input do not matter.
>
> What is your real problem?
>
> --
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 20 Apr 1999 12:18:18 -0400
From: Matt Curtin <cmcurtin@interhack.net>
Subject: Re: Books
Message-Id: <xlx90bnw9it.fsf@gold.cis.ohio-state.edu>
>>>>> On 20 Apr 1999 03:51:05 GMT, abigail@fnx.com (Abigail) said:
Abigail> If I were that poor, I'd rather sell my computer than
Abigail> polluting Usenet begging for click-throughs.
If I had Randal's legal bills, I'd answer someone's question and point
out a way that I could have the questioner get what he needs in an
easy way that will give me a bigger kickback.
Hmm.
--
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/
------------------------------
Date: Tue, 20 Apr 1999 09:43:53 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: CGI programmer wanted
Message-Id: <371CAEC9.3CEF42C4@mail.cor.epa.gov>
Abigail wrote:
>
> Diablo Killuminati (diablo@livenet.net) wrote on MMLVII September
> MCMXCIII in <URL:news:371a91da.11269790@news.erols.com>:
> == I opperate a couple of new adult sites
>
> Oh, a site full with new adults!
>
> == I am in need of a good CGI
> == programmer.
Of course, we all know that CGI == Perl. We learned that just this
week in another thread.
> Yes? And? Your posting is a simple statement, with no Perl
> content. Are you sure you have posted your entire article?
Actually, there was a lot more, but the MIME-encoded nude pictures
of Alyssa Milano and Pamela Anderson-Lee probably didn't show up
on your newsreader. Although why he superimposed the Camel book into
those pics is beyond me...
David
--
David Cassell, OAO
cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541)
754-4468
mathematical statistician fax: (541)
754-4716
------------------------------
Date: Tue, 20 Apr 1999 09:26:30 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: 00205613@bigred.unl.edu
Subject: Re: CGI/Telnet??
Message-Id: <371CAAB6.6846BFE5@mail.cor.epa.gov>
[cc to poster]
Zach Trexler wrote:
>
> Abigail (abigail@fnx.com) wrote:
> : Z Trexler (ztrexler@heehaw.com) wrote on MMLVIII September MCMXCIII in
> : <URL:news:7fgiqj$d1j$1@nnrp1.dejanews.com>:
> : {} I own a WebTV, but I am also an intermediate web developer at a university.
> :
> : Goodie. An intermediate web developer. I guess we get a well phrased, to
> : the point question, and not a "I wanna do this, and I've no clue where to
> : start". After all, you are intermediate. And you own a WebTV.
>
> Hey, you're quick.
And sarcastic. But bear in mind that Abigail is an equal-opportunity
provider of sarcasm. And you *did* implicitly ask for it. Instead of
posting from UNL, home of my in-laws, you posted from heehaw.com and
then asked about WebTV.
And you expected real Perl hackers not to tease you about that?
> : {} I want to find a way to write a CGI script that allows me to telnet from my
> : {} WebTV. Keep in mind that WebTV has no java capabilities, and obviously no
^^^^
Well, at last someone has something good to say about WebTV. :-)
> : {} built-in telnet program.
> :
> : I suggest you start with studying the telnet protocol, and while you are
> : doing that, figure out which of the languages supported by WebTV you want
> : to write your telnet client in.
> :
> : What do you say? WebTV doesn't have support for any language? Well.....
> : then maybe it's impossible.
>
> No, it's not impossible. Where did I say WebTV has no support for
> _any_ language?
As far as I know, WebTV has no support for ANY programmming language.
Being able to display HTML is not the same. HTML is a subset of a
markup language, as opposed to a programming language. There is a
very big difference, as I'm sure you know.
> : {} Apparently someone actually has created one before, at
hypermart.com, but it
> : {} was removed because of heavy traffic. I never saw it, and have only heard
> : {} about it.
> :
> : Uhm, yeah. Sure. Did you write hypermart.com about it?
Abigail's obvious skepticism is due to serious knowledge about the
Telnet protocol. It will take more than HTML capabilities to implement
a real Telnet session.
> UHM, no, I did not write Hypermart about it. How would they know
> about one little site that no longer exists? Anyways, I was able to
> find someone who had a backup copy of it on an angelfire site. Try
> this:
>
> http://demo69.hypermart.net/Telnet.pl
>
> And you'll see that you can attempt to log-in to a telnet application,
> or something of the sort. Try logging on to a remote server, though,
Yes, this is closer to 'something of the sort' than Telnet.. which is
the real problem.
> and all you get is connected and then promptly disconnected. Try
> this:
>
> http://demo69.hypermart.net/Unix.pl
>
> And you'll get a Unix prompt, albeit limiting.
And although this script has some serious security problems, that
shouldn't matter if your WEbTV has no filesystem or hard disk to
be destroyed by a rogue command. The other end of the connection might
not be so 'lucky'.
> : Now, what was your Perl question again?
Abigail's point is that your request really has a lot more to do with
WebTV capabilities and netowrk protocols and *general* programming
issues than it does with Perl. Or this newsgroup. Now if you
want to read the Perl FAQ and try to change the program yourself,
then you might want to come back here later with a question about
programming using Perl. Am I making the distinction clear? Because
most denizens of this newsgroup believe that there is a very clear
divide between the two topics, and tend to point that out in ways
that range from polite to space-shuttle-tile-ablating flames.
> There has to be a way to alter this script to get it to continually
> send input and output back and forth, without it disconnecting. You
> can either help me, mock me, or ignore me. It seems you've chosen to
> mock me, which I expected because I included the magical word "WebTV"
> in my post.
Well, that just gave Abigail some ammo. But it was your topic and
your mistakes that really led to the jibes. But then, Abigail is
known for that. Check DejaNews for this NG and the name Abigail, and
you'll see some quite acerbic posts.
You'll know you've become a Perl programmer when you read them and
laugh, and agree with the underlying point.
And then it will be too late for you.
You'll find yourself making fun of toy OSes and java programmers.
You'll find yourself making disparaging remarks about people who
think Perl is just for CGI, or just for shell programming.
You'll find yourself wondering what Larry would do in your place.
And then it will be too late! You'll be one of us, never able to
return! <nefarious laugh goes here>
> : Abigail
> : --
> : srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
> : //=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
>
> Cute.
That's real code there. Not readable code, but real code. Now if you
try running it and have a question about what it does, that's probably
considered a legal question here.
David
--
David Cassell, OAO
cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541)
754-4468
mathematical statistician fax: (541)
754-4716
------------------------------
Date: 20 Apr 1999 15:07:29 GMT
From: Basil McCrea <mccrebsi@ina.com>
Subject: DBD::Ingres
Message-Id: <371C982F.A76AEC8F@ina.com>
Hello,
This may be a RTFM question, but here goes. I'm trying to access
an Ingres Database with Perl. I've installed DBI-1.06 and
DBD-Ingres-0.16.
If I check the installed modules with pmdesc I get the following output,
which would suggest that DBD-Ingres is installed.
DBI::W32ODBC - An experimental DBI emulation layer for Win32::ODBC
DBI::Shell - Interactive command shell for the DBI
DBI::FAQ - The Frequently Asked Questions for the Perl5 Database
Interface
DBI::ProxyServer - a server for the DBD::Proxy driver
DBI::Format - A package for displaying result tables
DBI::DBD - DBD Driver Writer's Guide
DBD::Proxy - A proxy driver for the DBI
DBD::Ingres - Ingres access interface for Perl5
DBI - Database independent interface for Perl
But when I run the following script (which does nothing) I get the
error an message, which would suggest the module is not
installed or I'm doing something wrong.
#!/usr/bin/perl -w
use DBI;
use DBD::Ingres;
$dbh = DBI->connect('DBI:Ingres:db1:hostname', 'user', 'pass',
{ RaiseError => 1, AutoCommit =>1});
$sth = $dbh->prepare("SELECT * FROM user WHERE uid < 10");
$sth->execute;
Can't locate loadable object for module DBD::Ingres in @INC (@INC
contains: /opt/perl5/lib/PA-RISC2.0/5.00404 /opt/perl5/lib
/opt/perl5/lib/site_perl/PA-RISC2.0 /opt/perl5/lib/site_perl .) at
dbtest.pl line 6
BEGIN failed--compilation aborted at dbtest.pl line 6.
I using perl 5.004 on HP-UX 10.20
I would appreciate any help
Thanks
Basil
------------------------------
Date: Tue, 20 Apr 1999 10:20:26 -0600
From: Sherwood Botsford <sherwood@math.ualberta.ca>
Subject: Determining File system type for Find2Perl
Message-Id: <371CA94A.6AD1@math.ualberta.ca>
Find2perl is a good start, but it's less than wonderful. It would be
nice if it supported gnu find syntax. However, it's still cool, and
looking at the output of a few examples got me to the point where I
could handcraft my own &wanted to do what I want. (Running tests with
it,
by the way, shows that it runs about 1/3 the speed of gnu find, with cpu
usage
climbing from 25% to 40%. This isn't out of line at all.
I ended up using find2perl out of effort to get a find that would run
the same
way on all my platforms. Gnufind almost made it, except that it doesn't
recognize
and prune NFS filesystems: E.g.
find / -fstype nfs -prune -o -print doen't print the nfs files,
but it still scans the entire file system. Find2perl does prune
properly. When running repeated finds on many machines, it's not cool
to have
20 clients stat every file on the server...
Find2Pperl has other problems. E.g.
on an openbsd box
find2perl / -fstype ffs -print
puts out:
sub wanted {
(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
($dev >= 0) &&
print("$name\n");
}
Which will also pick up removable drives, and the /dev/proc pseudo
file system. On sgi's it would pick up /dev/fd which seems to be some
kind of kernel file descriptor structure.
On SGI boxes running IRIX 5.3 NFS file systems don't have
negative device numbers, but instead are numbered from hex 100000.
This makes for a clunky &wanted clause with things like
$sgiNFS = hex "100000";
$sgiNFSupper = hex "100010";
...
if (($dev < 0)|| (($dev > $sgiNFS) && ($dev < $sgiNFSupper))) &&...
Yuck. Anyone got an elegant way to return the filesystem type that the
current file is on? Perferably one that does most of it's work outside
of &wanted
I'm trying to write stuff that will give me the same output on
SGI 5.3 SGI 6.5 OpenBSD, Linux, NetBSD, NextStep 2.2,3.3, HPUX 10.20,
AIX 3.2.5, Sun Solaris 7
:w
(Ok, better would be to read mnttab, figure out which ones are nfs
file systems, then run find on the non nfs file systems, and compare
$dev to the device of the mount point...)
------------------------------
Date: Tue, 20 Apr 1999 09:54:25 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: FAQ 3.26: Why don't perl one-liners work on my DOS/Mac/VMS system?
Message-Id: <371CB141.EAC77E9@mail.cor.epa.gov>
Tom Christiansen wrote:
>
> [snippety down to the paragraph I want to enlarge: ]
>
> Using qq(), q(), and qx(), instead of "double quotes", 'single
> quotes', and `backticks`, may make one-liners easier to write.
For example, the above one-liner can be written under Unix and
Plan9 as:
perl -e 'print qq(Hello world\n)'
and under DOS, Win32, 4DOS, and VMS as:
perl -e "print qq(Hello world\n)"
Ilya, this works under OS/2 also, doesn't it? I don't have access
to a copy to check. Nor was I able to check on QNX or an Amiga.
Tom, you said 'patches are welcome'. Is this any help?
David
--
David Cassell, OAO
cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541)
754-4468
mathematical statistician fax: (541)
754-4716
------------------------------
Date: Tue, 20 Apr 1999 17:14:19 +0100
From: "Robert Carter" <robert@chackmore.demon.co.uk>
Subject: Getting file creation date using perl
Message-Id: <924625240.15408.0.nnrp-09.c2deb910@news.demon.co.uk>
Can anybody help?
I want to read the the file creation date and time of a html document.
Does anyone know how to do this
Thanks
Robert Carter
------------------------------
Date: 20 Apr 1999 10:33:49 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Getting file creation date using perl
Message-Id: <371cac6d@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Robert Carter" <robert@chackmore.demon.co.uk> writes:
:I want to read the the file creation date and time of a html document.
("a html"? -- you mean "an html".)
Anyway, have you looked at your friendly stat structure lately?
Permit me to help you:
struct stat {
dev_t st_dev; /* inode's device */
ino_t st_ino; /* inode's number */
mode_t st_mode; /* inode protection mode */
nlink_t st_nlink; /* number of hard links */
uid_t st_uid; /* user ID of the file's owner */
gid_t st_gid; /* group ID of the file's group */
dev_t st_rdev; /* device type */
time_t st_atime; /* time of last access */
long st_atimensec; /* nsec of last access */
time_t st_mtime; /* time of last data modification */
long st_mtimensec; /* nsec of last data modification */
time_t st_ctime; /* time of last file status change */
long st_ctimensec; /* nsec of last file status change */
off_t st_size; /* file size, in bytes */
int64_t st_blocks; /* blocks allocated for file */
u_int32_t st_blksize; /* optimal blocksize for I/O */
u_int32_t st_flags; /* user defined flags for file */
u_int32_t st_gen; /* file generation number */
int32_t st_lspare;
int64_t st_qspare[2];
};
Or perhaps you could read perlfunc's entry on stat:
0 dev device number of filesystem
1 ino inode number
2 mode file mode (type and permissions)
3 nlink number of (hard) links to the file
4 uid numeric user ID of file's owner
5 gid numeric group ID of file's owner
6 rdev the device identifier (special files only)
7 size total size of file, in bytes
8 atime last access time since the epoch
9 mtime last modify time since the epoch
10 ctime inode change time (NOT creation time!) since the epoch
11 blksize preferred block size for file system I/O
12 blocks actual number of blocks allocated
Now, which of those fields from eihter list hold the creation date?
NONE OF THEM.
What this has to do with HTML I have no earthly idea.
---tom
--
The hardest thing in the world to understand is the income tax.
--Albert Einstein
------------------------------
Date: Tue, 20 Apr 1999 08:46:16 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Help! CGI::Cookie script works fine, but problem when using SSI's
Message-Id: <371CA148.2223F5D5@mail.cor.epa.gov>
Kevin Howe wrote:
>
> Hi, I have an extremely simple script which reads a cookie and then prints
> it.
> The script works fine when called from the script path ex:
> http://...cgi-bin/test.cgi
>
> But it won't print when called from an SSI!
> ex: <!--#INCLUDE virtual="/cgi-bin/test.cgi"-->
>
> I am at a total loss here, it must have something to do with CGI::Cookie,
> but I can't say for sure.
> Can anyone shed some light?
The problem is unlikely to be with the program if it works properly
when called from the command line.
No, the problem is more likely with your server. Either it has not been
set up right for SSI's, or it has not been told to recognize Perl
scripts. So your problem is actually a job for a different newsgroup.
One of the CGI newsgroups, or one specific to your webserver, would
be better able to help you.
Or you could read through the Perl FAQ and find a reference to some
web/cgi/html documents that could help. This is nearly the first
quesiton in perlfaq9. Or use 'perldoc -q' to search the FAQ for
a helpful answer to your question: 'My CGI script runs from the
command line but not the browser...'.
HTH,
David
--
David Cassell, OAO
cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541)
754-4468
mathematical statistician fax: (541)
754-4716
------------------------------
Date: 20 Apr 1999 15:17:57 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: how old is perl 5
Message-Id: <7fi5r5$9fq$1@pegasus.csx.cam.ac.uk>
In article <371C8D17.BC5541BA@twcny.rr.com>,
charles <charles@twcny.rr.com> wrote:
>I saw a job posting asking for a person with 3+ years Perl 5.x
>experience. Has Perl 5.x been around that long?
I'd regard 5.002 as the first production-grade version of Perl 5.
And from "perldoc perlhist":
Larry 5.002 1996-Feb-29 Prototypes.
So yes, just. And the previous experimental versions of Perl 5
go back to 1993.
Mike Guy
------------------------------
Date: Tue, 20 Apr 1999 15:56:20 +0000
From: Steve Wells <wells@cedarnet.org>
Subject: Re: Is it possible to have "..." appear while processing?
Message-Id: <371CA3A4.AFB73C2E@cedarnet.org>
Poohba wrote:
>
> Is This coded right. I am trying to get "..." to appear while processing
> but as u can c i m lost. I put it as an attachment too b/c i wasn't sure
> how was best?
>
> #!/usr/bin/perl
>
> $file = 'duke.dat';
> $text = 'users.dat';
>
> print "Would u like to see if anyone is online?\n";
> $answer=<STDIN>;
>
> if($answer =~ /y/i) {
> &continue;
> }
>
> sub continue {
>
> $SIG{ALRM} = sub {
> alarm(3);
> print ".";
> }
> &getit;
> $SIG{ALRM};
> }
>
> sub getit {
> # Create the file
> system('finger @duke.edu > duke.dat');
>
> # Open all files and read
> open (FILE, "$file") || die "Can't open $file: $!\n";
> @users=<FILE>;
> @users = sort {$a cmp $b} @users;
> close(FILE);
>
> open (FILE, $text) || die "Can't open $text: $!\n";
> @persons=<FILE>;
> close(FILE);
>
> $found = 0;
>
> foreach $user (@users) {
> ($person) = split(/\n/, $user);
> $login = substr($person, 0, 8);
> chop($login);
> chomp($login);
> $name = substr($person, 9, 29);
> chomp($name);
> $hostname = substr($person,62);
> ($hosts) = split(/.ac/, $hostname);
> if($person eq ' ') {
> next;
> }
> if($person eq "[duke.edu]") {
> next;
> }
> foreach $friends (@persons) {
> ($userid) = split(/\n/, $friends);
> if($login =~ /$userid/i) {
> print "$login: $name is here on $hosts!\n";
> $found=1;
> }
> }
> }
>
> $SIG{ALRM} = sub {
> alarm(0);
> }
>
> if(!$found) {
> print "Sorry there is no one here for you to talk to!\n";
> }
>
> system("rm $file");
>
> if (-e $file) {
> print "You must erase duke.dat!\n";
> }
> else {
> print "The file is erased!\n";
> }
> }
You haven't turned off the buffering or initialized the alarm.
I made some changes to it and you can have at it (it should work as is)
--------------------------------------
#!/usr/bin/perl -w
use strict; # it's a good idea to get into the habit of using strict
# and to turn on warnings.
my $text = 'users.dat'; # the file we have our friends login names
# listed in -- one login name per line.
# Turn off Buffering
$| = 1;
# Do you really want to use this program? - why do you do this???
print "Would u like to see if anyone is online? (enter y or n) ";
chomp (my $answer=<STDIN>);
# Unless they answer some form of yes we'll die...
die ("Oh, $answer -- if that's how you want it -- I'm outa' here!\n")
unless ($answer =~ # this works case insensitvely for
# y, yes, yup, yeah, yep and (ye, yu, yus and yuah too)
/^[Yy](?:[Ee]|[Uu])?(?:[Ss])?(?:[Aa][Hh])?(?:[Pp])?$/);
# Alarm Configuration - every three seconds it will spit out a '.'
$SIG{ALRM} = sub { alarm(3);
print ".";
};
alarm(3); # initialize the alarm
# Gather up our list of friends usernames
open (FILE, "$text") || die "Can't open $text: $!\n";
my (@friends) = <FILE>;
chomp (@friends); # ouch! what a way to treat a friend!
close(FILE);
# Walk through the return value of the finger command looking
# for friends of ours -- if we find a friend then 'found' flags to 1
my $found = 0;
open (FINGER, "finger \@duke.edu |") or
die "Can't finger \@duke: $!";
while (my $line = <FINGER>) {
# sleep 1; # turn this on to slow it down and watch alarm work...
chomp $line;
next unless length($line);
my ($login, $name, $port, $idle, $when, $where) =
map { s/^\s+|\s+$//g; $_;} # here we remove the Xtra spaces
unpack ("A9 A30 A9 A5 A8 A13", $line); # break up line
# Grab up everything before .ac
my ($host) = split(/\.ac/, $where) if ($where);
next unless ($login ||
$login eq "[duke.edu]" ||
$login eq "Login");
foreach my $friend (@friends) {
next unless (lc($login) eq lc($friend));
printf("\n%8s: %s %s is here on %10s %3s",
$login, $name, , ' 'x(30-length($name)), $host);
$found = 1; # trip our flag...
}
}
}
}
close (FINGER);
# Cleanup
alarm(0); # shutoff the alarm...
print "\nSorry there is no one here for you to talk to!"
unless ($found);
print "\n";
exit 1;
--------------------------------
HTH,
STEVE
--
-----------
Stephen D. Wells
http://www.iren.net/wellss/
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5429
**************************************