[10509] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4101 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 29 11:06:31 1998

Date: Thu, 29 Oct 98 08:00:25 -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           Thu, 29 Oct 1998     Volume: 8 Number: 4101

Today's topics:
    Re: "Can't locate auto/Getopt/Long/autosplit.ix" (Johan Vromans)
    Re: after gathering information through a form and prin (John Hardy)
        ANN: "pgrep" = perl grep <sb@sdm.de>
    Re: changing file timestamp in Win32 <erhmiru@erh.ericsson.se>
    Re: Comparative modularization (was: Not to start a lan <tseaver@palladion.com>
    Re: Comparative modularization (was: Not to start a lan <jdporter@min.net>
        Crypt function <k.thomson@scet.com>
    Re: Crypt function (clay irving)
    Re: do vs eval `` - perl book wrong? <tchrist@mox.perl.com>
    Re: do vs eval `` - perl book wrong? <tchrist@mox.perl.com>
    Re: Docs on hints for perl (Joergen W. Lang)
    Re: eliminating duplicate lines <jhoglund@mirage.skypoint.net>
    Re: Expressive styles (was: Not to start a language war <jdporter@min.net>
    Re: File Permissions on NT 4 using Perl 5.004 <perlguy@technologist.com>
        Funny, no warning!?! (Bart Lateur)
    Re: Funny, no warning!?! (Matthew Bafford)
        Getting HTTP headers keydet89@yahoo.com
    Re: leading spaces and pipes <r28629@email.sps.mot.com>
    Re: Need simple solution on 'formatting' data printed f <e.christensen@netjob.dk>
    Re: Not to start a language war but.. (Walter Tice USG)
    Re: Not to start a language war but.. <garry@sage.att.com>
    Re: Not to start a language war but.. <jdporter@min.net>
        open2 in winnt bsethi@p21.com
        Oracle::DBD - TNS logon errors (Michael Murphy)
        Parsing large text file (TIA) christian.aranda@iiginc.com
    Re: Parsing large text file (TIA) <jhoglund@mirage.skypoint.net>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 29 Oct 1998 12:50:02 +0100
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Re: "Can't locate auto/Getopt/Long/autosplit.ix"
Message-Id: <wl390hz4mfp.fsf@plume.nl.compuware.com>

Larry Granroth <larry-granroth@NOSPAM.uiowa.edu> writes:

> Although, "/opt/local/lib/perl5/" isn't in @INC either . . . Hmmm.
> 
> I guess I'm still mostly clueless.

I think there is something wrong with your perl installation.
Apparently you installed some perl5, and later perl5.005_02. Your
@INC lists only the perl5.00502 entries, but twice.
Is the perl5 binary that is used the right one? I.e. maybe there is
one in /bin/perl and a different one in /usr/local/bin/perl (or whatever your
PATH specifies)? If so, what does 'perl -V' say?
Does the directory /opt/local/lib/perl5/5.00502/auto exist (and is
writable)?

-- Johan


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

Date: Thu, 29 Oct 1998 14:34:51 GMT
From: jhardy@cins.com (John Hardy)
Subject: Re: after gathering information through a form and printing out response want to continue printing on the same page using a PERL script
Message-Id: <f2%Z1.322$%Z6.550754@198.235.216.4>

Tom Phoenix wrote:

> On Wed, 28 Oct 1998, John Hardy wrote:
>
> > Subject: after gathering information through a form and printing out 
response
>     want to continue printing on the same page using a PERL script
>
> What a subject! But didn't you ask this same question earlier today? Maybe
> my earlier answer was unclear.

Yes I did and took your advice as to the subject. No your answer was clear 
enough.
I have all three Camel books and still can't figure it out.


>
>
> As far as I can tell, what you are asking for is something that Perl can
> easily do. It's simply a matter of producing the right output at the right
> time, after all.

Guess I'm not as smart as you , or maybe I don't know PERL as well as you do.


>
>
> "Simply," of course, IF the protocol you're implementing can do that.
> That's a big "if". Probably, you're using HTML, HTTP, and CGI, to talk to
> a browser from a server. The docs, FAQs, and newsgroups about those topics
> should be able to help you more than a newsgroup about Perl can. Good
> luck!
>

I always search before I ask . Maybe I am not searching for the right term or
subjectbut I can't find anything that has helped me yet, thats why I posted for
some help.


Thanks anyway!

John






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

Date: 29 Oct 1998 15:33:49 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: ANN: "pgrep" = perl grep
Message-Id: <71a1st$j7h$1@bsdti6.sdm.de>

(Posting did not appear on machine where first posted, therefore reposting.)

                          =======================
                            "pgrep" - perl grep
                          =======================

Did you ever want to have a "grep" combined with the power of Perl's
regular expressions?

Here it is!

This tool accepts the usual options for "grep":

    -i    ignore case
    -l    list filenames only
    -v    invert search
    --    end of options

The tool prints a usage if called without parameters.

For more information on "grep", see its corresponding manual pages on
your UNIX system.

Note that this tool is not restricted to UNIX platforms, though, it will
run wherever Perl does!

Just install this tool somewhere in your search path, e.g. "/usr/local/bin".

Don't forget to adjust the shell-bang line (the first line of the script)
to match the path where Perl is installed on your system.

Non-UNIX users please refer to the documentation of their Perl installation
for instructions on how to install Perl scripts as executable applications.

Available from

    http://www.perl.com/CPAN/authors/id/STBEY/
or
    http://www.engelschall.com/u/sb/download/

Enjoy!
-- 
    Steffen Beyer <sb@engelschall.com>
    Free Perl and C Software for Download: www.engelschall.com/u/sb/download/


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

Date: 29 Oct 1998 13:59:52 +0100
From: Michal Rutka <erhmiru@erh.ericsson.se>
Subject: Re: changing file timestamp in Win32
Message-Id: <laaf2f8qwn.fsf@erh.ericsson.se>

stevenfitz@my-dejanews.com writes:
<...>
> I am writing a small Win32 Perl script to synch two directories and find that
<...>
> utime ($newTime, $newTime, $dest_path);
<...>
> It doesn't seem to matter what I set $newTime to, utime always seems to set 
> it
> to the current time. Any thoughts on what I'm doing wrong or how I could do
> this better?

You are using Win32. This is wrong. If you want to do it better switch to
some decent operating system.

> Thanks,
> Steven

Regards,

Michal.


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

Date: Thu, 29 Oct 1998 08:34:28 -0800
From: Tres Seaver <tseaver@palladion.com>
Subject: Re: Comparative modularization (was: Not to start a language war but..)
Message-Id: <36389914.18C14A22@palladion.com>

Larry Wall wrote:
> 
> In article <wr3pvbcbl09.fsf@yeenoghu.cs.uchicago.edu>,
> Lyn A Headley  <laheadle@boguscs.uchicago.edu> wrote:
> >claird@Starbase.NeoSoft.COM (Cameron Laird) writes:
> >
> >
> >> More pertinent is that Scheme *lacked* a module system
> >> during the interval when the developers referenced earl-
> >
> >I think it is most pertinent to say that *Scheme* lacks a module
> >system.  :)
> 
> Odd how you can say something pertinent and impertinent simultaneously.  :-)

Actually, that should be "pertinent and impertinently," no?

-- 
=========================================================
Tres Seaver         tseaver@palladion.com    713-523-6582
Palladion Software  http://www.palladion.com


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

Date: Thu, 29 Oct 1998 10:51:53 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Comparative modularization (was: Not to start a language war but..)
Message-Id: <36388F19.9BDD5B5C@min.net>

Larry Wall wrote:
> 
> Lyn A Headley  <laheadle@boguscs.uchicago.edu> wrote:
> >I think it is most pertinent to say that *Scheme* lacks a module
> >system.  :)
> 
> Odd how you can say something pertinent and impertinent simultaneously.  :-)

Odd?  Not at all.  
Not in messifully useful languages like English (and Perl).

John Porter


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

Date: Thu, 29 Oct 1998 15:13:05 -0000
From: <k.thomson@scet.com>
Subject: Crypt function
Message-Id: <71a0va$joe@news5-gui.server.cableol.net>

I'm a bit confuser I can get a string encrypted with the crypt function

eg

$result = crypt ("kevin","ke");

But how do you enrypt it?

Thanks in advance Kevin.




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

Date: 29 Oct 1998 10:33:36 -0500
From: clay@panix.com (clay irving)
Subject: Re: Crypt function
Message-Id: <71a1sg$cfs@panix.com>

In <71a0va$joe@news5-gui.server.cableol.net> <k.thomson@scet.com> writes:

>I'm a bit confuser I can get a string encrypted with the crypt function

>eg

>$result = crypt ("kevin","ke");

>But how do you enrypt it?

Read the documentation!

  NAME

  crypt - one-way passwd-style encryption 
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

-- 
clay irving
clay@panix.com
http://www.panix.com/~clay/


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

Date: 29 Oct 1998 14:55:31 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: do vs eval `` - perl book wrong?
Message-Id: <719vl3$q6k$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    thomaso@best.com (Thomas Andrews) writes:
:It appears that the blue camel book has made an error in stating
:that:
:	do './foo.pl';
:is the same runtime behavior as:
:	eval `cat ./foo.pl`;

My copy says that it's ``rather like'', not ``identical to''.
In any event, if you prefer precise definitions, perhaps you'd
like this text from perlfaq8:

1)  do $file is like eval `cat $file`, except the former:
   1.1: searches @INC and updates %INC.
   1.2: bequeaths an *unrelated* lexical scope on the eval'ed code.

2)  require $file is like do $file, except the former:
   2.1: checks for redundant loading, skipping already loaded files.
   2.2: raises an exception on failure to find, compile, or execute $file.

3)  require Module is like require "Module.pm", except the former:
   3.1: translates each "::" into your system's directory separator.
   3.2: primes the parser to disambiguate class Module as an indirect object.

4)  use Module is like require Module, except the former:
   4.1: loads the module at compile time, not run-time.
   4.2: imports symbols and semantics from that package to the current one.

--tom
-- 
    "A good messenger expects to get shot." --Larry Wall


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

Date: 29 Oct 1998 14:57:35 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: do vs eval `` - perl book wrong?
Message-Id: <719vov$q6k$2@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    mgjv@comdyn.com.au (Martien Verbruggen) writes:
:It still means, however, that the two situations are not identical, as
:the documentation for do suggests. Maybe you should submit a bug
:report (stating that the documentation is incomplete, and needs to be
:changed in the following way.....).

>From perlfunc:

       Uses the value of EXPR as a filename and executes the
       contents of the file as a Perl script.  Its primary use is
       to include subroutines from a Perl subroutine library.

           do 'stat.pl';

       is just like

           scalar eval `cat stat.pl`;

       except that it's more efficient and concise, keeps track
       of the current filename for error messages, and searches
       all the -I libraries if the file isn't in the current
       directory (see also the @INC array in the section on
       Predefined Names in the perlvar manpage).  It is also
       different in how code evaluated with do FILENAME doesn't
       see lexicals in the enclosing scope like eval STRING does.
       It's the same, however, in that it does reparse the file
       every time you call it, so you probably don't want to do
       this inside a loop.

You might also look at the perlfaq8 cite I just made.

--tom
-- 
    Sorry.  My testing organization is either too small, or too large, depending
    on how you look at it.  :-)
            --Larry Wall in <1991Apr22.175438.8564@jpl-devvax.jpl.nasa.gov>


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

Date: Thu, 29 Oct 1998 15:59:00 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: Docs on hints for perl
Message-Id: <1dho1yd.1j91ykuwm70cN@host005-210.seicom.net>

Sergey V. Kolychev <ksv@gw.al.lg.ua> wrote:

> May be anybody have docs about $^H magic variable ?

>From perldelta:

<quote the docs>
=item $^H

The current set of syntax checks enabled by C<use strict>.  See the
documentation of C<strict> for more details.  Not actually new, but
newly documented.
Because it is intended for internal use by Perl core components,
there is no C<use English> long name for this variable.
</quote the docs>

that's about all that came up after I grepped my POD.
hth, HANF,

Joergen
-- 
  To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
   "Everything is possible - even sometimes the impossible"
             HOELDERLIN EXPRESS - "Touch the void"


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

Date: 29 Oct 1998 14:26:26 GMT
From: Jamie Hoglund <jhoglund@mirage.skypoint.net>
Subject: Re: eliminating duplicate lines
Message-Id: <719tui$bf$4@shadow.skypoint.net>

westi@leland.stanford.edu wrote:
: I am trying to open a webserverlog file and read in all the data to a new
: file The problem I'm having is eliminating all of the lines which are
: duplicates. If anyone could give me a few tips, I would really appreciate
: it.

There are unix utilities for this, but they only work on sorted files.

sort -u <infile

Might do the trick.

Also try: uniq

I think probably what you'll run into is the dates, IP numbers etc being
different? (if your parsing server logs) and if it's the requested URL you
want to analyze, I think I'd use a hash:


 ..

parse out the entry line getting the url into $url

 ..

++$LOG{$url};


Then at the end of the script: 

foreach $u (keys(%LOG)){
    print "Url: $u appears $LOG{$u} times\n";

}


I'm guessing the above is what you want, if it's the url you are looking
at. (could do the same with the referer, etc..)

Disclaimer: this is untested psuedo-code.

Jamie
-- 
 -------------------------------------------------------------------------
 jamie@lecart.com
 http://www.lecart.com 


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

Date: Thu, 29 Oct 1998 10:49:01 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Expressive styles (was: Not to start a language war but..)
Message-Id: <36388E6D.1162E8B7@min.net>

Cameron Laird wrote:
> 
> John Porter  <jdporter@min.net> wrote:
> >Cameron Laird wrote:
> >> Freud was an early contributor to c.l.p.m, I think;
> >> he certainly has the rhetoric down.
> >
> >I'm surprised, and even a little disappointed, to see this
> >kind of flamage coming from you, Cameron.
>
> 'Morning, John;

Top of the muffin^Wmorning to *you*, Cameron!


> I owe you thanks, by the way.  I
> was just poking around in the archives, and found
> a tip from you to a particular CPAN module that's
> proved invaluable to me.  I like your work.

I'm deeply, deeply gratified.


> I've long regarded Dr. Freud as an
> accomplished stylist, with good rhetorical rhythm
> and structural elegance.  clpm often surprises me
> for the vigor and forcefulness with which con-
> tributors express themselves.  ...

Mokay!


> Oh, and you're right that the man was capable of
> generating a high density of bogons. 

But (unfortunately), bogons with high memetic valence.


> I guess
> your point, though, is that it's only flamage to
> use "wacko ...  mere folly and futility" in a
> single paragraph if you cross-post to sci.psych*.

Really?  Then I failed.

Let's see... Deja News ... comp.psych* ... wacko ...

Hey! What's happening to my keyb


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

Date: Thu, 29 Oct 1998 11:55:39 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: File Permissions on NT 4 using Perl 5.004
Message-Id: <363857BB.FBEB88BC@technologist.com>

George Kuetemeyer wrote:
> 
> R.G. wrote:
> 
> > Has anyone had any experience changing file permissions on an NT server
> > using Perl?
> 
> Check out the documentation for: Win32::FileSecurity. It's got everything you
> need to change file permissions.

You may also want to look at the XCACLS.exe program in the resource
kit.  I had a few problems with the FileSecurity module so I chose to
use an external program.

The choice is yours, I don't recall what the problems were so I can't
elaborate on them.

I do use XCACLS in a Perl program to recursively set the file
permissions on a whole tree and it works very well.  Using FileSecurity
would undoubtably be much faster though.

Good luck,
Brent
-- 
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: Thu, 29 Oct 1998 14:02:06 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Funny, no warning!?!
Message-Id: <36396c5f.22111761@news.ping.be>

I stumled across this; I think it's strange that I don't get a warning.

Try this (provided a subdirectory "html" does indeed exist):

  #! perl -w
  opendir(HTML,"./html") or die "Can't open directory: $!";
  @file = grep { /\.html?$/ } readdir(DIR);
  closedir(DIR);
  $files = @file;
  print STDERR "This is perl $]";
  foreach $file (@file) {
     print STDERR "File = $file\n";
     open(HTML,"./html/$file");
  }

The only result I got is:

  Name "main::files" used only once: possible typo at test.pl line 5.
  This is perl 5.00401

You noticed anything strange? I openend a direectory handle HTML but I
tried to read and close directory handle DIR, which was never opened. No
warning though. Line 5 only serves to show that warnings are indeed
enabled.

It wouldn't be the first time that I'm late. Has this been fixed yet?

	Bart.


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

Date: Thu, 29 Oct 1998 10:04:07 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Funny, no warning!?!
Message-Id: <MPG.10a24ded6a8ddfdd9896eb@news.scescape.net>

In article <<36396c5f.22111761@news.ping.be>>, bart.mediamind@ping.be 
(Bart Lateur) pounded the following:
=> I stumled across this; I think it's strange that I don't get a warning.
=> 
=> Try this (provided a subdirectory "html" does indeed exist):
=> 
=>   #! perl -w
=>   opendir(HTML,"./html") or die "Can't open directory: $!";
=>   @file = grep { /\.html?$/ } readdir(DIR);
=>   closedir(DIR);
=>   $files = @file;
=>   print STDERR "This is perl $]";
=>   foreach $file (@file) {
=>      print STDERR "File = $file\n";
=>      open(HTML,"./html/$file");
=>   }
=> 
=> The only result I got is:
=> 
=>   Name "main::files" used only once: possible typo at test.pl line 5.
=>   This is perl 5.00401
=> 
=> You noticed anything strange? I openend a direectory handle HTML but I
=> tried to read and close directory handle DIR, which was never opened. No
=> warning though. Line 5 only serves to show that warnings are indeed
=> enabled.
=> 
=> It wouldn't be the first time that I'm late. Has this been fixed yet?

Name "main::files" used only once: possible typo at - line 5.
This is perl 5.00502

I would expect something like:

Readdir on unopened dirhandle DIR at - line 3.

Maybe this should be submited as a bug report?

What do you think, clpm?

=> 	Bart.

--Matthew


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

Date: Thu, 29 Oct 1998 13:07:34 GMT
From: keydet89@yahoo.com
Subject: Getting HTTP headers
Message-Id: <719pam$r70$1@nnrp1.dejanews.com>

I have been trying to write a small script that I can use to
quickly check some of the values of HTTP headers on my
web servers.  I haven't gotten anything working, and I haven't
been able to find any code snippets.

Could someone give me a clue or some other assistance?  This is
part of a continued monitoring of my web servers, and all I want
to get is some of the HTTP header values, such as server, etc.

Any help is greatly appreciated.  I am using ActiveState's latest
build (502) on NT...

Thanks
Carv

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 29 Oct 1998 08:20:57 -0600
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: leading spaces and pipes
Message-Id: <363879C9.558DA2FC@email.sps.mot.com>

Tad McClellan wrote:
> 
> Tk Soh (r28629@email.sps.mot.com) wrote:
> 
> : try this:
> 
> : ($junk, @field2) = split(/\|/,$prefix);
> 
> : Of course you can always undef $junk, if you even bother;
> 
>    try this (with a recent perl):

works on P5.003 and P5.005.
 
>    (undef, @field2) = split(/\|/,$prefix);  # no temp variables

cool! Thanks.

-tk


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

Date: Thu, 29 Oct 1998 16:27:50 +0100
From: EC <e.christensen@netjob.dk>
To: AgentJ <jhawk39@idt.net>
Subject: Re: Need simple solution on 'formatting' data printed from a file
Message-Id: <36388975.55115C2B@netjob.dk>

Hi
If the file you are reading contains linefeeds you could use:


unless(open (EVENTFILE, "oct.txt"))
{
die "error $!";
}

@lines=<EVENTFILE>;
close(EVENTFILE);

$all=join(" ",@lines);

$all=~ s/\n/<br>/g;

In this way you substitute all \n width <br>.


Ernst
AgentJ wrote:

> OK, I'm a total quack trying to write a somewhat legitimate snippet of Perl.
> I've achieved virtual success...but am stuck in one place. I'm trying to
> simple read specific lines from a text file. I'm to the point where I'm able
> to read and print the proper lines...but there's no 'carriage return'. I'm
> assuming I need a '/n' in there somewhere...but I've been unsuccessful in
> finding the right place.
>
> Here's the snippet of active code:
>
>    open (EVENTFILE, "oct.txt");
>  until ( $currentDay == $dayOfMonth ) {
>  $currentDay = <EVENTFILE>;
>    }
>
>  until ($currentDay =~ /<\/ul>/)  {
>  $currentLine = <EVENTFILE>;
>  print $currentDay;
>    }
>
>    close (EVENTFILE);
>
> It just spits out all the lines in one continuous stream without any
> 'carriage returns'. I'd love to have it print each line to the browser
> separately just as it is in the text file. I'd rather learn how to do this
> than put a <br> or paragraph tags on each line of the text file.
>
> If anyone can help...I'd be eternally grateful and believe that there is
> more to the internet than porn and chatrooms. Course..."Not that there's
> anything wrong with that."
>
> -John



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

Date: 29 Oct 1998 12:44:18 GMT
From: tice@hunch.zk3.dec.com (Walter Tice USG)
Subject: Re: Not to start a language war but..
Message-Id: <719nv2$ole@zk2nws.zko.dec.com>

In article <718rsc$ctn$1@client3.news.psi.net> abigail@fnx.com writes:
>Zenin (zenin@bawdycaste.org) wrote on MDCCCLXXXV September MCMXCIII in
><URL:news:909623452.948196@thrush.omix.com>:
>++ Dave Kirby <dkirby@bigfoot.com> wrote:
>++ 
>++ 	From my current (blagh) Java project:
>++ 
>++     public StringBuffer append (boolean bool)   { _extractStringBuffer().append (bool); type = STRING; return string; }
>++     public StringBuffer append (char     ch)    { _extractStringBuffer().append (ch);   type = STRING; return string; }
>++     public StringBuffer append (int     num)    { _extractStringBuffer().append (num);  type = STRING; return string; }
>++     public StringBuffer append (long    num)    { _extractStringBuffer().append (num);  type = STRING; return string; }
>++     public StringBuffer append (float   num)    { _extractStringBuffer().append (num);  type = STRING; return string; }
>++     public StringBuffer append (double  num)    { _extractStringBuffer().append (num);  type = STRING; return string; }
>++     public StringBuffer append (Object  obj)    { _extractStringBuffer().append (obj);  type = STRING; return string; }
>++     public StringBuffer append (String  str)    { _extractStringBuffer().append (str);  type = STRING; return string; }
>++     public StringBuffer append (char[]  data)   { _extractStringBuffer().append (data); type = STRING; return string; }
>++ 
>++ 	Please show me how the readability of this code would be helped	by
>++ 	either indent style blocks or max 80 column text.  Give me a couple
>++ 	minutes and I'm sure I could dig up a couple dozen Perl and C
>++ 	examples as well.
>
>Oh, that's easy:
>
>     public StringBuffer append (boolean bool) {
>         _extractStringBuffer().append (bool);
>         type = STRING;
>         return string;
>     }

Wha??? Look if there is just one instance, then sure do it like that, but for 2 or more, the 'long'
style is:

1. easier to read
2. easier to understand
3. easier to compare elements from different lines

I admit my reading style could be characterized as 'columnar top/down', but, really, it's SO simple
that way.

what about the additional doc you can get from something like this:

while (<T>) {
    ($NUM,$STA, $CAT,  $DEN,   $DFI,  $ABS,   $COM,  $VER,  $SEV,  $DAN)=unpack
     ("A5  A2 x2 A2 x26 A11 x11 A11 x1 A22 x83 A10 x20 A8 x20 A1 x4 A11",$_);

or what about the logical grouping of one thing per line?

if ($T1 ne 8 || $T2 ne 8) {
    die "Useage: qar_db_rep.pm (opt args:) <prev db name> <curr db name> <srcown db name> <start date> <end date (yymmdd)>\n";
}

>Code with lines over 80 chars always lose when it comes to readability.

Maybe on a print out, but with a decent size screen and window? Nah...

Well, just goes to show - to each his/her own

W

-- 
"I've done questionable things.." - Roy
"But also extraordinary things, revel in your time!" - Tyrell


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

Date: Thu, 29 Oct 1998 10:32:16 -0500
From: "Garrett G. Hodgson" <garry@sage.att.com>
Subject: Re: Not to start a language war but..
Message-Id: <36388A80.BA99438A@sage.att.com>

Zenin wrote:
> 
> Dave Kirby <dkirby@see.sig.for.addr> wrote:
>         >snip<
> : Yes python is OO, and so is perl. However creating a class in perl is
> : frankly a pain in the ass,
> 
>         Huh?  What ya been smoking?
> 
>                 package Foo;
>                 sub new { bless {}, shift }
> 
>         Or even shorter:
> 
>                 sub Foo::new { bless {}, shift }
> 
>         Want a sub class?
> 
>                 package Bar;
>                 use base qw(Foo);
> 
>         Want that in a one liner?
> 
>                 perl -e 'sub Foo::new { bless {}, shift }'

reminds me of programming in Xt, where one would simulate
inheritance by hand-rolling the data structures that C++
later generated.


> : * Block structuring by indentation. Some people hate this and some
> : people love it. I was put off of trying python for a long time because
> : of this, but after using it for a few days it seemed far more natural
> : than cluttering up the screen with curly braces.
> 
>         your right all this punctuation stuff just makes languages harder to
>         read i dont understand why english does it as well it must just
>         be like the metric system in that people arent friendly to change
>         maybe someday we shale all speek in python and the world will be a
>         better place

bogus example.  a more python-esque rendering might be:

	you are right
	all this punctuation stuff just makes languages harder to read
	i dont understand why english does it as well
	it must just be like the metric system \
		in that people are not friendly to change
	maybe someday we shall all speak in python \
		and the world will be a better place











-- 
Garry Hodgson			and when they offer
garry@sage.att.com		golden apples
Software Innovation Services	are you sure you'll refuse?
AT&T Labs			heaven help the fool.


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

Date: Thu, 29 Oct 1998 10:57:41 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <36389075.FE04B27D@min.net>

Jason Orendorff wrote:
> 
>   #Perl
>   package Widget;
>   @ISA = (Frob);
>   sub new { bless {} }

Fortunately there's other ways to do it.

  @Widget::ISA = ('Frob');
  sub Widget::new { bless {} }

'package' doesn't actually relate to Perl's OO in any special way;
it just changes the default namespace for any following unqualified
declarations.

John Porter


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

Date: Thu, 29 Oct 1998 13:56:03 GMT
From: bsethi@p21.com
Subject: open2 in winnt
Message-Id: <719s5j$ung$1@nnrp1.dejanews.com>

I am having a problem using perl open2 in winnt.
I want to execute a java client from within perl sending it an argument and
waiting for input from the client.
the code i have right now is

use IPC::Open2;
open2(*RMR, *WMR, "jre -cp c:\\jcust.java");
print WMR $id;
$line = <RMR>;

any help will be greatly appreciated.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 29 Oct 1998 06:26:52 -0500
From: murph@americasm01.nt.com (Michael Murphy)
Subject: Oracle::DBD - TNS logon errors
Message-Id: <murph-2910980626520001@nppkm606.us.nortel.com>

I posted this to comp.lang.perl.modules yesterday and got no response so
I'm posting it here today.

I'm gettin errors trying to logon to Oracle using DBI/DBD.  The error
numbers are 12203, 12537, and 12570.  They are all TNS related errors. 
They only happen a small percentage of the time when logging on, thru
cgi,  which makes this a tough problem to track down.  I was wondering if
anyone 
has seen similar problems and if so what was the cause?

TIA,
Mike

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Michael Murphy               ~   Nortel - Raleigh, North Carolina
 murph@americasm01.nt.com    ~      - my opinions are my own -


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

Date: Thu, 29 Oct 1998 08:53:04 -0500
From: christian.aranda@iiginc.com
Subject: Parsing large text file (TIA)
Message-Id: <719ruq$crb$1@news-1.news.gte.net>

Here is the story...

I need to parse through a large text file, search for key words (static) 
and extract all the data until the next key word, put it into a variable 
(for later manipulation) and contine through all the records.  Caveat:  
The data after the key word can span multiple (read 50-100) lines.  The 
way I figure it, I can m/'Keyword'/ and substr the data out of $_.  The 
problem is this:  that's fine for one line, but what about multiple 
lines?  I could keep a running variable that keeps adding the current 
line plus a \n, but that seems cumbersome and I know perl must have a 
better way!

Below is a sample of the data I need to parse:

PersonId:802.111
FirstName:Christian
LastName:Aranda
Description:This person needs to blah blah ....
more text
more text
more text
PersonId:803.000	<-----NOTE: New Record
FirstName:

you get the idea...

Thanks in advance -

Christian M. Aranda


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

Date: 29 Oct 1998 14:05:30 GMT
From: Jamie Hoglund <jhoglund@mirage.skypoint.net>
Subject: Re: Parsing large text file (TIA)
Message-Id: <719sna$bf$2@shadow.skypoint.net>

In comp.lang.perl christian.aranda@iiginc.com wrote:

: Below is a sample of the data I need to parse:

: PersonId:802.111
: FirstName:Christian
: LastName:Aranda
: Description:This person needs to blah blah ....
: more text
: more text
: more text
: PersonId:803.000	<-----NOTE: New Record
: FirstName:

: you get the idea...

: Thanks in advance -

I *think* you can screw around with the $/ variable. (or is it $\ I can't
remember)

$\ = "\nPersonID";

The each $record = <FILE>;

will be a complete paragraph, and you'll have to manually split out the
\n's: @lines = split(/\n/,$record);

Be careful, messing around with the new line variable will break nearly
everything else if it isn't restored.

Jamie


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

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

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