[7771] in Perl-Users-Digest
Perl-Users Digest, Issue: 1396 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 1 13:14:49 1997
Date: Mon, 1 Dec 97 10:00:28 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 1 Dec 1997 Volume: 8 Number: 1396
Today's topics:
Re: [BUG] Plain <> fails in Win32 native port <dsadinof@olf.com>
Background process pid <kerenw@amdocs.com>
Re: Background process pid (Andrew M. Langmead)
Re: Conditional compilation? (Andrew M. Langmead)
Re: getting value of a variable <merlyn@stonehenge.com>
localtime() <prl2@lehigh.edu>
Re: localtime() <tchrist@mox.perl.com>
Re: localtime() <prl2@lehigh.edu>
Re: localtime() (Andrew M. Langmead)
Re: Looking for better development envirement for PERL <prl2@lehigh.edu>
Re: Newbie question. Do you recommend moving from C? (Steve O'Hara Smith)
Re: newcomer Q - Perl - MS FrontPage - Windows95 <stevenjm@olywa.net>
open and whitespace <nobroin@esoc.esa.de>
Re: Outputting 100 lines at a time from a search (Bob Maillet)
Re: Passing LIST parameters to die() (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: PERL Hourly Rates (Adam Turoff)
Re: PERL Hourly Rates <Jacqui.Caren@ig.co.uk>
Re: Perl on Win32: Output file redirection clobbers fil <denis_haskin@iacnet.com>
Re: Perl Plug-In for Netscape? <Jacqui.Caren@ig.co.uk>
Re: Please help with form script <jefpin@bergen.org>
problems compiling modules ninerlives@hotmail.com
Re: Q: Learning perl with no progr. experience <cin@io.com>
Re: Q: Learning perl with no progr. experience <eglamkowski@usa.net>
Regular Expressions (David Siebert)
Re: Silly diamond operator (<>) problem? (Will Morse)
Re: undef and blessed thingies <reibert@mystech.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 01 Dec 1997 10:17:01 -0500
From: Danny Sadinoff <dsadinof@olf.com>
Subject: Re: [BUG] Plain <> fails in Win32 native port
Message-Id: <3482D4ED.2E182D74@olf.com>
Michael A. Chase wrote:
> Congratulations (I think). You appear to have found a bug in Win32
> native builds (Borland C++ at least) of the standard distribution. I am
> forwarding your message along with my results to perlbug@perl.com.
>
> I recreated your problem with both Perl 5.004_02 (compiled by Gurusamy
> Sarathy) and Perl 5.004_04 (compiled by me with Borland C++ 5.02) and
> confirmed it didn't occur with the ActiveState port (Build 310) or my
> Cygwin32 build of the Perl 5.004_04 (trial 4) standard distribution.
Without the long bug-submission process, let me just say that I get the same
misbehavior under perl5.004_04 compiled with MSVC5
------------------------------
Date: Mon, 01 Dec 1997 16:12:50 +0200
From: Keren Westreich <kerenw@amdocs.com>
Subject: Background process pid
Message-Id: <3482C5E1.9E1A325E@amdocs.com>
--------------3DAB222DD20A83ECA950BC97
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
When I execut background process from perl script like:
system("scriptName &"),
how can I get the background process pid?
--------------3DAB222DD20A83ECA950BC97
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
<FONT FACE="Arial,Helvetica"><FONT SIZE=-1>When I execut background process
from perl script like: system("scriptName &"),</FONT></FONT>
<BR><FONT FACE="Arial,Helvetica"><FONT SIZE=-1>how can I get the background
process pid?</FONT></FONT></HTML>
--------------3DAB222DD20A83ECA950BC97--
------------------------------
Date: Mon, 1 Dec 1997 16:21:05 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Background process pid
Message-Id: <EKIqr5.7nB@world.std.com>
Keren Westreich <kerenw@amdocs.com> writes:
>--------------3DAB222DD20A83ECA950BC97
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
Keren, Is there a way to turn off this extra coding that your news
posting software adds? If so, it would really be helpful to a lot of
people. Usenet is supposed to be a text based medium.
>When I execut background process from perl script like:
>system("scriptName &"),
>how can I get the background process pid?
Not very easily. What you are doing is causing perl to start (and eait
to complete) a shell, and have that shell start the program scriptName
asynchronously, and then have the shell end, and perl continue.
scriptName winds up being a child of (one of ) perl's child processes.
Now system() is basically a combination of fork(), exec() and wait(),
with some special signal handling thrown in. fork() starts a child
processes (which starts out almost identical to its parent.) exec()
overlays a new program on the (child) processes, and wait() allows a
parent to halt execution until a child process is done. What you want
is to do the fork() and the exec() without the wait().
$pid = fork();
if(not defined $pid) {
die "fork failed";
}
elsif($pid == 0) {
exec 'scriptName' or die 'Can\'t exec scriptName';
}
else {
# do whatever you want the parent to do.
}
You can find info on the fork() and exec() functions in the perlfunc
man page. You can find more about the Unix process model in books like
"Advanced Unix Programming" by W Richard Stevens.
--
Andrew Langmead
------------------------------
Date: Mon, 1 Dec 1997 15:48:39 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Conditional compilation?
Message-Id: <EKIp93.EwH@world.std.com>
jmf9946@is4.nyu.pam (Josh) writes:
>Is this not why god & Larry gave us numerical requires?
>require 5.004;
>though I don't have a perl4 handy to test it on, so it's probably wrong.
But it won't help. The "require VERSION" construct was added in perl
5. In perl 4, the "require filename" is parsed at compile time, but
doesn't execute until runtime. Most of perl 5's incompatible
constructs will cause errors at compile time. If somehow it gets
through and compiles cleanly, It will die with an unhelpful error
message like:
Can't locate 5.0039999999999996 in @INC at /tmp/perl-ea004Pj line 1.
--
Andrew Langmead
------------------------------
Date: 01 Dec 1997 09:50:01 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: getting value of a variable
Message-Id: <8ck9dp6m9y.fsf@gadget.cscaper.com>
>>>>> "John" == John Saya <jsaya@iname.com> writes:
John> I have a small program here that I want to use on a web site, but the
John> value of $host is not being passed to the subroutine in url_get.pl.
John> If I use $host="http://www.site.com" it will work, but not if I type
John> it in at the command line.
[...]
John> $line = <STDIN>;
John> $host = chop ($line);
This sets $host to "\n", and $line to the shortened hostname.
Perhaps you wanted to do that, but it's gonna make the next line
always fail.
John> &url_get($host);
Heh.
As I teach my introductory students:
PRETEND for the next few days that "chop" and "chomp" do *not* have
return values. If you find yourself *using* the return value, you'll
almost *certainly* be doing the wrong thing. If I see such in your
program, I will slap your wrist. :-)
(See www.perltraining.com for details about my classes.)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 273 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 1 Dec 1997 14:11:49 GMT
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: localtime()
Message-Id: <01bcfe63$0d826cc0$3e03b480@mm>
Problem: $loc_fmt[4] in the following code returns 11 instead of 12 for a
file created today (12/1/97). Why?
sub check_file_age {
my $desname = $_[0];
my $create_file = "";
if (-f $desname) {
my $file_mod_time = (stat($desname))[9];
print "\$file_mod_time = $file_mod_time\n"; # for testing
my $now_time = time();
print "\$now_time = $now_time\n"; # for testing
my $file_age = $now_time - $file_mod_time;
print "\$file_age = \$now_time - \$file_mod_time = $file_age\n"; # for
testing
my @loc_fmt = localtime($file_mod_time);
print "localtime(\$file_mod_time) = @loc_fmt\n"; # for testing
if ($file_age < 600) { # If file is less than 10 minutes old
print "\nThe file \"${desname}\"\ncurrently exists and was last ";
print "modified on $loc_fmt[4]-$loc_fmt[3]-";
print "$loc_fmt[5] at $loc_fmt[2]:$loc_fmt[1]:";
print "$loc_fmt[0].\nDo you wish to create an updated version ";
print "of this file instead of \nkeeping the old one?\n\n";
while ($create_file !~ /^[Yy | Nn]/) {
print ("Press Y to create a new file, or");
print (" N to keep the old one: ");
chomp($create_file = <STDIN>);
}
}
}
return($create_file);
}
------------------------------
Date: 1 Dec 1997 15:12:00 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: localtime()
Message-Id: <65uk40$2is$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Phil R Lawrence" <prl2@lehigh.edu> writes:
:Problem: $loc_fmt[4] in the following code returns 11 instead of 12 for a
:file created today (12/1/97). Why?
Because it's documented to do so.
man 3 localtime
or
man perlfunc # and search for localtime
Actually, so you can subscript arrays with it.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Most of what I've learned over the years has come from signatures."
--Larry Wall
------------------------------
Date: 1 Dec 1997 14:34:25 GMT
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Re: localtime()
Message-Id: <01bcfe66$38450d20$3e03b480@mm>
Phil R Lawrence <prl2@lehigh.edu> wrote in article
<01bcfe63$0d826cc0$3e03b480@mm>...
> Problem: $loc_fmt[4] in the following code returns 11 instead of 12 for a
> file created today (12/1/97). Why?
<snip>
Camel pp. 185 states that the month element has range 0..11, weekday has
range 0..6, and that the year has had 1900 subtracted from it.
I wonder why the day element doesn't also start at 0?
------------------------------
Date: Mon, 1 Dec 1997 15:59:28 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: localtime()
Message-Id: <EKIpr4.IyD@world.std.com>
"Phil R Lawrence" <prl2@lehigh.edu> writes:
>Phil R Lawrence <prl2@lehigh.edu> wrote in article
><01bcfe63$0d826cc0$3e03b480@mm>...
>> Problem: $loc_fmt[4] in the following code returns 11 instead of 12 for a
>> file created today (12/1/97). Why?
><snip>
>Camel pp. 185 states that the month element has range 0..11, weekday has
>range 0..6, and that the year has had 1900 subtracted from it.
>I wonder why the day element doesn't also start at 0?
Because that is the way the C library defines it?
But then you are likely to ask why the C library started month and
weekday at zero, but day-of-month at 1.
It seems to be because month and day of month are often strings, and
it is easy to convert the integer into a string using arrays, and
the first element of an array is numbered 0.
@weekdays = qw(Sun Mon Tue Wed Thu Fri Sat);
@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
$weekdays[$loc_fmt[6]];
$months[$loc_fmt[4]];
Day-of-month, on the other hand, is always used numerically.
--
Andrew Langmead
------------------------------
Date: 1 Dec 1997 14:54:36 GMT
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Re: Looking for better development envirement for PERL
Message-Id: <01bcfe69$099f7e80$3e03b480@mm>
Edris Abzakh <edris@canaan.co.il> wrote in article
<65tl8l$7ia$1@news.NetVision.net.il>...
> Hello ..
>
> I was wondering if any body knows about a better developing envirement
> for Perl than using Emacs and the primitive debugger of Perl .
> If there is any thing close to the modern envirements then please
> let me know about it . I'm willing to pay for it .
> please contact me at : edris@canaan.co.il
>
> P.S : I'm working under unix operating system but moving to PC is still
> an opened option .
I am very young and thus was weaned on Microsoft... As a result, I text
edit much faster in a Windows environment than in vi or emacs. TextPad (
http://www.textpad.com/ ) is a great program you can trial for free and do
your programming in. It has various key command settings - obviously I use
Microsoft compatible i.e. CTRL-V means paste. TextPad is $20 or $30 to
buy. As for debugging, I use
#!/usr/local/bin/perl -w
use diagnostics;
use strict;
at the head of my perl files.
To test my work as I go I just save my changes (click), FTP the file over
to my AIX system (click), and run it from my PowerTerm emulator. This is
the best system so far for me.
------------------------------
Date: 1 Dec 1997 16:16:29 GMT
From: sohara@mardil.elsevier.nl (Steve O'Hara Smith)
Subject: Re: Newbie question. Do you recommend moving from C?
Message-Id: <65unst$bco$1@ns.elsevier.nl>
Programming (sysdev@mb.sympatico.ca) wrote:
: So, what would be 2 statements in say Visual Basic,
: dim ls_temp as string
: ls_temp = "testing"
: becomes many statements in c.
Actually one statement in C
char *ls_temp = strdup ("testing");
Or one simpler statement in perl
$ls_temp = "testing";
The nasties come when you want to manipulate the string :)
eg adding something to the end of the string:
Perl:
$ls_temp .= " this";
C:
ls_temp = realloc (ls_temp, strlen (ls_temp) + strlen (" this") + 1);
strcat (ls_temp, " this");
Perl is a great deal simpler than C when it comes to handling strings
because you can ignore the memory allocation aspects (among other things), in
C you have to understand and handle them. On the other hand well written C will
be more efficient.
------------------------------
Date: Mon, 01 Dec 1997 09:18:28 -0800
From: Steven May <stevenjm@olywa.net>
Subject: Re: newcomer Q - Perl - MS FrontPage - Windows95
Message-Id: <3482F164.289DE06E@olywa.net>
Donna Provancher wrote:
> Hello out there,
>
> Re: build 5.003_7, Microsoft PWS
>
> I'm trying to run Perl scripts through FrontPage. I'm getting internal
>
> server error 500.
The short answer:
You can continue to fight the product from the evil empire.
Or:
Trash MS FrontPage
Get OmniHttpd (do a search).
Install.
Set Paths in server control panel
In Advanced settings, enable Perl/CGI support and CGI debugging
Copy script to cgi-bin
Run script.
Up to you.
Steve
--
Blackwater-Pacific Services
------------------------------
Date: Mon, 01 Dec 1997 17:10:21 +0000
From: Niall O Broin <nobroin@esoc.esa.de>
Subject: open and whitespace
Message-Id: <3482EF7D.2BDE@esoc.esa.de>
On page 194 in Camel II it says
But we've never actually seen anyone use that in a script...
Well, of course, someone had to use it :-)
I need to process files generated by Macintosh users who quite often use
filenames with leading spaces (deliberately because space sorts to the
top of a Finder file list) and trailing spaces (probably accidentally).
I was trapping for this as suggested in the Camel and it was working,
but I've now encountered other problems where code I didn't write opens
these files. I don't really want to have to modify the filenames
everywhere I might need to.
Does anyone know why open strips leading and trailing whitespace ? After
all, if a space is a legal character in a filename (as it is in most
modern Unices, if a little hard to deal with via most shells), why
shouldn't it be used ? I don't see it as a portability issue - if your
OS doen't support spaces in filenames, don't use them. I have looked at
do_open in doio.c so I know how the space stripping is done, and I could
easily change it it's a two liner), but would I break anything else ? I
really don't see how, but I'm not Larry :-)
--
Kindest regards,
Niall O Broin
UNIX Network Administrator nobroin@esoc.esa.de
Ground Systems Engineering Department Ph./Fax +49 6151 90 3619/2179
European Space Operations Centre, Darmstadt, Germany
------------------------------
Date: Mon, 01 Dec 1997 12:05:26 -0500
From: bob@cafemedia.com (Bob Maillet)
Subject: Re: Outputting 100 lines at a time from a search
Message-Id: <bob-0112971205270001@apt2.tiac.net>
In article <65tkcu$4e4@shoga.wwa.com>, scribble@shoga.wwa.com (Tushar
Samant) wrote:
>bob@cafemedia.com writes:
>>I have written a perl script which searches the lines of a text file for a
>>certain string and prints out the lines that have been found..I am using a
>>count to display the number of lines found that match..what I would like
>>to do is output only 100 or so lines of text at a time..not just the first
>>100 but each hundred after that and so on.
>>
>>Any ideas?
>
>Do you want *web pages* with 100 hits apiece?
>
Yes, Thats what I mean.
--
To get random signatures put text files into a folder called 3Random Signatures2 into your Preferences folder.
------------------------------
Date: Mon, 01 Dec 97 12:07:44 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Passing LIST parameters to die()
Message-Id: <3482f075$1$ofn$mr2ice@speaker>
In <lq1afemunf1.fsf@bmers2e5.nortel.ca>, on 11/30/97 at 03:39 PM,
Mark Mielke <markm@nortel.ca> said:
+-----
| > All examples I've seen of die() and associated handlers assume a single
| > scalar as a parameter. Maybe there is a good reason for this?
| When i first saw this... the most obvious reason i could think of was that
| die() was behaving much the same as print() does... but when i went on to
| say:
+--->8
die() originally took a scalar argument; it was modified to take a list and
concatenate the elements into a string to simplify writing die()s involving
expressions. I'll leave the question of whether it should obey $OFS to the
folks actually developing/maintaining the beast :-)
--
brandon s. allbery [Team OS/2][Linux][JAPH] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
"Never piss off a bard, for they are not at all subtle and your name scans to
`Greensleeves'." ---unknown, quoted by Janet D. Miles in alt.callahans
------------------------------
Date: 1 Dec 1997 10:50:59 -0500
From: ziggy@panix.com (Adam Turoff)
Subject: Re: PERL Hourly Rates
Message-Id: <65umd3$sma@panix.com>
In article <Pine.A41.3.95a.971127020512.28874C-100000@sp062>,
Alan J. Flavell <flavell@mail.cern.ch> wrote:
>On Wed, 26 Nov 1997, brian d foy wrote:
>
>> when i forget that, i just pull out the old FORTRAN code with which
>> i had to deal. talk about ugly...
>
>Hey, I work for the particle physics community. I've never forgotten
>that at a seminar at CERN on software design methodologies, someone
>said "Physicists write FORTRAN in any language".
>
>It's probably true, too. At least for us oldsters.
I wouldn't be that specific. FORTRAN programmers write FORTRAN in
any language. (I had a job once teaching C to FORTRAN programmers
right after the Gulf War. Their code was pretty much F77 with curly braces.)
Z.
------------------------------
Date: Mon, 1 Dec 1997 14:44:54 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: PERL Hourly Rates
Message-Id: <EKIMAv.AB8@ig.co.uk>
In article <toutatis-ya023180002711970204470001@news.euro.net>,
Toutatis <toutatis@no.mail.please> wrote:
>comdog@computerdog.com (brian d foy) wrote:
>
>> toutatis@no.mail.please (Toutatis) wrote:
>> > comdog@computerdog.com (brian d foy) wrote:
>> > > toutatis@no.mail.please (Toutatis) wrote:
>> > Thank you for perfectly illustrating my point. CGI scripting is _not_ as
>> > trivial as you're suggesting. The fact that you probably relied too much on
>> > Text::Wrap (with a die statement where it'd better not be) is foregivable.
>> > That you didn't test every condition under wich your script is used is
>> > somewhat understandable. You're a busy man. The fact you need additional
>> > information from me to reproduce the error leads me to believe you didn't
>> > properly configure your scripts
>>
>> the fact that i didn't reproduce any error is probably because i don't
>> know what you did to break it. my guess would be that you gave it input
>
>*Sigh*
>Now why leave out the _punchline_ in your quote:
>
>"... properly configure your scripts and/or httpd to provide you the essential
>debugging information (Text::Wrap is not _that_ buggy that it doesn't
>exactly tell you _why_ it invoked a die)."
Regarding the Text::Wrap problem I rewrote that module to fix the TWO
problems that exist in the current invocation. This (after checking by
Tim Bunce) was forwarded to the author. I have not had a response and
hope that Tim will include the changes into the maintenance release
at some point.
I did post the fix details and test cases with a C3 patch to clp.modules
quite some time ago, but have had no responses so must assume that no one
really cares about Text::Wrap, including the author :-(
Pity.
Jacqui
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: Mon, 01 Dec 1997 09:53:34 -0500
From: Denis Haskin <denis_haskin@iacnet.com>
Subject: Re: Perl on Win32: Output file redirection clobbers file?
Message-Id: <3482CF6E.E7BEF5D@iacnet.com>
Aha. I figured it out. I was misunderstanding how the -i switch behaved, what
"inplace editing" meant, and command-line redirection.
My test works exactly as expected if I run the script with the following command
line:
perl -i.bak test.pl test.txt
which causes perl to create a test.txt.bak, use that as its input file for <>,
and create an output file called test.txt.
My problem was that I had been trying to do
perl -i.bak test.pl <test.txt >test.txt
and the command-line redirection was stomping on the -i work...
dwh
Sr Software Developer
Denis_Haskin@iacnet.com
------------------------------
Date: Mon, 1 Dec 1997 15:36:42 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: Perl Plug-In for Netscape?
Message-Id: <EKIop7.AHs@ig.co.uk>
In article <eqtn56.ib3.ln@localhost>, Tad McClellan <tadmc@metronet.com> wrote:
>Eric Hilding (eric@hilding.com) wrote:
>: I've looked around but just can't seem to find the
>: info on an alleged Perl 'Plug-In' for Netscape. Any
>: references would be appreciated. Tnx.
>
>
>Where did you hear the allegations?
Would this perhaps be related to Felix's Penguin (embedded extended safe perl
for netscape etc). It uses OpenGL to provide windows/graphics capabilities.
A seriously beautiful idea that does not seem to have taken off - of course
I have not kept up with developments for a long time now :-(
>I've not heard of such a thing.
Come on - I have you down as one of the perl biggies - you
MUST have heard of penguin. :-)
Jacqui
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: Mon, 1 Dec 1997 09:41:17 -0500
From: TechMaster Pinyan <jefpin@bergen.org>
To: Wolfgang Viechtbauer <wviecht@rs6000.cmp.ilstu.edu>
Subject: Re: Please help with form script
Message-Id: <Pine.SGI.3.95.971201093731.25754A-100000@vangogh.bergen.org>
>Okay, simple script, but something does not seem to work. The script
>only writes "9 9 9" into the data.txt file. The script worked fine on
>a Win32 system, but now I am using it on a UNIX machine and it does
>not work.
You don't need to use the a ? b : c thing... just do this:
#!/usr/local/bin/perl
require("cgi-lib.pl"); #SOMETHING WRONG WITH THIS LINE???
open (DATA, ">>data.txt") || die ("Couldn't write to data file.\n");
&ReadParse;
$in{'question1'} ||= 9;
$in{'question2'} ||= 9;
$in{'question3'} ||= 9;
print DATA "$in{'question1'} $in{'question2'} $in{'question3'}\n";
close DATA;
I hope this works better for you...
(Phoenix - have a gripe for me?) :)
----------------
| "You care... but I don't care."
| - Ken Mayers
----------------
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
*NEW* techmaster@mindless.com *NEW*
** I can be found on #perl on irc.ais.net as jpinyan **
- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y?
------------------------------
Date: Mon, 01 Dec 1997 09:01:48 -0600
From: ninerlives@hotmail.com
Subject: problems compiling modules
Message-Id: <880987831.10342@dejanews.com>
Hi,
I have a few quick questions.
1. I'm compiling up the I/O module and I keep getting the following error.
I'm using Solaris 2.5. Here are the errors
14:43_dcollins_[5399]>~/utils/bin/make test
gcc -c -O -DVERSION=\"1.18\" -DXS_VERSION=\"1.18\" -fpic
-I/cadappl/perl/5.0/lib/sun4-solaris/5.003/CORE -DI_POLL IO.c
In file included from IO.c:11:
/cadappl/perl/5.0/lib/sun4-solaris/5.003/CORE/perl.h:1367: parse error
before `top_env'
/cadappl/perl/5.0/lib/sun4-solaris/5.003/CORE/perl.h:1367: warning: data
definition has no type or storage class
make: *** [IO.o] Error 1
14:45_dcollins_[5400]>gcc -v
gcc version 2.5.6
14:45_dcollins_[5401]>~/utils/bin/make -v
GNU Make version 3.75, by Richard Stallman and Roland McGrath.
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96
Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Report bugs to <bug-gnu-utils@prep.ai.mit.edu>.
Any ideas
2. Do I need to be able to compile this stuff up. Are not the modules just
the IO.pm and IO/* file. If I copy these to mu lib directory won't
everything work?
cc: replies to ninerlives@hotmail.com
Thanks
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 01 Dec 1997 10:05:47 -0600
From: Connie Neal <cin@io.com>
Subject: Re: Q: Learning perl with no progr. experience
Message-Id: <m3sosdyrok.fsf@memoria.di.ferro>
Randal Schwartz <merlyn@stonehenge.com> writes:
>
> While I'd love for everyone in the world to have three copies of my
> Llama book (one at home, one at the office/school, and one to carry
> with them), I really didn't write the book with non-programmers in
> mind. So there's quite a few things that I say "this is like an array
> in other languages" without explaining the why and how of manipulating
> an array... just how to do it in Perl.
So, would you write a learning perl book for us poor dummies that
are trying to learn perl as a first programming language? There
are many of us in need of such a book.
>
> Unfortunately, I have yet to read a "from zero programming to workable
> Perl knowledge" book that I'd recommend. Most of the books that
> dummies can read are books that only dummies would want to read. :-)
I agree with this. It's the reason I went with Learning Perl in
the first place.
Connie Neal
------------------------------
Date: Mon, 01 Dec 1997 11:08:37 -0500
From: the count <eglamkowski@usa.net>
Subject: Re: Q: Learning perl with no progr. experience
Message-Id: <3482E104.19E7@usa.net>
Connie Neal wrote:
> Randal Schwartz <merlyn@stonehenge.com> writes:
> > While I'd love for everyone in the world to have three copies of my
> > Llama book (one at home, one at the office/school, and one to carry
> > with them), I really didn't write the book with non-programmers in
> > mind. So there's quite a few things that I say "this is like an
> > array in other languages" without explaining the why and how of
> > manipulating an array... just how to do it in Perl.
About the only previous experience I had with programming before
Perl was BASIC on my C-64 ;)
I had used Pascal and C a wee, tiny bit, but nothing serious, and
what I did learn didn't stick in my brain too well.
None-the-less, I was able to learn Perl well enough for what I need
and want to do using the Learning Perl book. The most difficult
part of it for me was associative arrays.
Since, I've picked up C and C++ quite seriously, but much prefer
Perl for most tasks.
> So, would you write a learning perl book for us poor dummies that
> are trying to learn perl as a first programming language? There
> are many of us in need of such a book.
A "Teach Yourself Perl in 21 Days"? :)
Actually, I used the "Teach Yourself C in 21 Days" and the C++ version,
too. I much preferred the approach in the "Learning Perl" book -
chapters are short and too the point, with meaningful examples that
really illustrate the point(s), and an adequate number of interesting
exercises with answers.
> > Unfortunately, I have yet to read a "from zero programming to
> > workable Perl knowledge" book that I'd recommend. Most of the books
> > that dummies can read are books that only dummies would want to
> > read. :-)
> I agree with this. It's the reason I went with Learning Perl in
> the first place.
Just please no "Perl for Dummies". I avoid those books like the
plague :P
(fortunately, they are usually all groupped on one shelf, so they are
easy to avoid ;)
------------------------------
Date: 1 Dec 1997 15:29:15 GMT
From: dsiebert@gate.net (David Siebert)
Subject: Regular Expressions
Message-Id: <65ul4b$199k$1@news.gate.net>
I have the Camal but but this section is notvery clear. I need to convert \n
and \c\n to <BR> any suggestions?
------------------------------
Date: 1 Dec 1997 09:59:46 -0600
From: will@Starbase.NeoSoft.COM (Will Morse)
Subject: Re: Silly diamond operator (<>) problem?
Message-Id: <65umti$c5j$1@Starbase.NeoSoft.COM>
If you do an ls of *.err and there are no files that match that pattern,
you will get a similar error message. Are you sure that the perl script
is seeing the same directory as contains the *.err files?
You might look at doing some kind of file existance check ahead of the
reads.
Another error that sounds similar is passing all the files as a single
token:
myscript "file1 file2"
or
myscript '*.err'
(remember that it is actually the calling script that does the globs, try
setting the trace option in your shell to see this work).
I hope this contains a hint.
Will
In article <01bcfa60$fde92250$89ba0ccb@gregii>,
Greg McDermid <mcdermidg@acm.org> wrote:
>Hi,
>
>until recently I have been using the activestate (ex hip communications)
>perl, then I switched to the standard perl distribution (V 5.004 Win32
>under NT 4). At this point a lot of my scripts started failing, most have a
>very basic structure like:
>
>while (<>)
>{
> ...
>}
>
>The problem is that if the input is a specified list of files, or
>redirected input it works OK, but if I use wildcards it fails, e.g. perl
>x.pl *.err, the error being like "Can't open *.err". Is there something
>silly I missed here?
>
>
>Regards,
>
>Greg
>
>e-mail: mcdermidg@acm.org
--
# Copyright 1997 Will Morse. Internet repost/archive freely permitted.
# Hardcopy newspaper, magazine, etc. quoting requires permission.
#
# Gravity, # Will Morse
# not just a good idea, # Houston, Texas
# it's the law. # will@starbase.neosoft.com
#
# These are my views and do not necessarly reflect anyone else/
=========================================================================
By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
meets the definition of a telephone fax machine. By Sec.227(b)
(1)(C), it is unlawful to send any unsolicited advertisement to
such equipment, punishable by action to recover actual monetary
loss, or $500, whichever is greater, for EACH violation.
=========================================================================
------------------------------
Date: Mon, 01 Dec 1997 08:40:54 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: undef and blessed thingies
Message-Id: <3482DA85.1FA9EFE1@mystech.com>
Charles DeRykus wrote:
> Shouldst thou changeth the routine thusly though...
>
> sub ClearA { undef $_[0] }
>
> Verily, close your doors to such wickedness, for you shake
> the foundation of the blessed thingy and the house falls.
>
> Ducking,
>
> --
> Charles DeRykus
I agree - your example undef's the reference to the thingy so the handle is lost!
In this case, Perl's garbage collector should come through and clean up the thingy
since its reference count is decremented (assuming no other references exist).
Thanks for the comments,
Mark Reibert
-----------------------------
Mark S. Reibert, Ph.D.
Mystech Associates, Inc.
3233 East Brookwood Court
Phoenix, Arizona 85044
Tel: (602) 732-3752
Fax: (602) 706-5120
E-mail: reibert@mystech.com
-----------------------------
------------------------------
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 1396
**************************************