[6550] in Perl-Users-Digest
Perl-Users Digest, Issue: 175 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 25 08:07:16 1997
Date: Tue, 25 Mar 97 05:00:37 -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 Tue, 25 Mar 1997 Volume: 8 Number: 175
Today's topics:
1 2 Many (Help!) slacker@dixonillinois.com
Re: 1 2 Many (Help!) (Honza Pazdziora)
Re: ADVICE NEEDED: timelocal() prints wrong result (VK2COT)
Re: Can someone explain this behaviour? (David Alan Black)
Re: chunk POST and receive with LWP or other module <aas@bergen.sn.no>
Re: cls || ClrScr?? <jerry26@ibm.net>
db_file options for perl and win95 <zephyr@wesell.com>
FTLLIB.PL for Windows NT 4.0 needed and last-modified? (Donovan Janus)
Getting filedates in perl <qraoswa@era-lvk.ericsson.se>
Re: Help on Shopping Cart <zhouyu@usa.net>
Re: help <mgjv@comdyn.com.au>
Re: Looking backwards through a text file <dbenhur@egames.com>
Re: making links on the fly <mgjv@comdyn.com.au>
Re: Perl Data Structures Cookbook. Wher did it go? <Jeff@doom.jetinternet.com>
Re: Perl Interpretors (Markus Laker)
Problem with chdir <jjover@correu.andorra.ad>
Re: Question (Dominic Dunlop)
Re: Reg. Expressions with Associative Arrays <gabriele@clotho.com>
Re: term 'regular expressions' considered undesirable (Rahul Dhesi)
Re: text to HTML <hayes@coventry.ac.uk>
Re: undef in Arguments to Subroutines (Honza Pazdziora)
Re: Unix and ease of use (WAS: Who makes more ...) (Eric Bohlman)
Re: What's a bad Perl book? (Eric Bohlman)
Re: When is a perl program too big? <lupex@ascu.unian.it>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 25 Mar 1997 05:51:10 GMT
From: slacker@dixonillinois.com
Subject: 1 2 Many (Help!)
Message-Id: <33376541.2773768@news.essex1.com>
I've been messing with this for far too long for what seems like it
should have a simple answer. All I'm trying to do is read a file in
($file) if it exists and then print the same file back out. It works
but I'm getting 2 entries for each line in the first file which I do
not want. Does it matter that it's a comma seperated varable file?
If some one has the answer and the time to explain why the answer
works I can use all the help I can get.
if (-e $file){
open(ORIGINAL_CSV_FILE, "$file") or die "Can't open $file, $!" ;
print <ORIGINAL_CSV_FILE> ;
}
Thanks,
Greg McKean
slacker@dixonillinois.com
------------------------------
Date: Tue, 25 Mar 1997 08:37:14 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: 1 2 Many (Help!)
Message-Id: <adelton.859279034@aisa.fi.muni.cz>
slacker@dixonillinois.com writes:
> I've been messing with this for far too long for what seems like it
> should have a simple answer. All I'm trying to do is read a file in
> ($file) if it exists and then print the same file back out. It works
> but I'm getting 2 entries for each line in the first file which I do
2 entries. Does it mean you get each line twice? Or you get extra
empty line after each line?
> not want. Does it matter that it's a comma seperated varable file?
> If some one has the answer and the time to explain why the answer
> works I can use all the help I can get.
>
>
> if (-e $file){
> open(ORIGINAL_CSV_FILE, "$file") or die "Can't open $file, $!" ;
>
> print <ORIGINAL_CSV_FILE> ;
> }
Well, this piece of code works for me after I put $file = 'subjects';
line in front of it. Are you sure you do not mess up perl's variables
somewhere before this code?
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: Mon, 24 Mar 1997 23:31:13 GMT
From: dusanb@syd.csa.com.au (VK2COT)
Subject: Re: ADVICE NEEDED: timelocal() prints wrong result
Message-Id: <E7KMo1.26B@syd.csa.com.au>
Hello,
Blush and blush. So simple and I oversaw it!
Thanks to:
decoux@moulon.inra.fr (Guy Decoux)
gnats@deimos.frii.com (Nathan Torkington)
In essence, I was passing an invalid argument to the timelocal() call. Instead of
timelocal(37, 53, 04, 1, Mar, 97) one should use timelocal(37, 53, 04, 1, 2, 97).
Here is a correct Perl5 script:
#!/opt/local/bin/perl
use Time::Local;
$AAA = timelocal(37, 53, 04, 1, 2, 97);
$BBB = timelocal(37, 53, 22, 27, 1, 97);
$CCC = ($AAA - $BBB) > 0 ? ($AAA - $BBB) : abs($AAA - $BBB);
$DDD = $CCC / 3600;
printf("%d - %d = %d (%s hours)\n", $AAA, $BBB, $CCC, $DDD);
exit(0);
I hope someone learns from my mistake :).
Best wishes and good health to everyone.
--
Dusan U. Baljevic, Senior Member TechStaff
CSC Australia, dusanb@syd.csa.com.au
------------------------------
Date: 24 Mar 1997 23:09:11 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: Can someone explain this behaviour?
Message-Id: <5h71in$ql1@pirate.shu.edu>
Ken Anderson <anderson@necsys.gsfc.nasa.gov> writes:
>Hi,
>i ran into some curious behaviour that i just can't explain.
>check this out:
> % foo
> string list? (Exit with ^D):1 2 3 4
> 1 2 3 4
> 1 2 3 4
> 1 2 3 4
> 4 3 2 1
>as a simple example, this script asks for input line(s) (1 2 3 4)
>here is the script that did this:
> print "string list? (Exit with ^D):"; chop(@str=<STDIN>);
> print @str,"\n";
> print $str[0],"\n";
> print reverse(@str),"\n";
> print reverse(@str)."\n";
>As you can see, it puts the line into an array .
>The curious behaviour comes in the following print statements as i print
>the array, @str. Of course, the 1st line is in $str[0] and reverse does
>not reverse the one element. Now, why is the . (concat) operator getting
>perl to "reverse" the one, and only one, element in the array? Concat with
>a null string does this too. In fact, if you go
>
> print "help".reverse(@str),"\n";
>you get this:
> help4 3 2 1
With the concatenation operator in the mix, the reverse() expression is
being evaluated in a scalar context. And (Camel 207) reverse() in
scalar context "concatenates all the elements of LIST together
and then returns the reverse of that character by character."
Giving two list elements to your program illustrates this more clearly:
string list? (Exit with ^D):1234
5678
^D
12345678
1234
56781234 # list context: elements of @str in reversed order
87654321 # scalar context: all of @str concatted
# and reversed char by char
David Black
dblack@icarus.shu.edu
------------------------------
Date: 25 Mar 1997 08:52:39 +0100
From: Gisle Aas <aas@bergen.sn.no>
Subject: Re: chunk POST and receive with LWP or other module
Message-Id: <h3etkjtmg.fsf@bergen.sn.no>
dribbs@netspace.org (Keith Dreibelbis) writes:
> In looking through LWP and friends I found that if you wish to retrieve a
> large file from an HTTP::Request, there is a nice way to process the file
> in chunks, or to export the output to a file.
>
> I am curious if the opposite is possible, i.e. if you can have a variable
> to POST that actually comes from a file.
You can let the $req->content be a reference to a subroutine and you
can make this subroutine read data from a file. Since the LWP client
code only support HTTP/1.0 you will have to set the
$req->content_length() correctly.
open(F, "/etc/hosts");
$req = new HTTP::Request POST => "http://somewhere.com/";
$req->content_length(-s F);
$req->content(sub { scalar(<F>) });
$ua->request($req);
--
Gisle Aas <aas@sn.no>
------------------------------
Date: 25 Mar 1997 11:23:04 GMT
From: "Jerome R. Westrick" <jerry26@ibm.net>
Subject: Re: cls || ClrScr??
Message-Id: <01bc37d9$63af8750$0100007f@westi>
Peter Tapolyai <peter@uhu.com> wrote in article <33330D69.1978@uhu.com>...
> How do you clear the screen in perl ?
>
Printing a Form Feed "\f" works on some systems (most Unixes)
------------------------------
Date: 24 Mar 1997 21:20:44 GMT
From: "john z." <zephyr@wesell.com>
Subject: db_file options for perl and win95
Message-Id: <01bc388f$54156ba0$19d4b7cc@pciii>
after surfing around i find myself confused: what db_file options are
available
for windows 95 and perl 5.003.
i have a couple files that i would like to process with keys and btree
on both a win95 and unix box.
------------------------------
Date: Tue, 25 Mar 1997 10:12:20 GMT
From: donovan@zaak.nl (Donovan Janus)
Subject: FTLLIB.PL for Windows NT 4.0 needed and last-modified?
Message-Id: <3337a498.83495543@news.xs4all.nl>
Hi.
I need the FTBLIP.PL for Windows NT 4.0 and I can't find a working
copy. Could anyone please send it to me or direct me to a webpage?
Also, I need to know how I can see whether a file was last changed.
Kind regards,
Donovan Janus
------------------------------
Date: Tue, 25 Mar 1997 13:13:02 +0100
From: Oscar Wahlberg <qraoswa@era-lvk.ericsson.se>
Subject: Getting filedates in perl
Message-Id: <3337C14E.66ED@era-lvk.ericsson.se>
Hi all....
I've got a slight problem, I have to get the modified
time from a file at a regular basis...
I need to do this because I want to run specific code
if a file is older than ten minutes.
It seems to work the first time, but not the second
(I run it in a while loop)...
This is what I've done...
while (1) {
if ((-M $filename) > 0.00694) #0.00694 = 10 mins approx ?
{ #1/(24*6)
## Exec some code...
}
sleep($sometime);
}
That's simplifying it a bit, but shows what I am trying to do,
though it doesnt work at all.
After the second turn around I end up with a negative value from
the '-M $filename'.
I've tried doing a stat ($filename) and -M _, though no luck there
either ?
Can anyone help me solve this (trivial ?) problem or atleast
point me in a direction where I can find a possible solution...
Regards,
--
Oscar Wahlberg
------------------------------
Date: 19 Mar 1997 14:59:05 GMT
From: "Zhou Yu" <zhouyu@usa.net>
Subject: Re: Help on Shopping Cart
Message-Id: <01bc3464$4a9cdf60$LocalHost@zhou-yu>
And I found a good place to start:
http://www.worldwidemart.com/scripts/
--------------
zhouyu@usa.net
--------------
Webwalkers <sturner1@gte.net> wrote in article
<01bc33df$195d4dc0$5f9773cf@ia.airmail.net>...
> Hello,
>
> I am working on a shopping cart script that needs some modification.
Since
> I don't know much about scripting, I don't know where to begin. If
someone
> out there would like to help, please e-mail me. I would greatly
appreciate
> any help!
>
> Thanks,
>
> Tammy
> sturner1@gte.net
>
------------------------------
Date: Tue, 25 Mar 1997 13:00:06 +1100
From: Martien Verbruggen <mgjv@comdyn.com.au>
Subject: Re: help
Message-Id: <333731A6.54F0@comdyn.com.au>
Paul Swan wrote:
>
> Does any one have a small self serch program
yes.
#!/usr/local/bin/perl -w
use ME;
$self = new ME();
if (! $self->got_free_program()) {
$self->learn_to_program('perl', 5);
$self->search('help!');
}
exit;
Can't get much smaller, can you?
Invoice follows.
--
Martien Verbruggen
Webmaster www.tradingpost.com.au
Commercial Dynamics Pty Ltd, N.S.W., Australia
------------------------------
Date: Tue, 25 Mar 1997 01:15:55 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
Subject: Re: Looking backwards through a text file
Message-Id: <333797CB.4942@egames.com>
Abigail wrote:
> On Sat, 22 Mar 1997 10:05:46 +0900, Christopher Wright wrote in comp.lang.perl.misc:
> ++ instance of the word. It seemed silly to read the whole log into an
> ++ array since the only data I would be interested in 90% of the time was
> ++ the last section.
> Uhm, the solutions presented here *do* read in the whole file.
> You just don't notice it.
>
> ++ A different question though to solve the problem - can I write the file
> ++ "backwards" in the first place ? (ie put the line of log text at the
> ++ front of the file rather than at the end ?)
> Well, only if you move the file. You end up with reading and writing
> the entire file, in stead of just meddling with the end.
> In most case, not at all worthwhile.
If Christopher cares more about reducing the amount of time
invloved in manipulating this log file than the amount
of disk space it consumes, he should consider making the
file use fixed-length records. If he can guarantee that
each log entry is a fixed size than it's trivial to jump
around to any arbitrary record.
If I recall, his original query was how to print the tail
(last 20 lines) without reading the whole file.
This is quick & easy with fixed length records:
open(FILE,$filename) or die(...);
seek(FILE, -($record_length * $num_recs), 2);
while ($num_recs--) {
read(FILE, $record, $record_length);
# format and print $record
}
--
Devin Ben-Hur <dbenhur@egames.com>
eGames.com, Inc. http://www.egames.com/
eMarketing, Inc. http://www.emarket.com/
"It's better to be lucky than good." -- Elizabeth Bourne
------------------------------
Date: Tue, 25 Mar 1997 12:53:48 +1100
From: Martien Verbruggen <mgjv@comdyn.com.au>
Subject: Re: making links on the fly
Message-Id: <3337302C.245F@comdyn.com.au>
William Byrd wrote:
>
> I am new to perl, and am just laerning the language itself as a way to
> do some stuff from web pages, so anything that my perl scripts output
> must be able to print back through the web properly. I am fairly
> experienced with HTML and the forms needed for links, but what I am
HTML?
What about CGI? Have you read the CGI specs? or even the FAQ? Have you
asked on one of the groups devoted to CGI?
> having a problem with is this I have written a script which does the
> following:
[snip]
> This caused server configuration error to be returned.
Does it run from the command line? Did you think of returning a Content
type before starting to print stuff to output?
*sigh*
Have I seen this before?
--
Martien Verbruggen
Webmaster www.tradingpost.com.au
Commercial Dynamics Pty Ltd, N.S.W., Australia
------------------------------
Date: Tue, 25 Mar 1997 00:28:33 -0800
From: Jeff Silverman <Jeff@doom.jetinternet.com>
To: Jerome O'Neil <joneil@is.ssd.k12.wa.us>
Subject: Re: Perl Data Structures Cookbook. Wher did it go?
Message-Id: <33378CB0.2F06@doom.jetinternet.com>
Jerome O'Neil wrote:
>
> I am having some problems finding Tom's Perl Data Structures Cookbook
> on-line. The FTP site says it isn't where it used to be, and I'm
> wondering if it is somewhere else?
>
> Thanks!
>
> Jerome
Jerome,
Try ftp://ftp.epix.net/pub/languages/perl/doc/manual/html/perldsc.html
BTW, I live in Seattle - where are you?
Jeff Silverman
jeffs@statsci.com
------------------------------
Date: Tue, 25 Mar 1997 08:09:38 GMT
From: mlaker@contax.co.uk (Markus Laker)
Subject: Re: Perl Interpretors
Message-Id: <5h8151$bm1$1@newsserver.dircon.co.uk>
dianne cooper <cooper15@hsonline.net> wrote:
> I'm setting up my own server and I've been looking all over
> for a perl interpretor for Windows95. The only ones I find are
> for UNIX. Do I need to pay or order one? Or are they for
> download? I'd be glad if you could help me.
Point your Web browser at <http://www.activeware.com> and download
build 304, which became available over the weekend.
[Mailed and posted]
Markus Laker
------------------------------
Date: 25 Mar 1997 09:55:12 GMT
From: "Josep Jover" <jjover@correu.andorra.ad>
Subject: Problem with chdir
Message-Id: <01bc3901$bf7508c0$d0419ec2@SUZUKA.andorpac.ad>
Hi,
I've got Perl 5.0 with Windows NT server 4.0 and my scripts work good, but
when I want to use the function 'chdir' to change the directory of work
nothing happens.
In the Internet Information Server I define that :
Description Folder Alias
----------------------------------------------------------------------------
---------------------------------------------
The HTML pages are in the directory C:\InetPub\wwwroot <root>
The scripts are in the directory C:\InetPub\scripts /Scripts
The system C:\WINNT\System32\inetsrv\iisadmin /iisadmin
(default values)
When I use the function 'cwd' I retrieve C:\InetPub\scripts
I try all that I imagine to change the actual directory, but not result.
chdir('/'); chdir('//');
chdir('\'); chdir('\\'); chdir('..');.
Anybody knows what mistake I do ? I look in the book "Perl 5.0 CGI Web
Pages for Microsoft Windows NT" but I didn't found no answer.
Thanks for your help
Josep Jover
jjover@andorra.ad
------------------------------
Date: Tue, 25 Mar 1997 11:20:21 +0100
From: domo@tcp.ip.lu (Dominic Dunlop)
Subject: Re: Question
Message-Id: <19970325112021587642@[194.51.248.84]>
Andrew Koons <andy@wwdatalink.com> wrote:
> Does anyone know of a way to block specific countries from entering a
> page, using either a perl program or the server setup.
Think you're onto a loser here. Sure, I'm coming from a .lu domain just
now, but, if I dialled into CompuServe or MSN, I'd be coming from a .com
one. And if I were Libyan or similarly tainted, there'd be little to
stop me from making an international call to some point of presence in
some less taboo territory.
If your concern is merely legalistic rear-protection, you can lock out
particular top-level domains, or indeed sites or hosts that you don't
like. But such lock-outs are trivally defeated, so you'll be doing it
for show, rather than for effect.
--
Dominic Dunlop
------------------------------
Date: Mon, 24 Mar 1997 21:46:21 -0600
From: Gabriele R Fariello - 608-576-8660 <gabriele@clotho.com>
To: Michael Stearns <mstearns@darkwing.uoregon.edu>
Subject: Re: Reg. Expressions with Associative Arrays
Message-Id: <33374A8D.16CC28A9@clotho.com>
Michael Stearns wrote:
>
> This script is really a small part of a bigger script that converts a
> Framemaker .mif file to html. This script picks up where I have already
> parsed out all Frame's table description info and I am left with a bunch
> of html-formatted tables that all have unique imbedded ids. My problem
> is that the mif document stores all the table content in one place and
> has a corresponding unique id tag (Called AFrame) for the tables in
> another part of the document. With my limited knowledge of PERL, I am
> trying to use associative arrays to store the ids and then make the
> proper table replacements for the AFrame placeholder. Can anyone see
> what I am doing wrong here, or if there is an altogether easier method,
> I'd be interested in hearing that, too. I have included a very watered
> down example of what I have in the mif file at the bottom.
>
> Thanks,
> Michael Stearns
Most of your problem is in the regex. the .* with the s option set will
match not only end-of-line chars, but also <table> and </table> until it
is full and can still make the regex be true. Thus m/(<table>.*</table>/
using your data set will match from the FIRST <table> to teh LAST
</table> including all <table> and </tables> inbetween. use either the
class [^(<table>)] so as to not match the <table> tag or simply [^<] if
there are no other <> tags to contend with.
Some other bugs were fixed, but take a look at what I have (and remember
to delete carriage returns on lines that are wrapped but should not be).
Try this
#!/usr/local/bin/perl
foreach (@ARGV) {
open (INFILE,"$_") || warn ("Can't Open $_: $!\n");
#@table=<INFILE>;
#$table=join("",@table);
#$tableTemp = $table;
# I'd Use this, but I have $tableTemp Defined as a string for testing
$tableTemp = $table = join('',<INFILE>);
#Don't forget to close :*)
close(INFILE);
# Get only the table info into $tableTemp
$tableTemp =~ s|[^(<table>)]*<table>(.*)</table>.*|<table>$1</table>|s;
# Separate the tables with markers we can split on
$tableTemp =~ s|</table>[^<]+<table>|</table>SpLiT_hErE<table>|gs;
#I realize this step is a little convoluted, but I putting characters in
#so that I can use the split function in the following steps. I imagine
#it could be simpler.
if (
$tableTemp=~s!<table>\nid(\d+)([^<]+)</table>!$1SpLiT_hErE<table>$2</table>!gs)
{
%tableHash = split(/SpLiT_hErE/, $tableTemp);
}
# I assume this is where I am going wrong, but I can't figure out how
# to make it work. I've tried a bunch of options.
$table =~ s/AFrame(\d+)/$tableHash{$1}/gs;
open (OUTFILE,">$_") || warn ("Can't Open $_\n");
print OUTFILE ($table);
close(OUTFILE);
}
--
Gabriele R. Fariello | Clotho Internet Consulting
gabriele@clotho.com | 33 University Square No. 251
(608)-576-8660 | Madison, WI 53715
------------------------------
Date: 25 Mar 1997 12:06:27 GMT
From: c.c.eiftj@33.usenet.us.com (Rahul Dhesi)
Subject: Re: term 'regular expressions' considered undesirable
Message-Id: <5h8f43$e1q@samba.rahul.net>
In <slrn5jdqd1.6vh.bet@onyx.interactive.net> bet@nospam.interactive.net
(Bennett Todd) writes:
>Unless I'm missing something, you need another state; perhaps rename "start"
>to "sawa" and add
> start: if input is 'a' go to state 'sawa' else if input is EOF
> go to state 'fail' else go to (aka remain in) state 'start'.
Yes, you are right. The whole thing, revised, is below.
===
Finite state machine to implement /^a.*?b.*?c/ .
Begin in state 'start'. The state machine scans its input and makes a
state transition on each input character. Once we have seen an input
character and made a state transition we never need to examine that
character again. Hence no backtracking. EOF represents the end of the
input stream:
start: if input is 'a' go to state 'sawa' else go to state 'fail'.
sawa: if input is 'b' go to state 'sawb' else if input is EOF
go to state 'fail' else go to (aka remain in) state 'sawa'.
sawb: if input is 'c' go to state 'done' else if input is EOF
go to state 'fail' else go to state 'sawb'.
done: declare a match.
fail: declare failure.
--
Rahul Dhesi <dhesi@spams.r.us.com>
a2i communications, a quality ISP with sophisticated anti-junkmail features
** message body scan immune to fake headers *** see http://www.rahul.net/
>>> "please ignore Dhesi" -- Mark Crispin <mrc@CAC.Washington.EDU> <<<
------------------------------
Date: Tue, 25 Mar 1997 08:24:50 +0000
From: Mr Matty <hayes@coventry.ac.uk>
Subject: Re: text to HTML
Message-Id: <Pine.OSF.3.91.970325082123.27363A-100000@leofric>
> [mail&post]
> Lewis Taylor wrote:
> > I am currently writing a primative text to HTML routine. I want to
> > replace all instances of double carriage return (\n\n) with a paragraph
> > tag. But this :
> >
> > $big_string =~ s/\n\n/<P>/g;
> >
> > does'nt seem to do anything. I have also tried the two \n's in a
> > variable to no avail. Other printable chars in place of \n\n work. Can
> > someone please help?
>
Have you tried using the chop function? This will get rid of the
CR LF's for you, then i just did somthing like this..
chop ($lineoftext);
$lineoftext =~ s/($lineoftext)/<p>$1</p>/;
Matty..
------------------------------
Date: Tue, 25 Mar 1997 08:30:51 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: undef in Arguments to Subroutines
Message-Id: <adelton.859278651@aisa.fi.muni.cz>
"Neil Edmondson" <neiled@enteract.com> writes:
> This will drive me more crazy. What am I missing?
>
> I call the subroutine using the following....
>
> &Make_Log_Entry($logfile,$email,,,,$comments);
>
>
> The subroutine has the following for loop.
> sub Make_Log_Entry {
> .
> .
> $record = "";
> $arglength = @_;
> for ($arg = 0; $arg < $arglength; $arg++) {
> if (defined $_[$arg]) {
> $record .= "$_[$arg]|";
> } else {
> $record .= "|";
> }
> }
> .
> .
> other good stuff
> .
> .
> }
> #############################
> I had hoped $record would end up looking like this:
>
> logfile text|emailaddress||||comment text|
>
> but instead it comes out like this:
>
> logfile text|emailaddress|comment text|
>
> Shouldn't the null arguments come across as undef, and shouldn't the "if
> defined" catch them??
No, it shouldn't. Somewhere in perldata man page there is written,
that when you interpolate null list in a list, it has no effect. So
(1, (), 3) is the same as (1, , 3), the same as (1, 3).
If you need to pass over undef value, you have to pass it:
&Make_Log_Entry($logfile,$email,undef,undef,undef,$comments);
Hope this helps.
[CC'ed to original poster.]
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: Tue, 25 Mar 1997 11:39:26 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <ebohlmanE7LKDq.3FJ@netcom.com>
Tim Behrendsen (tim@a-sis.com) wrote:
: Indeed, which is why it will never be dominant (note I did
: *NOT* say successful, which is a different thing). Microsoft
: et al have an incentive of fundamental survivability, and
: Linux does not. Commercial operating systems will always be
: a few steps ahead of free operating systems, simply because
: they have to be to survive, and that is a much more powerful
: incentive than some guy working part time on some part of
: the operating system, particularly when that same guy is
: probably working on a commercial O/S in order to put the kids
: through college. Do you think he is going to put something
: into Linux that he wouldn't put into his commercial baby?
Quite possibly yes, because the "commercial baby" isn't his, it's his
boss's, and his boss's reasons for deciding what does/doesn't get put in
may very well be motivated by office politics (perhaps the feature that
the developer thinks would enhance the product's survival is being
strongly advocated by another manager who's competing with the
developer's boss for a possible promotion, so putting the feature in
would increase the promotability of the boss's rival). Or the software
may be released before it's completely ready because missing a deadline
would adversely affect the company's stock price, even though a premature
release would lead to increased support expenses in later quarters. Or a
simple change may require a month's worth of signature-getting, so the
developer doesn't bother to implement it.
Now this doesn't necessarily imply the opposite of what you were saying,
that free software is going to be of inherently better quality than
commercial software, but it does imply that the actual comparison is a
lot closer than you make it out to be.
Another consideration is that in many cases the market for free software
consists of those who are going to use it hands-on while the market for
commercial software consists of those who make the purchasing decisions
for their company, and in many cases those decisions are made with little
input from the actual users. Thus a large commercial software firm may
not feel it worthwhile to invest much in development that doesn't create
something that impresses computer-illiterate managers, even if that
development would enhance the usability of the software. This acts to
reduce the disparity in practically available resources between the free
software developer and the commercial software developer.
Now in some areas, commercial software is definitely going to have an
advantage over free software; mass-market consumer software is going to be
one of those, because the software marketing process is much more
important than the software development process in determining success in
that sort of market; what goes on the box is more important than what goes
in the box.
------------------------------
Date: Tue, 25 Mar 1997 11:51:27 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: What's a bad Perl book?
Message-Id: <ebohlmanE7LKxs.3wF@netcom.com>
Tom Christiansen (tchrist@mox.perl.com) wrote:
: Well, I find "Java in a Nutshell" to be a very bad Perl book. :-)
Even worse is "The C Programming Language." :-)>
(Seriously, has anyone done any research on whether Perl is easier to
learn as a first or subsequent language, and if the latter, which first
languages make it easier and which make it harder? I sometimes think my
C background has sometimes gotten in the way of my learning certain
aspects of Perl.)
------------------------------
Date: Tue, 25 Mar 1997 13:03:08 +0100
From: Roberto Lupi <lupex@ascu.unian.it>
To: Geoffrey Hebert <soccer@microserve.net>
Subject: Re: When is a perl program too big?
Message-Id: <Pine.LNX.3.93.970325125023.104B-100000@ascu.unian.it>
On Sat, 22 Mar 1997, Geoffrey Hebert wrote:
> 1. When is a perl program too big?
>
> I am used to breaking projects into a series of small programs rather
> than one large program. There are multiple reasons for doing this on
> all the systems I have worked - memory, program execution time,
> programmer understanding and more.
Probably a better choice (in Perl) would be using perl modules and
objects (you need Perl 5 for OOP), the reasons for this choice are:
- Running only one instance of the Perl interpreter is much less resource
expensive than running one instance for several small programs.
- Every time you restart a Perl script, the Perl interpreter need to
reload and reprocess the entire script (the Perl interpreter is a
multi-phase interpreter).
> 2. Perl control program or UNIX shell.
>
> Based on what I read I would do the following to run a fairly complex
> system:
>
> break task into programs of size 50-400 lines
> create a perl control program to exec the system:
> example:
> system(edit input data) check return
> system(sort) check return
> system(update main file) check return
> system(sort)check return
> system(more update)check return
> system(sort)check return
> system(report)check return
> system(more reports)check return
>
> What would you do? Why?
Probably a better choice would be calling a clean-up subroutine each time
your program enters a new phase (edit input data, sort, ecc.): undefining
(see undef in perlfunc) unwanted variables should *probably* work.
> Email please heberts@microserve.net Thanks
--------------------------------------------------------------------
| e-mail addresses: lupex@ascu.unian.it
Roberto Lupi | lupex@eealab.unian.it
| snail-mail address: Via II Giugno, 29
| 60030 Pianello Vallesina (AN)
| Italy
| phone: +39 (731) 704 106
-------------------------------------------------------------------
------------------------------
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 175
*************************************