[9108] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2726 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 26 14:07:22 1998

Date: Tue, 26 May 98 11:00:33 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 26 May 1998     Volume: 8 Number: 2726

Today's topics:
    Re: -e under NT and UNIX (Daniel)
    Re: .= food for thought? (Craig Berry)
        [HELP] perl and databases for dummies? <mblase@yahoo.com>
        ASP vs CGI <marshaln@shaw.wave.ca>
    Re: Best way to load ASCII files <rootbeer@teleport.com>
    Re: Copylefting manuals (Greg Lindahl)
    Re: Determining Opsys at runtime <barnett@houston.Geco-Prakla.slb.com>
    Re: Efficient Regex's <rootbeer@teleport.com>
    Re: file size with perl and win NT (Jim Lawhon)
    Re: Getting rid of carriage returns (Chris Nandor)
    Re: GNU attacks on the open software community (Chris Nandor)
    Re: GNU attacks on the open software community <keithmur@mindspring.com>
    Re: GNU attacks on the open software community (Abigail)
        hash of hashes in Berkeley DB? tarou@kormedia.com
    Re: Have we got a good free Perl manual? (Greg Lindahl)
    Re: How to add invisible counter on Web page (brian d foy)
    Re: How to add invisible counter on Web page (Craig Berry)
    Re: new to OO Perl (John Porter)
    Re: perl variables (brian d foy)
        Postscript module or Library??? (Michael Murphy)
    Re: replace line in file (brian d foy)
    Re: Statistics for comp.lang.perl.misc <p-fein@uchicago.edu>
        string to ASCII question <tenfoot@ddaccess.com>
    Re: system call question (Mike Stok)
    Re: while, each & assoc array (John Porter)
    Re: while, each & assoc array (Paul David Fardy)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 26 May 1998 17:26:07 GMT
From: daniel.mendyke@digital.com (Daniel)
Subject: Re: -e under NT and UNIX
Message-Id: <6ketvf$tbm$1@nntpd.lkg.dec.com>

In article <6kejmk$vmp$1@nntpd.lkg.dec.com>, daniel.mendyke@digital.com 
says...
>
>
>I need to verify the existence of a file.
>My script must run under both NT and UNIX.
>I've used 
>

The problem is not that I'm running under
UNIX and WIN32 but that the UNIX system
is through a server.  

The line is in a pl CGI script and I'm 
trying to insure the existance of image
file before displaying them.  

My development system is NT using ISS ver 3.
if I run the line 
'print qq(it's here!) if -e $image;'
from the command line it works.  But when
calling up the script through a browser it
doesn't.  

I'm looking for a way to verfiy the existence
of image files before trying to display them.


Daniel Mendyke 
==============================================
daniel@virtualvoices.com
Sell it OnLine at http://www.virtualvoices.com
==============================================



------------------------------

Date: 26 May 1998 17:02:16 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: .= food for thought?
Message-Id: <6kesio$bd8$1@marina.cinenet.net>

Charlie Stross (charlie@antipope.org) wrote:
: On 22 May 1998 22:04:30 GMT, Craig Berry 
: <cberry@cinenet.net> wrote:
: >No, he was asking for an op= form for prepending a string; like if it were
: >(say) @=, you could do
: 
: Oh. 
: 
: Why bother? I mean, there's the dot [concatenation] operator; there's also
: substr() and splice() and friends, and it's not too hard to roll your own
: sub to prepend one string to another. 

By that logic, why bother having +=, ++, and the like?  It's trivial to
mimic x op= y with x = x op y, and x++ with x += 1 or even x = x + 1
(taking proper care to do this in the right order wrt other operations). 
All such shorthands are merely there to make concise, elegant expressions
possible. 

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: Tue, 26 May 1998 11:59:20 -0500
From: Marty Blase <mblase@yahoo.com>
Subject: [HELP] perl and databases for dummies?
Message-Id: <356AF4E8.FABEBB1F@yahoo.com>

I'm a perl4 programmer (duck/hide) who's a little confused about the use of
modules in perl5, especially regarding database interaction. I've got the
O'Reilly 2nd edition perl book, which explains DB_File along with the other
standard library modules, but it's not too helpful to an inexperienced
databaser like me.

I'm trying to learn how to interact with popular databases in UNIX
specifically by using perl CGI scripts, but all the books I can find only
explain how to interact with databases directly. Is there a good "dummies
guide" for using perl to control databases anywhere, either on the web or in
print?

Please email any replies to mblase@yahoo.com. Thanks in advance!


- Marty


------------------------------

Date: 26 May 1998 17:09:46 GMT
From: "Neil Marshall" <marshaln@shaw.wave.ca>
Subject: ASP vs CGI
Message-Id: <01bd88c9$13892140$65d01eac@111964.tmi.telus.com>

Hello!  I am asked to do an investigation in server-side programming
language.  I read articles and get an impression that ASP is a more
powerful tool and a less learning curve than CGI.  Is that true?  Fairy
story?  However, what I want from you PERL experts are Pro's and Con's of
PERL programming.  It would refect a decision making to choose the right
programming language to suit with user and system requirements.

Thanks,

Neil  


------------------------------

Date: Tue, 26 May 1998 17:25:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Best way to load ASCII files
Message-Id: <Pine.GSO.3.96.980526102426.27437G-100000@user2.teleport.com>

On Tue, 26 May 1998, eric basley wrote:

> Do you know the best way to load files ?

Generally, I use Perl's I/O operators, like the line input operator,
documented in perlop. But maybe you have a different definition of "best"
than I do. Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: 26 May 1998 15:52:57 GMT
From: lindahl@pbm.com (Greg Lindahl)
Subject: Re: Copylefting manuals
Message-Id: <6keogp$be1@news3.newsguy.com>

Sami Sandqvist <samiss@cc.tut.fi> writes:

> I work as a programmer. In my country, if not otherwise agreed on, the
> employer gets the copyrights for my code. I can not GPL it. Would you
> not want to answer my questions about, for example, Perl? Am I evil?
> Do I "refuse to cooperate"?

Please do not put words such as "evil" into other peopole's mouths.
That just generates unnecessary flamewars.l

-- g


------------------------------

Date: Tue, 26 May 1998 11:57:28 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
To: Grimes <fgrimes@hotmail.com>
Subject: Re: Determining Opsys at runtime
Message-Id: <356AF478.595EC882@houston.Geco-Prakla.slb.com>

[courtesy cc to cited author]

Grimes wrote:
> 
> What's the best way to determine if script is running on Windows or Unix at
> runtime?  I suppose I could try to execute some platform-specific command
> and test for failure or success.  Is there a better (standard) way?
> 
> Thanks...
	perl -e 'print $^O'

prints:
	solaris
for me.


Have a look at the $^O variable using perldoc perlvar for more details.

Cheers,
Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

----------------------------------------------------------------------
Dave Barnett                 U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng    U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------


------------------------------

Date: Tue, 26 May 1998 17:22:21 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Efficient Regex's
Message-Id: <Pine.GSO.3.96.980526101314.27437F-100000@user2.teleport.com>

On Tue, 26 May 1998, Wade Williams wrote:

>    /^ID,(\d+)$/  && do

>    /^fired,(\d+)$/  && do

>    /^hits,(\d+)$/ && do

> This is just snippet of the real code.  In reality, there's probably 40
> or so Regex's in the while loop. 

What if you did something like this?

    if (($name, $val) = /^(\w+),(\d+)$/) {
	if ($keepers{$name}) {	# hash with 'hired', 'hits', etc
	    do_whatever;
	} elsif ($name eq 'ID') {
	    ...
	}
    } elsif ( # check some other kind of pattern, if needed...

Now it should be faster, I think. (If any of the 40 possible words has a
different action, you may even be able to usefully use a coderef as the
value of the hash. But if you don't know what that means, ignore it. :-)

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Tue, 26 May 1998 17:20:39 GMT
From: jim_lawhon@bigfoot.com (Jim Lawhon)
Subject: Re: file size with perl and win NT
Message-Id: <356af6b2.423306903@news.compuserve.com>

On Tue, 26 May 1998 15:10:13 GMT, vasile@club-internet.fr (Vasile
CALMATUI) wrote:

>Hello
>I have also a problem with big files under  Win95.
>The problem is that I can read only the first 4-5 Mb from the file (total length is 25 Mb).
>It works well by splitting the file in some little files of 4 Mb.
>Is this a Perl limitation ? Or Win95 ? On Perl under Win95 ?
>Had anybody else this problem ? A solution ?
>
>PS : I'm using Perl for Win32 "normal version" (not ActiveState) version 5.004_02
>- -
>Vasile Calmatui
>vasile@club-internet.fr
>http://www.chez.com/vasile/

It has been about 4 years since I've processed any files of that size.
(ASCII files with fixed length records)  I was using PERL under DOS.
I would be shocked to learn that newer versions of PERL would not do
this.   

Where is your script failing?  Does it appear to function properly
(except for processing the entire file) or are there error conditions?
EOF condition?  Out of memory?  



------------------------------

Date: Tue, 26 May 1998 17:23:34 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Getting rid of carriage returns
Message-Id: <pudge-2605981317580001@dynamic265.ply.adelphia.net>

In article <6keou9$2nf$1@sloth.swcp.com>, "Oban Lambie"
<oban@brownrice.com> wrote:

# Little help please...
# 
# I'm using numerous perl scripts that write to straight line text file
# databases and I don't know how to get rid of carriage returns when they are
# submitted via a web form.
# 
# $submittedText  =~ s/\n/\<br\>/g;
# 
# Above substitution line doesn't do it.
# 
# Eternal gratitude if someone can help me.

Please see comp.infosystems.www.authoring.cgi.  Your problem is that the
"newline" from a web form is not a newline, it is a CRLF sequence
(\015\012).

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


------------------------------

Date: Tue, 26 May 1998 17:30:07 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: GNU attacks on the open software community
Message-Id: <pudge-2605981324310001@dynamic265.ply.adelphia.net>

In article <6keqpp$l4g$1@halcyon.com>, tzs@halcyon.com (Tim Smith) wrote:

# Chris Nandor <pudge@pobox.com> wrote:
# >No, I am not.  What I did not do is properly tie it in to the legal
# >principle involved here, which is market effect (well, I did not tie it in
# >the first time I mentioned this, though I did in later posts).
# >
# >  A.  Tom allows distribution on thousands of CD-ROMs
# >  B.  A new CD-ROM comes out with perlfaq, Tom tries to stop it
# >  C.  Tom has to prove that this new CD impacts the potential market,
which I 
# >      cannot see how he could do
# >
# >Tom has allowed this market to change, knowingly.  He cannot, therefore,
# >come back and say that continued infringement affects his market, so the
# >CD maker claims fair use and that's the end of it.
# 
# That's hardly the end of it.  Market affect is only one of the four
# factors in determining fair use.  True, it is usually the most
# important, but in a case where the use is of the entire work, and is
# reproductive rather than productive, and is commercial and public rather
# than private and non-commercial, I don't think fair use will be found by
# the courts.

Well, read my post about Salinger's letters.  They were looking to
publicly, commercially reproduce entire works, but they lost not because
of that, but because of market effect, and because the works had not
previously been published (i.e., nature of the copyrighted work, the 2d of
the criteria for fair use).  Specifically, "nature" addresses whether or
not the work has been published before.

You could also use the 1st of the criteria: purpose of use.  On most
CD-ROMs, the publisher doesn't really care to make any profit from perlfaq
itself, but wants to give the user of the CD-ROM easy access to what is
already available without cost.  Purpose of use takes into account whether
or not the use is in the public interest, and I think reproduction of
perlfaq on Red Hat and Debian CDs clearly is.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


------------------------------

Date: Tue, 26 May 1998 12:40:31 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: GNU attacks on the open software community
Message-Id: <356AFE8F.4DDE5B75@mindspring.com>

Barry Margolin wrote
> 
> In article <3565B905.DC80058C@mindspring.com>,
> Keith G. Murphy <keithmur@mindspring.com> wrote:
> >I must confess partiality to "freed", as someone else suggested.  It's
> >short, and nicely conveys the idea that the freedom was conferred upon
> >the software, and has permanence.  Just like a freed slave.
> 
> But "freed" implies that it was once not free.  A freed slave is a person
> who was once a slave, but had his slavery terminated.  Someone who has
> always been free is not freed.  And in general, free software is born free,
> it is not usually proprietary software that has since had its freedom.

Hmmm.  If I sat down here and wrote some code, it wouldn't be free.  If
I then stuck the GPL on it, I guess it would.  It wouldn't be born free;
I'd have freed it.  But all that depends on when you stick the GPL on, I
guess, so it's getting a bit ridiculous.  But it doesn't seem to me
quite so obvious that software is "born free"; in fact, by default, it
is not.
> 
> There are a few exceptions, though: Mozilla would be an example of freed
> software (it was born as the proprietary Netscape).
> 
Of course, if you mean point of release as analogous to birth, you're
right.

By the way, the incorrect (according to you) implication that it was not
always free, does *what* kind of harm?


------------------------------

Date: 26 May 1998 17:48:20 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: GNU attacks on the open software community
Message-Id: <6kev94$1pr$1@client3.news.psi.net>

Jan Vroonhof (vroonhof@frege.math.ethz.ch) wrote on MDCCXXIX September
MCMXCIII in <URL: news:by7m39j9y0.fsf@bolzano.math.ethz.ch>:
++ abigail@fnx.com (Abigail) writes:
++ 
++ > Could you point out why there is no comment about non-free books for
++ > the other items?
++ 
++ As I didn't write the document, no I cannot. Neither can I point
++ point out why the perl item is above the X books.
++ 
++ Does it matter that much?


Judging to the number of postings, I'd say "yes".



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


------------------------------

Date: Tue, 26 May 1998 17:22:50 GMT
From: tarou@kormedia.com
Subject: hash of hashes in Berkeley DB?
Message-Id: <356af8f2.16093604@news.comstar.com>

Just a quick question Is it possible to write a hash of hashes to a
Berkeley DB file using Perl? I've tried it and I seem to be able to
access it in the same script that loads the information from a flat
file. The problem comes when I try to open the file and read the hash
of hashes after loading it in another script.
I am able to get the original key-value, but am unable to get the
values from the next hash. Any ideas?

tarou@kormedia.com


------------------------------

Date: 26 May 1998 15:50:07 GMT
From: lindahl@pbm.com (Greg Lindahl)
Subject: Re: Have we got a good free Perl manual?
Message-Id: <6keobf$be1@news3.newsguy.com>

tina@scandinaviaonline.se (Tina Marie Holmboe) writes:

>   What I *cannot* understand, however, is the fact that there are 3.7 MB
>   of manual pages distributed with the version of Perl 5.004 installed
>   locally.

rms was writing about something that took place many years ago. Perl
version 5.004 was not available many years ago.

>   But perhaps I've gotten this wrong - the man-pages ain't as free as Perl?

Go check the copyright and license. Then please post carefully as to
not generate unnecessary flamewars.

-- g


------------------------------

Date: Tue, 26 May 1998 13:10:30 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: How to add invisible counter on Web page
Message-Id: <comdog-ya02408000R2605981310300001@news.panix.com>
Keywords: from just another new york perl hacker

In article <01bd88ad$e63b2f00$974b88cf@fundata.com>, "JP" <pangjo@vincentinc.com> posted:

>We are running Novell Web server with Perl interpeter installed.  We would
>like to keep track of the main page without letting the users see the
>counter.  
>
>Can anyone tell me what I should do to accomplish this.  Thanks in advance.

grep the access logs.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>


------------------------------

Date: 26 May 1998 17:47:30 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to add invisible counter on Web page
Message-Id: <6kev7i$bd8$2@marina.cinenet.net>

JP (pangjo@vincentinc.com) wrote:
: We are running Novell Web server with Perl interpeter installed.  We would
: like to keep track of the main page without letting the users see the
: counter.  
: 
: Can anyone tell me what I should do to accomplish this.  Thanks in advance.

With full access to the server logs, it's *far* better to analyze those
logs than to rely on an on-page hit counting scheme.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: Tue, 26 May 1998 17:25:04 GMT
From: jdporter@min.net (John Porter)
Subject: Re: new to OO Perl
Message-Id: <MPG.fd4c6c8cf51e9d29896ed@news.min.net>

I know you said you've returned to doing this "the old way",
but you may as well learn how to do it the OO way; it's
good stuff, you know.  No need to get frustrated.

I think you want to make the %props and @format data items
contained within each object, but as you had it, they are
"class static" (to use a C++ term).

Make the following substitutions throughout your code:
   In place of:             Use:
   $props{$key}             $self->{'props'}{$key}
   %props                   %{$self->{'props'}}
   $format[$index]          $self->{'format'}[$index]
   @format                  @{$self->{'format'}}
(for all values of $key and $index)


> package COBPerson;
> use Carp;
> 
> my %props;
> my @format;

Delete these two declarations; they should be package variables.


> sub new 
> {
> 	my $self = { };

Do this instead:

	my $self = {
	  'props' => {},   # ref to empty hash
	  'format' => []   # ref to empty array
	};

>....

> 	$props{'filename'} = $filename;

Make that:

	$self->{'props'}{'filename'} = $filename;

And so on.

> #
> # read the format
> #
> sub loadformat 
> {
>         my $self = shift;
>....
> 	@format = split(/\n/, $format);

Make that:

	@{$self->{'format'}} = split(/\n/, $format);




------------------------------

Date: Tue, 26 May 1998 13:05:54 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: perl variables
Message-Id: <comdog-ya02408000R2605981305540001@news.panix.com>
Keywords: from just another new york perl hacker

In article <35698E9B.DDD778F2@matrox.com>, Ala Qumsieh <aqumsieh@matrox.com> posted:

>Mike Stok wrote:


>> >This actually needs to be
>> >
>> >    if (index ($var, '@') <= $[) {
>> >      ...
>> >    }
>> >
>> >to work right
>
>Ever heard of regular expressions?if ($var =~ /\@/) {
>    ...
>}--

why do you insist on writing a regular expression for everything?
index() was made for this task - don't you think it's optimized
to perform it? (try using Benchmark if you are unsure).

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>


------------------------------

Date: Tue, 26 May 1998 12:52:48 -0500
From: mike_murphy-ppk@nortel.com (Michael Murphy)
Subject: Postscript module or Library???
Message-Id: <mike_murphy-ppk-2605981252500001@nppkm606.us.nortel.com>

Does anyone know of an existing module or library for creating postscript
files?  I found the HTML::Formatter that can turn html into postscript but
that's not what I need.  I've also searched CPAN and deja-news.

TIA, 
Mike Murphy

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Mike Murphy              ~ Nortel                   ~
~  my opinions are my own  ~ Raleigh, North Carolina  ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


------------------------------

Date: Tue, 26 May 1998 13:08:59 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: replace line in file
Message-Id: <comdog-ya02408000R2605981308590001@news.panix.com>
Keywords: from just another new york perl hacker

In article <35699BE2.475FC8E5@matrox.com>, Ala Qumsieh <aqumsieh@matrox.com> posted:

>Ryan McGuigan wrote:
>
>> for example, if I try to replace testing with kill, I'll end up with
>> killing.
>>
>> here's a small bit of code
>> open TEST, '+<testfile' or die "can't open it. $!\n";
>> while (<TEST>) {
>>         if ($_ =~ /$search/) {
>>                 print TEST "kill";
>>         }
>> }
>> close TEST;

> Maybe you'de like to investigate the \b (boundary) assertion.

he'd do better to replace entire lines according to the FAQ.  a
boundary assertion is of limited use for in-place editing, and
certainly doesn't solve this problem.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>


------------------------------

Date: Tue, 26 May 1998 17:40:01 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <87iumtue1a.fsf@bj2-64.rh.uchicago.edu>

Well, that was telling. ;)
-- 
Peter Fein                                                         773-834-6206
1005 E. 60th St.                                              Chicago, IL 60637
p-fein@uchicago.edu                                   http://pfein.home.ml.org/



------------------------------

Date: Tue, 26 May 1998 13:49:21 -0400
From: "Brian" <tenfoot@ddaccess.com>
Subject: string to ASCII question
Message-Id: <6kevds$qgf@world6.bellatlantic.net>

Hi, i am new at this perl stuff - so here goes:

I need to convert an array of characters to its numeric ASCII value.

if anyone knows how i can do this, i would appreciate the help!!

please reply via email
thanks alot!
-Brian
tenfoot@ddaccess.com




------------------------------

Date: 26 May 1998 18:19:35 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: system call question
Message-Id: <6kf13n$5sc@news-central.tiac.net>

In article <01bd889f$a1055220$1bbdc9c2@pnnac93.pncl>,
Paul Dalton <pauldnospam@pncl.co.uk> wrote:
>Hello,
>	I need to do a whois query from a www page. Can I pass the domain to check
>to the shell and do a lookup and then pass the output back to the browser?
>My initial attempts have led to premature termination of header errors. My
>book on perl says that system() only returns it return code, not the output
>of the command run. Am I going to have to write my whois output to a file
>and then read it in?

Have you set $| to 1 and sent the headers before calling whois?  If not
you're most likely suffering from the perl script's output being buffered
by stdio and appearing after the output from whois.

bRIAN d fOY has a useful CGI meta-faq on http://www.computerdog.com and
Tom Christiansen has the idiot's guide to solving Perl/CGI problems at
http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html which might
help you out.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


------------------------------

Date: Tue, 26 May 1998 17:10:01 GMT
From: jdporter@min.net (John Porter)
Subject: Re: while, each & assoc array
Message-Id: <MPG.fd4c3405e167ab99896ec@news.min.net>

This thread is no longer appropriate for comp.lang.perl.misc, you know.

On 25 May 1998 04:19:53 GMT,
in article <6karh9$lks$1@coranto.ucs.mun.ca>,
pdf@morgan.ucs.mun.ca (Paul David Fardy) wrote:
> 
> I dislike
> Stroustrup's "int* ptr;" and I discourage its use because it suggests
> that "int* ptr1, ptr2;" is a declaration of two pointers.
> This isn't good idiom. It's just idiosyncrasy.

A better solution to that problem is to eschew that syntax for
declaring multiple variables.  So rather than
	int a, b;
one should instead say
	int a;
	int b;
There are no good reasons to do it the first way anyway 
(speaking Fortran natively not withstanding).

And so, if one uses the second form, the problem you talk about
never arises, and your argument against "int* ptr" is utterly moot.
	int* ptr;
is good idiom, and completely unidiosyncratic.

But why are we talking about this on clpm?

John Porter


------------------------------

Date: 26 May 1998 17:16:11 GMT
From: pdf@morgan.ucs.mun.ca (Paul David Fardy)
Subject: Re: while, each & assoc array
Message-Id: <6ketcr$cu$1@coranto.ucs.mun.ca>

Paul David Fardy <pdf@morgan.ucs.mun.ca> wrote:
> the subject.  Can anyone explain why some don't like "cuddled
> elses"?  I find that cuddled elses increase the likelihood that
> a particular block of code can be displayed fully in limited space
> which usually eases comprehension.

"Jari Aalto+mail.perl" <jari.aalto@poboxes.com> writes:
>You asked for opinion :-) I look code purely from visual perspective
>and the best code is always "airy", not tight to me. So using the
>new styled brace alignment, is easier to read and focus on, because
>with K&R style the openeing brace goes too far right.

>    if ( this and that and more on this condition last to the end ) {
>       code 
>       code
>       code
>    }

>To me, the brace to the right is catasrophic :-) It's much more visually
>pleasent to read it like above. Code is also placed "even" when 
>braces surround it.

>    if ( this and thant and more on this condition last to the end )
>    {           
>       code 
>       code
>       code
>    }


Well that helps me understand a little, thanks. (.. though I don't
know how representative your opinion is.)

Let me ask a leading question:  Where do you stand on highlighting
keywords?  I find that this distracts from the real code.
The statements and expressions are more important than the syntax.
I find that the same applies to braces: they don't deserve such
attention.  Of course they are important, and so are keywords,
but they are there to support the code and should not be intrusive.

That's the beauty of indentation.  It does not say "Look at me!".
Just the opposite: it silently says "Look: these lines are a block. -->"

It's my belief that the braces provide little to the human reader
that isn't better provided by sensible indentation.  Both the code
samples above are quite clear to me because I rely on the indentation
to reflect the semantics of the code.  The highlighted open brace
adds nothing for me.  The close brace, on the other hand, is isolated
from its control; highlighting it, and including a visible link back,
adds value.

[ I say "braces provide little", but I'm thinking only of the
  simple comprehension of a block of code.  As they do for
  software parsers, the braces provide unambiguous formality for
  the code.  But if you're required to think in those terms in
  your regular programming, you're aren't going to meet many
  deadlines.  Programming should be more natural than that. ]

I principly dislike isolated braces because it wastes vertical
space.  For reasons already stated, I don't feel the space adds
anything valuable and I'm not talking about cramming code on to
the screen/window.  But if you add 6+ lines of "{" by reformatting
my 20 lines of code, it will no longer fit nicely in a 24 line
window.  I think that's an appreciable loss without any gain.

This is particularly significant with Perl because one can do
a lot with a little code, but Perl requires that even a little
code may contain several braces in flow control structures.


"Jari Aalto+mail.perl" <jari.aalto@poboxes.com> writes:
>  Just an opinion. Just as I prefer TheCapiTalizedFunctions over
>  The_capitalized_functions. The reasoning for this is that code is
>  "more beatiful" when token "_" is removed. I mean, if I can remove
>  puctuation, I do that everywhere --> English.pm always).

You said the best code is "airy", but now it seems, you're crammin'
identifiers together. :-)

Beauty is the eye of the beholder, but I'd bet you'd have to think
harder if your compiler reported

	"TheCapiTalizedFunctions" is not declared

than you would if your compiler reported

	"the_capi_talized_functions" is not declared

because capitalization doesn't delineate words as well as space
does.  I doubt you'd have missed that mistake in the first place.
Written languages use spaces for good reason and the underscore
is a good placeholder for a space.  The use of space/underscore
also works better with abbreviation

   (IsADevice vs ISADevice) vs (ISA_device vs is_a_device)

   SetRGBColour vs set_RGB_colour -- vs set_RGB_color :-)

Actually, the -our/-or debate is much the same as this one,
isn't it?

Paul Fardy
-- 
"The American abolition of -our in such words as honour and favour
has probably retarded rather than quickened English progress in
the same direction."
-- H. W. Fowler, Modern English Usage, 2nd ed.

"But everyone knows that such a change would be regarded by Britons
as a kind of linguistic cleansing, something not to be contemplated
in any circumstances.  And, of course, there is always a great
deal to be said for national pride concerning long-held tradition."
-- R. W. Burchfield, Fowler's Modern English Usage, 3rd ed.


------------------------------

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 2726
**************************************

home help back first fref pref prev next nref lref last post