[10293] in Perl-Users-Digest
Perl-Users Digest, Issue: 3886 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 4 07:07:13 1998
Date: Sun, 4 Oct 98 04:00:23 -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 Sun, 4 Oct 1998 Volume: 8 Number: 3886
Today's topics:
Re: Beginner - Help with simple calculation... <howel88@cyberway.com.sg>
Re: build database connection in CGI... <bholmes@ipopros.com>
Building perl for Solaris (Gerard Hickey)
CGI.pm objects <mp@mkt2mkt.com>
Re: CGI.pm objects <gellyfish@btinternet.com>
Re: Custom HTML functions - I could use some direction, <psdspss@execpc.com>
Re: grep syntax question <camel@mit.edu>
HELP !!! <qli3@jetson.uh.edu>
Re: HELP !!! <gellyfish@btinternet.com>
Re: Help with system() on NT (Ethan H. Poole)
Re: I have installed Linux. Now what? (David M. Cook)
Is perl the correct choice for this problem? <bholmes@ipopros.com>
Re: Performance issue with not reassigning referenced a <rick.delaney@shaw.wave.ca>
Re: Perl as solution? <eashton@bbnplanet.com>
Re: perl exec'd in background with stdin/stdout remappe (Richard F. Barham)
Re: perl exec'd in background with stdin/stdout remappe (Richard F. Barham)
perl samples for input/output devices <sunnyk@netscape.com>
Re: Perl training in San Jose, CA <psdspss@execpc.com>
Re: Problem with Getopt::Std <gellyfish@btinternet.com>
Question about EventServer <du7c-njk@asahi-net.or.jp>
Question about EventServer <du7c-njk@asahi-net.or.jp>
RFC: "Build'n'Play" installation tool <sb@sdm.de>
sendmail to newsgroup <neymeyr@online.de>
Re: sendmail to newsgroup <gellyfish@btinternet.com>
simple cookie for retaining names <brettr@centuryinter.net>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 4 Oct 1998 16:15:59 +0800
From: "Xu Hongwei" <howel88@cyberway.com.sg>
Subject: Re: Beginner - Help with simple calculation...
Message-Id: <36172ee1.0@news.cyberway.com.sg>
Raynald Provencher wrote in message <6v5anf$ai6$1@news.quebectel.com>...
>I a very new in PERL. I have tried some things, but it didn't work. This is
>a simple calculation:
>
>$total = $price * 0.9
>
>This gives me, for example:
>
>6.95 * 0.9 = 6.255 or
>110.00 * 0.9 = 99
>
>What should I do to get "6.25" instead of "6.255" and "99.00" instead of
>"99"?
>
>Thanks
>
>Raynald
>You may use rproven@microtec.net to anwser....
>
>
>
$price = 6.95;
$total = sprintf("%.2f", $price * 0.9);
print $total;
------------------------------
Date: Sun, 04 Oct 1998 04:23:32 -0600
From: bholmes <bholmes@ipopros.com>
Subject: Re: build database connection in CGI...
Message-Id: <36174CA4.53C454E4@ipopros.com>
Zenin wrote:
>
<snip>
>
> http://www.apache.org/perl/
>
Great answer -- just became a permanent bookmark in my browser.
You are the Master of the Obvious!
bholmes
boulder.co
------------------------------
Date: 4 Oct 1998 02:38:49 GMT
From: hickey@crypto.kernelrom.com (Gerard Hickey)
Subject: Building perl for Solaris
Message-Id: <6v6n3p$h2g$1@news.chatlink.com>
Keywords: Solaris installation
I am attempting to build Perl 5.004 for Solaris. Everything seems to
build just fine, but none of the libraries are working. Below is a
small snipet from the make test.
lib/socket........Can't load '../lib/auto/Socket/Socket.so' for
module Socket: ld.so.1: ./perl: fatal: relocation error: symbol not
found: main: referenced in ../lib/auto/Socket/Socket.so at
../lib/DynaLoader.pm line 166.
at ./lib/socket.t line 14
BEGIN failed--compilation aborted at ./lib/socket.t line 14.
FAILED at test 0
This build was done on Solaris 2.5.1 using gcc 2.7.2. I even tried to
put /usr/ccs/bin at the front of $PATH. I figure that this problem
has been solved many times before, but I can not find anything.
If anyone knows what I am doing wrong, please drop me a line.
Thanks....
--
Gerard Hickey hickey@kernelrom.com
Kernel Rom Security Services http://www.kernelrom.com/
Finger hickey@kernelrom.com for PGP keys and info.
------------------------------
Date: Sat, 03 Oct 1998 21:08:17 -0800
From: madame philosophe <mp@mkt2mkt.com>
Subject: CGI.pm objects
Message-Id: <361702A1.160E1207@mkt2mkt.com>
Hi all,
I'm attempting to use CGI.pm with it's oo interface....
I'm guessing that I should keep myself straight by constructing objects
within subroutines (methods?). I know I don't have to, but for my
barely understanding the rules I'm grasping for a programming
methodology that will keep my nose clean.
What I want to know is this:
How I use CGI.pm objects without getting totally over my head with oo
programming? I've perused the modules and I'm completely overwelmed.
(Don't tell me to take a programming class or I'll hunt you down and
skin you alive, er.. I mean that such a suggestion won't be helpful to
me at this point in time)
CGI.pm is fairly understandable, or I should say the most understandable
to me.
(This is for a web cgi script)
I get it that CGI.pm generates a new object (Q), but how to use other
CGI.pm objects alongside Q within the same script? Do I HAVE to make
packages?
Here's a teeny example...
If I've already declared "use CGI; " and "$q = new CGI; " in the main
routine
can I do this in a subroutine?? Dites-moi!
(I'm not confident in my syntax, either, so there you go)
sub verify_this_user {
local(@login_keys) = @_;
my($user) = new CGI(@login_keys);
if ($user->param('login')) {
check_password($user);
} elsif ($user->param('forgot')) {
retrieve_clueword($user->param('username'));
email_to_agent($user->param('username'));
} elsif ($user->param('change_password')) {
check_username($user->param('username'));
if ($user_matched = 1){
print_change_password_page($user);
}
}
} #end of verify_this_user()
If you know of any FAQ's about OO perl other than the cryptic perlbot,
perltoot, and perlobj, or any books that might supplement Stein's CGI
book, please let me know!
Thank you thank you thank you thank you thank you thank you thank you
thank you thank you thank you thank you thank you thank you thank you
thank you thank you thank you thank you thank you thank you thank you
thank you thank you thank you thank you thank you thank you thank you
thank you thank you thank you thank you thank you thank you!
madame P
------------------------------
Date: 4 Oct 1998 10:58:35 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: CGI.pm objects
Message-Id: <6v7kcr$29m$1@gellyfish.btinternet.com>
On Sat, 03 Oct 1998 21:08:17 -0800 madame philosophe <mp@mkt2mkt.com> wrote:
> Hi all,
> I'm attempting to use CGI.pm with it's oo interface....
Good, good.
> I'm guessing that I should keep myself straight by constructing objects
> within subroutines (methods?). I know I don't have to, but for my
> barely understanding the rules I'm grasping for a programming
> methodology that will keep my nose clean.
You dont really need to do that and there is some overhead on constructing
the new objects - I would favour passing around the object variable between
subroutines if the object was not desired to be global.
> What I want to know is this:
> How I use CGI.pm objects without getting totally over my head with oo
> programming? I've perused the modules and I'm completely overwelmed.
> (Don't tell me to take a programming class or I'll hunt you down and
> skin you alive, er.. I mean that such a suggestion won't be helpful to
> me at this point in time)
> CGI.pm is fairly understandable, or I should say the most understandable
> to me.
> (This is for a web cgi script)
> I get it that CGI.pm generates a new object (Q), but how to use other
> CGI.pm objects alongside Q within the same script? Do I HAVE to make
> packages?
> Here's a teeny example...
> If I've already declared "use CGI; " and "$q = new CGI; " in the main
> routine
> can I do this in a subroutine?? Dites-moi!
> (I'm not confident in my syntax, either, so there you go)
> sub verify_this_user {
> local(@login_keys) = @_;
> my($user) = new CGI(@login_keys);
> if ($user->param('login')) {
> check_password($user);
> } elsif ($user->param('forgot')) {
> retrieve_clueword($user->param('username'));
> email_to_agent($user->param('username'));
> } elsif ($user->param('change_password')) {
> check_username($user->param('username'));
> if ($user_matched = 1){
> print_change_password_page($user);
> }
> }
> } #end of verify_this_user()
You cannot create a new CGI object from an array like that.
As far as I know (and the manpage seems to indicate) there are four possible
constructors:
Plain:
my $query = new CGI;
# The CGI object is created from the current CGI environment
File:
my $query = new CGI($filename); # or
my $query = new CGI(\*FILEHANDLE);
# file consists of name=value lines
# this could have been previously created by CGI's save() method
Reference to Hash:
my $query = new CGI(\%hash);
# %hash contain name value pairs.
Query string:
my $query = CGI($querystring);
# where $querystring is a properly formatted URL escaped query string
# such as would be found from $ENV{QUERY_STRING}
In your example (if I was going to do it like that) I would probably use
the latter constructor so the beginning of your code would become:
sub verify_this_user {
local $query_string = shift;
my $user = new CGI($query_string);
....
}
And you would use it (assuming you already have a CGI instance called $q)
like:
verify_this_user($q->query_string());
Have fun
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 03 Oct 1998 23:37:25 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: Custom HTML functions - I could use some direction, hints, help! :-)
Message-Id: <6v6tdq$fq3@newsops.execpc.com>
I guess u want something like this
<HTML>
..
Fixed portion...
<poll>
....
variable portion...
...
</poll>
...
Fixed Portion
..
</HTML>
So whenever u need to change the file, have your perl program print in
following order to a temp file
Fixed portion
Variable portion (data source)
Fixed portion
If u want this page to be dynamic, probably u should make it a cgi script
that gets executed
so that, the variable portion gets updated with the latest.
Hope that helps.
If not, sorry (:-(
Deva
cnlsilva@3dgaming.com wrote:
> I am attempting to modify a script to allow a HTML page to be updated
> dynamically. I want to use a custom tag <poll> and </poll> to allow
> new information to be updated to the page in a easy to use manner.
> I have Mastering Regular Expressions and Programming Perl and was not
> able to find a model in which a string\output was put inbetwent two
> tags located anywhere in a file - any help or direction???
> Thanks in advance...
------------------------------
Date: Sun, 04 Oct 1998 02:48:48 -0400
From: Alok Saldanha <camel@mit.edu>
Subject: Re: grep syntax question
Message-Id: <36171A50.BF8F90FD@mit.edu>
Stephen Totten wrote:
> I know how do to a regular grep on a string, but how do I do a '-i' test?
>
> grep {?i/.pdf$/} $file
>
Okay, I think I see what you're getting at . You mean the -i filetest
operator. What you need is the "and"
shortcircuit operator. Also, grep acts on a list. Try something like the
following:
grep {((/.pdf$/) and (-i $_))} @files
to find all the .pdf files which are -i (whatever -i means...). some of my
parens might be redundant... you can
experiment and see what works.
-Alok
------------------------------
Date: Sat, 3 Oct 1998 23:00:42 -0500
From: "Charles Li" <qli3@jetson.uh.edu>
Subject: HELP !!!
Message-Id: <6v6ruk$ci7$1@news4.wt.net>
I'm doing PERL CGI programming. I am not able to use CGI.pm (for some
reason), how do I pass on the HTML form inputs to the variables in my PERL
CGI script?
--
Charles Li
------------------------------
Date: 4 Oct 1998 10:04:18 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: HELP !!!
Message-Id: <6v7h72$280$1@gellyfish.btinternet.com>
On Sat, 3 Oct 1998 23:00:42 -0500 Charles Li <qli3@jetson.uh.edu> wrote:
> I'm doing PERL CGI programming. I am not able to use CGI.pm (for some
> reason),
What do you mean by "for some reason" - does it crash your system, do you
come out in explicable palpitations when you start typing "use CGI;" or is
it as seems more likely that someone has told you it cant be installed on
your system. If it is the latter I would question the judgement of the
person who told you but nonetheless all is not lost - read the section in
perlfaq8 entitled "How do I keep my own module/library directry ?" and with
any luck you'll be able to use CGI.pm without anyone knowing.
> how do I pass on the HTML form inputs to the variables in my PERL
> CGI script?
Of course it could be that this a college exercise and you been have told that
you shouldnt be using CGI.pm - In which case it would be cheating to do so
not that cheating is deprecated in all situations but in the case of
education it does defeat the object a little.
Some people still swear by cgi-lib.pl which,whilst I havent used it for ages,
is fairly robust and does most of what you'll need it just lacks the OO
features and the HTML methods of CGI.pm.
If however you really have to come up with your own method I would strongly
recommend read rfc1945 (which describes HTTP) and the CGI specification
from http://hoohoo.ncsa.uiuc.edu/ before you set out.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 4 Oct 1998 04:52:30 GMT
From: ehp@gte.net (Ethan H. Poole)
Subject: Re: Help with system() on NT
Message-Id: <6v6uue$5rt$2@news-1.news.gte.net>
[Posted and Emailed] In article <36164568.1145@csi.com>, tb@csi.com says...
>
>Along the lines of using system() on NT. When executing a simple script
>such as:
>
> print "This is a line\n";
> system ('sc query Eventlog');
> print "This is the last line";
>
>The output shows the output from the sc query command followed by
>
> This is a line
> This is the last line
>
>It appears the system call is executed, then the print commands are
>executed. Why does this happen ? Any hints are appreciated.
The commands are being executed in the order you have programmed them. Your
problem relates to the buffering of STDOUT. Because the script's STDOUT is
being buffered (by default), while the external call's STDOUT is released the
moment it returns, you're allowing the two processes to get out of sync.
Try adding the following to the beginning of your script:
select (STDOUT);
$| = 1;
--
Ethan H. Poole | Website Design and Hosting,
| CGI Programming (Perl & C)..
========Personal========= | ============================
* ehp @ gte . net * | --Interact2Day--
http://home1.gte.net/ehp/ | http://www.interact2day.com/
------------------------------
Date: Sun, 04 Oct 1998 06:32:17 GMT
From: davecook@home.com (David M. Cook)
Subject: Re: I have installed Linux. Now what?
Message-Id: <slrn71e60u.kk.davecook@rama.escnd1.sdca.home.com>
On Fri, 02 Oct 1998 01:31:23 -0700, Dan Bialek <dan.bialek@mindspring.com>
wrote:
>I am at complete loss. I fired up the emacs in X windows, but I really
>have no idea what I am doing. I apologize for my ignorance, but if
>anyone can shine flashlight of help this way, I would be ever thankful.
>Please respond via email.
You might want to try an editor with more familiar keybindings. I recommend
you try mcedit in the mc package. Or you can download nedit, which has a
perl syntax mode.
See http://www.kernel-panic.com/links/devel.html for links.
Once you get your bearings, you may wish to come back to emacs. It's a
great editor for development.
Dave Cook
------------------------------
Date: Sun, 04 Oct 1998 04:55:44 -0600
From: bholmes <bholmes@ipopros.com>
Subject: Is perl the correct choice for this problem?
Message-Id: <36175430.6E7ACB3@ipopros.com>
Here is a sample of some data that I am faced with:
10-Q 1059573 19981001
edgar/data/1059573/0000950152-98-007996.txt
10-Q 1059575 19981001
edgar/data/1059575/0000950152-98-007996.txt
10-Q 756767 19981001
edgar/data/756767/0000756767-98-000018.txt
10-Q 804191 19981001
edgar/data/804191/0000804191-98-000011.txt
10-Q/A 1027430 19981001
edgar/data/1027430/0000916641-98-001081.txt
10-Q/A 315374 19981001
edgar/data/315374/0000315374-98-000008.txt
10-Q/A 857855 19981001
edgar/data/857855/0000910195-98-000503.txt
This data comes in plain txt files. I need to perform the following
operations:
Parse the data using the first column/string, saving only those lines
where that string is one of a predetermind set of values, deleting all
the other lines.
Append a string to the beginning of the fourth column/string. This
string is a constant, and is of the "http://somedomain/path/ flavor and
will create a URL out of each string in the fourth column.
I'm new to perl and would like some idea as to it's capabilities.
Thanks,
bholmes
boulder.co
------------------------------
Date: Sun, 04 Oct 1998 03:36:16 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Performance issue with not reassigning referenced arguments passed to a function?
Message-Id: <3616EEC7.6F6FDC48@shaw.wave.ca>
[posted & mailed]
Matt Bieber wrote:
>
> Can anyone comment on weather there are any performance issues if you
> do not bother reassigning referenced arguments passed to a function?
>
> For example, I have several functions that are passed references to
> multiple hashes (\%hash1, \%hash2, etc.), where none of the hashes or
> hash values need to be changed or added to, only output or otherwise
> referred to. In these functions right now I am simply referring to the
> reference whenever I need the value, as in:
>
> print $$hash1{'value1'};
>
Good. Why make a copy if you don't have to worry about modifying the
original?
> Usually what I see in others scripts' is that the reference is
> assigned to a local variable at the top of the function:
>
> %myhash = %$hash1;
>
> and then used. Does anyone have any thoughts on if there's a
> performance or other issue to not reassigning?
Sure there is. Making a local copy of the hash means extra allocation
time, and extra memory usage. This will create big slowdowns if the
hashes are large.
If you want to modify the hash in your subroutine, but leave the
original unchanged, then you might want to make a copy. Otherwise it's
probably better to carry on as you are doing.
> The hashes I'm using are not that big really, about 20 pairs, and at
> most I'm passing 3 of these to a function.
In that case it probably doesn't make a huge difference. One might want
to make a copy for clarity's sake, i.e. accessing elements as $hash{key}
instead of $hash->{key} or $$hash{key}.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sun, 04 Oct 1998 04:27:48 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Perl as solution?
Message-Id: <3616F6CD.F1A7E1F@bbnplanet.com>
Larry Wall wrote:
> I don't think any of you guys tried it. The warning in question only
> appears if the right side of the = is a constant. Of course, in this
> case, is_annoying() was pretty constant...
Actually, it would seem not. Inconsiderate perhaps, but not always
annoying. They are seemingly willing to work with me and my neighbors.
I'm glad really. The cop last night was completely into the pilot..:)
*giggle* So was the neighbor even if his wife was ready to shoot
me...toy factor is everything :) I love engineers.
e.
As I was lying there with my eyes closed, just after I'd
imagined what it might be like if in fact I never got up
again, I thought of you. I opened my eyes then and got
right up and went back to being happy again.
I'm grateful to you, you see. I wanted to tell you. -R. Carver-
------------------------------
Date: Sat, 3 Oct 1998 23:38:03 -0500 (CDT)
From: rfbarham@flash.net (Richard F. Barham)
Subject: Re: perl exec'd in background with stdin/stdout remapped(2)
Message-Id: <1.$/37w2cf@bato.friendly.org>
In article <19981003215448.17273.00002860@ng29.aol.com>,
SKotha <skotha@aol.commail> wrote:
>.>I cannot get a dialog going between a process that called the perl script
>>(and which presumably has remapped stdin/stdout to itself) and the perl
>>script.
>>In fact, it just hangs. Any hints on how to do this? (I've set $| to 1);
>
>Could you please provide more information? And some code snippets...
This is what I'm doing. I'm setting up a perl script as a go between for
sending mail. That is, other programs call the script to send mail to and
through the system (it does this by connecting to localhost port 25
[sendmail]). With elm it works just fine because elm calls it and sends the
mail through stdout (my stdin). I don't know if elm uses a temporary file or it
pipes to my script. However, pine is causing a problem. Pine wants a dialog
between it and my script. I've written my script to emulate SMTP, but after
pine calls the script it just hangs. Since stdin/stdout are remapped, I can't
use the debugger to see what is going on. I've even tried to set up a debugging
file to see all that gets sent in, but it turns out zero in length. Here is the
code:
sub do_smtp_mode {
if($debug) {
open DEBUG, ">$tmpfilename.debug";
select(DEBUG); $| = 1; select(STDOUT);
}
my($in_data) = 0;
my($date) = `date`;
chop($date);
my(@address, $a, $b, $c, $d);
print "220 $host SMTP fakesend v1.0; $date\n";
while(<>) {
print DEBUG $_ if $debug;
if($in_data) {
if(/^\.$/) {
$in_data = 0;
close OUTFILE;
print "250 DAA01135 Message accepted for delivery.\n";
} else {
print OUTFILE $_;
}
} elsif(/^Mail From:/i) {
/^[^:]+:\s*([^\s]+)/;
$smtp_from = $1;
print "250 $1... sender ok\n";
@smtp_to = ();
} elsif(/^HELO/i) {
/^[^\s]+ (.*)/;
@address = gethostbyname($1);
($a, $b, $c, $d) = unpack('C4', $address[4]);
print "250 $host Hello $1 [$a.$b.$c.$d], pleased to meet you.\n";
} elsif(/^Rcpt To:/i) {
/^[^:]+:\s*([^\s]+)/;
print "250 $1... Recipient ok\n";
push(@smtp_to, $1);
} elsif(/^Quit/i) {
print "221 $host closing connection.\n";
last;
} elsif(/^Data/i) {
open OUTFILE, ">$tmpfilename.smtp";
print "354 Enter mail, end with a \".\" on a line by itself\n";
$in_data = 1;
} else {
# chop;
# print "500 Command not recognized: \"$_\"\n";
print "250 okay\n";
}
}
close DEBUG;
}
In this particular snippet, it doesn't have $| = 1, but I've tried that and
still it doesn't work. If I call my script through the shell it works just
fine.
Pine *can* be configured to send it's mail through a temporary file, but I was
hoping to support sendmail's -bs option which throws it into SMTP mode.
I've tried some of the obvious things, such as changing the while(<>) to
while(<STDIN>), yet, it just stalls.
TIA,
Richard
------------------------------
Date: Sun, 4 Oct 1998 02:10:11 -0500 (CDT)
From: rfbarham@flash.net (Richard F. Barham)
Subject: Re: perl exec'd in background with stdin/stdout remapped(2)
Message-Id: <1.#p77w2+v@bato.friendly.org>
It worked fine when I had another process call it with it's stdin/stdout
remapped. Must be a problem with pine. Sorry for the message.
------------------------------
Date: Sat, 03 Oct 1998 20:32:34 -0700
From: sunny kim <sunnyk@netscape.com>
Subject: perl samples for input/output devices
Message-Id: <3616EC52.EF452930@netscape.com>
Hi,
Can anyone please point me to some perl sampes on handling input/output
devices like barcode readers, LCD display, etc?
thank you in advance,
sunny.
------------------------------
Date: Sat, 03 Oct 1998 23:47:02 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: Perl training in San Jose, CA
Message-Id: <6v6tvr$fq3@newsops.execpc.com>
See the following pages :
http://www.learningtree.com/us/ilt/courses/431.htm
http://language.perl.com/info/training.html
If you already know a language like 'C', you can easily learn
perl by going thru Learning Perl :- Randal Schwartz etal.
There is an excellent web site with a lot of info
http://www.perl.com
Hope that helps.
Deva
Susan Johnson wrote:
> I am looking for courses on Perl in the San Jose, CA
> area. I don't know anything about Perl, so am looking
> first at an introductory course before going on to the
> more advanced material.
>
> --
> -------------------------------------------------------------------------
> Susan Johnson Email: susanj@nms.fnc.fujitsu.com
> Configuration Management Engineer Tel: 408-895-1622
> Fujitsu Network Communications Fax: 408-895-1515
> 2860 Junction Avenue
> San Jose, CA 95134-1922
> -------------------------------------------------------------------------
------------------------------
Date: 4 Oct 1998 10:23:31 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Problem with Getopt::Std
Message-Id: <6v7ib3$292$1@gellyfish.btinternet.com>
On Sun, 04 Oct 1998 02:50:27 GMT Perless Dudek <perless@yellowkite.com> wrote:
> Hello,
> I am trying to learn pearl and am using some examples from the "Perl 5
> How-to" book. I have pasted my offending code below. Simple as it may be I
> cannot make it work. Are there different syntaxes on different platforms? I
> have tried variations of the Get opt line but the compiler always returns
> the following error:
> syntax error in file optdemo.pl at line 2, next 2 tokens "use 'Getopt::Std'"
> Execution of optdemo.pl aborted due to compilation errors.
> ***Offending Code*** Below is my file.
> #!/usr/bin/perl -w
> use 'Getopt::Std';
> getopt('de');
<snip>
Lose the quotes around Getopt::Std.
While you're here I would also suggest checking the return of getopt()
with something like:
getopt('de') || warn "Bad option\n";
if you want to be warned about incorrect switches.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sun, 04 Oct 1998 18:03:07 +0900
From: Chikeobi Otuokere Njaka <du7c-njk@asahi-net.or.jp>
Subject: Question about EventServer
Message-Id: <361739CB.673861B0@asahi-net.or.jp>
I have been using the EventServer module and I have a couple
of questions. I hope someone can shed some light on them for me. First,
a little about my project:
I have to monitor the contents of about 40 files what are being written
to by about 30 processes. The data files have a specific naming
convention and a new one is created every day at 00:00 (GMT) by each
process.
I use the EventServer to monitor each file as it is written to. The
problem is that since the files are basically closed everyday at
midnight, I have to open a new file (I use an interval event to trigger
when the old file handles should be closed and new ones opened).
the problem is that the EventServer module does not recognize events
that are registered after the server has been started. Is there any way
around this. If not, how can I trick it into monitoring a different file
handle?
Any help will be appreciated.
Thanks.
Chikeobi Njaka
Account Manager
NDS Asia Pacific LTD.
Tokyo Japan.
------------------------------
Date: Sun, 04 Oct 1998 18:03:35 +0900
From: Chikeobi Otuokere Njaka <du7c-njk@asahi-net.or.jp>
Subject: Question about EventServer
Message-Id: <361739E7.FEBE8AFC@asahi-net.or.jp>
I have been using the EventServer module and I have a couple
of questions. I hope someone can shed some light on them for me. First,
a little about my project:
I have to monitor the contents of about 40 files what are being written
to by about 30 processes. The data files have a specific naming
convention and a new one is created every day at 00:00 (GMT) by each
process.
I use the EventServer to monitor each file as it is written to. The
problem is that since the files are basically closed everyday at
midnight, I have to open a new file (I use an interval event to trigger
when the old file handles should be closed and new ones opened).
the problem is that the EventServer module does not recognize events
that are registered after the server has been started. Is there any way
around this. If not, how can I trick it into monitoring a different file
handle?
Any help will be appreciated.
Thanks.
Please reply to cnjaka@ndsjapan.com
Chikeobi Njaka
Account Manager
NDS Asia Pacific LTD.
Tokyo Japan.
------------------------------
Date: 4 Oct 1998 09:28:03 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: RFC: "Build'n'Play" installation tool
Message-Id: <6v7f33$cqq$1@bsdti6.sdm.de>
The german section of O'Reilly is currently preparing the german version
of the book "Programming with Perl Modules", which will be accompanied
by a CD-ROM with a current snapshot of CPAN, "as usually" :-) .
Moreover this CD-ROM is planned to include a tool for automatically
installing Perl and most of the modules from CPAN (some subsets have
also been defined) called "Build'n'Play", or "BnP" for short.
This tool will be released under the "Artistic" and the "GNU General Public"
Licenses (just like Perl) and will be available from CPAN right after the
book from O'Reilly went to market (due in November).
This tool has been developed by Ralf S. Engelschall (author of some famous
software packages such as mod_rewrite, mod_ssl, ePerl and WML) and has been
rewritten for this occasion by myself (Ralf considered his original version
unsuitable for publication and wanted it "polished" for cleanness before
going into "the world").
A more detailed description of "BnP" follows below.
The tool has some characteristics which remind of "CPAN.pm", but it also
has some unique features not found elsewhere (for details, see below).
Michael Gerth <mic@oreilly.de> from O'Reilly and myself (Steffen Beyer
<sb@engelschall.com>) would be very glad if some volunteers could take
a look at this tool ("peer review") before actual publication and if
they would share with us a) their opinions about and b) their experiences
with this tool!
Because of the deadlines involved in this book project we would need this
feedback on October 15th at the latest, in order to be able to fix any
errors which might have been found before the CD-ROM goes into mass
production.
Here the more detailed description of what "Build'n'Play" is and does:
-------------------- cut here -------------------- cut here --------------------
Have you never built the Perl distribution before, or do you find building
it tedious work?
Did you ever hesitate to upgrade your Perl installation, because doing so
would also necessitate the recompilation of innumerable installed modules
due to the binary incompatibility between the two Perl versions?
Or did you ever want to get rid of the many superfluous modules that got
installed over time, to start anew from scratch and to install a fresh copy
of Perl with only the modules that you really want and need?
And did you ever think about automating this recompilation and installation
process?
Do you routinely install UNIX servers and did you ever wish to be able to
automate the whole installation process, not just for Perl but also for
other important software packages which require many many steps to install,
like for instance a C compiler? (Which usually needs to be compiled at least
_THREE_ times in a bootstrapping process?)
Did you ever get the "software rage" ;-) (a term coined by Scott Adams, as it
seems, the famous author of "The Dilbert Principle") when something went wrong
and you had to go back to the beginning and do it all over again?
Did you ever hate the common software installation practice where all the
binaries get installed into the same place (such as "/usr/local/bin",
for instance), trampling over one another, and other files getting copied
all over your file system, thus making the de-installation of a package
extremely difficult (which files belong to this package and which don't,
and where are they?!)?
Did you ever want to organize your software packages in a neat, hierarchical
way (grouped in categories, i.e., subdirectories) for a maximum of clarity,
and allowing the easy de-installation without any residues whatsoever?
If the answer to any of these questions is yes, "Build'n'Play" might be the
right solution for you:
"Build'n'Play" allows you to write installation scripts for _ANY_ software
package you want (not just Perl) _IN_PERL_ (which means that you have all
the flexibility and computing power of Perl at your disposition, and not
only shell scripts which you might have been using for this purpose until
now).
This also means that you do not need to spend hours in front of the console
anymore typing in commands, but that you can let the installation run and
only check it from time to time, freeing you for other, less tedious tasks.
Moreover, these installation scripts will be able to automatically resume at
the exact position where they aborted after an error occurred (a compilation
error, for instance), thus greatly simplifying the installation process.
Better still, "Build'n'Play" allows you to install Perl itself in this very
same way, even if there is no Perl installed at all yet!
How can "Build'n'Play" _INSTALL_ Perl _USING_ a Perl script if there is no
Perl installed?!
It does so by a bootstrapping process (using "miniperl", for the technically
interested) performed by the "build" command of "Build'n'Play", which is a
shell script for this very reason.
And finally, "Build'n'Play" comprises a tool called "genopt" for maintaining
a software package installation hierarchy which allows you to organize your
various software packages in categories and which allows easy de-installation
without any remains.
(This latter tool is also a shell script, because it is intended to be useable
at the time when you first install a new machine starting from zero - just as
the "build" command!)
Installing Perl and its modules requires about 3,200 shell commands, which
you normally would have to type in manually, worth about one day's (eight
hours) work.
With "Build'n'Play", you can just say "build perl", lean back and wait for
the installation to complete (this takes about three hours on a Pentium
133 MHz with 32 MB of RAM running FreeBSD 2.2.6).
Note again that unlike "CPAN.pm", "Build'n'Play" does _NOT_ require Perl
to be installed already!
Note also that "Build'n'Play" proper does not handle dependencies between
Perl modules automatically, because "Build'n'Play" is not a Perl-specific
tool (such an automatic mechanism could be built into the "perl.bnp"
installation script (which installs Perl and its modules), though).
In the installation script "perl.bnp" - as it is provided in the current
distribution of "Build'n'Play" - these dependencies have already been taken
care of, by defining appropriate subsets of the modules to be installed which
encompass all relevant dependencies.
Moreover, "Build'n'Play" allows you to automatically install bundles of Perl
modules which require non-Perl software packages like "Gimp" and "ImageMagick",
for example (which "CPAN.pm" doesn't allow you to do).
Be aware of the fact that "Build'n'Play" doesn't update your installation
automatically when a new version of a module or software package becomes
available; you will have to change the corresponding installation script
manually (this usually just means to adjust the version number in the script
for the module or package in question) and re-run "Build'n'Play".
Sometimes (for instance when new versions of modules or packages are broken
or if they do not work together well with already installed versions of other
modules or packages) this may even be an advantage!
"Build'n'Play" is capable, however, of automatically downloading such a new
distribution file, if configured properly (just as "CPAN.pm" is, but without
the need for any Perl modules in order to perform the actual download).
(This is crucial for "Build'n'Play" because it is intended to be useable
already when installing a machine for the first time, but you will actually
need a tool for downloading such as "snarf" or "lynx", though.)
-------------------- cut here -------------------- cut here --------------------
The necessary files can be downloaded via anonymous ftp from:
ftp://ftp.engelschall.com/pub/bnp/
Note that some source files that have disappeared from CPAN in the meantime
are included in the file "Sources.tar.gz", which is also included in the "fat"
versions of "BnP" you'll see under the above URL. For the purpose of updates,
the "plain" distributions of "BnP" (without these sources) are also available.
Note further that the installation instructions are still mostly in German.
But issuing "./build" after unpacking the distribution prints a help screen
(in English) that should get you going.
The principle is simple: Think of "Build'n'Play" as something very similar
to "make" and "Makefiles": There is a command called "build" (the equivalent
of "make") and several "Buildfiles" (called "perl.bnp", "gimp.bnp" and so on)
for the different "targets" you can "build"; just say "build perl" for
building and installing Perl and its modules, for instance.
There is also a command "build clean" (the equivalent of "make clean") for
deleting the internal temporary workspace, which should always be used between
different builds (but not if restarting an aborted installation, of course!).
If you want to build a subset of a target, just append the subset(s) or
"subtarget(s)" in question to the name of the target using dots:
% ./build perl.core.fox
This command will install Perl itself ("core") plus those modules that will
be discussed more thoroughly in the book (the fox will be the animal on its
cover), for instance.
If you want to know which subtargets are available, use the tool "tags" from
the "misc" subdirectory, e.g.
% ./misc/tags perl
For a list of available targets, just call "build" without parameters.
Thank you very much for _ANY_ feedback!!
Best regards,
--
Steffen Beyer <sb@engelschall.com>
Free Perl and C Software for Download: www.engelschall.com/u/sb/download/
------------------------------
Date: Sun, 04 Oct 1998 11:33:15 +0100
From: 5105-22 <neymeyr@online.de>
Subject: sendmail to newsgroup
Message-Id: <36174EEB.EFDBA0CE@online.de>
Hi,
I have the problem that I want to send an comment from HTML (or perl) to
a newsgroup
Who can help me?
Thanks,
P.S.: Could you please also contact my by email (This newsgroup is that
big that it is difficult to find the own message)
------------------------------
Date: 4 Oct 1998 11:41:10 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: sendmail to newsgroup
Message-Id: <6v7msm$2fj$1@gellyfish.btinternet.com>
On Sun, 04 Oct 1998 11:33:15 +0100 5105-22 <neymeyr@online.de> wrote:
> Hi,
> I have the problem that I want to send an comment from HTML (or perl) to
> a newsgroup
You probably want to check out News::NNTPClient and Net::NNTP available from
CPAN.
> P.S.: Could you please also contact my by email (This newsgroup is that
> big that it is difficult to find the own message)
Get a better newsreader.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sun, 4 Oct 1998 04:58:54 -0500
From: "brettr" <brettr@centuryinter.net>
Subject: simple cookie for retaining names
Message-Id: <6v7h3p$mnj$1@newsread1-mx.centuryinter.net>
I'd like to create a cookie that will put the user's name and maybe 2 or 3
others things into a form that they have already visited. Does anyone have a
script or demo form that does this?
brettr
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3886
**************************************