[10474] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4066 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 25 17:05:39 1998

Date: Sun, 25 Oct 98 14:00:20 -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           Sun, 25 Oct 1998     Volume: 8 Number: 4066

Today's topics:
    Re: *Why* does clpm attract non-perl posts? (David Alan Black)
    Re: CGI - question about 'nph-' scripts - Please help! <tupshin@tupshin.com>
    Re: deadlock with flock() and open() (Abigail)
        faq? where is it? <avitala@macs.biu.ac.il>
    Re: faq? where is it? <jbharvey@auspex.net>
    Re: Gnu Unzip????? (Don Groves)
        How to respond to non-Perl posts (was Re: *Why* does cl <Russell_Schulz@locutus.ofB.ORG>
    Re: Not to start a language war but.. <tchrist@mox.perl.com>
    Re: Not to start a language war but.. <jbharvey@auspex.net>
    Re: Objects -vs- packages & hashes <jbharvey@auspex.net>
        Perl interfacing?? <dustin_kofoed@bc.sympatico.ca>
    Re: Perl interfacing?? <tupshin@tupshin.com>
    Re: Regular Expression Problem ??? <trevorh@curtco.com>
    Re: Regular expressions.. <trevorh@curtco.com>
    Re: Regular expressions.. (Bart Lateur)
    Re: What isn't Perl good for? (Abigail)
    Re: What isn't Perl good for? <dgris@rand.dimensional.com>
        why it must be `%%' (was Re: Using percent (%) in print <Russell_Schulz@locutus.ofB.ORG>
        Win32 Registry.pm incosistent for nonexistent toplevel  (Bob N.)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 25 Oct 1998 15:00:57 -0500
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: *Why* does clpm attract non-perl posts?
Message-Id: <71001p$h51$1@pilot.njin.net>

Hello -

Lloyd Zusman <ljz@asfast.com> writes:

>There will always be novices coming here, and many of them, being
>novices in the first place, are going to be unaware of netiquette and
>c.l.p.misc conventions.  The fact that the number of novices doesn't
>seem to be significantly decreasing says a lot more about Perl's
>quality, usefulness, and popularity than anything about some sort of
>fallaciously-imagined "reluctance" on the part of these novices to
>take their questions elsewhere.


Of course there is a range of cases and experiences, but I've definitely
seen/read defenses of the posing of CGI and other non-Perl or
para-Perl questions in clpm.

Besides, it comes back to the original question: all else being equal,
why don't people interested in X find their way to newsgroups about
X?  (Ummm, that's X as in a variable, not X as in X :-)

Any argument that can be made about why CGI questions end up in clpm
*should* apply to such questions ending up in comp...cgi.  Perhaps
the spillover is less than I think, as a percentage of all such
posters.  It's certainly strikingly high as a percentage of clpm
posters.


David Black
dblack@pilot.njin.net


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

Date: 25 Oct 1998 13:55:36 PST
From: "Tupshin Harper" <tupshin@tupshin.com>
Subject: Re: CGI - question about 'nph-' scripts - Please help!
Message-Id: <7106oo$b9f@chronicle.concentric.net>

This is actually not a Perl question.  Nph refers to non-parsed header, and
allows your CGI script to have it's output sent to the  web browser without
being modified by the web server.  Assuming that you're using Apache, read
the FAQ at http://www.apache.org/docs/misc/FAQ.html
The relevant portion is:

35. How can I get my script's output without Apache buffering it? Why
doesn't my server push work?
As of Apache 1.3, CGI scripts are essentially not buffered. Every time your
script does a "flush" to output data, that data gets relayed on to the
client. Some scripting languages, for example Perl, have their own buffering
for output - this can be disabled by setting the $| special variable to 1.
Of course this does increase the overall number of packets being
transmitted, which can result in a sense of slowness for the end user.
Prior to 1.3, you needed to use "nph-" scripts to accomplish non-buffering.
Today, the only difference between nph scripts and normal scripts is that
nph scripts require the full HTTP headers to be sent.

-Tupshin Harper
-Programmer/Network Administrator
-Studio Verso

Wrzek wrote in message <363337db.9450684@news.pg.gda.pl>...
>Hi,
>
>I want to write script in perl to push some information.
>I heard that souch script should be 'nph-' type, so first i tried
>to write a small script and change its name to nph-xx.cgi.
>
>My script xx.cgi works good, but when i changed its name to
>nph-xx.cgi Netscape try to save output istead of show the effect.
>
>Could somebody help me?
>
>Wrzek
>
>P.S. Sorry, I know that my English is poor :(
>
>
>==== My test script =========================================
>
>#!/usr/bin/perl
>
>print ("Content-type: text/html\n\n");
>print ("<html>\n<body>\n<center>\n");
>print ("<blink><font color='red' size='6'>OK</font><blink>\n");
>
>exit;
>
>==== My 'Push' script =======================================
>
>#!/usr/bin/perl
>
>    use CGI::Push qw(:standard);
>
>    [...]
>
>    do_push(-next_page=>\&next_page,
>            -last_page=>\&last_page,
>            -delay=>10);
>
>    sub next_page {
>        my($q,$counter) = @_;
>        return undef if $counter >= 10;
>        $last_updated = localtime (time);
>        return start_html('Test'),
>           [...]
>        end_html();
>      }
>
>     sub last_page {
>      my($q,$counter) = @_;
>         return start_html('Done'),
>         "<center>", h1('End'), "\n",
>           "<img src='./end.gif' border=0><br>", "\n",
>           $last_updated, "\n",
>                end_html;
>     }
>
>exit;
>




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

Date: 25 Oct 1998 18:52:59 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: deadlock with flock() and open()
Message-Id: <70vs2b$7iv$1@client3.news.psi.net>

Sam Holden (sholden@pgrad.cs.usyd.edu.au) wrote on MDCCCLXXXI September
MCMXCIII in <URL:news:slrn7358gc.5pi.sholden@pgrad.cs.usyd.edu.au>:
++ On 24 Oct 1998 23:26:59 GMT, Abigail <abigail@fnx.com> wrote:
++ >
++ >Its a common problem in databases. One process locks table A (or just
++ >a page) then table B. Then another process comes in and locks B first,
++ >then table A. Using a third, global, lock would reduce database managers
++ >to silly DOS applications. There's a reason multiple processes can
++ >exist on certain OSses.
++ 
++ Isn't this very deadlock the reason you don't attempt to hold more than one
++ lock at a time, unless those locks are _always_ obtained in a certain order?

Locking multiple things in unavoidable. Locking things in a certan order
is handy dandy if you know what to lock in advance, but in many situations,
the locking order is data driven - that is, external parameters decide
what to lock.

After all, your OS doesn't lock the things in a certain order - for the OS
the locking order is determined by external parameters: the applications
requesting locks.

And don't forget that sometimes it's more efficient in having deadlock
occur and solving it then then spending too much time in figuring out
how to avoid it.


Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Sun, 25 Oct 1998 20:03:34 +0200
From: "Avshi Avital" <avitala@macs.biu.ac.il>
Subject: faq? where is it?
Message-Id: <70vp9i$ciu$1@cnn.cc.biu.ac.il>

sorry if this seems a bit dumb, but where is the FAQ everybody is referring
to? is there more than one? is it a news group, or a web page? will there
ever be eternal peace?

curiously,

Avshalom Avital
Information Retrieval Laboratory
Bar-Ilan University, Israel
avitala@macs.biu.ac.il





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

Date: Sun, 25 Oct 1998 20:47:14 GMT
From: "Justin B. Harvey" <jbharvey@auspex.net>
Subject: Re: faq? where is it?
Message-Id: <36338E2C.EC7FFBC9@auspex.net>

Avshi Avital wrote:
> 
> sorry if this seems a bit dumb, but where is the FAQ everybody is referring
> to? is there more than one? is it a news group, or a web page? will there
> ever be eternal peace?
> 
> curiously,
> 
> Avshalom Avital
> Information Retrieval Laboratory
> Bar-Ilan University, Israel
> avitala@macs.biu.ac.il

www.perl.com where else? :)


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

Date: Sun, 25 Oct 1998 11:09:13 -0800
From: see@my.sig (Don Groves)
Subject: Re: Gnu Unzip?????
Message-Id: <MPG.109d1732e48ec873989735@news.europa.com>

In article <19981025122947.20908.00000806@ng82.aol.com>, mattjm82@aol.com 
says...
> Douse any one know were I can get Gnu Unzip?
> Thanks.

Yes, but first, please tell us by what logic you decided to
post this to a Perl newsgroup? 
-- 
Don Groves (groves_acm_org)
Replace underscores to get my email address


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

Date: Sun, 25 Oct 1998 12:58:08 -0500
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: How to respond to non-Perl posts (was Re: *Why* does clpm attract non-perl posts?)
Message-Id: <19981025.125808.1W3.rnr.w164w_-_@locutus.ofB.ORG>

dblack@pilot.njin.net (David Alan Black) writes:

> If someone is interested in CGI programming and/or Web administration
> and/or the vagaries of Micros**t IE, etc., why wouldn't that person
> actually WANT to participate in the appropriate newsgroups?

not as far as they know, no.

remember perl's audience -- it's no longer being exclusively used by
people who know netiquette, know how to design software as well as
anyone could, know correct locking, and have memorized the y-1900 error.

and these people simply never understood what they were doing when
they posted to the wrong group.

> To wit:  there are an awful lot of *answers* being provided on clpm to
> these off-topic questions, usually prefaced with, "Your question isn't
> really about Perl, but anyway..." or words to that effect.  It may well
> be kind-hearted and good to field these questions - but I wonder whether
> perhaps such fielding could be confined to email.

I think it should not.

if you answer, DO NOT JUST USE E-MAIL.  use news.  I see two benefits:

  1. the answer will be archived for others, who DO search first, to find.

  2. the answer (with a correct Followup-To: the right group, of course)
     will allow the thread to leave the perl group, and go somewhere
     where it is on-topic.  this way, you have not only answered the
     question, but redirected further questions.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: 25 Oct 1998 18:50:11 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Not to start a language war but..
Message-Id: <70vrt3$43d$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, cg@pobox.com writes:
:Perl is effectively a single-user language - no harm with that, but not
:suited for the numerous occasions when you need to modify someone else's
:code.

This is not the fault of the language: horrible programmers always create
unmaintainable code.  You cannot blame us that Perl is easier for bad
programmers to approach -- and be for their purposes successful with --
than is Python.  Given the reasonable estimates of at least thousand or
more perl programmers for every individual python programmer, I reckon
that if you had just 10% of the supercrappy programmers that we have
programming Perl come over to your sandbox to code up pessimal Python,
the same comment would apply.

--tom
-- 
    #define NULL 0           /* silly thing is, we don't even use this */
        --Larry Wall in perl.c from the v4.0 perl source code


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

Date: Sun, 25 Oct 1998 21:21:11 GMT
From: "Justin B. Harvey" <jbharvey@auspex.net>
Subject: Re: Not to start a language war but..
Message-Id: <36339620.1260E326@auspex.net>

What do you mean it's hard to modify someone else's code?  Works for
me...

Cees de Groot wrote:
> 
> Tom Christiansen  <tchrist@mox.perl.com> said:
> >In comp.lang.perl.misc, mso@eve.speakeasy.org (Mike Orr) writes:
> >:The more $@%{}/* -> => symbols, the better.  Who cares
> >:if the result is an unreadable code?
> >
> >This was a lie yesterday.  It is a lie today.  It shall be a lie tomorrow.
> 
> Well, it was the reason I moved from Perl to Python for SGMLtools, and
> I'm very happy I've done so. I've tried for 4 years to write R/W code
> in Perl, and then simply gave up (why try when there are alternatives?).
> Perl is effectively a single-user language - no harm with that, but not
> suited for the numerous occasions when you need to modify someone else's
> code.
> 
> --
> Cees de Groot               http://pobox.com/~cg          <cg@pobox.com>
> --- We're hiring Java developers => www.acriter.com


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

Date: Sun, 25 Oct 1998 20:54:06 GMT
From: "Justin B. Harvey" <jbharvey@auspex.net>
Subject: Re: Objects -vs- packages & hashes
Message-Id: <36338FC7.DE3958D2@auspex.net>

I don't really understand why you're doing all this, creating functions
that are done in perl, however you can bless an anonymous hash, and then
put your information in it like:

package Foo::Bar;

sub new {
    my ($class, $this) = @_;
    $this = { };
    bless $this, $class;
    return $this;
}

# That code above makes it so you now have an anonymous hash object.
# So to set things in the caller script:

$f = new Foo::Bar;

$f->{key1} = "information";

# Simple.

But let's say you want to open up a file with it, you can store
variables or handles (I think) in the hash, whatever you want.


Jamie Hoglund wrote:
> 
> Hi folks,
> 
> I use packages all the time, largely because I find them a convenient
> way to hide subroutine names and use variables that are global only to
> those subroutines that might use them.
> 
> One package I use is for accessing files, I have a rather large
> associative array that contains information about a particular file.
> 
> $State[$fh]{FILENAME}
>            {HEADER}
>            {etc}
> 
> Most of the subs have a '$fh' as a first argument, that $fh is used as a
> key into the hash to fetch state info for that particular file.
> 
> Doing things like:
> 
> $fa = &open_file("filename.a");
> $fb = &open_file("filename.b");
> 
> $dat_a = &read_line($fa);
> $dat_b = &read_line($fb);
> 
> would read a line from the appropriate file. (for this example) all the
> subs know what file to access and what variables to update by the $fb.
> 
> It works, but based on what little I know of object technology, it seems
> I'm reinventing objects.
> 
> Seemed to me, a $fb = new mypackage;
> 
> Where the &new() subroutine opens the file (among other things) and gives
> me an instance of "mypackage" so that &read_line becomes:
> 
> $dat_b = $fb->read_line();
> 
> *might* make more sense. (well, either way, I still have to keep track of
> $fb)
> 
> So I set out to try to understand what all this "instance of $fb" stuff
> was about.
> 
> in "new" I have something like:
> 
> package mypackage;
> $Testing = "We are set";
> sub new {
>   my($this) = shift;
>   my($class) = ref($this) || $this;
>   my($self) = shift;
>   my($class) = bless($self,$class);
>   return($self);
> }
> 
> sub set_var {
>    my($self)=shift;
>    $Testing = shift;
> 
> }
> 1;
> 
> The above doesn't work, unless I do a:
> 
> $self->{Testing} = shift;
> 
> My question is, are objects worth it?
> 
> Is there any grave danger in just using regular packages with "$fh" as a
> key into the hash? It seems a lot simpler to me.
> 
> There must be a way to avoid all that $self->{stuff}, and still get the
> desired effect. ("package-global" variables that are specific to this
> instance of a package)
> 
> I don't understand it, so I'm probably not seeing the real value of
> objects.
> 
> Jamie


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

Date: Sun, 25 Oct 1998 13:40:37 -0800
From: Preferred Client <dustin_kofoed@bc.sympatico.ca>
Subject: Perl interfacing??
Message-Id: <36339AD5.5792@bc.sympatico.ca>

Hello,

I just want to make a simple interface in Perl that will be linked to a
MySQL database.  I don't have much time to learn the language, and i
just need to know how to make such things as buttons, dropdown boxes,
scroll boxes and so on.  Are there any good resources on the net where i
could get this information?  I will be incorporating a Perl Script
interface into HTML to place on a website......................

Thanks, Dustin

dustin_kofoed@bc.sympatico.ca


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

Date: 25 Oct 1998 13:46:42 PST
From: "Tupshin Harper" <tupshin@tupshin.com>
Subject: Re: Perl interfacing??
Message-Id: <710682$ara@chronicle.concentric.net>

Look at the DBI and CGI Perl modules.  Both available at http://www.cpan.org

-Tupshin Harper
-Programmer/Network Administrator
-Studio Verso

Preferred Client wrote in message <36339AD5.5792@bc.sympatico.ca>...
>Hello,
>
>I just want to make a simple interface in Perl that will be linked to a
>MySQL database.  I don't have much time to learn the language, and i
>just need to know how to make such things as buttons, dropdown boxes,
>scroll boxes and so on.  Are there any good resources on the net where i
>could get this information?  I will be incorporating a Perl Script
>interface into HTML to place on a website......................
>
>Thanks, Dustin
>
>dustin_kofoed@bc.sympatico.ca




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

Date: Sun, 25 Oct 1998 17:58:12 +0000
From: Trevor Hilaiel <trevorh@curtco.com>
Subject: Re: Regular Expression Problem ???
Message-Id: <363366B4.6926E3B9@curtco.com>


disclaimer
this is probably not the best way, nor the most efficient way, but
hopefully it helps
/disclaimer
  
I do something like this:

+-----
$/ = undef; 
my $content = <HTTPD>; # cram the entire file into "$content"

$content = s{  < \s* VirtualHost \s* ${ARGV[0]} \s* >  # the opening
directive for our
                 .*?   #any number of directives       # target IP
               </VirtualHost>  
            }{}xs;
+-----

I would think that this:

while (<DATA>) {
    print unless /^<VirtualHost $ip>/ .. m#^</VirtualHost>#;
}

wouldn't filter out the body of the <VirtualHost> directive..  Maybe I'm
missing something?
 
-Trevor

r j huntington wrote:
> 
> Hi, I'm learning perl and I've been reading the FAQs and other perl docs
> but I'm stuck on a particular problem that really needs a solution. Any
> assistance is greatly appreciated in advance.
> 
> This particular script removes the VirtualHost directive from httpd.conf
> for a domain that is being removed from the system. Here's a sample
> (the ip address is contrived).
> 
> <VirtualHost 201.102.12.21>
> ServerName www.nodomain.com
> ServerAdmin webmaster@nodomain.com
> DocumentRoot /home/noname
> TransferLog /home/noname/logs/access.log
> ErrorLog /home/noname/logs/error.log
> ScriptAlias /cgi-bin/ /home/noname/cgi-bin/
> </VirtualHost>
> 
> No problem removing the first 7 lines; they each contain something
> unique to that VirtualHost directive. The problem is the </VirtualHost>
> tag. Of course, every VirtualHost directive ends with that tag on a
> line by itself.
> 
> My thoughts run to 2 possible solutions, either find the first line
> and remove that and the following 7 lines (whatever they may be), or
> remove the first 7 lines based on their unique content and then somehow
> find the sequence "\n</VirtualHost>\n" and remove that.
> 
> Unortunately, I haven't been able to figure out how to do either. Can
> anyone help me, please, either with some suggested code or a pointer to
> the appropriate docs. So far, I find regular expressions a little
> confusing, so maybe I'm missing something obvious, in which case I
> apologize for the noise.
> 
> Thanks for any help.    -rh-


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

Date: Sun, 25 Oct 1998 18:12:02 +0000
From: Trevor Hilaiel <trevorh@curtco.com>
Subject: Re: Regular expressions..
Message-Id: <363369F2.A71FFE9E@curtco.com>

r j huntington wrote:
> 
> : I was wondering if anyone knew about an online (preferably HTTP or FTP)
> : resource that had in-depth documentation about Perl regular expressions.
> : This seems like the hardest thing I am trying to tackle so far.
> 
> http://www.perl.com/CPAN-local/doc/manual/html/pod/perlre.html

If that leaves you thirsty, try "Mastering Regular Expressions" from
O'Reilly..  I enjoyed this one a great deal.  It's a thorough treatment
of regexs in general but devotes quite a bit of time to the perl
implementation. 

I'm in no way associated with O'Reilly or Friedl, just enjoyed the book.

-Trevor


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

Date: Sun, 25 Oct 1998 19:55:24 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Regular expressions..
Message-Id: <36357eb2.1798903@news.ping.be>

root@delistic.dyn.ml.org () wrote:

>I was wondering if anyone knew about an online (preferably HTTP or FTP)
>resource that had in-depth documentation about Perl regular expressions.
>This seems like the hardest thing I am trying to tackle so far.

The thing that pulled me through was Tom Cristiansen's article from the
series "Far More Than Everything That You Ever Wanted To Know..."
(FMTEYEWTK) about regular expressions. Find the series at
<http://www.perl.com/CPAN-local/doc/FMTEYEWTK/index.html>, in particular
the article at
<http://www.perl.com/CPAN-local/doc/FMTEYEWTK/regexps.html>.

HTH,
Bart.


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

Date: 25 Oct 1998 19:07:41 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: What isn't Perl good for?
Message-Id: <70vstt$7iv$2@client3.news.psi.net>

Michael Lewchuk (jlewchuk@junctionnet.com) wrote on MDCCCLXXX September
MCMXCIII in <URL:news:36325997.7071805@news.junctionnet.com>:
++ 
++ Also, from my POV, PERL is treated as a programming language, which it's not.
++ If you try to treat it like one, you will fail miserably in producing good
++ code.  Either it'll be illegible, unmaintainable, buggy, incomprehensible, or
++ all of the above.  You'll try to turn a program into a batch job, thereby
++ producing a botch job instead.


Just because you can write legible, maintable, bugfree or comprehensible
code in Perl doesn't mean others have the same limitations.




Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


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

Date: Sun, 25 Oct 1998 20:11:26 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: What isn't Perl good for?
Message-Id: <m3af2kjtx2.fsf@rand.dimensional.com>

jlewchuk@junctionnet.com (Michael Lewchuk) spewed forth
the following flamebait on clpm:

> >Martien Verbruggen wrote:
> >
> >> Perl isn't horrible at anything. And it is always time to use C.
> 
> Really?  Perhaps you'd like to hire someone to write a 3DFX card
> device driver in PERL for you, then be forced to maintain it.

Well, of course you wouldn't write a device driver in perl.  At
least not as a serious piece of production software (although I
think it would be an interesting curiosity for hardcore JAPHs).

Low level hardware control is not something perl is designed to
do.  Text processing, networking, and system administration are
the things that perl is designed for.  I would wager that there
are far more programmers who are solving problems in areas such
as these than are writing device drivers. So from a perspective
of the greatest utility to the most people perl wins hands down 
over languages such as C, C++, or assembler.

> From my POV, it depends on what you're doing.  If you're playing
> with UNIX commands all day, PERL takes a real load off the old
> keyboard (and the fingers thereby).

I will agree that if you are doing a large number of things that
are easily expressible as unix commands that perl is a very good
language to glue everything together.
  
>                                      If you're busy doing something
> that can't be explained as a simple set of UNIX commands, then it's
> time to go for the old C/C++ manual.

Lately I've been writing a lot of database code.  Very little of
this can be explained as a `simple set of Unix commands', yet it
never even occurred to me to try and write it all in C or (gasp)
C++.  Trying to manipulate massive quantities of textual data in
C is somewhat akin to using a screwdriver as hammer.  You can do
it, but there are better ways.  
  
>                                       Those of you who have been
> around computers for 20 years may understand this reference: if it's
> a batch job, use PERL, if it's a program, use C/C++.

Wow, you manage to be elitist, condescending, and utterly wrong
all at the same time.  The only thing I can think of that makes
batch jobs any different from `programs' is that they generally
are started from a scheduler rather than from a command prompt.

>                                                       In other
> words, if you were limited to using shell commands only, could you
> do it?  If so, use PERL.

You seem to believe that the only functionality offered by perl 
is C<system()>, C<exec()>, and C<``>.  This is obviously false,
as any programmer who has ever written a 10,000 line program in
perl without using any of these constructs can attest.

> Also, from my POV, PERL is treated as a programming language, which it's not.

Please elaborate on exactly how it is not a programming language.
You may want to include your definition of `programming language'
for the benefit of us morons who think that perl qualifies.

> If you try to treat it like one, you will fail miserably in producing good
> code.  Either it'll be illegible, unmaintainable, buggy, incomprehensible, or
> all of the above.  You'll try to turn a program into a batch job, thereby
> producing a botch job instead.

Wow, you can come up with snappy phrases that are easy to remember
but contain absolutely no meaning.  Do you work for Microsoft's PR
department by chance?

> The only reason to move from C/C++ to PERL is that you can do many high-level
> useful things easily.  PERL is not better than C/C++, it's just easier on the
> brain and fingers for high-level tasks.

Make up your mind.  Can perl be used as a replacement for C/C++
or not.  You assert above that it cannot, then you provide what
is, to me, the best reason of all to switch -- it's makes doing
things easier.

All in all, your post is incoherent, contradictory, and uses
terms that are very poorly defined.  Not to mention, it only
managed to elicit one or two responses.  You have scored a 2
out of a possible 10 on the troll-o-meter.

HTH.  HAND.

dgris
-- 
Daniel Grisinger          dgris@perrin.dimensional.com
Supporter of grumpiness where grumpiness is due on clpm.
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Sun, 25 Oct 1998 12:41:17 -0500
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: why it must be `%%' (was Re: Using percent (%) in printf issue)
Message-Id: <19981025.124117.2c8.rnr.w164w_-_@locutus.ofB.ORG>

Tom Lynch <toml@synnet.com> writes some C-became-Perl code:

> printf "%s occured %d which is %3.2f\%\n", $key, $hash{$key}, [...]
> I don't understand this because I'm escaping the % sign.

I know others have pointed out the use of `%%'.  but I wanted to mention
why is MUST be `%'.

inside a string, `\' escapes string things -- like a `$' that you didn't
want to introduce a [Perl] variable, or a `"' that you didn't want to
terminate the string, or a `t' that you wanted to turn into a tab, or
even another `\' that you didn't want to escape something else.

things where `\' doesn't apply (like the seemingly harmless `%') just get
passed through unmolested.

and the `\', which wasn't necessary, so must have been there because the
programmer wanted to be extra safe in escaping punctuation, vanishes.

so when printf actually gets to look at the string, there is no hint,
nor even a possibility of a hint, that the `\' was ever there.  for a
`\' to have survived this transition, it would have had to be something
like

  `\\%'

which would be such a pain to type, it was decided to just use `%%'
instead.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: 25 Oct 1998 21:29:50 GMT
From: bobn@interaccess.com (Bob N.)
Subject: Win32 Registry.pm incosistent for nonexistent toplevel keys
Message-Id: <71058e$2bd$1@supernews.com>

Registry.pm exports toplevel keynames which may not exist on all systems.
The returned object from Open is sometimes undefined and sometimes
defined, based on the sate of the variable (that is to hold the object)
prior to the call.

this shows the code that demonstrates this and the results:
"
use diagnostics;
use Win32::Registry;

{
my $NewObj;
$HKEY_DYN_DATA->Open('',$NewObj);
print "Case 1: $NewObj\n";

$NewObj = 0;
$HKEY_DYN_DATA->Open('',$NewObj);
print "Case 2: $NewObj\n";
}

{
my $NewObj;
$HKEY_LOCAL_MACHINE->Open('',$NewObj);
print "Case 3: $NewObj\n";

$NewObj = 0;
$HKEY_LOCAL_MACHINE->Open('',$NewObj);
print "Case 4: $NewObj\n";
}

print "Perl Version is ", $];
__END__
C:\Data\perl_scripts>perl -w junk3
Use of uninitialized value at junk3 line 7 (#1)

    (W) An undefined value was used as if it were already defined.  It was
    interpreted as a "" or a 0, but maybe it was a mistake.  To suppress
this
    warning assign an initial value to your variables.

Case 1:
Case 2: Win32::Registry=HASH(0x110668c)
Case 3: Win32::Registry=HASH(0x1106af8)
Case 4: Win32::Registry=HASH(0x1101cf0)
Perl Version is 5.00502
C:\Data\perl_scripts>
"

This shows what I do about it:
"
@TopKeys = ();
for ( sort (keys %main::)) {
   if ( /^HKEY_[A-Z_]*/ ) {
       push(@TopKeys,$_);
    }
}
# find the HKEY_ vars which Registry.pm puts into
# the main:: namespace

for (@TopKeys) {
    print "$_\n";
    my $Dir = '';
    my (@SubKeys, %data, );
    my $NewObj = undef;

    # check that the top level key is valid.  To be valid, the operation
    # must return a defined $NewObj and must have SubKeys or Values.
    # The check for subkeys and values is needed because even a
non-existent
    # key sometimes will return a $NewObj.
    {
    no strict 'refs';
    ${$_}->Open($Dir, $NewObj);
    # this is $HKEY_WHATEVER->Open($Dir, $NewObj);
    }
    # THE FOLLOWING 4 LINES OF CODE CHECK IF THE KEY RETURNED
    # A USEABLE NEWOBJ, AND IF ANY SUBKEYS AR VALUES EXIST.
    next if ( !defined $NewObj );
    $NewObj->GetKeys(\@SubKeys);
    $NewObj->GetValues(\%data);
    next if ( not (scalar @SubKeys) and not (scalar keys(%data)) );

    $hlist->add($_, -text=>$_);
    $hlist->indicator('create', $_, -text=>'+');
}

"




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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4066
**************************************

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