[7820] in Perl-Users-Digest
Perl-Users Digest, Issue: 1445 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 10 03:08:43 1997
Date: Wed, 10 Dec 97 00:00:36 -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 Wed, 10 Dec 1997 Volume: 8 Number: 1445
Today's topics:
accessing a file in directory other than cgi script? none@nowhere.com
Re: accessing a file in directory other than cgi script (brian d foy)
Call chmod in cgi script? none@nowhere.com
Re: Call chmod in cgi script? (brian d foy)
Re: Call chmod in cgi script? (David Richards)
Controlling rcp from perl. plambert$1@plambert.org
Re: getting list of directories, returned as an array (Joshua J. Kugler)
Re: Help with line substitution <rootbeer@teleport.com>
Re: How to directly call a POST method <pcnguyen@u.washington.edu>
libperl.so <mab@sycon-design.com>
malloc <mab@sycon-design.com>
Re: Need documentation on WORD_BASIC ole module <pcnguyen@u.washington.edu>
Re: Need help stripping whitespace (Tushar Samant)
NEWBIE, problems in running Perl scripts <jz32@cornell.edu>
Re: NEWBIE, problems in running Perl scripts (brian d foy)
Re: open and whitespace plambert$1@plambert.org
Re: Perl,select and mrtg (Bob Farmer)
Re: Pie chart with GD.pm (Thaths)
Re: Socket I/O in Perl5 <bowlin@sirius.com>
Re: strongly-typed or not? <Russell_Schulz@locutus.ofB.ORG>
What is wrong with this script? <lyurdin@nwlink.com>
Re: What is wrong with this script? (Steve Frost)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 09 Dec 1997 22:29:04 -0500
From: none@nowhere.com
Subject: accessing a file in directory other than cgi script?
Message-Id: <348E0C80.222A@nowhere.com>
Is it possible to open a file in a perl cgi script that is in a
superdirectory (or any other directory for that matter) than the one
which is in the script itself?
I've got a directory 'cgi-bin' under my root directory, and I'd like to
run a script from it which opens a file in my root directory. I thought
maybe something like:
open(FILE, "../myfile.htm"); # this is a reference to the
superdirectory, right?
would do it, but it doesn't. I also tried:
open(FILE, "/myfile.htm"); # isn't this how you refer to a
document in your root directory?
but neither of these successfully open the file. I know that if I place
the file in the same directory as the script itself and use:
open(FILE, "myfile.htm"); # refering to the file in the current
directory
it will open it with no problem, so either I'm using incorrect syntax to
specify the directory, or you simply can't access files in directories
other than your script. Can anyone give me some insight?
If possible, please e-mail me at:
tschwartz@infomedics.com
Thanks in advance!
Ted Schwartz
------------------------------
Date: Tue, 09 Dec 1997 22:51:37 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: accessing a file in directory other than cgi script?
Message-Id: <comdog-ya02408000R0912972251370001@news.panix.com>
In article <348E0C80.222A@nowhere.com>, none@nowhere.com wrote:
>Is it possible to open a file in a perl cgi script that is in a
>superdirectory (or any other directory for that matter) than the one
>which is in the script itself?
maybe. depends on your local set-up. you might be in a chroot()-ed
environment.
> open(FILE, "../myfile.htm");
perhaps you haven't seen Tom Pheonix's popular refrain, which i happen
to have in handy:
Even when your script is "just an example" (and perhaps
especially in that case!) you should _always_ check the
return value after opening a file.
should you
open(FILE, "../myfile.htm") or die "$!";
you'll find your job much easier.
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 09 Dec 1997 22:17:26 -0500
From: none@nowhere.com
Subject: Call chmod in cgi script?
Message-Id: <348E09C6.2F5E@nowhere.com>
Is it possible to call the UNIX system command 'chmod' in a cgi script?
My purpose is to temporarily give a file write permission, write to it
via the script, then reset the file permission to read only to prevent
unwanted tampering. I'm trying to do it like this:
...earlier stuff...
`chmod 666 myfile.htm`; # set permissions to read and write for all
...write to the file...
`chmod 644 myfile.htm`; # set permissions back to read only for others
But when I execute this (with myfile's permission initially 644) the
chmod commands within my script have no effect and the file does not get
written to. Is there some limitation here I'm not aware of? Am I not
using correct syntax? Is there another way to achieve the same result?
If possible, please e-mail your response to:
tschwartz@infomedics.com
Thanks in advance!
Ted Schwartz
------------------------------
Date: Tue, 09 Dec 1997 22:38:13 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Call chmod in cgi script?
Message-Id: <comdog-ya02408000R0912972238130001@news.panix.com>
In article <348E09C6.2F5E@nowhere.com>, none@nowhere.com wrote:
>Is it possible to call the UNIX system command 'chmod' in a cgi script?
yes.
>`chmod 666 myfile.htm`; # set permissions to read and write for all
was there something wrong with the built-in chmod()? i'm assuming that
you are using perl because you posted to a perl newsgroup.
also, do you have chmod in whatever the script thinks is the current
working directory? (hint: absolute paths are a good thing sometimes) :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 10 Dec 1997 05:32:55 GMT
From: dr@ripco.com (David Richards)
Subject: Re: Call chmod in cgi script?
Message-Id: <66l9i7$s8r$1@gail.ripco.com>
In article <348E09C6.2F5E@nowhere.com>, <none@nowhere.com> wrote:
>Is it possible to call the UNIX system command 'chmod' in a cgi script?
Yes, in fact per has a built-in 'chmod' command.
>My purpose is to temporarily give a file write permission, write to it
>via the script, then reset the file permission to read only to prevent
>unwanted tampering. I'm trying to do it like this:
That is _NOT_ a good idea. Your idea provides only the illusion of security,
with anybody who can write a few lines of code being able to get through
your 'protection'.
>...earlier stuff...
>`chmod 666 myfile.htm`; # set permissions to read and write for all
>...write to the file...
>`chmod 644 myfile.htm`; # set permissions back to read only for others
You should instead use:
chmod(0666,"/path/to/myfile.htm");
chmod(0644,"/path/to/myfile.htm");
That leading '0' (zero) is required so Perl will know the argument is octal.
>But when I execute this (with myfile's permission initially 644) the
>chmod commands within my script have no effect and the file does not get
>written to.
What I don't understand is, if the script has permission to change the mode
(permissions) on the file to allow writing, then it would already have
sufficient permissions to have written to the file before the chmod().
>Is there some limitation here I'm not aware of? Am I not
>using correct syntax? Is there another way to achieve the same result?
I'm guessing that 'myfile.htm' isn't in the 'current working directory'
of the script, thus the chmod commands are failing.
Or the script is trying to change permissions on a file that isn't owned
by the userid the program is running as.
Just as you cannot write to a file you do not own (unless permissions are
set to group or world write) you also cannot change permissions on a file
you do not own, for similar reasons.
------------------------------
Date: 10 Dec 1997 06:19:17 GMT
From: plambert$1@plambert.org
Subject: Controlling rcp from perl.
Message-Id: <66lc95$6qa$6@nntp1.ba.best.com>
I have a project which brings up two issues. I think I have a handle on
solving the one, but the second is beyond me right now.
Specifically, I will be rcp'ing a files to LOTS of other machines. These
files will essentially be generated on the fly. I _can_ do it the
"easy" way, and write the file to /tmp/foo.$$, then system "rcp /tmp/foo.$$
$host:$filename", but that leaves me with little or no error control.
If the rcp fails, I need to know if the hostname lookup failed, the host
was unreachable, a permission problem exists on the other end, etc. This
is a bit of a pain, all told, and difficult to do with the stock rcp on
most machines.
Also, if possible, I'd like the source file to be a variable in memory,
or something similar, so it can be generated on the fly.
I can't be the first to do this. If I can't get this to work, I'm going
to give up and try to get the Expect.pm module to work, using rsh. ;-)
Second, suggestions on the following problem: when rcp'ing these files,
there is no point in doing just one at a time. I'd like to be able to
start N processes, and let the main process be the "shephard". When one
finishes, start the next in the list.
This is easy enough, I guess, but it becomes difficult when handling the
proper logging of errors. I want errors to be reported back to the
"master" in a reasonable way, so I can deal with them on my own later.
The rcp questions are the most important--any help there will be _greatly_
appreciated!
--Paul L.
------------------------------
Date: Wed, 10 Dec 1997 05:24:59 GMT
From: jkugler@inreach.com (Joshua J. Kugler)
Subject: Re: getting list of directories, returned as an array
Message-Id: <348e2593.32238118@news.inreach.com>
On 9 Dec 1997 01:54:19 GMT, mgjv@comdyn.com.au (Martien Verbruggen)
wrote:
()In article <348c87cf.506463@news.inreach.com>,
() jkugler@inreach.com (Joshua J. Kugler) writes:
()
()> I would
()> like (or maybe just would like help writing) a subroutine to
return a
()> list of directories to an array starting with the current
directory.
()I take it you mean a recursive list? have a look at the File::Find
module.
()
()hint: use the -d file test
Ok, I have been able to write a little munge that does what I want,
but there has to be a better way. Here is what I have so far.
use File::Find;
find(\&get_dir_list, '/win');
@dirlist = (sort keys %dirlist);
print "@dirlist";
sub get_dir_list {$main::dirlist{$File::Find::dir} = 1;}
That works, and well. The only problem is the File::Find goes through
EVERY file, even though all I want is directory name. And I don't see
how -d could change that because File::Find passes the directory name
to the subroutine, and does not have any "command line" arguments for
only listing subdirectories. The script I am going to be using this
in could potentially be dealing with directories that have many files
in them, and it really slows things down when parses though files,
instead of just listing the directories.
I tried a routine sent to me that used readdir, but it only found one
level down. I suppose I could rewrite find.pm, but I am not that good
on my Perl yet. Getting a dir listing is not hard. I can do that. I
guess my logic doesn't work that far yet. Well, I always want to
learn. I guess that's what I'm doing. :) Thanks for all your help.
It is appreciated!
As my ISP's news server isn't always reliable, please reply via e-mail as well.
Joshua J. Kugler
Computer Consultant--Web Developer
Real e-mail address spelled out to prevent spam. jkugler at inreach dot com
http://www.cwebpages.com/jkugler
Every knee shall bow, and every tongue confess, in heaven, on earth, and under the earth, that Jesus Christ is LORD -- Count on it!
------------------------------
Date: Tue, 9 Dec 1997 20:13:17 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John Robson <as646@FreeNet.Carleton.CA>
Subject: Re: Help with line substitution
Message-Id: <Pine.GSO.3.96.971209201206.12988A-100000@user2.teleport.com>
On 9 Dec 1997, John Robson wrote:
> I want to add a <BR> at the end of each line in a text file.
> So I tried this substitution :
>
> s/$_/$_<BR>/;
Others have shown other solutions, but this one seems to be simple:
s/$/<BR>/;
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/
Ask me about Perl trainings!
------------------------------
Date: Tue, 9 Dec 1997 21:11:34 -0800
From: "P. Nguyen" <pcnguyen@u.washington.edu>
To: Leon Andrews <leon@staff.netchannel.co.uk>
Subject: Re: How to directly call a POST method
Message-Id: <Pine.A41.3.96a.971209211116.15528C-100000@dante33.u.washington.edu>
can you use onMouseOut() event?
On Tue, 25 Nov 1997, Leon Andrews wrote:
> sounds like you want to run the script as a server side include...
>=20
>=20
> SveN wrote:
>=20
> > Help,
> >
> > I have a HTML Dokument that uses:
> >
> > <form method=3DPOST action=3D"http://www.domain.com/cgi-bin/test.pl">
> > <input type=3Dtext name=3Dvar size=3D6><BR><BR>
> > <input type=3Dsubmit>
> > </form>
> >
> > Now I want to call test.pl directly without any user action
> > (no klicking on the submit button) with a specified value for
> > var. How can I do this?
> >
> > Greeting from SveN, Germany
>=20
>=20
>=20
> --
> ..................
> Leon Andrews
> NetChannel UK Ltd.
>=20
>=20
>=20
>=20
>=20
_____ ___ ___ __ __ __ __ __ __ ___
/\ '__`\ /'___\/' _ `\ /'_ `\/\ \/\ \/\ \/\ \ /'__`\/' _ `\
\ \ \L\ \/\ \__//\ \/\ \/\ \L\ \ \ \_\ \ \ \_\ \/\ __//\ \/\ \
\ \ ,__/\ \____\ \_\ \_\ \____ \ \____/\/`____ \ \____\ \_\ \_\
\ \ \/ \/____/\/_/\/_/\/___L\ \/___/ `/___/> \/____/\/_/\/_/
\ \_\ /\____/ /\___/
\/_/ \_/__/ \/__/
=1B[1;32m=1B[5mPh=E1t Peter Nguy=EA=F1=1B[0m
=1B[1;33m=1B[5mMajor: Electrical Engineer at University of Washington=1B[0=
m
=1B[1;34m=1B[5mE-mail: pcnguyen@u.washington.edu=1B[0m
=1B[1;35m=1B[5mWebpage: http://weber.u.washington.edu/~pcnguyen=1B[0m
------------------------------
Date: Tue, 09 Dec 1997 12:56:55 -0800
From: Michael Bezman <mab@sycon-design.com>
Subject: libperl.so
Message-Id: <348DB096.9DFA8342@sycon-design.com>
Hi !!!
I am trying to compile perl 5-0004 in order to use static perl library
libperl.so
but it fails to compile - complainig : cannot load libperl.a
I am running Linux Red Hat 4.2 I belive with gcc 2.7.1.
Does anybody know anything about it ?
Thanks.
Mike
------------------------------
Date: Tue, 09 Dec 1997 13:03:15 -0800
From: Michael Bezman <mab@sycon-design.com>
Subject: malloc
Message-Id: <348DB213.3D5A41B1@sycon-design.com>
Hi !!!
When I was running configure script it asked me about malloc feature -
does it mean perl is support memory allocation like C ?
If yes where can I get more info on this ?
Thank you.
Mike
------------------------------
Date: Tue, 9 Dec 1997 22:27:39 -0800
From: "P. Nguyen" <pcnguyen@u.washington.edu>
To: Graham Wile <graham@webworks.ca>
Subject: Re: Need documentation on WORD_BASIC ole module
Message-Id: <Pine.A41.3.96a.971209222154.15528E-100000@dante33.u.washington.edu>
I have try to start out my own by lookin at the excel example and produce
a small script that will read word doc file and save it as htm file. (I
use word 97 file option, filesavehtml. here is an example:
use OLE;
$application =3D CreateObject OLE 'Word.Basic' || die $!;
if (-f "e:\\inetpub\\test.doc") {
=09$application->{'Visible'} =3D 1;
=09$application->FileOpen("e:\\inetpub\\test.doc");
# $application->WebSelectHyperlink("TRUE");
#=09$application->ToolsCreateDirectory("e:\\inetpub\\blah");
=09$application->FileSaveHtml("e:\\inetpub\\test.htm");
=09$application->FileExit;
=09$application =3D NULL;
}
1;
The lines that I comment out cause I can't get it to work. I am glad, I
need it asap, if anyone can help on it. I need to convert all the url=20
address in the doc to hyperlink address. I know it works when I type in
word and it automatically convert the url address to hyperlink. Thanks
On Tue, 9 Dec 1997, Graham Wile
wrote:
> I have found a reference that gives a parameter list for=20
> the perl WORD_BASIC module functions:
>=20
> =09=09http://home.ljusdal.se/perl/ole/Word_Basic.htm
>=20
> The problem is, I cannot find real documentation, with examples.=20
> I found some examples for the Excel part, but I need something=20
> for Word to get me started.=20
>=20
> For eaxample, I would like to know how to call Word from a perl=20
> script, create a new document, and save it as a file. Then=20
> maybe more advanced stuff. To do that I will need examples on=20
> how to use the Insert, FileNew, etc. methods in a Perl context=20
> from a perl script.
>=20
> Is there anyone there who can point me in the right direction?=20
> Any help would be greatly appreciated.=20
>=20
> =
=20
> Thanks
>=20
>=20
_____ ___ ___ __ __ __ __ __ __ ___
/\ '__`\ /'___\/' _ `\ /'_ `\/\ \/\ \/\ \/\ \ /'__`\/' _ `\
\ \ \L\ \/\ \__//\ \/\ \/\ \L\ \ \ \_\ \ \ \_\ \/\ __//\ \/\ \
\ \ ,__/\ \____\ \_\ \_\ \____ \ \____/\/`____ \ \____\ \_\ \_\
\ \ \/ \/____/\/_/\/_/\/___L\ \/___/ `/___/> \/____/\/_/\/_/
\ \_\ /\____/ /\___/
\/_/ \_/__/ \/__/
=1B[1;32m=1B[5mPh=E1t Peter Nguy=EA=F1=1B[0m
=1B[1;33m=1B[5mMajor: Electrical Engineer at University of Washington=1B[0=
m
=1B[1;34m=1B[5mE-mail: pcnguyen@u.washington.edu=1B[0m
=1B[1;35m=1B[5mWebpage: http://weber.u.washington.edu/~pcnguyen=1B[0m
------------------------------
Date: 9 Dec 1997 20:14:08 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: Need help stripping whitespace
Message-Id: <66kttg$aq3@tekka.wwa.com>
rob@gadgetguru.com writes:
>Yep, there sure is. I should have been more specific.
>
>The URLs in question are in HTML anchor tags:
That's a *very* significant bit of information. It changes the problem
completely and renders everyone's (laborious) responses irrelevant.
> <A HREF="http://www.somecompany.c om">Broken link!</a><A
> HREF="http://www.anoth ercompany.com">Another one</a>
"Correcting bad syntax" is the job of the DWIM module. The current power
of Perl just doesn't cut it. But to make the best of the situation --
are all these URLs enclosed in quotation marks? Some HTML omits the
quotes since URLs don't contain whitespace.
If there's unquoted URLs anywhere then you are definitely hosed. Other-
wise, there is mostly an unambiguous string that's the intended URL...
Here is a quick solution which will cover most cases (but is strictly
speaking incorrect) --
#if $html contains all of your HTML --
$html =~ s{
(< \s* A \b [^>]+ \b HREF \s* = \s* ) (["']?)(.+?)\2 (.*? >)
}{
my($pre, $quot, $url, $post) = ($1, $2, $3, $4);
$url =~ s/\s+//g;
$pre . $quot . $url . $quot . $post;
}exgi;
Please test it a lot, though, because it doesn't know what pathological
shapes your bad HTML takes...
------------------------------
Date: Tue, 09 Dec 1997 20:11:52 -0500
From: Jeremy Zifchock <jz32@cornell.edu>
Subject: NEWBIE, problems in running Perl scripts
Message-Id: <348DEC58.6C49@cornell.edu>
I have been stymied for some time on this script. I post data to it via
an HTML page and expect it to update that info onto another HTML page at
the <!--next--> prompt. It runs from the UNIX command line, but
obviously doesn't contain the posted data I want it to. Please e-mail
me: jz32@cornell.edu if you have any suggestions. Thank you
Jeremy Zifchock
#!/usr/local/bin/perl5 -w
#use diagnostics
#use strict
# Variables
$dirsa = "/ih3/book/dirs.html";
$dirsb = "/www/ih3/book/dirs.html";
$cgi = "/ih3/cgi/hash.pl";
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
# Get rid of plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$FORM{$name} = $value;
}
# Begin editing the directions file
open (FILE,"$dirsb") or die "Can't Open $dirsb: $!\n";
@LINES=<FILE>;
close(FILE);
$SIZE=@LINES;
# Open Link File to Output
open (DIRS,">$dirsb") or die "Can't Open $dirsb: $!\n";
# Insert new directions
for ($i=0;$i<=$SIZE;$i++) {
$_=$LINES[$i];
if (/<!--next-->/) {
print DIRS "<!--next-->\n";
print DIRS "<b>$FORM{'date'}</b><br\n>";
print DIRS "$FORM{'directions'}\n";
print DIRS "<br>\n";
}
else {
print DIRS $_;
}
}
close (DIRS);
------------------------------
Date: Wed, 10 Dec 1997 01:25:02 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: NEWBIE, problems in running Perl scripts
Message-Id: <comdog-ya02408000R1012970125020001@news.panix.com>
In article <348DEC58.6C49@cornell.edu>, jz32@cornell.edu wrote:
>I have been stymied for some time on this script. I post data to it via
>an HTML page and expect it to update that info onto another HTML page at
>the <!--next--> prompt. It runs from the UNIX command line, but
>obviously doesn't contain the posted data I want it to.
have you gone through the steps in "An Idiot's Guide to Perl CGI Problems",
which is referenced in the CGI Meta FAQ? that should help you either
find your problem or ask a more specific question.
good luck :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 10 Dec 1997 05:28:28 GMT
From: plambert$1@plambert.org
Subject: Re: open and whitespace
Message-Id: <66l99s$6qa$5@nntp1.ba.best.com>
Bart Lateur <bart.mediamind@tornado.be> spewed:
> Oh by the way, I didn't hear you complain about any troubles in using
> files with names starting with any of these characters:
> +><|
> That, too, are legal characters for filenames, on a Mac.
Hmmm. I believe these are legal on most Unixen, too. ;-)
I recently had this argument with a coworker who was mad because his
scripts began to fail when moving files for users that had spaces in their
filenames. I pointed out that he had failed to create a script capable of
handling any valid filename. He replied that no user should ever make
a file with a space in the name.
My argument was that if this were true, why is it allowed by the filesystem,
the shell, and everything in between?
Yes, it is inconvenient to handle these things. But where DOS users think
UNIX users are crazy for having "long" filenames, Mac users think UNIX
users are crazy for having "limited" (if only by tradition) character sets
for their filenames.
It's only going to get worse, btw. HFS+, a new filesystem being implemented
slowly under Mac OS and Rhapsody, stores all filenames as Unicode. This
is not a Mac thing--tell me why there is no Kanji version of Perl?
Perl is centered on a very specific audience, and many of the conventions
in perl presuppose a certain audience and situation. Look at the problems
with the Win32 ports, DOS ports, Mac ports, etc., as merely foreshadowing
of what is to come. Someday, someone will need a UNIX that can easily
handle Hebrew on a low level. It _will_ happen.
I'm sure that version 32.002 of Perl will have Unicode support; I'm afraid
to think of what it might look like. ;-) But the world is a big place,
and there is very little we can do to change it. ;-)
--Paul L.
------------------------------
Date: 9 Dec 1997 21:09:49 -0600
From: ucs_brf@unx1.shsu.edu (Bob Farmer)
Subject: Re: Perl,select and mrtg
Message-Id: <66l15t$8g0$1@unx1.shsu.edu>
In article <rml$mGCIxvY6@cc.usu.edu>, Joe Doupnik <jrd@cc.usu.edu> wrote:
>In article <348D9B94.2CDC@pyrenet.fr>, Olivier PRENANT <ohp@pyrenet.fr> writes:
>> Joe Doupnik wrote:
>>>
>>> --------
>>> Probably you built Perl without select() support, for some reason.
>>> Best to rebuild it and look at the configuration information it uses. Perls
>>> here have been built without gcc, thank goodness, so yours can be too. If
>>> you have gcc try renaming its files to avoid finding gcc and tell gnu
>>> configure to keep away from /usr/local/* (my solutions). Even though many
>>> Unix programs have BSD brainwashing, select() is not in libsocket.a but
>>> rather is in libc.a/.so and ld.so.
>>> Also scroll back up this list to see my response to another person
>>> who forgot to use LD_LIBRARY_PATH. There should be no need to tinker with
>>> anything in system directories (no adding static links etc). Finally, to
>>> remove remaining abiguity try running with a simple shell such as sh or
>>> ksh, rather than csh.
>>> In short, small can be beautiful, simplicity can be a virtue,
>>> don't tinker in system space, and similar platitudes about surviving Unix.
>>> Joe D.
>>
>> I still can't noway having the select statement...
>>
>> Would you sending your Makefile and config.h file if you succedded?
>---------
> I am using Perl 5.003 so that will not help with your Perl5.004
>details, if that's the makefile/config.h you refer to. I construct Perl
>very straight forwardly, and ensure it has does not look at user-level
>material (such as /usr/local/*). I don't even keep a copy of the build
>material these days.
> But I use sockets with Perl heavily every day, including with
>MRTG.
> Joe D.
I use Perl 5.004_01 on UnixWare, without any problems. Compiled it on my
system using cc. I don't remember anything real special that needed to be
done during the configuration (pre-compiling) process, except manually
setting d_csh in config.sh to "undef"--this fixed a few problems that
cropped up during the post-compiling tests, including some glob stuff.
Anyone who wants a copy of any particular config file can send me email
(I thought the main config file for perl was config.sh, btw, not config.h
or the Makefile--but it's been a while).
--
Bob Farmer ucs_brf@unx1.shsu.edu
University Computer Services, Sam Houston State Univ. (409)294-3547
------------------------------
Date: 10 Dec 1997 01:33:56 GMT
From: thaths@nospam.com (Thaths)
To: Chandra Shirashyad <c4sshir@srv.pacbell.com>
Subject: Re: Pie chart with GD.pm
Message-Id: <66kri4$39p4@continuity.mcom.com>
[Posted and mailed]
In article <348DA73B.3D61@srv.pacbell.com>,
Chandra Shirashyad <c4sshir@srv.pacbell.com> writes:
> I am trying to create a pie-chart with GD.pm, but not very successful
> doing so. The arc function is not very helpful in creating a pie chart.
> Have anyone of you created a pie-chart using GD? Please let me know what
> was your approach.
Here is how I do my pie charts -
<Begin pseudocode>
Let us say the pie has 5 slices. Slice 1 represents the value $v1, Slice 2
represents value $v2 ... (you get the idea).
$total = $v1 + $v2 + $v3 + $v4 + $v5
$total corresponds to 360 degrees (ie. 2 * pi radians)
Then, $v[1-5] corresponds to $v[1-5] * 360 / $total degrees (ie. 2 * pi *
$v[1-5] / $total radians). Let us call the angles $a1, $a2 etc.
Once you have calculated the angle that each slice makes at the centre of
the pie, start off at angle 0 and draw an arc for $a1 ... etc.
You probably also have to draw lines from the center of the pie to the
beginning and end of each arc. Basic trigonometry should help you here.
Thaths
--
"He who laughs last gets dirty stares."
http://people.netscape.com/thaths/
%remove_this%thaths@netscape.com
------------------------------
Date: Tue, 09 Dec 1997 21:51:20 -0800
From: Jim Bowlin <bowlin@sirius.com>
To: "Erik D. Jones" <erikdj@cyberjunkie.com>
Subject: Re: Socket I/O in Perl5
Message-Id: <348E2DD8.CF7898A3@sirius.com>
Erik D. Jones wrote:
>
> I am working with PERL5.003 and I'm writing a program that scans a range
> of IP addresses. For each IP address it attempts a socket connection to
> a particular PORT. Everything works great and I am able to process the
> errors properly and all that (set by errno from the connect() function
> call), but the connection timeout value is set so high that without
> creating a multithreaded program, this scan is going to take a million
> years. [snip]
If you are running on Unix there is an easy fix. If you are running on NT
then as far as I know, you're screwed until they implement the alarm() function
on NT. The code below will break out of any code inside the eval after 10
seconds.
$SIG{ALRM} = sub { die "timeout!"};
alarm(10);
eval {
# put your code in here
alarm(0);
}
$@ and $@ =~/^timeout/ and do {
# process timeout errors here
};
HTH -- Jim Bowlin
------------------------------
Date: Wed, 10 Dec 1997 01:34:51 +0000
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: strongly-typed or not?
Message-Id: <19971210.013451.0V0.rnr.w164w@locutus.ofB.ORG>
comdog@computerdog.com (brian d foy) writes:
>>the fact that you need to use `-w' to detect when you've used ne instead
>>of != is a big hint that the computer isn't doing enough work for you,
>
> i'd rather have the flexibility to decide which context i would like
> to use in comparisons.
exactly. strong typing wins there. `all scalars are scalars' doesn't.
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: Tue, 9 Dec 1997 23:00:01 -0800
From: "Larry Yurdin" <lyurdin@nwlink.com>
Subject: What is wrong with this script?
Message-Id: <66lel9$3fg$1@texas.nwlink.com>
The following script in Perl 5.003 with 755 permissions and the correct path
on my server has been checked by my instructor who said the syntax is fine.
However, it still gets this error message on the Perl Script Validator on my
commercial server:
Bare word found where operator expected, line 41 near ".
Line 41 is: print<< "EndFound";
The script follows. Any feedback on what I am doing wrong would be much
appreciated.
#!/usr/local/bin/perl5.003
#
#
unshift(@INC, /cgi-bin);
require('cgi-lib.pl');
&ReadParse(*input);
#here is 10
if (($input{'fruit'} eq "apples" || $input{'fruit'} eq "pears" ||
$input{'fruit'} eq "combo") && $input{'number'} eq "ten")
{
$price = 10;
}
#here is 20
elsif (($input{'fruit'} eq "apples" || $input{'fruit'} eq "pears" ||
$input{'fruit'} eq "combo") && $input{'number'} eq "twenty")
{
$price = 20;
}
#here is 30
elsif (($input{'fruit'} eq "apples" || $input{'fruit'} eq "pears" ||
$input{'fruit'} eq "combo") && $input{'number'} eq "thirty")
{
$price = 30;
}
#add for postage
if ($input{'postal'} eq "ups") {$price += 5;}
elsif ($input{'postal'} eq "fedex") {$price += 10;}
#indicate delivery time
if ($input{'postal'} eq "ups")
{$time = "in 5-10 business days.";}
elsif ($input{'postal'} eq "fedex")
{$time = "tomorrow.";}
print &PrintHeader;
print << "EndFound";
<HTML>
<HEAD>
<TITLE>N.W. Fruit Baskets Confirmation</TITLE>
</HEAD>
<BODY BGCOLOR="#CCFFCC">
<HR>
<H1><FONT COLOR="red"><CENTER>Thank you for ordering with N.W. Fruit
Baskets</H1></FONT></CENTER>
<HR>
Your total is \$$price. Your basket will arrive $time
<HR>
</BODY>
</HTML>
EndFound
Thanks for your help.
Claire Yurdin
------------------------------
Date: Wed, 10 Dec 1997 08:26:10 GMT
From: frostbyt@shell02.ozemail.com.au (Steve Frost)
Subject: Re: What is wrong with this script?
Message-Id: <66lg84$euc$1@reader1.reader.news.ozemail.net>
Some time ago "Larry Yurdin" <lyurdin@nwlink.com> wrote:
>print << "EndFound";
Hi Claire,
Not sure if it makes any difference, but I would have used:
print <<EndFound;
Cheers
Steve
(posted+emailed)
--
********************************************************************
Stephen Frost Stephen Frost
Managing Director Technical Consultant
Frostbyte Computer Consultants Pty Ltd OzEmail Limited
Melbourne, Australia (ACN 078 000 030) Sydney, Australia
--------------------------------------------------------------------
http://www.frostbyte.com.au "Faith is the evidence
frostbyt@shell02.ozemail.com.au of things unseen."
--------------------------------------------------------------------
Please remove the 'shell02' if emailing me or the mail will bounce.
------------------------------
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 1445
**************************************