[10185] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3778 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 21 16:07:24 1998

Date: Mon, 21 Sep 98 13:00:21 -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           Mon, 21 Sep 1998     Volume: 8 Number: 3778

Today's topics:
    Re: Boolean Searching... (Andre L.)
        Class as Datatypes? <achoy@us.oracle.com>
        Cookie Help! <benderle@mindspring.com>
    Re: Cookie Help! <rasan@horizonlive.com>
    Re: even/odd numbers <nguyend7@msu.edu>
    Re: even/odd numbers <nguyend7@msu.edu>
        hash slices with hashes of hashes (Stefan Lundstrom)
    Re: hash slices with hashes of hashes (Sean McAfee)
    Re: IO::Select Problems <robin.houston@guardian.co.uk>
        JAPH: how does this .sig work? <akarandi@pcocd2.intel.com>
    Re: JAPH: how does this .sig work? (Matt Knecht)
        Newbie sort questions <Eric-Goforth@csi.com>
    Re: Number Sort (Andre L.)
    Re: Open directory in perl <frejos@cswnet.com>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <jdporter@min.net>
    Re: Perl & Java - differences and uses <fsg@newsguy.com>
        PerlMagick & linux (Enrique Terrazas)
        Printing Question  --  I'm a beginner <josh@jersey.net>
    Re: Printing Question  --  I'm a beginner <eashton@bbnplanet.com>
        Problem with Splits on blank lines <r26878@email.sps.mot.com>
    Re: Problem with Splits on blank lines (Matt Knecht)
    Re: require does not work <frejos@cswnet.com>
    Re: Search for special characters? <r28629@email.sps.mot.com>
    Re: Search for special characters? <r28629@email.sps.mot.com>
    Re: where is Date::Parse? (Greg Bacon)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Mon, 21 Sep 1998 13:11:05 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Boolean Searching...
Message-Id: <alecler-2109981311050001@dialup-600.hip.cam.org>

In article <6u4mbg$nch$1@nnrp1.dejanews.com>, expoinfo@globalexpos.co.nz wrote:

> I have a search script were i need a boolean search.. here is some of it..
> how do i get it to add the 'All Regions" to the $aera2 value to search for
> either or the $area2 or 'All Regions'...
> 
>     $area = $area2 || 'All Regions';

The '|' alternation regexp metacharacter is described in perlre. 

r   f
  t   m

Andre


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

Date: Mon, 21 Sep 1998 12:14:40 -0700
From: Allen Choy <achoy@us.oracle.com>
Subject: Class as Datatypes?
Message-Id: <3606A5A0.ACB9AEC2@us.oracle.com>


Hi.

I've been playing around with perl5.005_02, and noticed I could do this:

my Foo $bar;

I probably missed the description of this in the docs.  Could someone
elaborate
on what this means?  Is this some form of type checking?

Thanks,

Allen



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

Date: Mon, 21 Sep 1998 14:23:45 -0400
From: Brian Enderle <benderle@mindspring.com>
Subject: Cookie Help!
Message-Id: <360699B1.F3A378A2@mindspring.com>

Can anyone direct me to (hopefully) an on-line or downloadable file that
explains how to use cookies; ie. writing, reading, etc.

Brian Enderle



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

Date: Mon, 21 Sep 1998 15:48:11 -0400
From: Rasan Rasch <rasan@horizonlive.com>
Subject: Re: Cookie Help!
Message-Id: <3606AD7B.B5BCF615@horizonlive.com>

> Can anyone direct me to (hopefully) an on-line or downloadable file that
> explains how to use cookies; ie. writing, reading, etc.

You should use CGI.pm.
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
There should be a section on cookies with an example script.



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

Date: 21 Sep 1998 19:14:18 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: even/odd numbers
Message-Id: <6u68ia$f77$1@msunews.cl.msu.edu>

Uri Guttman <uri@sysarch.com> wrote:
:>>>>> "DN" == Dan Nguyen <nguyend7@msu.edu> writes:


:   DN> For example.  In my 'C' class.  They told us to do

That line may be confusing.  This is actually an assembly language
class that I'm currently taking.  We're currently only doing stuff in
C on a Sparc.

:   DN> ch ^= 0x20;
[snip]

: and highly wrong today with unicode and other non-ascii char
: sets. toupper() is clearer, should be just as fast for ascii and
: portable.

I know it's bad.  But this was only was with ascii so it didn't matter
for the assignment that they gave us.  Anyways, they explicitly told
use to do it that way, and not to use toupper().



-- 
           Dan Nguyen            | There is only one happiness in
        nguyend7@msu.edu         |   life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 |                   -George Sand



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

Date: 21 Sep 1998 19:17:53 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: even/odd numbers
Message-Id: <6u68p1$f77$2@msunews.cl.msu.edu>

Abigail <abigail@fnx.com> wrote:
: Dan Nguyen (nguyend7@msu.edu) wrote on MDCCCXLVII September MCMXCIII in
: <URL: news:6u4hgm$9vc$1@msunews.cl.msu.edu>:
: ++ 
: ++ For example.  In my 'C' class.  They told us to do

Clarification:  It's a CS class on assembly.  We're doing C
programming currently.

: ++ ch ^= 0x20;
[snip]


: It's also wrong of course. It only works for a-z, and a subset
: of the accented letters in ISO-8859-1.

It's not the way I would do it.  But it's the way they told us to.
They were teaching us ascii so that way worked, and was an
introduction to the next section that we would be doing.

-- 
           Dan Nguyen            | There is only one happiness in
        nguyend7@msu.edu         |   life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 |                   -George Sand



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

Date: 21 Sep 1998 17:44:30 GMT
From: edtslun@edt.ericsson.se (Stefan Lundstrom)
Subject: hash slices with hashes of hashes
Message-Id: <6u639u$8ii@newstoo.ericsson.se>

Hi!

I've run into a wall here - anybody got any ideas?

I use hash slices quite a lot for printouts and so
on, but I can't manage to get it to work when I have
hashes of hashes.

my %hash = (key_a  =>  {
                            key_a1 => 1,
                            key_a2 => 2,
                        },
            key_b  =>  {
                            key_b1 => 11,
                            key_b2 => 22,
                        },
            key_c  =>  {
                            key_c1 => 111,
                            key_c2 => 222,
                        },
            key_d  => D,
        );

my $hp = \%hash;

print @hash{key_a,key_b}, "\n";
	# Works allright: HASH(0xbd450)HASH(0xd1444)

print @$hp{key_a,key_b}, "\n";
	# Works allright: HASH(0xbd450)HASH(0xd1444)

print @hash{key_a}{key_a1,key_a2}, "\n"; #
	# Bad: "Can't use subscript on hash slice"

I've tried a number of different incantations but to
no avail. I can't find anything in the FAQ or the
manuals that addresses this. Please help!

/Stefan Lundstrom



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

Date: Mon, 21 Sep 1998 18:12:13 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: hash slices with hashes of hashes
Message-Id: <1GwN1.4015$F7.15085299@news.itd.umich.edu>

In article <6u639u$8ii@newstoo.ericsson.se>,
Stefan Lundstrom <edtslun@edt.ericsson.se> wrote:
>my %hash = (key_a  =>  {
>                            key_a1 => 1,
>                            key_a2 => 2,
>                        },
>            key_b  =>  {
>                            key_b1 => 11,
>                            key_b2 => 22,
>                        },
>            key_c  =>  {
>                            key_c1 => 111,
>                            key_c2 => 222,
>                        },
>            key_d  => D,
>        );

>my $hp = \%hash;

>print @hash{key_a,key_b}, "\n";
>	# Works allright: HASH(0xbd450)HASH(0xd1444)

>print @$hp{key_a,key_b}, "\n";
>	# Works allright: HASH(0xbd450)HASH(0xd1444)

>print @hash{key_a}{key_a1,key_a2}, "\n"; #
>	# Bad: "Can't use subscript on hash slice"

print @{$hash{key_a}}{key_a1, key_a2}, "\n";

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Mon, 21 Sep 1998 19:28:30 +0100
From: Robin Houston <robin.houston@guardian.co.uk>
Subject: Re: IO::Select Problems
Message-Id: <36069ACE.8D910969@guardian.co.uk>

Edwin S. Ramirez wrote:
> [...] However, if
> there are multiple lines waiting in the socket, once I read a single line
> from the socket, select does not return any sockets from the can_read
> statement.  It does not realize that there is data already in the socket and
> it does not return when new data arrives.

This is true. You need to get *all* the data from the socket.
Personally I would use sysread() and then split the data into lines by hand.
I've done this in several programs, and it works fine.

You might also try getlines() (equivalently <FH> in an array context), though this will hang if a
partial line arrives (until the line is completed).

 .robin.


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

Date: Mon, 21 Sep 1998 10:41:12 -0700
From: "Arvind K. Karandikar" <akarandi@pcocd2.intel.com>
Subject: JAPH: how does this .sig work?
Message-Id: <36068FB8.2452@pcocd2.intel.com>

(reposting - i don't think it went out the first time around)

[cc sent to Abigail <abigail@fnx.com>]

i found this .sig in one of Abigails' posts:

perl  -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
          for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
          print chr 0x$& and q
          qq}*excess********}'

and i'm stumped as to how we end up with japh from this. i figure $_ is 
being stored with some encoding of japh, but didn't get much further 
than this.

questions :

what is the for loop doing? the docs say $* is used to set multiline
pattern matching (and its deprecated) by setting it to 0 or 1. does
***** have any special interpretation here? 

i tried different interpretations of $**=****** ($* *= ****..etc) but
this didn't help much either.

as to the rest of it - just what is going on? there is no terminating ;
in the print statement, the 'and' is between $& and ...what? what
does the last line (qq}*excess********}) do? 

-- 
______________________________________________________________________
Not speaking for intel

Arvind K. Karandikar
akarandi@pcocd2.intel.com
----------------------------------------------------------------------


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

Date: Mon, 21 Sep 1998 18:59:56 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: JAPH: how does this .sig work?
Message-Id: <MmxN1.498$XP2.3856774@news3.voicenet.com>

Arvind K. Karandikar <akarandi@pcocd2.intel.com> wrote:
>perl  -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
>          for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
>          print chr 0x$& and q
>          qq}*excess********}'

It may help to realize how much quoting is going on here, and what the
quote delimiters are.  Here's what I got when I boiled it all down to
somthing much simpler, and formatted sanely:

$_ = '4a75737420616e6f74686572205065726c204861636b65720a';

for ($x = 1; $x *= 1; $x *= 1) {
    $x *= s/../"print chr 0x$& and 'qq'"/ee;
}

Using $* is very tricky, especially when combined with the *= operator
and the noise of ****** which could be any string.

You can see the final bit of magic if you slip in another print
statement:

    $x = $x * s/../print "print chr 0x$& and 'qq'"/ee;

Even in this simplified form, theres a good deal going on.  Any use of
s///ee makes me cross-eyed when I first try to figure out what it's
doing.

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: Mon, 21 Sep 1998 13:47:54 -0400
From: Eric Goforth <Eric-Goforth@csi.com>
Subject: Newbie sort questions
Message-Id: <3606914A.49ED@csi.com>

I was hoping that someone can explain some demo programs in Naba
Barkakati's Discover Perl.  As given in the book, here are two examples
of using the sort funtion:

C:\Perl\myapps>cat sortcost.pl
#!/usr/bin/perl
@cost = (24.99, 19.95, 49.95, 44.99);
@sorted_cost = sort @cost;
#print "@sorted_cost\n";
print "@sorted_cost";

C:\Perl\myapps>cat sortname.pl
#!/usr/bin/perl
@names = ("Joe", "Tom", "John", "Bill", "Mary", "Susan");
@sorted_names = sort(@names);   #save the array
print "@sorted_names\n";

My question is, what's the rule as far as using parentheses when using
the sort function?  Is it used for strings arrays only?  

Also, I don't see any difference between print "@sorted_cost\n"; and
print "@sorted_cost";.  Both of these cause all the output to be printed
on a single line, I thought that \n was supposed to be a line feed.

TIA,
Eric
-- 
To respond via e-mail, please remove what's between Eric and Goforth in
my address in order to get my real e-mail address.


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

Date: Mon, 21 Sep 1998 14:12:35 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Number Sort
Message-Id: <alecler-2109981412350001@dialup-600.hip.cam.org>

In article <MPG.106f231a38bc0c1f989879@nntp.hpl.hp.com>, lr@hpl.hp.com
(Larry Rosler) wrote:

[...]
> For the more efficient approach, read the FAQ and the FMTYEWTK about 
> sorting to which it points.  Once you get the hang of the Schwartzian 
> Transform, you can pour it out by rote:
> 
> @anarray = map $_->[0] => sort { $a->[1] <=> $b->[1] }
>     map { [ $_, (split /\|/)[0] ] } @anarray;


This is right, though the formatting could be neater. :-) 
However the thing may be (?:somewhat|marginally) more efficient if you
only split on the first "|", since only the first element is needed (just
an observation.)

   @anarray = map  { $_->[0] }
              sort { $a->[1] <=> $b->[1] }
              map  { [ $_, (split /\|/, $_, 2)[0] ] } @anarray;

A possible regexp alternative:

   @anarray = map  { $_->[0] }
              sort { $a->[1] <=> $b->[1] }
              map  { [ $_, /^(\d+?)\|/ ] } @anarray;

Andre


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

Date: Mon, 21 Sep 1998 13:38:43 -0500
From: Josh Freeman <frejos@cswnet.com>
To: cedilnik andrej <andy@here.ml.org>
Subject: Re: Open directory in perl
Message-Id: <36069D33.EFBBB208@cswnet.com>

Hello:

opendir (DIR, "/home/filename");
@filelist = readdir (DIR);
closedir (DIR);

foreach $file (@filelist) {
open (FILE, $file);
   ... whatever ...
close (FILE);
}

Josh Freeman
frejos@cswnet.com

cedilnik andrej wrote:
> 
> Hi!
> 
> I have directory full of .dat files. Now I would like to open each file
> and check first line to see if it match and what it is.
> 
> How do I open directory?
> 
> Please make CC to andy@here.ml.org
> 
>                         Andy


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

Date: Mon, 21 Sep 1998 14:32:11 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <36069BAB.FCC07031@min.net>

George Reese wrote:
> 
> I have already stated that freedom has no place in programming. 

s/stated/claimed/;

> Now you may disagree with it, and I have certainly provided
> support for that assertion.

No, you "certainly" have not.
Unless for "support" we are to read "repeated dogmatic assertions".

-- 
John "Many Jars" Porter


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

Date: Mon, 21 Sep 1998 14:34:26 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <36069C32.B68579FF@min.net>

George Reese wrote:
> 
> More to the point, "programmer freedom", while it may be fun for the
> programmer, is the freedom to escape application design constraints
> MUCH MORE SO than it is to optimize beyond the foresight of the
> language designers.  On large scale, multi-developer projects, such
> freedom is dangerous.

Pure poppycock.

Thanks for a good chuckle, George.

-- 
John "Many Jars" Porter


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

Date: Mon, 21 Sep 1998 14:37:36 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <36069CF0.B07720FD@min.net>

Jonathan Abbey wrote:
> 
> In article <360026F0.136F6AD@min.net>, John Porter  <jdporter@min.net> wrote:
> | > Java is pure OO.
> |
> | No, not really.  One glaring example is that intrinsic data types
> | are not classes like user-defined classes.  Arrays, for example,
> | can only hold intrinsic data types.  That's one of the reasons
> | they had to invent the Vector class.
> 
> That turns out (*cough*) not to be the case.  In Java, arrays can
> indeed be defined to hold intrinsics, but they can also be defined to
> hold instances of any defined type of object.
> 
> Vectors are there to provide dynamically sizable arrays, to allow
> deletions in the middle, to provide a bunch of methods for finding
> elements, performing enumerations, etc.
> 
> One thing Vectors can't do is hold unwrapped intrinsics.  Vectors can
> only deal with objects.

So I got it a little backwards. :-)

My point is essentially the same; intrinsic data types are not
full-fledged classes.  Working with them is not done in an OO style,
unlike in Smalltalk.

-- 
John "Many Jars" Porter


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

Date: Mon, 21 Sep 1998 14:40:58 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <36069DBA.88E816C@min.net>

George Reese wrote:
> 
> In comp.lang.java.programmer Patricia Shanahan <pats@acm.org> wrote:
> : When it comes to programming language selection I believe in keeping a
> : good stable and picking the horse for the course.
> 
> Where have I argued contrary to this?  The point goes back to perl v
> python.  When you have that in your bag of tricks in a structured
> language, why bother with a second that does just the same thing?

Interesting to note how your arguments have evolved from
"Perl is so far beneath Python" to "One is as good as the other,
so why bother with two".

-- 
John "Many Jars" Porter


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

Date: Mon, 21 Sep 1998 14:53:01 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <3606A08D.96113B3E@min.net>

George Reese wrote:
> 
> This thread is (now) basically about the OO
> structure enforced by python and perl vs. the lack of structure in
> perl.  Perl and python are functionally similar languages.  Perl,
> however, allows a variety of ways of expression.  Python, on the other
> hand, forces an OO expression in a very strict syntax.

BFD about syntax.  Syntax is not the issue.

The issue is: Is OO important, and does Language X enforce coding
in an OO style?

I know you admitted that Python falls short of Pure OO in one way
(encapsulation).  But the fact is, Python is no better than Perl at
forcing the programmer to program in an OO style.  Recent example
programs in this thread illustrate this.  Python is considerably less
OO than Java -- not to mention true OO languages like Smalltalk.


> My money is on the "drone" armed with the algorithm.

Great!  You'll probably lose.


> It is a good rhetorical device to take a belief which I will affirm
> (that OO is important) and then dismiss that belief as religious.

You're being a little disingenuous.
You have not be arguing that OO is "important", 
you have been arguing that OO is The One True Way.  
That's religious.  

Dismissed.

-- 
John "Many Jars" Porter


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

Date: Mon, 21 Sep 1998 14:57:23 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <3606A193.9F07E265@min.net>

Randal Schwartz wrote:
> 
> Funny thing.  Dejanews has nearly precisely a two year gap for
> any postings to comp.lang.perl.* by this "Larry Wall" guy.
> 
> Welcome back.

Randal, I think as long as we wage the Perl vs. Java debate,
and cross-post it to comp.lang.java programmer, we'll see
Larry here sometimes.

So don't get too excited.  :-)

-- 
John "Many Jars" Porter


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

Date: Mon, 21 Sep 1998 15:29:27 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <3606A917.6924FA9B@min.net>

George Reese wrote:
> 
> In comp.lang.java.programmer Uri Guttman <uri@sysarch.com> wrote:
> :>>>>> "GR" == George Reese <borg@imaginary.com> writes:
> : another reason not to hire you.
> 
> I did not know I asked you for a job.

Um, he said "would not", not "will not".


> : if it is an algorithm and it works it
> : can be programmed. it may be a pig but on a turing compatible system it
> : can be done.
> 
> If it is an algorithm, a computer can be programmed to do it IN
> PRINCIPLE.  There are a lot of things computers can do in principle
> that they cannot yet do in fact.

The principle is all that matters.


> : in fact algorithms are not usually descibed in english but in pseudo
> : code or some formal language. these can easily be converted to working
> : code by your drones.
> 
> Uh, bullshit.  Algorithms are described in all sorts of ways.  Daniel
> Dennett has a wonderful book called "Darwin's Dangerous Idea" that
> talks all about the idea of evolution as an algorithm.  I would love
> to see that formulated in pseudo code.

Algorithms are usually described in pseudocode or some formal
language.  Fact.

Does the word "usually" confuse you?


> OO is about isolating all risks.

Glad to hear you say that, because now I know for sure that
you don't know what you're talking about, even in the subject area
most dear to you.

-- 
John "Many Jars" Porter


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

Date: Mon, 21 Sep 1998 15:44:14 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Java - differences and uses
Message-Id: <3606AC8E.E6D72732@min.net>

Brent A Ellingson wrote:
> 
> George Reese (borg@imaginary.com) wrote:
> 
> : * I have never said that OO was proper for everything.
> :   That Python was written in C does not imply that C was necessarily
> :   the best tool for the job.  In fact, I believe I have seen rather
> :   lengthy lamentation of this fact in python forums.
> 
> Exactly WHO laments that significant parts of Perl, Python,
> Emacs, Java, most UNIX's, most LISP's, most Schemes, most C++'s,
> Win9x, WinNT, ad infinatum, are written in C?
> 
> Does Guido van Rossum lament this?  Does Larry Wall lament this?
> Do Guy Steel, or Richard Stallman, or James Gosling lament this?
> 
> NO.  They each took the the cursed hammer in hand, and built screw
> drivers, and pipe wrenches, and table saws.
> 
> NONE of them sat in a corner and swore at the damned hammer.

Oh, I'll bet they ALL did.

Not that they do now, given that their toolboxes are now better
outfitted.

-- 
John "Many Jars" Porter


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

Date: Mon, 21 Sep 1998 11:54:38 -0700
From: "Felix S. Gallo" <fsg@newsguy.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <6u677j$sek@enews2.newsguy.com>

George keeps trying:
>fsg wrote in message <3605A0F8.4CA9E00E@ultranet.com>...
>>George, your schtick was briefly amusing in the sophomore-learns-a
>>new-language-and-decides-its-the-bestest-ever kind of way, but these
>>repetitious assertions of categorical fact and incoherent, raving
>>evangelism are making you out as a dolt in front of millions of your
>>potential employers and coworkers.
>
>Is a barrage of insults commonly accepted in comp.lang.perl.misc as a
proper
>form of argumentation?

Speaking of which, if you're going to fall back on 'this is not a proper
form
of argumentation' whenever someone makes a point, I'm going to have
to ask you exactly what form of argumentation you are attempting to
require.  Please be specific.  In going back through your posts, I've yet
to find one that wasn't either absurd, unsubstantiated, incoherently placed,
argument to unfounded authority, ad hominem, or circular logic -- so
please make sure you're not hypocritical in your selection.

>  Trust me, perl programmers are not my potential
>employers or coworkers.

*laugh*

>>> Design and naming things should be the result of a repeatable and
>>> structured process.  That is what OO methodologies are.
>>
>>Besides one other person, I have traditionally been the most vocal
>>standard-bearer on perl5-porters for 'OO methodologies' (sic).
>
>Hmm.  If the OO-ness of perl is any measure of your OO expertise, I do fear
>greatly.

It's not.

>> But
>>even I understood after my sophomore year that OO is not for
>>everything.  And you too will come to understand, one day, after
>>your first meaningful software project, that there are all sorts of
>>things a hell of a lot more important than ideological purity.
>
>You and Uri just keep repeating the mantra that I think OO is for
everything
>in spite of the fact that I have repeatedly stated that is not the case.
>And here you misrespresent my point view punctuated with an insult.


The fact that you contradict yourself implies that you're irrational, but
it doesn't free you from having to explain your statements, such as
the one about how if you don't design algorithms with design patterns,
you're doing voodoo (I passed that around the office, and everyone
fell about laughing, by the way.  Nice.)  You've made a number of
authoritative and objective statements about how OO is mandatory.
That you have then occasionally retreated into a fumbling, semi-
apologetic uh-that-is-not-what-I-really-meant when confronted by,
e.g., Larry, is not good enough.

>>> Formatting is a function of standard programming practices, or, better
>>> yet, a well structured language like python.
>>
>>Python is a little less well structured than Perl, which is about
>>what you'd expect from a subset of Perl.
>
>Then you either don't know jack shit about python or you don't know jack
>shit about structured programming.

Both of those are false, but thanks for the misplaced evangelism.

> You are the only person I have ever
>heard make this ridiculous claim.  Even in this thread, no one has tried
>that line of argumentation.

Mmm, proof by quantity.  You say you studied argumentation where?

In any case, python really is a subset of Perl, if you study both their
opcode sets.  Perl provides _more_ ways to structure programs,
and so in the hands of a capable programmer, can be more cleanly
structured.  No, it's not forced on you -- but you don't seem to
understand that there is no linkage between syntactic bondage and
program goodness.

>>> Algorithms should be the result of proven design patterns.
>>
>>Once you actually begin to design algorithms in the real world,
>>you will find out that this sentence, beyond just not making any
>>kind of sense at all, is purest levity.
>
>You mean once I do what I have been doing for years, something I am a
>recognized expert in?  Damn!

Please explain who is recognizing you as an expert.  I've never heard
of you, and the only person I know who has thinks that you program
for MUDs.

>>For a good real world example that you can study the source code
>>for, try the perl5 regular expression code.  It was not designed
>>with 'design patterns' in mind -- in fact, it was invented more
>>than a decade before 'design patterns' became the latest vogue --
>>but it has survived numerous attempts to supplant it with
>>replacements designed by 'OO methodologies' (sic).  Why?  Because
>>cleanliness is not everything.  In some cases, speed is
>>everything.  In others, functionality is everything.  In still
>>others, cost is everything.  In my several years of real world
>>software, I would guess that speed and cost have been my most
>>usual requirements, followed by cleanliness and thence by
>>functionality.
>
>And this would be why I would not hire you.

I continue to believe that you are not employed as an actual software
programmer; the possibility just seems so remote.  But in the event
that you are, you must just be starting out.  So let me provide you
with a little real world advice: get flexible in your thinking or prepare
to be jobless.  The real world software industry does not screw
around with people who think their one big idea is the solution to
all the problems in the world.

>>By the by, I'm also a major advocate of design patterns, have
>>written articles, etc., etc.  But it's just _funny_ to suggest
>>that even a third of your code can be based on the current art.
>
>Funny only if you do not understand anything about OO software engineering.

More un-backed-up assertions.  As backup, the 150 years of OO software
engineering experience I'm familiar with (me, coworkers, and all the people
I know in the field) believe that you are totally smoking dope.  Nobody can
even understand your line of thinking; and these include people who helped
design COM, who have written clean room JVMs, who helped design
CORBA, and who are employed by firms both large and small.  All of us
were programmers long before 'OO methodologies' (sic) became a fad,
and we'll likely be around for the next thing too.  The best approximation
anyone has come up with is from a fellow who has written two OO design
books: he generously suggests that you're using the words 'algorithms'
and 'design patterns' to mean something they don't usually mean (in
or outside of software engineering), and that you're trying to say that
systems should be designed coherently.  Which would be so obvious
as to be uninteresting, but that's the most charitable view.  The least
charitable view is that you're trying to make up for a lack of something
to say by putting out Officially Approved Buzzwords In a Random Order.

>>> Otherwise, you are just talking voodoo.
>>
>>If 99% of the world is held together by voodoo -- which it is,
>>considering what's running your car, your microwave, your
>>computer, your routers, your electronic musical instruments,
>>your thermostat, and your utilities -- then maybe you should
>>give voodoo a little respect.
>
>Those are small, isolated applications.  Try moving into the world of more
>complex applications.

Neither your computer, your router, or your public utilities are 'small,
isolated applications' (sic).  Do you have any idea how many millions
of lines of code are in Windows or Solaris, or how massively complex
the public utility computers are?

>>I think we can forgive Uri that -- after all, you clearly don't
>>know what it is to be a programmer.
>
>Another personal attack.  At least when I stated Uri does not know what
>freedom is, it came after showing where his use of the word was absurd.
You
>are just simply making attacks which, in this case, is clearly not backed
up
>the facts.

Your 'showing where his use of the word was absurd' was unconvincing
and illogical; it merely showed that you do not believe the same things
that he believes.  This may come as a surprise to you, but you're not
the arbiter of objective fact.

I can conclusively say that I have not found a single person willing to
support your side of the argument amongst my collection of coworkers,
compatriots, friends and acquaintances, a collective group owning
about 150 years worth of OO experience, about 250 years worth of
real world software experience, and about 20 million dollars in
equity in successful software companies.

>>And you need to stop learning from books and try to make money out here
>>in the asynchronous sixty-way in-the-dark firefight we professional
>>hackers call 'trying to make a living writing software'.  We look
>>forward to competing with you.  Not to be too cruel, but at this
>>point, I'd take 1 Ari over 30 George Reeses.
>
>I make a very good living at writing software, thank you.


I admit to great surprise.  In what field?

Felix




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

Date: Mon, 21 Sep 1998 12:15:42 -0700
From: terrazas@labmed.ucsf.edu (Enrique Terrazas)
Subject: PerlMagick & linux
Message-Id: <terrazas-2109981215420001@asgard.ucsf.edu>

Hello,

I installed ImageMagick (ImageMagick-4.1.0-1glibc.i386.rpm) on my linux
machine (Pentium PC running RedHat Linux 5.1) with no problem.  However, I
can't get PerlMagick installed.  I get the following error when I try to
"make":

cc -c -I../magick -I/usr/local/include/magick -I/usr/X11R6/include
-Dbool=char -DHAS_BOOL -I/usr/loc
al/include -O2    -DVERSION=\"1.45\" -DXS_VERSION=\"1.45\" -fpic
-I/usr/lib/perl5/i386-linux/5.00404
/CORE  Magick.c
Magick.xs:15: magick.h: No such file or directory
make: *** [Magick.o] Error 1

Is magick.h supposed to be installed with ImageMagick?  If so, it doesn't
seem to be installed on my machine. 

Any help would be appreciated.  TIA

-- 
Enrique Terrazas
mailto:terrazas@labmed.ucsf.edu
http://pangloss.ucsf.edu/~terrazas/


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

Date: Mon, 21 Sep 1998 13:31:52 -0400
From: Josh Cook <josh@jersey.net>
Subject: Printing Question  --  I'm a beginner
Message-Id: <36068D88.7D87@jersey.net>

Sorry to ask what is probably a simple question, although I have no clue
how to do this.  We run Perl on our UNIX box and I need to send the
output of a Perl program to our HP4 printer.  The problem is that I need
to set the printer to landscape mode (for printing on envelopes).  Does
anyone know who to do this with the equipment I have.  Any pointers or
examples would be great!

Please respond via email

Thanks
Josh
josh@jersey.net


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

Date: Mon, 21 Sep 1998 18:06:07 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Printing Question  --  I'm a beginner
Message-Id: <36069326.16765B2A@bbnplanet.com>

Josh Cook wrote:

> Sorry to ask what is probably a simple question, although I have no clue
> how to do this.  We run Perl on our UNIX box and I need to send the
> output of a Perl program to our HP4 printer.  The problem is that I need
> to set the printer to landscape mode (for printing on envelopes).  Does
> anyone know who to do this with the equipment I have.  Any pointers or
> examples would be great!

My goodness, printing with Unix seems to be a recurrent theme today.
Josh, this isn't a Perl question. However, if you have an HP4 they have
wonderful documentation on their Jetadmin software which may answer your
question. Also, you might go compile yourself a copy of enscript which
will do the job even better. You might also just read the manpage for
lp. Enjoy.

e.

"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon."  R. Carver


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

Date: Mon, 21 Sep 1998 10:02:57 -0700
From: Carlos Corzo <r26878@email.sps.mot.com>
Subject: Problem with Splits on blank lines
Message-Id: <36068687.4AF43B58@email.sps.mot.com>

Hello,

I have a string which contains blank spaces between the information in the line.

I would like to split the line to create a list containing all of the strings
which were separated by blanks, then I will reverse the list and pop the first
element off the list to get rid of the first string and then reverse the list
again.  After this I will join the remaining list back to create a new string.

I can do this but my problem is the initial split of the line 

I have like

Example:

TheDogRan       Over the mountain

I want to create a list of

("TheDogRan", "Over", "the", "mountain")

and then do what I explained earlier.  My problem is the pattern to use on the
split command to create this list from the string expression above.

Thanks for your help.

Carlos


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

Date: Mon, 21 Sep 1998 18:06:42 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Problem with Splits on blank lines
Message-Id: <SAwN1.497$XP2.3830022@news3.voicenet.com>

Carlos Corzo <r26878@email.sps.mot.com> wrote:
>I would like to split the line to create a list containing all of the strings
>which were separated by blanks, then I will reverse the list and pop the first

pop works of the 'righthand side' of an array.  shift works on the
'lefthand side' of an array.  Neither work on lists.

@array = qw(first middle last);
print 'shift works on the ', shift @array, " element\n";
print 'pop works on the ',   pop   @array, " element\n";
print "All that is left is what's in the @array.\n";

>element off the list to get rid of the first string and then reverse the list
>again.  After this I will join the remaining list back to create a new string.
>
>I want to create a list of
>
>("TheDogRan", "Over", "the", "mountain")

Wow, that sounds like a lot of work.  How about:

($new_string = $old_string) =~ s/\S+\s*$//;

Which will trim from the end of the string to the first whitespace it
encounters (Or, failing that, the begining of the string).

You can trim off trailing whitespace easily enough.  If you'd rather do
it in one step use:

($new_string = $old_string) =~ s/\s+\S+\s*$//;

Although, this will fail when the string does not have any whitespace in
it except for trailing.


If you decide this isn't what you want and still want your original
method, don't bother reversing - there is no need:

$old_string  = 'TheDogRan Over the mountain';
@temp_array  = split /\s+/, $old_string;
$old_element = pop @temp_array;
$new_string  = join ' ', @temp_array;

This has the disadvantage (?) of compressing all whitespace into one
space.

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: Mon, 21 Sep 1998 13:47:38 -0500
From: Josh Freeman <frejos@cswnet.com>
To: Dan Albertsson <dan.albertsson@swipnet.se>
Subject: Re: require does not work
Message-Id: <36069F4A.6E52F301@cswnet.com>

Dan,

I assume that IIS changes the Environment Path when it runs the script.
Try pushing the path into the @INC array:

push (@INC, "E:\\MyPath");
require "test1.sub";

I'm not sure if the '\' has to be escaped or not in this context.

Josh Freeman
frejos@cswnet.com

Dan Albertsson wrote:
> 
> When trying to call functions in other perl files I use for example:
> 
> require 'test1.sub';
> 
> And then call functions in that file.
> 
> This works fine running perl stand-alone in Windows95, NT and Unix
> environment.
> It also works fine when called as a cgi-script on my apache webserver.
> 
> But it does not work when called as a cgi-script on my Microsoft IIS
> webserver. My webbrowsers only response is something like:


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

Date: Mon, 21 Sep 1998 13:48:41 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Search for special characters?
Message-Id: <36069F81.2260114@email.sps.mot.com>

yakuza wrote:

> 1.  I need to allow the users to search for special characters such as a
> "$".  How do I allow the search without requiring the user to type in the
> escape character?

Try quotemeta fucntion or \Q\E escapes in regex:

	$quotedword = quotemeta v;
	print 'found' if /$quotedword/;
			OR
	print 'found' if /\Q$to_search\E/;

-Tk-


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

Date: Mon, 21 Sep 1998 13:50:02 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Search for special characters?
Message-Id: <36069FD3.8109E7E6@email.sps.mot.com>

yakuza wrote:

> 1.  I need to allow the users to search for special characters such as a
> "$".  How do I allow the search without requiring the user to type in the
> escape character?

Try quotemeta fucntion or \Q\E escapes in regex:

	$quotedword = quotemeta $to_search;
	print 'found' if /$quotedword/;
			OR
	print 'found' if /\Q$to_search\E/;

-Tk-


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

Date: 21 Sep 1998 19:41:52 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: where is Date::Parse?
Message-Id: <6u6a60$ptk$2@info.uah.edu>

In article <6u5vgj$q3h$2@client3.news.psi.net>,
	abigail@fnx.com (Abigail) writes:
: It's just a plain stupid and dumb piece of code. To frustrating
: to work with. 

This is not my experience.  Could you elaborate?

Greg
-- 
A great many people think they are thinking when they are merely rearranging
their prejudices. 
    -- William James


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

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

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