[8675] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2292 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 10 15:07:15 1998

Date: Fri, 10 Apr 98 12:00:29 -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           Fri, 10 Apr 1998     Volume: 8 Number: 2292

Today's topics:
        an interesting problem <phil@math.univ-tlse1.fr>
    Re: Bill Gates should be invited to O'Reilly's "Free So (Michael Funk)
    Re: Bill Gates should be invited to O'Reilly's "Free So (Chris Nandor)
    Re: can't copy gif file on NT? <sowmaster@juicepigs.com>
    Re: can't copy gif file on NT? (Craig Berry)
        Consulting Job Offer <yasumura@ix.netcom.com>
        error message during installation (Alan Jiang)
    Re: General Rudeness, e.g. Re: Need a web login script <eugene@vertical.net>
    Re: How do I format Local Date? (I R A Aggie)
        IPC::open2 and  $/ (sdm)
        Is it the code or is it the server? <sanct@dlc.fi>
    Re: keys in hashs <lr@hpl.hp.com>
        Newbies simple question - NT/Perl <iang@jet.es>
    Re: Perl Puzzle: How Many Contexts? (Ilya Zakharevich)
    Re: perl win 32 :  asterisk on command line (Jeffrey R. Drumm)
    Re: perl win 32 :  asterisk on command line (Jeffrey R. Drumm)
    Re: print <perlguy@inlink.com>
    Re: problem printing long line to file <lr@hpl.hp.com>
    Re: problem printing long line to file (Craig Berry)
    Re: RMS should be invited to O'Reilly's "Free Software  (Michael Funk)
    Re: Sharing a constant between scripts <rsgoheen@pobox.com>
    Re: substitution question (Craig Berry)
        THIS HAS TO BE EASY ;) Child .bat inheriting Perl %ENV <bldadmin@esd.sgi.com>
    Re: Week of Month (I R A Aggie)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 10 Apr 1998 11:22:00 -0700
From: Phil Ehrens <phil@math.univ-tlse1.fr>
Subject: an interesting problem
Message-Id: <352E586F.A892101@math.univ-tlse1.fr>

This is a multi-part message in MIME format.

--------------336EDF511493FC673F6679D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I am trying to write a customer list parser for my boss.  It has to be
REALLY easy for him to modify.

I hacked up the following bit of code, and found I had an intersting
problem, the last block acts strangely, and when I tried to debug it
with a bunch of prints, all my tests worked as expected EXCEPT the
actual pattern that I want!

The bad block is at the end, and describes the problem in detail.

All help appreciated!

Phil

--------------336EDF511493FC673F6679D
Content-Type: text/plain; charset=us-ascii; name="phildb.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="phildb.pl"

=head 

 call as:
          phildb database 3 italian french etc.

 where a database of translations is provided
 and "3" is an entry to search for
 italian french etc. are the langs to return 
 the word in!

 here is the database contents:

une uno una 1 one ein
deux dos due 2 two tswei
trois tres trese 3 three drei
quatre quatro quattro 4 four fier
cinq cinco cinque 5 five funf

=cut

BEGIN{ 
$n = 0;
$delimiter  = " "; # the database delimiter
$output_sep = "\n"; # the output seperator
$french     = 0;   # column descriptors
$spanish    = 1; 
$italian    = 2;
$integer    = 3;
$english    = 4;
$german     = 5;

if($#ARGV > 2){ # when more than one field is requested
   while($n <= $#ARGV){$language[$n++] = pop(@ARGV);}
  }
 else{$language[0] = pop(@ARGV);} # only one field was requested

$search_str = pop(@ARGV); # search string is $ARGV[2];
@foo = <>; # read whole database ($ARGV[1]) into memory

} # end of BEGIN block

foreach(@foo){
        if(@foo[$i] =~ /$search_str/io){
           @current_line = split($delimiter,@foo[$i]);
           $j = 0;
           
           # the next block SHOULD return the listed translations,
           # but it doesn't!?  it ALWAYS returns language[0] (french)!
           # returning the french value 3 times if three langs are
           # requested!  what's the deal?
           foreach(@language){
                   printf("%s%s",@current_line[@language[$j++]],$output_sep);
                  }
           
           }
$i++;
}

--------------336EDF511493FC673F6679D--




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

Date: 10 Apr 1998 18:00:22 GMT
From: mwfunk@uncc.campus.mci.net (Michael Funk)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <slrn6isnnh.csq.mwfunk@localhost.domain>

On 10 Apr 1998 09:40:24 GMT, Stefaan A Eeckels <Stefaan.Eeckels@ecc.lu> wrote:
>
>I believe the GPL to be one of the main reasons for the
>success of Linux (as oposed to the BSD386 derivatives),
>even though the effect of the GPL is to severely restrict what
>commercial companies can do with the code (they can't make it
>proprietary, as happend with X ;-). 

Linux had a year or so head start on FreeBSD and the 
derivatives, that makes a big difference too.  Some
would argue that the X thing demonstrates that free
software doesn't need an anticommercial clause...XFree86
stuck with the older, free version, will continue to
develop that, and will likely be more relevant in years
to come than TOG, with regard to being the 'standard'
X implementation.  TOG made a derived work proprietary,
but the existing license ensured that they could never
take R6.3 away from anyone.  This is good enough in 
my view.

Some might complain that TOG will be able to lift code
from XFree86 but not vice-versa...I also have no problem
with that.  TOG will still have to put in a ton of added
value if they want to make XFree86 irrelevant, and that's
simply not possible given their resources and abilities.

>Would you object to 'his free software concept' ?

I think no one here would object to their own notion of what
free software is all about, but a large number of people
do have objections to his particular perspective.

  Mike



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

Date: Fri, 10 Apr 1998 18:01:38 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <pudge-1004981401260001@dynamic500.ply.adelphia.net>

In article <352E11A3.4813@min.net>, jdporter@min.net wrote:

# Chris Nandor wrote:
# > 
# > Maybe you mean the images on the fronts of the book?  The Camel image was
# > public domain and is no more; 
# 
# Now I'm confused. How can someone take a public domain image and make
# it proprietary?  Who did they buy the rights from? The public?
# 
# Also, where did you get your information? I don't see where (in the
# book itself) it says the camel image on the cover is trademarked
# property
# of O'Reilly.

It certainly is, for certain purposes (i.e., the cover of Perl books, Perl
web sites, etc.).

Where do I get my info?  Tim O'Reilly, for one, at the Perl Conference. 
People involved with Perl Mongers.  ORA employees, TPI, etc.

I could probably use that image for use with a beverage company, as long
as it was not in any way related to computer programming.  Then again,
IANAL.  I just know that everyone who seems to know agrees that ORA has
exclusive rights to this image in relation to Perl.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==               New Book:  MacPerl: Power and Ease               ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


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

Date: Fri, 10 Apr 1998 13:54:24 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: hsiwei yu <yu.michael@epamail.epa.gov>
Subject: Re: can't copy gif file on NT?
Message-Id: <352E5CD0.928@juicepigs.com>

hsiwei yu wrote:
> 
> Hi All,
> 
> this script won't copy a gif file on NT (but OK on UNIX)
> 
> open( INFILE, "...gif" ) || die( .. );
> open( OUTFILE, "> ...gif" ) || die( .. );
> 
> while ( <INFILE> ) {
>    print OUTFILE;
> }
> 
> The output gif file is smaller in size than the original. An implication of
> this is I can't send a gif file to web page for display.
> 
> I run on NT, Perl from ActiveWare, version 5.003_07. Or I need a special
> switch when copying binary file? TIA


You are using an outdated version of perl. You can find the standard
win32 port (5.04_04) at perl.com.

But the immediate answer you are looking for may be found in the docs.

 perldoc -f binmode


HTH

-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: 10 Apr 1998 18:01:18 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: can't copy gif file on NT?
Message-Id: <6glmpe$e7f$2@marina.cinenet.net>

hsiwei yu (yu.michael@epamail.epa.gov) wrote:
: this script won't copy a gif file on NT (but OK on UNIX)
: 
: open( INFILE, "...gif" ) || die( .. );
: open( OUTFILE, "> ...gif" ) || die( .. );
: 
: while ( <INFILE> ) {
:    print OUTFILE;
: }
: 
: The output gif file is smaller in size than the original. An implication of
: this is I can't send a gif file to web page for display.

GIFs are binary files, but you're treating them as text files in the 
fragment above.  You need to use binmode on both filehandles to stop NT 
from doing \r\n <-> \n conversions.  Also, doing 'line-oriented' 
processing on the INFILE is a no-no in any environment; binary files 
don't have lines.  My recommendation is that you simply use File::Copy 
instead.

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


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

Date: Fri, 10 Apr 1998 05:57:37 GMT
From: Gary Yasumura <yasumura@ix.netcom.com>
Subject: Consulting Job Offer
Message-Id: <6glmkj$53q@dfw-ixnews5.ix.netcom.com>

I'm looking for someone who can modify cgi/perl scripts.

Send your qualifications to yasumura@cyberinkpress.com

Thanks,
Gary Yasumura
CyberInk Press
Santa Clara, CA
E-mail: yasumura@cyberinkpress.com
        yasumura@ix.netcom.com


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

Date: 10 Apr 1998 14:09:12 -0400
From: weijiang@pegasus.rutgers.edu (Alan Jiang)
Subject: error message during installation
Message-Id: <6gln88$3ec$1@pegasus.rutgers.edu>

I have a question about installing libnet-1.0604. When I type 'make
install', the following error message is displayed:

/bin/sh:
/var/tmp/perl-root/usr/lib/perl5/i386-linux/5.00401/perllocal.pod: No
such
file or directory
make: *** [doc_site_install] Error 1

My questions are:
1. What is the source of the problem
2. Why modules are installed under /var/tmp/perl-root/usr/lib/perl5
  instead of /usr/lib/perl5

FYI, the version of perl installed on the server is 5.00401.
thanks for any suggestions

Alan Jiang
Rutgers University


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

Date: Fri, 10 Apr 1998 13:32:50 -0500
From: Eugene Sotirescu <eugene@vertical.net>
Subject: Re: General Rudeness, e.g. Re: Need a web login script
Message-Id: <352E65D0.40AE3078@vertical.net>

Please note that:
1.There is some 'general rudeness' in the question too. "I need" this and that
is what you say to a salesperson (although even then a 'please' may be used),
not to the providers of free advice in a newsgroup you're new to.
2.RTFM is irrelevant since this is not a Perl question
4.Yes, pointing the poster to a relevant newsgroup would have been appropriate.

5.There is no "its my playground" attitude in what Abigail has posted.
6.It was Abigail decision whether to respond or ignore the post. She decided to
'add to the general noise'; so did you and so did I if you're reading this.

BTP

Eugene

sonny wrote:

> Do you think that being rude to people who post questions that you deem
> aren't worthy will deter others from doing so?  All this invective just adds
> to the general noise.  Ignore them, tell them to RTFM, or give'm an URL, but
> this "its my playground" attitude is really childish.
>
> sonny
>
> Abigail wrote:
>
> > David Schwab (dschwab@wolfe.net) wrote on MDCLXXXII September MCMXCIII in
> > <URL: news:352C9571.FD3BAB78@wolfe.net>:
> > ++ Yes I need a weblogin script that allows people to pass a login and
> > ++ password thru a prompt and then have another way for an admin to add
> > ++ users and remove something like .Htaccess please help if you can.
> >
> > So, what's your Perl question?
> >
> > This group is not about the web, nor is it a gimme, gimme, gimme group.
> >
> > Abigail
> > --
> > perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'





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

Date: Fri, 10 Apr 1998 14:18:49 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: How do I format Local Date?
Message-Id: <fl_aggie-1004981418490001@aggie.coaps.fsu.edu>

In article <Pine.BSI.3.96.980410104456.19504A-100000@pentagon.io.com>,
Chocolate <poohba@io.com> wrote:

+ How do I format the $ENV{'LOCAL_DATE'}

I don't have no such stinkin' environmental variable.

+ or can I format the /usr/bin/date?

Try 'man date', which has a section:

     + format
          If the argument begins with +, the output of date is under the
          control of the user.  Each Field Descriptor, described below, is
          preceded by % and is replaced in the output by its corresponding
          value.

Alternatively, there is the perl routine 'localtime':

perldoc -f localtime
=item localtime EXPR

Converts a time as returned by the time function to a 9-element array
with the time analyzed for the local time zone.  Typically used as
follows:

    #  0    1    2     3     4    5     6     7     8
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                                                localtime(time);

All array elements are numeric, and come straight out of a struct tm.

[snip]

Info on "struct tm" can be found in the man page for the c version of
'localtime' (man localtime), and states:

     Declarations of all the functions and externals, and the tm structure,
     are in the time.h header file.  The structure declaration is:

          struct    tm {
               int  tm_sec;   /* seconds after the minute - [0, 61] */
                                   /* for leap seconds */
               int  tm_min;   /* minutes after the hour - [0, 59] */
               int  tm_hour;  /* hour since midnight - [0, 23] */
               int  tm_mday;  /* day of the month - [1, 31] */
               int  tm_mon;   /* months since January - [0, 11] */
               int  tm_year;  /* years since 1900 */

[editor's note: please observe that tm_year provides a relative year to
 1900, so if you want to reconsitute the full year, you'll need to add
 1900 to the result of tm_year.]

               int  tm_wday;  /* days since Sunday - [0, 6] */
               int  tm_yday;  /* days since January 1 - [0, 365] */
               int  tm_isdst; /* flag for alternate daylight */
                                   /* savings time */
          };
---

There, you now have sufficient information (actually, a lot more than you
need) to solve your problem.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: 10 Apr 1998 18:54:36 GMT
From: sdm@blue.seas.upenn.edu (sdm)
Subject: IPC::open2 and  $/
Message-Id: <6glptc$6mm$1@netnews.upenn.edu>

  I have two scripts that communicate to each other using IPC::open2. 
script1's output is unbuffered (undef $/), and script2's output
is unbuffered. I've noticed that script2 does not stop under certain 
conditions, and I was wondering if this was caused by the unbuffered 
output, or totally unrelated. 
  I've read the man page, and it mentions problems with sort, but I 
thought this might be a bit different.
  On a related note, is there any way I can kill the script from within it
if it is using too much cpu time? Certain times, it seems to be spinning 
out of control with no end in sight. 

thanks,
steve



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

Date: Fri, 10 Apr 1998 21:56:36 +0300
From: Aleksi Asikainen <sanct@dlc.fi>
Subject: Is it the code or is it the server?
Message-Id: <352E6B64.4DDB4C91@dlc.fi>

I have this big but easy - I hope - problem;

I made a simple server routine with perl, and a client that works like
this

    while ($line = <SOCK>) {print "$line\n\r";} 

It worked fine with WIN95 MS-DOS -window but now I want to change it to
work under a HTML-page so that it prints text "forever" until the "stop"
button of browser is pressed. (Means that it does not print a file, but
a log)

But it does not work. Browser only says "transferring data from a.b.c.d"
and does not go foward and print the data to the page.

So, does the script need some kind of flushing or is it just that my
HTTP-server (Sambar 4.1) is not configured right (if it's so, I promise
that I change group ;)?

-aleksi


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

Date: Fri, 10 Apr 1998 10:55:41 -0700
From: Larry Rosler <lr@hpl.hp.com>
To: Mark-Jason Dominus <mjd@op.net>
Subject: Re: keys in hashs
Message-Id: <352E5D1D.AE99C308@hpl.hp.com>

Mark-Jason Dominus wrote:
> 
> In article <352DB35D.7243@outofservice.com>,
> Jeff  <jn1@outofservice.com> wrote:
> >$myhash{'key'} = 12;
> >$myhash{key} = 12;
> >
> >first one is the better way to do it- the second one is a
> >bareword, and if perl6 ever came along and claimed the literal
> >token key as a symbol, your script would fail.
> 
> Wrong.  They are identical.  Try
> 
>         $myhash{time}
> 
> and see what it does.  Does it get the time?  Nope.

But it *does* get a warning from the "-w" flag.  So in that sense, they
are not identical.

Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com


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

Date: Fri, 10 Apr 1998 19:05:20 +0200
From: "Ian Gregson" <iang@jet.es>
Subject: Newbies simple question - NT/Perl
Message-Id: <6gloq5$s3t$1@diana.bcn.ibernet.es>

hello I have just downloaded an advertising perl script but I can't get it
to work. The first line of each .cgi file is. It tells me to make sure that
this points to where perl is installed

#!/usr/local/bin/perl

But for some reason when I point my web browser at admin.cgi it just
displays the file as a text document within my IE4.0. It is obviously not
compiling it. Am I doing something wrong ??

I have installed perl in the above location. The documentation tells me to
do a which perl to find out the location of #! but I can't find out how to
do this.

Any help would would be greatly appreciated.

Ian

Ian Gregson
iang@jet.es





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

Date: 10 Apr 1998 18:51:00 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl Puzzle: How Many Contexts?
Message-Id: <6glpmk$rma$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Mark-Jason Dominus
<mjd@op.net>],
who wrote in article <6glci5$1ir$1@monet.op.net>:
> In article <352D97F3.F8D8C17A@coos.dartmouth.edu>,
> Ronald J Kimball  <rjk@coos.dartmouth.edu> wrote:
> >There is no such thing as an "array" context.  List, scalar, void.
> 
> I've been trying to make a list of contexts; not all are
> distinguishable by `wantarray'.  The manual notwithstanding, there's
> not really any such thing as `boolean' context; that's just a figure
> of speech.  But there are at least two other contexts in Perl.

There is a boolean context.  It is currently distinguished only by
overloading engine (AFAIK), but this slowly propagates out, witness

    while ($in = <IN>)

discussion on p5p.

Ilya


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

Date: Fri, 10 Apr 1998 18:23:10 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: perl win 32 :  asterisk on command line
Message-Id: <352e0071.1967589@news.mmc.org>

On Fri, 10 Apr 1998 02:01:46 GMT, daclay@NOSPAMzip.com.au (Excession)
disingenuously blathered:

(much snippage)

>Try using * as an argument to a CMD file, and see what happens, Mr Perfect.

Name calling, now, Mr. Excession?

Well, without knowing what you want for commands in the CMD file (and any
commands you provide me will certainly have their own logic for command line
parsing):

	C:\Temp>copy con: test.cmd
	@echo off
	echo %1
	%1
	^Z
        1 file(s) copied.

	C:\Temp>test.cmd *.*
	*.*
	The name specified is not recognized as an
	internal or external command, operable program or batch file.

Bzzzzt. Thank you for playing.

Oh, and if you can come up with an example that _seems_ to prove your point,
I'd LOVE to see it.

>Do you get paid to enumerate 'what sucks about x' ?  

Nope. I happily do it for free; no sacrifice is too great, etc . . . 

>Are you familiar with the term ' it's easy to criticise, it's difficult to
>create'?   Do you whine and moan and carp about hardware?  Application
>software? Automobiles?  Public Transport?  Government decisions?
>Multinational expansionist policies?   Does any of your, er, ``considered''
>output do anyone any good whatsoever?

I'm quite familiar with the phrase you quoted. My job consists of creating
applications and interfaces. When the world I create _in_ makes my life more
difficult, I complain about it. Other folks may benefit from not having to
travel down the road I mistakenly took.

Furthermore, I don't understand what automobiles, hardware, public transport,
multinational expansionist policies and government decisions have to do with
the discussion at hand, but my 'considered output' usually helps those that ask
for it, and often, as a side effect, those that don't. I've been doing what I
do for a long time and make a darn good living at it. I doubt this would be the
case if I had provided ill-considered output for all these years . . .

And Now, Back to our scheduled program:

I pointed out a pitfall of Perl in the NT environment that to seasoned
DOS/Windows/NT developers would prove to be unexpected behavior. I DO know what
I'm talking about; as I said, I've been doing this for a long time. I know full
well what goes into obtaining a list of filenames from a command line argument
to an application. If you _truly_ did, you wouldn't be arguing with me on that
point.

Since I spend half of my development life in Unix and the other half in NT, I,
personally, find working with NT brain-addling, and I'm not shy about sharing
that experience with others. Your posts won't make me stop.

You, or anyone else, are free to make whatever comments about my choices of
operating systems you like, but I'll expect you to back them up (I've offered
to back mine up, but you've conveniently ignored that). I may defend my
choices, but I won't piss on your right to make your observations.  I will
point it out to you when you're wrong . . . believe it or not, I'll even agree
with you when you're right!

Stop taking this OS thing so personally.

>>Anyway, it's irrelevant. I posted an opinion about an operating system. I
>>followed that opinion with a smiley, which even most humor-challenged
>>individuals such as yourself recognize as an indication of frivolity.
>>Apparently, you're more humor-bereft than most.

>Ah, the old 'didn't ya see the smilie' line.  Perhaps the thought that I
>was speaking to the audience as well as yourself, crossed your heated brow
>as you composed your reply, hmm?

Ah, so your point was to display your inability to recognize humor to the world
as opposed to just me. Thanks for the clarification. ;-)

HUMOR ALERT!!!!! INCOMING INCOMING INCOMING ----------^

>>>This operating system *bigotry* really gets up my nose.  Sure, Windows NT
>>>has some problems, and Windows 95 has more, but the amount of oleaginous
>>>self congratulation by the various Unix-centred BIGOTS on this group,
>>>whenever 'NT' and 'Problem' come into scope, is just over-the-top pathetic.

>>If a simple opinion followed by a smiley gets under your skin this badly, I
>>might suggest that your suggestion to 'Grow up' is, ahem, misdirected.

>The 'simple opinion' was merely another example of the wider motif; "if
>someone mentions NT then denigrate, denigrate, denigrate!"  It was a
>catalyst for my rant.  I'm sure you feel hurt and angered that someone
>would take umbrage at your twee little offering (smiley and all), but my
>point remains -- O/S bigotry itself SUCKS far more than any individual
>operating system.

Well, I guess we differ on our definition of the term "bigotry." Apparently,
negative comments about your personal favorite operating system are "bigoted."
Tell the truth . . . if I had made the same comment about AmigaOS, VMS, CP/M,
or OS/2, just _what_ would your contribution to this thread have been?

As I mentioned previously, I work in _both_ the NT and Unix environments. My
primary desktop system is an NT system, and I'm xtermed into a couple of Unix
boxes all day long. I use Perl on my NT box for stuff that's _not_ mission
critical. It's one of the few things that makes NT a little less mind-numbing.

I have found NT to be lacking in areas that are important for doing the kind of
work I do (I develop interfaces between clinical systems at a large hospital in
the US Northeast). If my opinions about NT were _unfounded_, THAT would be "OS
bigotry". I've seen you offer no proof that NT provides functionality
equivalent to Unix (or any other operating system for that matter). If I have
the facts to back up my opinion but you refuse to acknowledge them, who's the
bigot?

Would you trust _your_ well-being to an operating system that crashes
regularly, whose applications (even the OS vendor's own!) write over other
applications' shared files willy-nilly, and must be rebooted to make even some
of the simplest configuration changes?

If so, you're a much braver (or foolhardy) man than I am.

>>>The plain fact of the matter is that -perl- is able to run on many
>>>different platforms, and whatever platform it runs on, there are different
>>>caveats.

>>>What makes the incompatibilities and idiosyncratic behaviour of perl on
>>>different versions of Linux, any different from perl running on DOS, OS/2
>>>or Window 95 or Windows NT? 
>
>>You'll find that the difference in Perl's operation on the aforementioned Unix
>>platforms is almost imperceptable when running the same version/build of Perl.

>Because Perl is Unix-centric.  And thats fine, I was surprised when I
>learnt that Perl would run on Windows NT, I was more surprised when I found
>it would run quite well on Windows 95.  I think it is great that Perl is
>available on these platforms, and I've gushed about that aspect of perl
>before (http://www.pcug.org.au/~dac/perl.htm).  

No argument there, other than the caveats that not all of Perl's functionality
is available because of shortcomings in Microsoft's operating systems.

>You won't find me going around saying 'Linux sucks because it won't run
>Starcraft'.  Yet if NT can't do something that Linux can, then it's "NT is
>braindead, it can't do FWVM".  Swings and roundabouts.

Well, if you couldn't play your video games on Linux, I guess you'd have a
right to be upset, and I sure wouldn't get my panties all in a bunch if you
whined. You see, even YOU have a right to an opinion . . .

Personally, I don't CARE what you say about ANY operating system if your
comments are valid and you have the proof to back them up. Just as you
SHOULDN'T care what I say, unless it's factually incorrect. This has absolutely
NOTHING to do with bigotry . . . look the word up in your Funk and Wagnalls
sometime.

>>Your perceived differences are either because the vendors of those Linux
>>versions insist on including outdated versions, or you don't actually have any
>>experience with them (I'll give you the benefit of the doubt and assume the

>Sheesh.  My perceptions have nothing to do with the DIFFERENCES between
>various versions of Linux.  The #perl IRC channel has regular bitching
>sessions concerning the folly of Red Hat vs the innate righteousness of
>Slackware.  I'm recounting Linux-head vs Linux-head here; from the horses
>mouth, so to speak.

Regardless, the differences between the versions of Unix are far smaller than
the differences between the versions of Windows, even between different patch
levels of the SAME version of Windows. If Perl seems peculiar on NT, it's
downright wacky on 95; sockets are almost hopelessly broken, file associations
don't work at the command prompt, redirection is even WORSE than in NT. These
aren't Perl's fault; it's just making the best of a bad situation.

>>former).  I run Perl on SCO, AIX, HP/UX and Linux (SlackWare 4.3 if it

>Yada yada yada.

Aaaargh. Skewered by an irrefutable argument. Maybe I'll have better luck next
time . . . a minor point, though; you spelled 'yadda' wrong.

>>One who has worked in the Unix world will find the lack of features such as
>>alarm(), fork(), decent redirection, the need for binmode(), etc. to be
>>virtually crippling.

>If NT were Unix I'd be surprised to find those features missing too.
>Funnily enough, NT isn't Unix. :-)

That was my point. If NT were Unix, I wouldn't be calling it brain-addling.
Unfortunately, it's a Unix wannabe that comes up short in too many areas for me
to trust the health of our organization and patients to it.

Oh, a smiley . . . or did you drop your keyboard?

>For alarm() I'd have to think about it, for fork() I'd use spawn() and

Well, when you've thought about it enough, provide us all with a reasonable
alarm() for Perl on NT. Oh, and where would I find the documentation for Perl's
spawn() function? This was, after all, a post and reply about Perl's
peculiarities in the NT environment; let's stick to Perl, OK?

>binmode() just *is* (For a unix-centric example, look at FTP.  How many
>times have people stumbled over the arrant nonsense inherent in having to
>know what TYPE of file you were trying to send or recieve?)

What the *HELL* are you talking about?

In the Unix world, you DON'T have to specify what type of file you're
transferring with ftp. It's only when you're communicating with OTHER operating
systems that use bizarre file formats (such as redundant line termination
characters) that you have to specify file types. You see, OTHER operating
systems have file types that confuse users. Unix doesn't.

I use the ftp protocol every day to transfer files between Unix, OpenVMS,
VSE/ESA and (Oh my GOD!) NT systems. The "type" of file I transfer is quite
important _outside_ the Unix environment.  The fact that functionality has been
added to FTP that _allows_ me to convert files on-the-fly would normally be
considered a bonus, don't you think?

Please, let's discuss this again when you've done your homework. You're even
welcome to Email me direct rather than raise the noise level here any higher
than it already is.

(apologies to my fellow Perlers for the noise . . . this is my last public post
on this particular subject)

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Fri, 10 Apr 1998 18:57:26 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: perl win 32 :  asterisk on command line
Message-Id: <352f6811.28494873@news.mmc.org>

[posted and mailed]

On Thu, 9 Apr 1998 09:47:41 -0400, "Michael Kairys" <kairys@mi.sl.com> wrote:


>Nope. Note the original command:
>
>>>problem: perl -w somescript.pl -l thisarg -p * -u thatarg
>
>The -p switch comes *after* the script file, and as such is handled by the
>script, not Perl. Example:
>
>In any case Perl does not behave as you hyothesize. Examples:

>> perl -w -p * somescript.pl
>Can't open perl script "*": Invalid argument


In ActiveState's port, DOS wildcards on the command line are expanded by
PerlGlob.exe. In the 'standard distribution' binary, they aren't. Mystery
(probably) solved. As I stated in my tediously long reply to the under-informed
Mr. Excession, CMD.EXE/COMMAND.COM isn't expanding ANYTHING before passing it
to perl.

Here's proof:

D:\perl5.03\bin>perl -e "print join qq(\n),@ARGV,qq(\n)" *
Cmd32.exe
Perl.exe
Perl300.dll
PerlGlob.exe
PerlMsg.dll
perlw32-install.bat
perlw32-install.txt
perlw32-uninstall.bat

D:\perl5.04\bin>perl -e "print join qq(\n),@ARGV,qq(\n)" *
*

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Fri, 10 Apr 1998 18:14:45 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: print
Message-Id: <352E6194.DDCAD57B@inlink.com>

I know that this will work:

print $One,"d";

You can also put it in the middle:

print "Here is the variable ", $One, " And no some more text.";

HTH

Brent


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

Date: Fri, 10 Apr 1998 10:50:40 -0700
From: Larry Rosler <lr@hpl.hp.com>
To: Mark-Jason Dominus <mjd@op.net>
Subject: Re: problem printing long line to file
Message-Id: <352E5BF0.A0D773E5@hpl.hp.com>

Mark-Jason Dominus wrote:
> 
> In article <1998041000574401.UAA20086@ladder01.news.aol.com>,
> Hello570 <hello570@aol.com> wrote:
> >        I tried printing a line to a file using both of the
> > following methods, but the output was split into two
> >lines.
> 
> If you don't want newlines in the middle of your string, then don't
> put newlines in the middle of your string.

One way to do that while avoiding editing or readability problems with
very long strings is to concatenate individual strings, each on its own
line but without embedded newlines.  The most efficient concatenation is
achieved using "join '', <list of strings>".

Which leads to a somewhat related question.  It seems to me that the
following statements are equivalent semantically (as double-quotish
interpolation occurs in each case):

print <<HERE;
string1
string2
 ...
stringn
HERE

print qq{string1
string2
 ...
stringn\n};

(assuming there are no unmatched curly brackets in the entire string, of
course, or choose any other appropriate delimiter).

Usually when TMTOWTDI in Perl, there are tangible reasons for choosing
one way over the other(s).  Can someone suggest why one would *ever*
choose to use the HERE document style in preference to the one shown
above, or to the concatenated strings discussed in the first paragraph? 

All I can perceive is that the HERE delimiter can be made sufficiently
elaborate to ensure that the syntax is correct.  What value was added to
Perl by the HERE approach?  (Not that it could be removed now, of
course; the question is why should one choose to use it in new code.)

Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com


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

Date: 10 Apr 1998 18:30:09 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: problem printing long line to file
Message-Id: <6glofh$e7f$3@marina.cinenet.net>

Larry Rosler (lr@hpl.hp.com) wrote:
[snip]
: Which leads to a somewhat related question.  It seems to me that the
: following statements are equivalent semantically (as double-quotish
: interpolation occurs in each case):
: 
: print <<HERE;
: string1
: string2
: ...
: stringn
: HERE
: 
: print qq{string1
: string2
: ...
: stringn\n};
: 
: (assuming there are no unmatched curly brackets in the entire string, of
: course, or choose any other appropriate delimiter).
: 
: Usually when TMTOWTDI in Perl, there are tangible reasons for choosing
: one way over the other(s).  Can someone suggest why one would *ever*
: choose to use the HERE document style in preference to the one shown
: above, or to the concatenated strings discussed in the first paragraph? 

HERE documents do offer the advantages that you can avoid an initial
newline without that ugly offset first line, and also (as you suggest)
that you can use all punctuation internally without fear of bumping into
the delimiter accidentally.  To me, these seem adequate to explain the
feature's existence.

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


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

Date: 10 Apr 1998 18:07:50 GMT
From: mwfunk@uncc.campus.mci.net (Michael Funk)
Subject: Re: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <slrn6iso5g.csq.mwfunk@localhost.domain>

On 10 Apr 1998 08:54:16 -0700, Tim Smith <tzs@halcyon.com> wrote:
>
>Placing something in the public domain, or using a license with very
>few restrictions, is like giving someone cash for their birthday.  They
>get to decide exactly how they want to use it.  Placing something under
>GPL is like giving someone a gift certificate for "Underwear R Us"
>for their birthday.

This is a great analogy!  There really isn't a counterargument against
it, although I suspect the opposition would say that they want you
to use the GPL because they want to make sure you don't shop at some
evil competitor's store.

  Mike



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

Date: Fri, 10 Apr 1998 11:08:10 -0700
From: Robert Goheen <rsgoheen@pobox.com>
Subject: Re: Sharing a constant between scripts
Message-Id: <352E600A.201FDAC9@pobox.com>

Jonathan Feinberg wrote:

> Kevin's advice is good.  There is, however, a pseudo-module that does
> it for you:
> 
>    use constant AUTHOR => 'rsgoheen@pobox.com';
> 
> Please note that, as a matter of style, I spell my constants in all
> caps.  Since scalar constants are currently implemeneted as inline
> functions, using caps has the benefit of avoiding conflicts with
> perl's operator names.  The constant pragma is package-scoped.
> 
>    #!/c/perl/bin/perl -w
>    package foo;
>    use constant FOO => 'bar';
>    package main;
>    print foo::FOO, "\n";

Sounds good.  But how would I apply this to an array or hash that I
wanted to use across several scripts?

Actually, on a nit-picky point too, is there any way to use a constant
as defined above within double quotes, and have Perl substitute the
value of the constant?  I ask that because I'm doing CGI work, where I
have large print blocks, and its easier to do something like:

print <<EOF;

bla bla bla.
<A HREF="mailto:AUTHOR>mail me</A>
bla bla bla.

EOF

Rather than:

print "<A HREF="mailto:" . AUTHOR . ">mail me</A>";


Thanks!

> 
> --
> Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


--------
Robert S. Goheen
rsgoheen@pobox.com


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

Date: 10 Apr 1998 17:52:49 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: substitution question
Message-Id: <6glm9h$e7f$1@marina.cinenet.net>

Barry Kaplan (barry@megaspace.com) wrote:
: Is there a way to take instances of repeating text such as:
: Embedded RoutersEmbedded RoutersEmbedded Routers
: and substitute out the redundancies?

That strongly depends on your definition of 'repeating text'.  To deal 
with text like your example, where there's no word boundary between the 
repetitions, you need to rely on the fact that repetitions of the same 
character four or more times in a row don't occur in English -- 
otherwise, you'd end up changing e.g. 'green' to 'gren'.  So:

  s/([\w ]{2,}?)\1+/$1/g;

Note, however, that this *won't* catch repeated three-letter patterns 
('AndAndAnd').

HTH!

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


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

Date: Fri, 10 Apr 1998 11:26:59 -0700
From: Build Administrator <bldadmin@esd.sgi.com>
Subject: THIS HAS TO BE EASY ;) Child .bat inheriting Perl %ENV
Message-Id: <352E6473.3AE03B6E@esd.sgi.com>

I had one suggestion to quote the 101, but no luck.
This problem is the same if I try to system() off another perl script.

Build Administrator wrote:

> Under NT, when I system("somefile.bat") it doesn't have the environment
> I've established with %ENV.
>
> Is there a way to do this?   Example below prints nothing for TEST_ENV.
>
> Thanks.
>
> JR
>
> # test.pl script
>
> $ENV{"TEST_ENV"} = 101;
> system("test.bat");
>
> #-------------------
>
> REM test.bat script
>
> echo off
> echo TEST_ENV: %TEST_ENV%
>
> REM ------------------





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

Date: Fri, 10 Apr 1998 14:33:19 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Week of Month
Message-Id: <fl_aggie-1004981433200001@aggie.coaps.fsu.edu>

In article <slrn6is7f0.stg.harrison@localhost.localdomain>,
harrison@pixi.com wrote:

+ Well, at least I found my own mistake. :-)  But I'm still working to
+ fix it.  It doesn't handle months that start right near the end of the
+ week really well.  [I've also moved on to Time:: and friends for the
+ speed].

Well, let us know how it turns out. I knew the code size could be
very small (in terms of # of lines) but I was astounded that you'd
gotten it into about 12 lines.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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