[7349] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 974 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 4 10:07:18 1997

Date: Thu, 4 Sep 97 07:00:33 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 4 Sep 1997     Volume: 8 Number: 974

Today's topics:
     500 Server Error (The handle is invalid) <dbaker@dkburnap.com>
     Re: 500 Server Error (The handle is invalid) <dbaker@dkburnap.com>
     Re: Communication between objects and global subroutine <seay@absyss.fr>
     Re: Communication between objects and global subroutine (Chris Nandor)
     Re: complex pattern?!? it shouldn't be, i think :) <jeffro@fore.com>
     Re: Erase line when using print (progres meter) <eike.grote@theo.phy.uni-bayreuth.de>
     float -> hex <sg3384@scn.de>
     Re: float -> hex <seay@absyss.fr>
     Re: formatted reading? <eike.grote@theo.phy.uni-bayreuth.de>
     Re: formatted reading? <seay@absyss.fr>
     Re: formatted reading? (Al)
     Re: formatted reading? <seay@absyss.fr>
     FormMail with file-attach kultomten@hotmail.com
     Re: getuid and setuid (Lutz Albers)
     Re: grep-like search with multiple file output? (Maynard Hogg)
     How to reload current script using link... <LCharlier@ti.com>
     Re: I seem to be missing something obvious with package <seay@absyss.fr>
     installing perl <eglamkowski@mathematica-mpr.com>
     Re: IS there a 'strlen' in Perl? <mikep@rt66.com>
     Re: Making a Swiss-Army Knife HTML tool in Perl <flavell@mail.cern.ch>
     MetaInfo Sendmail <dbaker@dkburnap.com>
     Re: Newbie File Locking (Lutz Albers)
     Re: Numeric sorting <seay@absyss.fr>
     Re: Numeric sorting <mikep@rt66.com>
     Re: Perl for Win32 and Netscape, not working. <hubik@pagi.pl>
     Perl usage statistics <menyhert@acm.org>
     search and replace / ascii > html <mzys@faktum.de>
     Re: shell commands <seay@absyss.fr>
     SQL access to Access via Perl? (Cliff Bradshaw)
     UPPER & lower CaSeS (EASY PROBABLY) <lmisosa@eei.ericsson.se>
     Re: UPPER & lower CaSeS (EASY PROBABLY) <eike.grote@theo.phy.uni-bayreuth.de>
     Re: UPPER & lower CaSeS (EASY PROBABLY) <seay@absyss.fr>
     WIN95 server with perl?file.pl <jknot@hotmail.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 4 Sep 1997 13:06:01 GMT
From: "David Baker" <dbaker@dkburnap.com>
Subject: 500 Server Error (The handle is invalid)
Message-Id: <01bcb933$7b758020$dda3bece@DAVIDBAKER.BURNAP>

I keep getting this error on a new install of Activeware's Perl for Alpha
(Build 307).  I see the registry entery for

 .pl C:\perl5\bin\Perl.exe %s

The program exicutes fine from the command line.  IIS 3.0 just seems to not
like it.  Anyone have any ideas?

Please e-mail dbaker@dkburnap.com


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

Date: 4 Sep 1997 13:10:50 GMT
From: "David Baker" <dbaker@dkburnap.com>
Subject: Re: 500 Server Error (The handle is invalid)
Message-Id: <01bcb934$27b14c20$dda3bece@DAVIDBAKER.BURNAP>

The answer is...

PERMISSIONS.

On the Alpha install, it did some odd things to the permissions for the
directory.  Once I granted access to the inet user, the scripts ran fine.




David Baker <dbaker@dkburnap.com> wrote in article
<01bcb933$7b758020$dda3bece@DAVIDBAKER.BURNAP>...
> I keep getting this error on a new install of Activeware's Perl for Alpha
> (Build 307).  I see the registry entery for
> 
> .pl C:\perl5\bin\Perl.exe %s
> 
> The program exicutes fine from the command line.  IIS 3.0 just seems to
not
> like it.  Anyone have any ideas?
> 
> Please e-mail dbaker@dkburnap.com
> 


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

Date: Thu, 04 Sep 1997 12:23:55 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Communication between objects and global subroutines in Perl
Message-Id: <340E8C3B.3917BE98@absyss.fr>

Dan Sumption wrote:
> 
> For example, if the template string is
> '$description is worth $value'
> and
> $description='this program'
> and
> $value='nothing'
> 
> Then the subroutine will return:
> this program is worth nothing

Then junk the templates strings.  There is nothing magical or sacred
about interpolation.  Just have the last line of your subroutine be

	$obj->description()." is worth ".$obj->value();

tack on a "\n" if you like.  Of course, that can also be

	sprintf "%s is worth %s", $obj->description(), $obj->value().

Then the function returns what it returned before, namely the string
"this program is worth nothing".  If you want dynamic ordering of values
(sometimes description comes first, sometimes value), then you have to
be a bit more complicated.  I did something like that to return messages
in either english or french by reading in message format files, and
using eval to build a custom subroutine for each possible message.  It
wasn't too hard to do, but I think that is overkill for your problem.

HTH

- doug


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

Date: Thu, 04 Sep 1997 08:16:42 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Communication between objects and global subroutines in Perl
Message-Id: <pudge-ya02408000R0409970816420001@news.idt.net>

In article <340dd551.3439796@news.demon.co.uk>, dan@gulch.demon.co.uk (Dan
Sumption) wrote:

# However, because of the interpolation method used, I need to keep the
# variable names simple, e.g. $description rather than
# $self->{description}. This means (I think) that I need to store the
# values (if only temporarily) in variables which are accesible outside
# the object's package.


In article <340E8C3B.3917BE98@absyss.fr>, Doug Seay <seay@absyss.fr> wrote:

# Then junk the templates strings.  There is nothing magical or sacred
# about interpolation.  Just have the last line of your subroutine be
# 
#         $obj->description()." is worth ".$obj->value();
# 
# tack on a "\n" if you like.  Of course, that can also be
# 
#         sprintf "%s is worth %s", $obj->description(), $obj->value().

No, he is accessing a hash key, not a method.  So even easier:

         "$$obj{description} is worth $$obj{value}"

When accessing an object as a hash, you can use the alternate syntax above.

--
Chris Nandor             pudge@pobox.com             http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])


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

Date: Thu, 04 Sep 1997 03:16:25 -0700
From: Jeff Rosenfeld <jeffro@fore.com>
Subject: Re: complex pattern?!? it shouldn't be, i think :)
Message-Id: <340E8A79.41C67EA6@fore.com>


Tom Phoenix wrote:
> 
> On Wed, 3 Sep 1997, MJ.VAN OOSTERHOUT wrote:
> 
> > This script will remove all HTML tags from a file:
> >
> > undef $/;
> > $_ = <>;
> > s/<.*?>//g;
> > print $_;
> 
> Actually, HTML tags have a more complex format than that regular
> expression will deal with.
> 
>     <img src= "rt-arrow.gif" alt= "==>" >

Well, I'm not fluent with HTML but the examples presented so
far are not all that hard to deal with (yes, the more observant
will notice that I cheated a little to handle nested angle brackets):

% perl5 -pe '1 while s/<([^<"]|\"(\\.|[^\\"])*\")*?>//g'
a <img src= "rt-arrow.gif" alt= "==>" >b
a b
a <!-- <This line is a (single) valid HTML 2.0 comment> --> b
a  b
%

	- Jeff.


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

Date: Thu, 04 Sep 1997 12:27:51 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Erase line when using print (progres meter)
Message-Id: <340E8D27.59E2@theo.phy.uni-bayreuth.de>

Hi,

DeJean wrote:
> 
> I would like to have a kind of progress meter for perl
> I'm printing info to the screen like
> 
>   doing 1 of 10
>   doing 2 of 10
>   ...

Maybe you could develop your own code from the following example:

   #!/usr/local/bin/perl -w

   $| = 1;

   print "counting:  ";
   for(1..10) {
       print "\b$_"; 
       sleep 1;
   }
   print "\nfinished\n";



>   print "Erase line ...";
>   for($i=0;$i<=100000;$i++) {
>   }
>   print "... now";
> 
> prints both items at the same time. (No explicit clearing of buffer)

You must set the special variable $| to a nonzero value to do
unbuffered output.


Bye, Eike
-- 
======================================================================
 Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
 e-mail -> eike.grote@theo.phy.uni-bayreuth.de
 WWW    -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html 
           http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================


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

Date: Thu, 04 Sep 1997 11:51:27 +0200
From: Georg Steinlein <sg3384@scn.de>
Subject: float -> hex
Message-Id: <340E849F.6AD0@scn.de>

-- 
   Georg Steinlein  : Phone:   ++49-(0)9131-983384
   SIEMENS AG       : Fax:     ++49-(0)9131-982480
   AUT E 234        : -------------------------------------
   Erlangen,Germany :   E-Mail:  sg3384@scn.de


Hi !

I'm a perl newbie and have the following question:

For special purposes I need to get the binary representation of a floatvalue.

e.g.

input:  
	$floatval = 256.0;

result: 
	$hexval = 0x43800000;



in C this is is done easily with the following statement:

ulong hexval;
float floatval;

hexval = *((ulong *) &floatval);



is a similar construct possible in perl, too ??


Thanks.


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

Date: Thu, 04 Sep 1997 15:25:47 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: float -> hex
Message-Id: <340EB6DB.7A226FC1@absyss.fr>

Georg Steinlein wrote:
> 
> For special purposes I need to get the binary representation of a floatvalue.

~/bin> perl -e 'print unpack("b*", pack("f", 24.0)), "\n";'
00000000000000000000001110000010

Is this what you wanted?  I threw together a C program to try it out and
I got

float=24.00000 long=41c00000

The long value matches the binary field other than the bits are
reversed.  Since I'm using an Intel CPU, I guess it is just a little
endian thing (I never will get used to that brain damage).  If you want
to change that around, just use reverse().

- doug

PS - Be aware that floating point values aren't very standardized, so
taking a floating point value on one system and trying to use it on
another can cause madness.


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

Date: Thu, 04 Sep 1997 11:05:54 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: formatted reading?
Message-Id: <340E79F2.15FB@theo.phy.uni-bayreuth.de>

Hi,

(Al)fred Heller wrote:
> 
> Hei all
> 
> I would like to do a very simple thing - to read formatted lines from a
> file: e.g. position 1 is string1, from 2-5 is real number1, and so on..
> How can I achieve this goal?

First: What do you mean by 'formatted' ? Fixed length of entries ?
Special (comma?) separator ? ...

A common approach for problems like this is to use 'regular
expressions', so maybe you should learn about these.

Example:

   $a = 'Alfred,Heller';
   $a =~ /^(\w+),(\w+)$/;
   print "First Name: $1\n";
   print "Last Name: $2\n";


Bye, Eike
-- 
======================================================================
 Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
 e-mail -> eike.grote@theo.phy.uni-bayreuth.de
 WWW    -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html 
           http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================


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

Date: Thu, 04 Sep 1997 12:55:14 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: formatted reading?
Message-Id: <340E9392.7AE7FB3F@absyss.fr>

(Al)fred Heller wrote:
> 
> I would like to do a very simple thing - to read formatted lines from a
> file: e.g. position 1 is string1, from 2-5 is real number1, and so on..
> How can I achieve this goal?

All the data is text, right?  Just the meaning happens to be a numeric? 
This is usually done with

	my $line = <INPUT>;
	$line =~ m/^(.)(\d\d\d\d)/;
	my ($str, $num) = ($1, $2);

If your data is "binary", then life is a bit easier as you get to use
unpack()

	my ($str, $num) = unpack('Af', <INPUT>);

- doug


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

Date: Thu, 04 Sep 1997 14:18:01 +0200
From: "(Al)fred Heller" <ajh@ibe.dtu.dk>
Subject: Re: formatted reading?
Message-Id: <340EA6F9.7EB5@ibe.dtu.dk>

(Al)fred Heller wrote:
> 
> Hei all
> 
> I would like to do a very simple thing - to read formatted lines from a
> file: e.g. position 1 is string1, from 2-5 is real number1, and so on..
> How can I achieve this goal?
> 
> Thank you
> 
> Fred
> 
> --
> Alfred Heller
> Department of Buildings and Energy
> Build. 118, DTU
> DK- 2800 Lyngby
> Tel: +45 45 25 18 59
> Fax: +45 45 93 44 30
> e-mail: ajh@ibe.dtu.dk
Thank all for your help!
I can see from the answers that I have not explained enough.
If you have a value from position 1-3 and another form 4-6 in a text
file, then there is a possibility that the two values stick together
"123 456" gets "123456".
That is the problem - one cannot use ragular experessions and \d\d or
split().

Do you have a better idea

Fred

-- 
Alfred Heller
Department of Buildings and Energy
Build. 118, DTU
DK- 2800 Lyngby
Tel: +45 45 25 18 59
Fax: +45 45 93 44 30
e-mail: ajh@ibe.dtu.dk


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

Date: Thu, 04 Sep 1997 15:40:42 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: formatted reading?
Message-Id: <340EBA5A.2F3BE769@absyss.fr>

>(Al)fred Heller wrote:
>
> Thank all for your help!
> I can see from the answers that I have not explained enough.
> If you have a value from position 1-3 and another form 4-6 in a text
> file, then there is a possibility that the two values stick together
> "123 456" gets "123456".
> That is the problem - one cannot use ragular experessions and \d\d or
> split().

When you post and reply, please say so in the text, or at least ensure
that your mail has a Newsgroups: line to warn the recepient that the
discussion is the newsgroup.  Here is the same thing that I just mailed
you.  I'm posting it in case anyone else cares to see it.

-

If there are two nubers of length 3 each ("123" and "456") that run
together (ie "123456"), why can I not parse them with

        $line =~ m/^(\d\d\d)(\d\d\d)/;

It will take the first three digit characters and put them in $1 and the
next three and put them in $2 (or it will return false if the pattern
didn't match, but I'm leaving out error checking for now).  This RE can
be shortened to

        $line =~ m/(\d{3})(\d{3})/;

But that shouldn't change how it works.

For arbitrary values in positions, change the \d to . (match anything
other than the end-of-line character ($/)), or fire up unpack() using
'A' to get your characters (A3 gets the next three characters).  Also,
you could use substr() as

        substr("123456",3,3)

will return "456" (start at the third character (0 based) and get 3
characters).

- doug


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

Date: Thu, 04 Sep 1997 07:27:16 -0600
From: kultomten@hotmail.com
Subject: FormMail with file-attach
Message-Id: <873375151.3662@dejanews.com>

Hello everybody!
Does anyone know where to find a Form-Mail script that allows for
attaching files that are then saved on a specified location? Hotmail ueses
this, and allows for sending files with your mail.
If you have heard / seen a script with this feature, please ,mail me the
address!

Thank You
Kultomten@hotmail.com

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Thu, 04 Sep 1997 11:25:12 +0200
From: lutz@muc.de (Lutz Albers)
Subject: Re: getuid and setuid
Message-Id: <lutz-ya023480000409971125120001@news>

In article <5uhojm$1ok$1@scapa.cs.ualberta.ca>, wtang@cs.ualberta.ca (Wei
Tang) wrote:

>Hi,
>
>I checked the online manual
>        http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfunc.html
>and it seems that there are no functions named "getuid" or "setuid".
>
>If I want to call in a CGI script a Unix shell program which can only
>run under my own uid, what should I do?

Check $< and $> (or $EUID and $UID if you 'use English'). See man perlvar.

ciao
  lutz
--
Lutz Albers, lutz@muc.de, pgp key available from <http://www.pgp.net>
Do not take life too seriously, you will never get out of it alive.


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

Date: 4 Sep 1997 20:13:14 +0900
From: maynard@gol.com (Maynard Hogg)
Subject: Re: grep-like search with multiple file output?
Message-Id: <HNoD0wY1bGpc092yn@gol.com>


Tom Grydeland <tom@mitra.phys.uit.no> wrote:

>#!/store/bin/perl -wn
>BEGIN {
>        open OUT1, ">out1"      or die "Couldn't open out1: $!\n";
>        open OUT2, ">out2"      or die "Couldn't open out2: $!\n";
>        open OUT3, ">out3"      or die "Couldn't open out3: $!\n";
>}
>/pat1/ && do {
>    print OUT1 $_;
>    next;
>};
>/pat2/ && do {
>    print OUT2 $_;
>    next;
>};
>/pat3/ && do {
>    print OUT3 $_;
>    next;
>};

>Now that wasn't too hard, was it?

Finally, a perl script that I can actually read! Here I thought the
whole point to perl was to be as obscure and opague as possible. <g>

One quibble: I'd get rid of the next statements since there is a
possiblity that the same line might match one or more of the filtering
patterns.

Next question: How does one generalize this script to imitate AWK's
associative arrays?

BEGIN {
#This implementation doesn't really have to store the outfile[]
#array, but other file naming schemes might.
  pattern[++i] = "first pattern";outfile[i]=sprintf("out%05d",i)
  pattern[++i] = "second pattern";outfile[i]=sprintf("out%05d",i)
  ;
}

{
  for (j in pattern)
    if ($0 ~ pattern[j]) {
      print > file[j]
      close file[j]   #How can you tell I'm a DOS person? <g>
    }
}

-- 
    |\^/|     Maynard Hogg
 _|\|   |/|_  #306, 4-30-10 Yoga, Setagaya-ku, Tokyo, Japan 158
 >         <  Fax: +81-3-3700-7399
  >_./|\._<   Internet: maynard@gol.com
              http://www2.gol.com/users/maynard/
Unsolicited commercial electronic mail sent to this address will be
copyedited at a cost of US$200/hour (half-hour minimum).


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

Date: 4 Sep 1997 12:46:31 GMT
From: "Lloyd Charlier" <LCharlier@ti.com>
Subject: How to reload current script using link...
Message-Id: <01bcb930$91778830$02f199c0@cna0183046-tm6>

I have a large Web application written in Perl that has many forms, all of
which are
dynamically generated from the script.  On all of the pages, I have a
common toolbar,
comprised of HREFs pointing to the current script itself.  When I click on
one, I
save a cookie (via an "onClick" event) that specifies the next command in
the script
to be executed upon re-invocation.  All of this works great under all
versions of
Netscape.  When I try it under any version of MS IE however (including
4.0b2), the
"onClick" event fires as planned but the page is not re-loaded.  It appears
that IE is trying
to be smart and not re-load what it thinks is already being displayed!  How
can I get
around this problem?  On all of my forms that I "Submit", everything works
great.  It's
only when MS IE is faced with a link pointing to itself (e.g. script.pl has
an HREF
pointing to script.pl) that it exhibits this behavior.  Thanks in advance.

Regards,

Lloyd A. Charlier                             Texas Instruments
Incorporated
                                                E-mail & Scheduling
Services

****************************************************************************

E-mail: LCharlier@ti.com       SMTP-Pager:
2145819877@alphapage.airtouch.com
 Phone: (972) 575-4508      Digital Pager: (214) 581-9877
   Fax: (972) 575-4853
****************************************************************************


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

Date: Thu, 04 Sep 1997 12:42:02 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: I seem to be missing something obvious with packages
Message-Id: <340E907A.5F31E023@absyss.fr>

Eli the Bearded wrote:
>
>         require MyLists;
>         ...
>         foreach $item (@MyLists::list) { ... }
>         foreach $item (@MyLists::slit) { ... }
>         ...
> 
> This (seems to) work fine, except that '-w' gives me warnings
> that @MyLists::list, et al, is referenced only once from main.
> What am I overlooking?

I end up adding ugly stuff like

	@MyLists::list() = () if ( 0 );
	@MyLists::slit() = () if ( 0 );

just to give that important second reference.

- doug


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

Date: Thu, 04 Sep 1997 08:57:29 -0400
From: the count <eglamkowski@mathematica-mpr.com>
Subject: installing perl
Message-Id: <340EB039.48F2@mathematica-mpr.com>


We just got a new server and I am trying to install perl but the
configure script is complaining that I don't have a working C compiler
(which is silly, cause I've been compiling lots of C programs for the
new system and they all work fine...)

% uname -a
SunOS mpr-nj 5.5.1 Generic_103640-08 sun4u sparc SUNW,Ultra-2

% cc -V
cc: SC4.0 18 Oct 1995 C++ 4.1

>From running Configure:

Use which C compiler? [cc]

Checking for GNU cc in disguise and/or its version number...

*** WHOA THERE!!! ***
    Your C compiler "cc" doesn't seem to be working!
    You'd better start hunting for one and let me know about it.

I tried specifing the full path, all three of them! ;)
/usr/ucb/cc, /opt/SUNWspro/bin/CC and /opt/SUNWspro/SC4.0/bin/CC
(the first two being symbolic links to the last) but none of these
worked.
It is not that all the site licenses are checked out, and I couldn't
find any help in the Install file, so I am completely stumped.  
Anybody have any clues? :)


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

Date: Thu, 04 Sep 1997 07:20:14 -0600
From: Mike Powell <mikep@rt66.com>
Subject: Re: IS there a 'strlen' in Perl?
Message-Id: <340EB58D.6F13@rt66.com>

Jun Zhuang wrote:

> Is there a function like 'strlen()' in C in Perl5?
> I just want to use it to count the chars in a char string.

I think Perl uses length() to do that. That's what I've
used for things like substr() and dropping that annoying
end of line character at the end (e.g. length()-1).
==============================
Mike Powell
mikep@rt66.com
powellmw@acm.org
http://www.rt66.com/~mikep/

==============================
Political Correctness is a load of crap.  The premise of PC is that it
tries to please everyone.  However, it is humanly impossible to please
everyone.  It is also the government's way of telling you (you meaning
you people and not you specifically) what to say.  So just say what you
want to say and get on with life.

==============================
"It's all good. It's rock 'n roll."
"It's pure uncut, uncensored... rock 'n roll."
"Rock 'n roll baby..."
"Ya know what I like baby? ...rock 'n roll."
        --Rock 'n Roll Brothers, 94 Rock Morning Show


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

Date: Thu, 4 Sep 1997 12:39:00 GMT
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Making a Swiss-Army Knife HTML tool in Perl
Message-Id: <Pine.A41.3.95a.970904143208.42462A-100000@sp053>


[I know this isn't strictly on-topic for your question, but I
couldn't resist commenting.]

On Thu, 4 Sep 1997, T. Wheeler wrote:

> I mean good old-fashioned middle-of-the-road 3.2ish HTML that can be
> viewed by the majority of browsers. I am a big fan of
> platform-independence.

"middle-of-the-road 3.2-ish HTML" can be significantly less
platform-independent than is HTML4.0.  If you want genuine platform
independence, you might be better off with HTML2.0, plus stylesheets
for different kinds of platform.

HTML3.2 has things like FONT COLOR, that don't work on monochrome
displays, and ALIGN=RIGHT that doesn't work on a speaking machine, etc.

HTML4.0 has things like OBJECT, that are equipped with a formal
fallback for platforms that can't handle the object - or for
implementations that don't grok OBJECT at all.  And it deprecates
some of the presentation-specific effects from HTML3.2, putting them
where they always should've been - in a stylesheet.




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

Date: 4 Sep 1997 13:42:09 GMT
From: "David Baker" <dbaker@dkburnap.com>
Subject: MetaInfo Sendmail
Message-Id: <01bcb938$87fdde00$dda3bece@DAVIDBAKER.BURNAP>


Anyone gotten Perl to work with this manufacturer?

Thanks,

David Baker
Please email dbaker@dkburnap.com


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

Date: Thu, 04 Sep 1997 11:30:33 +0200
From: lutz@muc.de (Lutz Albers)
Subject: Re: Newbie File Locking
Message-Id: <lutz-ya023480000409971130330001@news>

In article <Pine.GSO.3.96.970903115241.11990G-100000@julie.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:

>On 3 Sep 1997, Martin Fischer wrote: 
>
>> flock FILE, 8;  # not really needed, perl does it on closing the file
>> close FILE; 
>
>Not only is it not really needed, it's also not really recommended, not
>really good, and not really safe! :-)
>
>At the moment just after you release the lock, another program will get
>the chance to write to the file. But you may (and usually do) have data in
>a buffer in memory which has not been written to the file yet. That means
>that the file may be incomplete, but the other script now has permission
>to start working with it. Eek!

Grrr. I thought that perl5.004 DOES indeed flush the file buffers before
releasing the lock (at least that whats perldelta claims).

It's always a good thing to get in the habit of releasing a lock. You might
someday use a system/language which doesn't automaticly releases the locks
and then you might have a problem :-)

So, IFF you're using the latest version of perl, you can safely unlock
before closing.

ciao
  lutz
--
Lutz Albers, lutz@muc.de, pgp key available from <http://www.pgp.net>
Do not take life too seriously, you will never get out of it alive.


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

Date: Thu, 04 Sep 1997 11:50:45 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Numeric sorting
Message-Id: <340E8475.3A825CEA@absyss.fr>

Trevor Chambers wrote:
> 
> I have a file along the lines of
> 
> name1 1
> name2 31
> name3 7
> name4 2
> 
> etc, and I want to sort it into descending numerical order....but I'm
> stuck.  I presently read the file in to an associative array, and then
> tried to sort by the values, but couldn't make it work.
> 
> I tried using backticks and the Unix sort, but I couldn't make that work
> properly either...it sees 31 as lower than 7 (3<7).
> 
> This must be really common and simple...could someone enlighten me?

You need to get the numeric part away from the text.  There are several
ways of doing this, including (but not limited to)

- build a hash with the numeric part as a key
	1=>"name1 1",
	31=>"name2 31",
	etc
Then use the normal ways to get sorted data from a hash (man perlfaq4
for details).  This won't work if unless all the numeric parts are
unique.

- have your sorter do some parsing
	sub sorter()
	{
	die "bad a=$a" unless ( $a =~ m/^\W+\s+(\d+)/ );
	my $akey = $1;
	die "bad b=$b" unless ( $b =~ m/^\W+\s+(\d+)/ );
	my $bkey = $1;
	$akey <=> $bkey;
	}

	sort sorter @list;

Which means lots of reparsing, and thus it is slow, especially on large
inputs.  This is the way I would have used before Randal Schwartz
enlightened us.

- parse things once and build a [$key, $data] pair and sort this by the
$key field.  When you are done, just go through this sorted list and
extract the $data (original) fields.  This is the logic behind the
(in)famous Schwartzian Transform.  This becomes a one-liner of "map sort
map".

	map { $_->[1] }
        sort { $a->[0] <=> $b->[0] }
        map { m/^\S+\s+(\d+)/; [$1, $_] } @your_array;

These three lines are really part of the same statement, so this is an
"honorary" one liner.  I always break it into three lines because that
is easier to read.  The first one (appearing last because LIST stuff
seems to happen right to left) takes "@your_array" and builds a list
where each element has two values, the first being the numeric value
from the pattern (standard RE) and the second being the data.  The
second phase of the ST is the sort which does a numeric comparison of
the first element of the two values (your sorting list is the result of
the map).  The final map appears on the first line and it just prunes
out the original data from its list (the result of the sort).

I hope that this helps.

- doug


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

Date: Thu, 04 Sep 1997 07:26:45 -0600
From: Mike Powell <mikep@rt66.com>
Subject: Re: Numeric sorting
Message-Id: <340EB715.4ACA@rt66.com>

Trevor Chambers wrote:

> I have a file along the lines of
> 
> name1 1
> name2 31
> name3 7
> name4 2
> 
> etc, and I want to sort it into descending numerical order....but
> I'm stuck.  I presently read the file in to an associative array,
> and then tried to sort by the values, but couldn't make it work.
> 
> I tried using backticks and the Unix sort, but I couldn't make
> that work properly either...it sees 31 as lower than 7 (3<7).
> 
> This must be really common and simple...could someone enlighten
> me?
> 
> Thanks in advance....

You might consider creating the key "$number$name". But you
would still run into the 3<7 problem.

So beforehand you might consider filtering the numbers as a
string (they can be treated that way if I recall). Pad the
numbers with "0"'s. For instance if you have 31, 7, ... then
you would pad them and end up with "31", "07", ... If you
had numbers 100, 31, 7, ... then you would end up with "100",
"031", "007". You can probably accomplish this with a nested
loop. Perhaps a foreach and then a while loop or something.

Shouldn't be too difficult. A couple of subs defined to
process your numbers and rock and roll.

Hope this helps.
==============================
Mike Powell
mikep@rt66.com
powellmw@acm.org
http://www.rt66.com/~mikep/

==============================
Political Correctness is a load of crap.  The premise of PC is that it
tries to please everyone.  However, it is humanly impossible to please
everyone.  It is also the government's way of telling you (you meaning
you people and not you specifically) what to say.  So just say what you
want to say and get on with life.

==============================
"It's all good. It's rock 'n roll."
"It's pure uncut, uncensored... rock 'n roll."
"Rock 'n roll baby..."
"Ya know what I like baby? ...rock 'n roll."
        --Rock 'n Roll Brothers, 94 Rock Morning Show


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

Date: 4 Sep 1997 11:45:33 GMT
From: "Hubik" <hubik@pagi.pl>
Subject: Re: Perl for Win32 and Netscape, not working.
Message-Id: <01bcb927$28204d80$023074c3@hbz>

Mike Rambour <me@no-spam.com> wrote in article
<5ukuee$a37@daffy.sb.west.net>...
>   Help, I have just installed Netscape Gold V3.03 and now when I try
> to run a perl prog that works fine in Explorer and used to work in
> Netscape V2.01, I get an error trying to run a application x-perl.
> 
>   This is the same machine where it works with explorer and Netscape
> 2.01, CGI from the web work just fine, its only ones from
> http://localhost/cgi-bin/xxx.pl that give that error.  I am running
> NT4 and I can't seem to find out what I need to do to make the new
> version of Netscape work.

	I had the same problem running perl scripts on NT machine with Netscape
(don't remember version). I've changed HTTP header in perl output:
before:	print "Content-type: text/html\n\n"
after:	print "HTTP/1.0 200 OK\nContent-type: text/html\n\n"
and now everything works fine in both Explorer and Netscape.

Regards,

  Hubert Kowalski
   K R E A T O R
   hubik@pagi.pl




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

Date: Thu, 04 Sep 1997 08:39:24 -0400
From: George Menyhert <menyhert@acm.org>
Subject: Perl usage statistics
Message-Id: <340EABFC.278239F5@acm.org>

This is a multi-part message in MIME format.
--------------44268D7E88BD45F66DAADA3A
Content-Type: text/plain; charset=us-ascii
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Transfer-Encoding: 7bit

Can anyone quote some Perl usage statistics for ISP's?

My company has opted to do some scripting in Perl 4 because they believe
"most" ISP's have not upgraded.  I am running into problems and every
helpful (sarcasm) response has been "upgrade".  Since this is a
commercial product, I would need to prove that support for Perl 4 is not
worth the hassle.

If anyone could quote an estimate of what proportion of ISP's are using
Perl 4 you may be able to make my life easier.

--
George Menyhert

----------
mailto:menyhert@acm.org
http://w3.one.net/~menyhert

"I love deadlines. I love the whooshing sound they make as they rush
by."
      dna@cix.compulink.co.uk

"If there is one thing I can't tolerate it is intolerance."
      me

                              why all the talk of tolerance?  what
happened to respect?


--------------44268D7E88BD45F66DAADA3A
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for George Menyhert
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             George Menyhert
n:              Menyhert;George
adr:            ;;;Cincinnati;OH;;USA
email;internet: menyhert@acm.org
title:          Software Engineer
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
end:            vcard


--------------44268D7E88BD45F66DAADA3A--



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

Date: Thu, 04 Sep 1997 11:51:55 +0200
From: Mainz Young Site Crew <mzys@faktum.de>
Subject: search and replace / ascii > html
Message-Id: <5ulvuo$ko4@news.go.dlr.de>

Hi!

i got an ascii-file with error messages looking like:

anr999d | drive mounted nicht
anr998c | das und das geht nicht 


with | being a free chosen delimiter

now i want to convert this via a perl-script to a html-file with tables:

<HTML>
  
  <HEAD>
    <TITLE>Error Messages</TITLE>
      </HEAD>
  
  <BODY>    
<TABLE WIDTH="100%" BORDER="2" CELLPADDING="5" CELLSPACING="2">  
      <TR>  
        <TD VALIGN="TOP" ALIGN="LEFT">   <B>ANR4578E</B></TD>        
        <TD VALIGN="TOP" ALIGN="LEFT">Database backup/restore terminated
- required volume was not mounted.</TD>        
      </TR> 
  
      <TR>      
        <TD VALIGN="TOP" ALIGN="LEFT">   <B>ANR1405W</B></TD>        
        <TD VALIGN="TOP" ALIGN="LEFT">Scratch volume mount request
denied - no scratch volume available. </TD>        
      </TR>
       <TR>  
        <TD VALIGN="TOP" ALIGN="LEFT">   <B>ANR0428W</B></TD>        
        <TD VALIGN="TOP" ALIGN="LEFT">  Session X for node
refused...</TD>        
      </TR>
      
         
</TABLE>
</HTML>

 ... meaning the delimiter has to be replaced with the html-code.
execution of the script should look like: convert.pl input.txt
output.html

can anybody give me a script like that or tell me where i can find it?


thanks,
m.reinhardt


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

Date: Thu, 04 Sep 1997 12:31:05 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: shell commands
Message-Id: <340E8DE9.68FC16C4@absyss.fr>

David Mossakowski wrote:
> 
> I need to create a form on intranet for people to be able to change
> their UNIX passwords.  Question is:  even if I log in the script as a
> super user can I execute something like: system "yppasswd user_name";
> ?   I mean it then asks for the password and then again to retype it.
> Is there a way to type remotely?  If not how else can I do this?

Normally passwd and yppasswd read directly from the tty device, not from
STDIN.  This is your problem.  I think you can get around this by
launching a pseudo-tty and using it.  I've never worked with
pseudo-terminals, so I can't say how easy/hard it is, but I don't think
it is the kind of thing you'll do in an afternoon.


> Please don't ask why don't we just tell the people to go to UNIX machine
> and change the password there.

OK, I won't ask, although I think that question deserves an answer.

Since you say "intranet", I assume that you are doing some web
programming.  Most web stuff sends data in the clear.  This means that
anyone snooping on your ethernet at the time can watch the unencrypted
password (and confirmation) go by.  Sure, this is a problem with telnet
too, so you aren't adding any security holes with that, but it can be
made more secure with some simple encryption.  This might be more than
you want to do, but if you don't care about keeping passwords secure,
why bother using them at all?

- doug


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

Date: 4 Sep 1997 11:25:52 GMT
From: cjb@trog.dra.hmg.gb (Cliff Bradshaw)
Subject: SQL access to Access via Perl?
Message-Id: <5um5s0$60q$1@trog.dra.hmg.gb>

Anyone know if it's possible to access an Access database on a network
via SQL using perl..?

The aim is to provide a Web front end to the database.

Any advice gratefully received.

--
Cliff
cjbradshaw@dra.hmg.gb
"Linux: The Choice of a GNU Generation"


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

Date: Thu, 04 Sep 1997 12:04:54 +0100
From: Shaun O'Shea <lmisosa@eei.ericsson.se>
Subject: UPPER & lower CaSeS (EASY PROBABLY)
Message-Id: <340E95D6.C03@eei.ericsson.se>

How do I convert a string ,inputed by a user which could be a mix of
upper or lower case letters, into all either upper OR lower case? 

EG: Convert  " CasTle " into either "CASTLE" or "castle".
Thanks in advance,

			Shaun......:-)

-- 
***********************************************************************
Shaun O'Shea,
lmisosa@eei.ericsson.se
OR
shaunos@orca.ucd.ie
***********************************************************************


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

Date: Thu, 04 Sep 1997 13:32:49 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: UPPER & lower CaSeS (EASY PROBABLY)
Message-Id: <340E9C61.FF6@theo.phy.uni-bayreuth.de>

Hi,

Shaun O'Shea wrote:
> 
> How do I convert a string ,inputed by a user which could be a mix of
> upper or lower case letters, into all either upper OR lower case?
> 
> EG: Convert  " CasTle " into either "CASTLE" or "castle".

Go to the 'perlfunc' manual page and learn about the functions named
'lc' and 'uc'.


Bye, Eike
-- 
======================================================================
 Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
 e-mail -> eike.grote@theo.phy.uni-bayreuth.de
 WWW    -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html 
           http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================


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

Date: Thu, 04 Sep 1997 15:28:33 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: UPPER & lower CaSeS (EASY PROBABLY)
Message-Id: <340EB781.30EF178@absyss.fr>

Shaun O'Shea wrote:
> 
> How do I convert a string ,inputed by a user which could be a mix of
> upper or lower case letters, into all either upper OR lower case?
> 
> EG: Convert  " CasTle " into either "CASTLE" or "castle".

RTFM

What part of "man perlfunc" did you not understand?

- doug


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

Date: Thu, 04 Sep 1997 03:56:49 PDT
From: "jeff knot" <jknot@hotmail.com>
Subject: WIN95 server with perl?file.pl
Message-Id: <19970904105650.17417.qmail@hotmail.com>

we can replace http://www.somewhere.com/cgi-bin/prog.pl
 with http://www.somewhere.com/cgi-bin/perl.exe?prog.pl
 How do we replace http://www.somewhere.com/cgi-bin/prog.pl?something
 along with the same approach?
 I do not suppose it is 
 http://www.somewhere.com/cgi-bin/perl.exe?prog.pl?something
 Thanks in advance.
 Jeff

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


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

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

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