[7082] in Perl-Users-Digest
Perl-Users Digest, Issue: 707 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 8 05:17:20 1997
Date: Tue, 8 Jul 97 02:00:24 -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, 8 Jul 1997 Volume: 8 Number: 707
Today's topics:
Re: a2p subroutine not found (Matthew Cravit)
Build error "Prototype mismatch" <rolf@hallo.ch>
Re: concantenated HTML file printing <rootbeer@teleport.com>
Re: Day of the week. (Clay Irving)
Doing Square Roots <drseuss1@geocities.com>
Re: Doing Square Roots (Tad McClellan)
Re: Doing Square Roots <rootbeer@teleport.com>
Re: Gen. a random no. (within range) <ajohnson@gpu.srv.ualberta.ca>
Re: GIFgraph.pm or finance scripts <mkruse@shamu.netexpress.net>
Re: Having trouble with the READ command <rootbeer@teleport.com>
Re: help using ~s/ / / please! (Eric Bohlman)
Re: HTTP SOCKET SUPPORT (Clay Irving)
Re: HTTP SOCKET SUPPORT <me@anon.com>
Re: Localtime in the year 2000 <rootbeer@teleport.com>
Re: Localtime in the year 2000 (Tad McClellan)
Re: Looping throught 2 files simultaneously while searc <me@anon.com>
Net:News vs. News::NNTPClient radrog@cyberdude.com
Re: open(OUT,">>$file") fails to detect read-only file (M.J.T. Guy)
Re: Oraperl - latest version?? (John D Groenveld)
Re: owner of files created by my scripts is 'nobody'... (Tung-chiang Yang)
perl and mpc <amiga@inch.com>
Re: Printing problem with web browser and perl <rootbeer@teleport.com>
Problem in writing a test script, please help (Chuan Wang)
Re: problems compiling perl5.004_01 on Linux 2.0.0 (Douglas J Davenport)
SIGCHLD handler not being called consistently (Jonathan Rozes)
SUMMARY - Function Pointers in PERL crr026@email.mot.com
Trapping system errors <joao@ultranet.com>
Re: URL counter? (Tung-chiang Yang)
Re: VMS: How to get DCL Symbols? (Dan Sugalski)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 Jul 1997 15:33:29 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Re: a2p subroutine not found
Message-Id: <5prqrp$25c$1@shell3.ba.best.com>
In article <5prkuf$9ld@soda.CSUA.Berkeley.EDU>,
David Zeng <dizzy@soda.CSUA.Berkeley.EDU> wrote:
>As for the a2p subroutine... I tried to call it directly from my script
>with the format
> "a2p("<filename>");"
>Perl complains that
> "Undefined subroutine &main::a2p called at <perl script name>"
a2p is not a function. a2p is a program, which is called from the shell.
If you really want to call it from within a perl script, you can either
write the awk coke you're trying to convert into a file, and then use the
system() command to run a2p, or you can read the perlipc man page and look
at how to spawn a process and write to its STDIN/read from its STDOUT.
>If I want to do something with this "AFILE" now, such as putting each line
See the "I/O" operators section of the perlop man page. You should be able
to get that with the command "perldoc perlop".
Hope this helps.
/MC
--
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Mon, 07 Jul 1997 23:22:54 +0200
From: Rolf Hatt <rolf@hallo.ch>
Subject: Build error "Prototype mismatch"
Message-Id: <33C15E2D.80169A2D@hallo.ch>
Hi,
I try to build 5.004_01 on a SUN Solaris 2.4.
In the make-process I get a lot of error messages like:
"Prototype mismatch: sub ExtUtils::MakeMaker::prompt ($;$) vs ($;$) at
(eval 1) line 29."
What's wrong ?
Greetings
Rolf Hatt
HALLO Internet AG
Switzerland
------------------------------
Date: Mon, 7 Jul 1997 15:24:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jesse Markham <foug@msg.ti.com>
Subject: Re: concantenated HTML file printing
Message-Id: <Pine.GSO.3.96.970707152323.10643H-100000@kelly.teleport.com>
On Mon, 7 Jul 1997, Jesse Markham wrote:
> Was curious if anyone knew of Perl script that can grab several HTML
> files and throw them into one long file, then print them as one
> document.
I don't know of one, but with LWP you could write one in a few lines of
code. You can find LWP on CPAN. Hope this helps!
--
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/
------------------------------
Date: 6 Jul 1997 20:51:04 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: Day of the week.
Message-Id: <5ppeho$6g3@panix.com>
In <33BB72F9.1B3B7FA5@absyss.fr> Doug Seay <seay@absyss.fr> writes:
>ray wrote:
>>
>> Does anyone know a script or good algorithm for getting the day of the
>> week given a month, day and year? For example, the day of the week is
>> Wednesday for July 2nd, 1997.
>Use Time::Local to get seconds, then localtime() to get $wday.
Eh, does Time::Local know about "July"? Also, localtime() is going to
return 0 .. 6 for $wday -- You'll need to build a hash to get "Wednesday"
You could use the Date:DateCalc module:
#!/usr/local/bin/perl -w
use Date::DateCalc qw(day_name_tab day_of_week decode_month);
$special_day = "July 2 1997";
($month,$day,$year) = split / /,$special_day;
$mm = decode_month($month);
$weekday = day_of_week($year,$mm,$day);
$day_name = day_name_tab($weekday);
print "$special_day is $day_name\n";
This prints:
July 2 1997 is Wednesday
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
------------------------------
Date: 4 Jul 1997 22:56:01 -0700
From: Walt Staton <drseuss1@geocities.com>
Subject: Doing Square Roots
Message-Id: <33BDD6C1.3606@geocities.com>
I am working on a couple short scripts to do math problems, and I was
wondering if there is a way to perform square roots?
Thanks,
Walt
------------------------------
Date: Sat, 5 Jul 1997 07:10:36 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Doing Square Roots
Message-Id: <sjdlp5.aj.ln@localhost>
Walt Staton (drseuss1@geocities.com) wrote:
: I am working on a couple short scripts to do math problems, and I was
: wondering if there is a way to perform square roots?
^^^^^^^^^^^
You mean like the function you find when you search for 'square root'
in the free Perl man pages that are included with the perl distribution?
Duh.
: Thanks,
Uh huh.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Sat, 5 Jul 1997 05:19:38 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Walt Staton <drseuss1@geocities.com>
Subject: Re: Doing Square Roots
Message-Id: <Pine.GSO.3.96.970705051852.28536C-100000@kelly.teleport.com>
On 4 Jul 1997, Walt Staton wrote:
> I am working on a couple short scripts to do math problems, and I was
> wondering if there is a way to perform square roots?
Sure is, and it's documented in perlfunc(1). Hope this helps!
--
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/
------------------------------
Date: Tue, 08 Jul 1997 01:14:10 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Gen. a random no. (within range)
Message-Id: <33C1DAB2.3D57CDA4@gpu.srv.ualberta.ca>
P.M.Wong wrote:
>
> I would like to generate a random number (whole number)
> But it has to fall within a certain range that i specify
> like, 10< n < 20
> Are there any statement in perl to do it ?
yes, for a random integer such that
$n1 < random_num <$n2
you could use:
$n1=165;
$n2=200;
$rnd_num=int(rand($n2-$n1-1))+$n1+1;
or, if your range is relatively small, and you
only need to set it once (or a few times) you
could try:
@range=($n1+1..$n2-1);
$rnd=$range[rand(@range)];
you can look in the perlfunc documentation
for rand() and srand() and come up with
other constructs.
regards
andrew
------------------------------
Date: 7 Jul 1997 01:29:13 GMT
From: Matt Kruse <mkruse@shamu.netexpress.net>
Subject: Re: GIFgraph.pm or finance scripts
Message-Id: <5ppgp9$c4d$2@usenet88.supernews.com>
Zenin <zenin@best.com> wrote:
: I'm
: adding this support into my rewrite, Image::Graph, but it's no were
: near finshed...
If anyone is working on a graphing module, please take a look at
http://mkruse.netexpress.net/perl/
for my Graph.pm. Please take it and ideas you get from it and work it in.
It never hurts to have even more ideas that are mostly implemented :)
--
Matt Kruse
mkruse@netexpress.net
http://mkruse.netexpress.net/ http://www.mkstats.com/
---------------------------------------------------------------------------
------------------------------
Date: Fri, 4 Jul 1997 18:25:39 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Euan Forrester <deforres@acs.ucalgary.ca>
Subject: Re: Having trouble with the READ command
Message-Id: <Pine.GSO.3.96.970704181757.24625B-100000@kelly.teleport.com>
On Fri, 4 Jul 1997, Euan Forrester wrote:
> I'm trying to use the read command to get a fixed length binary record
> from a file. The problem, is that after I execute the command, the length
> of the variable I'm storing the record into is twice the number of bytes I
> specified in the read command.
That sounds like maybe Perl is miscompiled. Try this code, and see what it
reports.
my $file = q{/usr/bin/perl}; # Adjust as needed
my $len = 10; # How many bytes to ask for
open FILE, $file
or die "Can't open '$file': $!";
my $var = 123; # A dummy value
my $read = read FILE, $var, $len;
die "Read error: $!" unless defined $read;
warn "Hmmm... Got $read bytes instead of $len" unless $read == $len;
warn "Hmmm... \$var starts with '123'" if substr($var, 0, 3) eq '123';
print "Read reported: ", unpack("H*", $var), "\n";
Hope this helps!
--
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/
------------------------------
Date: Tue, 8 Jul 1997 02:31:30 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: help using ~s/ / / please!
Message-Id: <ebohlmanECzB0J.JJF@netcom.com>
shane whinfrey (oa32@dial.pipex.com) wrote:
: which works great. but when i try to reverse the process and put \r
: and \n back in place, like this:-
: $print_address =~s/*!*/\r/g;
: $print_address =~s/*!!*/\n/g;
: i get the following error message:-
: /*!*/: ?+* follows nothing in regex
Asterisks have a special meaning when used in a regular expression (which
the match part of a substitution is). A quick read through perlre should
clear things up for you.
------------------------------
Date: 6 Jul 1997 20:54:24 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: HTTP SOCKET SUPPORT
Message-Id: <5ppeo0$6r5@panix.com>
In <8clo3kacvo.fsf@gadget.cscaper.com> Randal Schwartz <merlyn@stonehenge.com> writes:
>Get and install LWP from the CPAN.
>Then it's just:
> use LWP::Simple;
> $content = get "http://www.stonehenge.com/merlyn/WebTechniques/";
>Too easy.
Please... Perl is a programming language -- Make it more difficult. :)
Perl Modules are your friend,
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
------------------------------
Date: Sun, 06 Jul 1997 17:40:46 -0700
From: Chris Hostetter <me@anon.com>
Subject: Re: HTTP SOCKET SUPPORT
Message-Id: <33C03B0E.7864B6B7@anon.com>
> telnet localhost 80
> GET /index.html
>
> everything works just fine. Any ideas as to what I could be doing
i'm that you acctually run what you have above, it will hangs as well...
you probably haven't noticed thisbecause i'm guessing you've been doing
this:
% telnet localhost 80\n
GET /index.html\n
(whether it was visible or not)
i'm fairly certain if you do the same thing in your perl script you will
get similar results.
> send (S, "GET /index.html", 0) || die "cannot send over socket\n";
(see the problem now?
(note: the reason is worked with port 13 is because the RFC for the
service "daytime" doesn't specify any input from the user (hence no need
for anyhing, let alone a '\n'))
PS: merlyn (and other newsgroup afficieanados)...
while i agree with the whole "don't reinvent the square" philosophy, i
think a lot of people are getting a little too zeleaous with the
expression "go use a module"...
As the fellow said: he was trying to write a little program based on an
example in the llama, just to learn how to use sockets ... he isn't
trying to impliment some complex server or any thing - just learn.
true: if his end goal is to write a program that retreives URLs, he
should just use LWP, AFTER he undertstands how/what it does. But if his
goal is to learn sockets "$content = get "foo.vcom";" isn't going to
teach him a lot is it?
besides: If every answer to every new users question is:
"go use the existing modules."
then who is going to write new modules?
? ? ?
---
------------------------ The Hoss Man --- "c4"
-------------------- Chris M Hostetter -- --Deep Blue
---------- hossman@uclink3.berkeley.edu - "Resign!"
http://www.rescomp.berkeley.edu/~hossman/ --Gary Kasparov
------------------------------
Date: Sat, 5 Jul 1997 05:33:29 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Morten Simonsen <mortensi@idt.ntnu.no>
Subject: Re: Localtime in the year 2000
Message-Id: <Pine.GSO.3.96.970705052325.28536E-100000@kelly.teleport.com>
On 4 Jul 1997, Morten Simonsen wrote:
> I wonder what localtime will return as the year when we enter
> the year 2000. Will it return 0 or 100?.
The answer is well documented virtually everywhere that localtime is. But
if you can't use the docs, and you've never heard of the FAQ, and you
can't bring yourself to look up old postings on a Usenet archive like Deja
News, you could always write a test script.
perl -e 'print join " ", localtime(time+1e8), "\n";'
> Do I have to use time() to be absolute in control of the date? But if I
> use time() I have to calculate the date myself,
Somebody should have told you about modules. They're in the docs, too.
Hope this helps!
--
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/
------------------------------
Date: Sat, 5 Jul 1997 07:56:49 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Localtime in the year 2000
Message-Id: <haglp5.3o.ln@localhost>
Morten Simonsen (mortensi@idt.ntnu.no) wrote:
: I wonder what localtime will return as the year when we enter
: the year 2000. Will it return 0 or 100?. Do I have to use time()
^^^^
: to be absolute in control of the date? But if I use time() I
: have to calculate the date myself, and that is not a pleasant
: task.
: Can anyone help me?
Yes.
You can help you.
You are expected to make some teeny tiny eensy beensy little bit of
effort to answer your own question BEFORE posting to thousands of
computers around the entire world.
A word search for '2000' in the Perl FAQ would have answered your
question in a few seconds instead of consuming tens (hundreds?) of
megabytes of hard disk storage on news servers around the Earth.
This post also raises a red flag to all the regulars on the newsgroup
that we can expect more questions straight from the docs from your
particular email address. Some might even put that address in a list
of addresses that would end up reducing the number of experienced
Perl programmers who see your postings in the future...
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Sun, 06 Jul 1997 18:02:56 -0700
From: Chris Hostetter <me@anon.com>
Subject: Re: Looping throught 2 files simultaneously while searching -- Help Requested!
Message-Id: <33C04040.40239ABB@anon.com>
it sounds like you are trying to write a subset of the features for the
unix program "sdiff"
(it runs diff on 2 files and "interactively tries to merge them")
you may want to take a look at that and see if it will do everything you
want.
---
------------------------ The Hoss Man --- "c4"
-------------------- Chris M Hostetter -- --Deep Blue
---------- hossman@uclink3.berkeley.edu - "Resign!"
http://www.rescomp.berkeley.edu/~hossman/ --Gary Kasparov
------------------------------
Date: Sun, 06 Jul 1997 20:02:40 -0600
From: radrog@cyberdude.com
Subject: Net:News vs. News::NNTPClient
Message-Id: <868235736.5164@dejanews.com>
Was looking at two contributed modules for NNTP referencing:
News::NNTPClient and Net::NNTP. At first glance, they look to
have the same functionality. Which one should I use? Pros, cons?
Thanks in advance.
Roger Endo
radrog@cyberdude.com
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 5 Jul 1997 12:19:47 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: open(OUT,">>$file") fails to detect read-only file
Message-Id: <5ple53$t8p@lyra.csx.cam.ac.uk>
Jerry Nowlin <nowlin@iexist.lucent.com> wrote:
>I'm writing some automated tests to verify perl CGI scripts. This suite
>of tests detected a problem with opening a file to append. If the file
>is made read-only by the test, to exercise the error leg that detects
>that the file is not writable, it is still opened successfully by this
>segment of code:
>
> if (open(OUT,">>$datafile")) { ...
On my system (SunOS 4.1.3) this fails with $! set to "Permission denied".
So either it's a problem with your OS (unlikely IMHO) or you aren't
opening the file you think you are. Have you checked the value of
$datafile? Have you checked the current directory (if you're using
relative paths)?
Mike Guy
------------------------------
Date: 5 Jul 1997 00:05:19 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Oraperl - latest version??
Message-Id: <5pkh5v$ij1$1@tholian.cse.psu.edu>
In article <33BC20EC.528C@fsl.noaa.gov>,
David Salisbury <salisbur@fsl.noaa.gov> wrote:
>I need to install oraperl soon, and am wondering what the
Here's the bad news: oraperl 2.4 is the last version of oraperl, the perl4
extension.
The good news is that DBI/DBD::Oracle includes a stable Oraperl emulator
Run, don't walk to CPAN http://www.perl.com/CPAN/
Happy Perl'ng,
John
groenvel@cse.psu.edu
------------------------------
Date: Sat, 5 Jul 1997 06:24:56 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: owner of files created by my scripts is 'nobody'... help
Message-Id: <tcyangECu1tK.G0J@netcom.com>
Try comp.infosystems.www.* groups.
==================================
Francis Cebedo wrote after zapping the scum of the universe:
: I have a perl script that is executed from a web page. This script creates
: files successfully but the owner of the files is 'nobody'. This is causing
: me a lot of pain.
: Is there a way I can modify my script to avoid this? I understand this can
: be fixed on the server but I cannot control that.
--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===
soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml
------------------------------
Date: Sun, 06 Jul 1997 21:15:49 -0400
From: Gabriel Russell <amiga@inch.com>
Subject: perl and mpc
Message-Id: <33C04345.1ABD@inch.com>
At my job we have a Sun ultra 4000 with 8 cpus. We are going to install
the new(er) version of perl. We have the real sun development suite that
comes with MPC a Sun multiprocessor c compiler. It does all sorts of
auto multiprocessing optimazitions in during compilation. I haven't
really studied it yet. Does anyone know if it is a good idea to compile
perl with such a tool? will it preform better? will it work at all? This
machine is a production machine and really can't be used for testing
programs, so I need to know if this idea is stable. Thank you for any
information.
Gabriel Russell
grussell@wiley.com
amiga@inch.com
------------------------------
Date: Sat, 5 Jul 1997 05:23:07 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Coutsogiannopoulos Alexis <widget@santonet.gr>
Subject: Re: Printing problem with web browser and perl
Message-Id: <Pine.GSO.3.96.970705052025.28536D-100000@kelly.teleport.com>
On Thu, 3 Jul 1997, Coutsogiannopoulos Alexis wrote:
> Is there any way that i can force the browser to print without
> having the user to press the print button?
You can't force a browser to do anything. The most you can do is ask it
nicely. To ask it something from your Perl CGI script, print the right
stuff to standard output. To find out what stuff to print (and whether
such a request is even possible) see the browser docs, or a browser or CGI
newsgroup, or that group's FAQ. Hope this helps!
--
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/
------------------------------
Date: 8 Jul 1997 04:49:59 GMT
From: chuan@engr.mun.ca (Chuan Wang)
Subject: Problem in writing a test script, please help
Message-Id: <5psgtn$cgt$1@coranto.ucs.mun.ca>
Hi,
I'm a new Perl user and I have a problem which I tried to figure it
out for a few days and I still haven't got a clue. I hope somebody
can help me.
I'm supposed to write an automatic testing script in Perl. I have a
program written in C which is not supposed to be modified. This program
has some steps. Each step it prompts you to type one of its choices.
For instance, 0, 1, 2 or exit. Once the user types one choice, the
program continues until it finishes. The content of the next prompt
will depend on what the tester types in the previous prompt. Also the
number of steps varies depending on what the tester chooses on each prompt.
Now I want to write a Perl script to do the exhaustive test (which covers
all the options).
I understand I have to use two processes to accomplish the job. The parent
process launch the C program, and the child process read the prompt from
the parent process and feed one of the choices to the parent process so the
parent process can keep going.
I know how to fork a child process and use two pipes to do bidirectional
communication. But in my case, the two process needs to be sychronized
properly. The function wait or waitpid seems not suitable here.
My questions are:
1. Is is possible to do this in Perl?
2. What's the proper way to do the sychronization?
3. Since the C program is not modifiable, shall I just forget about the
named pipe?
I just gone through half of the Camel book (2nd edition). I find the book
lacks the examples. Is there any written script already on some web site
for this kind of work?
Any advice is appreciated.
------------------------------
Date: 5 Jul 1997 09:23:19 -0400
From: puzzlery@light.lightlink.com (Douglas J Davenport)
Subject: Re: problems compiling perl5.004_01 on Linux 2.0.0
Message-Id: <5plhs7$76r@light.lightlink.com>
You are missing the dynamic load library (libdl.so). I had this problem
while trying to build a different program a while ago. You should be able
to get it at you favorite Linux Archive site.
-djd
In article <jsafk3w285.fsf@cypress.skiles.gatech.edu>,
Tzvetan Stoyanov <stoyanov@math.gatech.edu> wrote:
>
>Hi,
>
>When I run sh Configure -d to compile perl5.004_01 on Slackware
>Linux 2.0.0 I get the following result:
>
>----------------------
>Your C linker may need flags. For this question you should
>include -L/whatever and any other flags used by the C linker, but you
>should NOT include libraries like -lwhatever.
>
>Make sure you include the appropriate -L/path flags if your C linker
>does not normally search all of the directories you specified above,
>namely
> /usr/local/lib /shlib /lib /usr/lib
>To use no flags, specify the word "none".
>
>Any additional ld flags (NOT including libraries)? [ -L/usr/local/lib]
>
>Checking your choice of C compiler, libs, and flags for coherency...
>I've tried to compile and run a simple program with:
>
> cc -O2 -Dbool=char -DHAS_BOOL -I/usr/local/include -L/usr/local/lib -o try try.c -lgdbm -ldb -ldl -lm -lc
> ./try
>
>and I got the following output:
>
>/usr/i486-linux/bin/ld: cannot open -ldl: No such file or directory
>I can't compile the test program.
>(The supplied flags might be incorrect with this C compiler.)
>
>You have a BIG problem. Shall I abort Configure [y]
>Ok. Stopping Configure.
>-----------------------------------
>
>I haven't made any changes to the original Slackware distribution.
>Can somebody help me with the shared libraries options for the
>linker?
>
>Thanks,
>Tzvetan Stoyanov
------------------------------
Date: 7 Jul 1997 19:35:05 GMT
From: jrozes@gumbo.tcs.tufts.edu (Jonathan Rozes)
Subject: SIGCHLD handler not being called consistently
Message-Id: <5prgd9$j4u$1@d2.tufts.edu>
Hi--
This is under 5.003 on a Digital Unix 4.0B system...
I have an application that needs to decrement a counter every time a
child process exits. I wanted to do this via a signal handler, but it
seems that my handler is not called consistenly. Given the following
simple test script:
#!/usr/bin/perl -w
use strict;
use POSIX;
$|=1;
$SIG{CHLD} = \&REAPER;
for (1..3) {
simplefork();
}
sleep 10;
sub simplefork {
my $pid;
if ($pid = fork) {
print "Parent[$$]\n";
waitpid($pid,&WNOHANG);
} elsif (defined $pid) {
sleep 1;
print " Child[$$]\n";
sleep 2;
print " Child[$$] FINISHED\n";
exit 0;
} else {
die "Error: can't fork: $!\n";
}
}
sub REAPER {
$SIG{CHLD} = \&REAPER;
my $d = wait;
print "REAPER[$d]\n";
}
__END__
When I run this, my signal handler only gets called once, sometime twice.
If I do waitpid($pid,0) instead of a nonblocking waitpid, the handler
gets called every time. When I run the script on an IRIX 5.3 box, I get
expected results with either form of waitpid.
I get the same results under 5.004_01, or if I recompile either version
with compiler optimizations disabled.
What gives? Any clues at all would be appreciated...
jonathan
--
+++ Jonathan Rozes, Unix Systems Administrator, Tufts University
++ jrozes@tcs.tufts.edu, http://rozes.tcs.tufts.edu/
+ Remember, there's a difference between kneeling down and
bending over --FZ
------------------------------
Date: Mon, 07 Jul 1997 23:01:33 -0600
From: crr026@email.mot.com
To: Chris.Phillips@utas.edu.au,ajohnson@gpu.srv.ualberta.ca
Subject: SUMMARY - Function Pointers in PERL
Message-Id: <868333902.14656@dejanews.com>
Hi all!
Thanks for your replies! They were just what I was looking for. I learnt a
lot today.
====================
Andrew Langmead (aml@world.std.com) says
In C where you have pointers of any kind, in Perl you have
references. Pointers to functions become references to
subroutines. You can make arrays of references to functions, but the
really neat perl trick is hashes of references to functions.
%do_it = ( foo => \&do_foo, bar => \&do_bar, @otherfuncs);
$sub = $do_it{foo};
&$func(@args) if $sub;
sub do_foo {
}
sub do_bar {
}
=============
Yes, hashes of references was just what I had in mind. But the code you
gave should be
&{$sub(@args)} if $sub;
=============
jason (web@calarts.edu) says
There certainly is! Try:
$someArray[$someIndex] = \&someFunction;
&{$someArray[$someIndex]}; # calls &someFunction
=============
andrew (ajohnson@gpu.srv.ualberta.ca) says
Do you want something like the following...(perl5 assumed):
@funct_ptrs=("blah","doh","last_function");
$funct_ptrs[3]=sub {
print "but really, I'm the last function\n";
};
foreach $i (0..3) {
&{$funct_ptrs[$i]};
}
sub blah {
print "I am the blah function\n";
}
sub doh {
print "I am the doh function\n";
}
sub last_function {
print "I am the last_function\n";
}
the first three elements of @funct_ptrs are just strings
which are used as symbolic references to the named
subroutines, and the fourth element is a reference to an
annonymous subroutine...use whichever method suits your
purposes.
===========
kentay@nortel.ca says
Here's a function pointer (subroutine reference): \&sub_a
Here's an array (list) of them: @list = ( \&sub_a, \&sub_b );
Here's a dereference: &{@list[1]);
===========
Thanks, but the code on the last line should be &{$list[1]}.
Thanks also to Chris.Phillips@utas.edu.au and Tom Phoenix
(rootbeer@teleport.com) for similar answers and references to the perlref
doc. Being a newbie, I didn't know references were references to pointers!
And as can be seen -- there are more than one way of doing this!
Best regards,
Ramesh
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Sun, 06 Jul 1997 22:00:38 -0400
From: Joao Cabral <joao@ultranet.com>
Subject: Trapping system errors
Message-Id: <33C04DC6.326EFABD@ultranet.com>
Hello All,
I am trying to "rsh" to all unix systems at my company to do some
maintenance. Well some machines are owned by private individuals and do
not allow you to remotely login to the system. So for those systems I
get the familiar "Permission denied" message. Here is how I am doing
this:
$found = `rsh $machine <run a command here>`;
Is there a way to trap the "Permission denied" error so it does not show
up during the execution of the script? If someone has any answers can
you please email me at jcabral@pictel.com . Thank you very much in
advance.
Joao "John" Cabral
Software Release Engineer
PictureTel
------------------------------
Date: Sat, 5 Jul 1997 06:24:59 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: URL counter?
Message-Id: <tcyangECu1tn.G16@netcom.com>
Try comp.infosystems.www.* groups.
==========================
Jeff Davis wrote after zapping the scum of the universe:
: I am looking for a script to count URLs on a Web page and report
: the total via a SSI.
: Anyone seen anything like that already done or do I need to
: roll my own?
--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===
soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml
------------------------------
Date: 5 Jul 1997 03:43:35 GMT
From: sugalsd@peak.org (Dan Sugalski)
Subject: Re: VMS: How to get DCL Symbols?
Message-Id: <5pkft8$cbl$1@bashir.peak.org>
ASV (doku@asv.de) wrote:
: Does anybody know how DCL symbols (not logicals!) can be accessed in Perl?
Sure. Use the VMS::DCLSym module. It's part of the standard Perl
distribution, though it's not built by default. (It lives in
[.vms.ext.dclsym] and needs to be hand-installed)
Dan
------------------------------
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 707
*************************************