[11406] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5006 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 26 22:07:20 1999

Date: Fri, 26 Feb 99 19:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 26 Feb 1999     Volume: 8 Number: 5006

Today's topics:
        Add Default Directory to @INC <andy@piziali.dv.org>
    Re: Add Default Directory to @INC (Jim Trocki)
    Re: Executing a Program <ofleig@sim3.univ-rennes1.fr>
        FAQ 7.1: Can I get a BNF/yacc/RE for the Perl language? <perlfaq-suggestions@perl.com>
        FAQ 7.2: What are all these $@%* punctuation signs, and <perlfaq-suggestions@perl.com>
    Re: Getting PID at process start up time <mpersico@erols.com>
    Re: Newbie : bash doesn't want to run my script ! <mpersico@erols.com>
        Offtopic (Was: Re: custom dial script - simple if you k <cw@dwc.ch>
    Re: Offtopic (Was: Re: custom dial script - simple if y <mpersico@erols.com>
    Re: Perl comment <tchrist@mox.perl.com>
    Re: Perl comment (Larry Rosler)
        Perl For A Mainframe??? <pjh@mccc.edu>
    Re: Perl Xbase Module. <ghill@n2.net>
        Please help with Array of Array with a Hash, using psto (James Olsen)
    Re: quick newbie question <jglascoe@giss.nasa.gov>
    Re: randomize sequence <sasho@staff.mgu.bg>
    Re: referer() for security? (Joonas Timo Taavetti Kekoni)
    Re: Remove a specific member of an array (Tad McClellan)
    Re: Runing a perl script on one WEB Server and Writing  <cw@dwc.ch>
    Re: Sorting trouble. Assistance appreciated. <ebohlman@netcom.com>
        strip first character of string? (Peter Bismuti)
    Re: syntax error? (Larry Rosler)
    Re: syntax error? <Allan@Due.net>
    Re: Tricky input problem... kirk@kaybee.org
    Re: UTF-8 - Latin 1 (Ilya Zakharevich)
    Re: Win32, How to delete a read only file? (RedWine)
        Win32::API <jnswart@stargate.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 26 Feb 1999 18:34:19 -0600
From: "Andrew J. Piziali" <andy@piziali.dv.org>
Subject: Add Default Directory to @INC
Message-Id: <36D73D8B.45FFC557@piziali.dv.org>

   I am currently running Perl 5.003 and upgrading to 5.005.  A number
of installed programs reference modules in /usr/lib/perl5/site_perl.
When I built Perl 5.005 this directory was excluded; only

	/usr/lib/perl5/5.00502/i386-linux
	/usr/lib/perl5/5.00502
	/usr/lib/perl5/site_perl/5.005/i386-linux
	/usr/lib/perl5/site_perl/5.005

are searched.

   How do I add /usr/lib/perl5/site_perl to the default @INC search
path?  I'd like to avoid having to modify the other programs, such as
those in LWP.pm.

   Thank you!

-- 
                                                        |
Andy@Piziali.dv.org                       ________------+------________
                                                       / \
                                                      *---*
	http://keys.pgp.com:11371/pks/lookup?op=get&search=andy@piziali


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

Date: 27 Feb 1999 01:20:28 GMT
From: trockij@transmeta.com (Jim Trocki)
Subject: Re: Add Default Directory to @INC
Message-Id: <7b7h8s$57r$1@palladium.transmeta.com>

In article <36D73D8B.45FFC557@piziali.dv.org>,
Andrew J. Piziali <andy@piziali.dv.org> wrote:

>   How do I add /usr/lib/perl5/site_perl to the default @INC search
>path?  I'd like to avoid having to modify the other programs, such as
>those in LWP.pm.

Read the "perlrun" man page, then set your PERL5LIB environment variable.


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

Date: Fri, 26 Feb 1999 15:23:29 +0100
From: Oliver Fleig <ofleig@sim3.univ-rennes1.fr>
To: nullspace@hotmail.com
Subject: Re: Executing a Program
Message-Id: <36D6AE60.4729E94F@sim3.univ-rennes1.fr>


--------------C3626643F749874299E31AA0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

nullspace wrote:

> Hi,
> I'm trying to write a script that looks something like this (in chuncks=
):
>
> 1)Writes two values to a file
>
> 2)Run a complied program from inside the script by calling it(it access=
es
> the above file)
>
> 3)Reads an outfile that the program creates back into the script for
> manipulation.
>
> So far, I can do (1) and (3) but I'm having trouble with the code for
> running the compiled program from my script. I thought it was the exec(=
"
> /test/a.out & ") command. It works to a point. The program runs but any=
thing
> after that call in my perl script doesn't get reached. I thought that t=
here
> must be a way to find out if a.out has finished but I just don't know t=
he
> proper code. Any help would definitely be appreciated. Thanks!!
>
> Chris

Hi Chris!I am a newby to Perl, but I think I can help you:
'exec' replaces the current process with the shell.
In other words as soon you call
"exec (something);"
the programm called "something" replaces your current perl process and
therefore will never return to your script because the process associated=
 to it
is teminated.

You should try "system" but without calling your binary with "&" because =
that
prevents you perl process from waiting for the called programm to have
finished. And as you want to process the results of the programm called y=
ou
better wait for them.
Also see the perlfunc manual!

Is that of any help??

Oliver

--
------------------------------------------------------------------------
Dipl.-Ing. Oliver Fleig
Laboratoire SIM

    Facult=E9 de M=E9decine          tel +33 2 99 33 68 63
    Univ=E9rsit=E9 de Rennes 1       fax +33 2 99 33 68 88
    2 Av. du Pr. L=E9on Bernard    ofleig@univ-rennes1.fr
    F-35043 RENNES Cedex         http://sim3.univ-rennes1.fr






--------------C3626643F749874299E31AA0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
nullspace wrote:
<BLOCKQUOTE TYPE=CITE>Hi,
<BR>I'm trying to write a script that looks something like this (in chuncks):

<P>1)Writes two values to a file

<P>2)Run a complied program from inside the script by calling it(it accesses
<BR>the above file)

<P>3)Reads an outfile that the program creates back into the script for
<BR>manipulation.

<P>So far, I can do (1) and (3) but I'm having trouble with the code for
<BR>running the compiled program from my script. I thought it was the exec("
<BR>/test/a.out &amp; ") command. It works to a point. The program runs
but anything
<BR>after that call in my perl script doesn't get reached. I thought that
there
<BR>must be a way to find out if a.out has finished but I just don't know
the
<BR>proper code. Any help would definitely be appreciated. Thanks!!

<P>Chris</BLOCKQUOTE>
Hi Chris!I am a newby to Perl, but I think I can help you:
<BR>'exec' replaces the current process with the shell.
<BR>In other words as soon you call
<BR>"exec (something);"
<BR>the programm called "something" replaces your current perl process
and therefore will never return to your script because the process associated
to it is teminated.

<P>You should try "system" but without calling your binary with "&amp;"
because that prevents you perl process from waiting for the called programm
to have finished. And as you want to process the results of the programm
called you better wait for them.
<BR>Also see the perlfunc manual!

<P>Is that of any help??

<P>Oliver

<P>--
<ADDRESS>

<HR WIDTH="100%"><B>Dipl.-Ing. Oliver Fleig</B></ADDRESS>

<ADDRESS>
<B>Laboratoire SIM</B></ADDRESS>

<TABLE BORDER=0 CELLSPACING=30 NOSAVE >
<TR VALIGN=TOP NOSAVE>
<TD NOSAVE>
<ADDRESS>
Facult&eacute; de M&eacute;decine</ADDRESS>

<ADDRESS>
Univ&eacute;rsit&eacute; de Rennes 1</ADDRESS>

<ADDRESS>
2 Av. du Pr. L&eacute;on Bernard</ADDRESS>

<ADDRESS>
F-35043 RENNES Cedex</ADDRESS>
</TD>

<TD NOSAVE>
<ADDRESS>
tel +33 2 99 33 68 63</ADDRESS>

<ADDRESS>
fax +33 2 99 33 68 88</ADDRESS>

<ADDRESS>
<A HREF="mailto:ofleig@univ.rennes1.fr">ofleig@univ-rennes1.fr</A></ADDRESS>

<ADDRESS>
<A HREF="http://sim3.univ-rennes1.fr">http://sim3.univ-rennes1.fr</A></ADDRESS>

<BR>&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<BR>&nbsp;</HTML>

--------------C3626643F749874299E31AA0--



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

Date: 26 Feb 1999 16:29:10 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 7.1: Can I get a BNF/yacc/RE for the Perl language?  
Message-Id: <36d72e46@csnews>

(This excerpt from perlfaq7 - Perl Language Issues 
    ($Revision: 1.24 $, $Date: 1999/01/08 05:32:11 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq7.html
if your negligent system adminstrator has been remiss in his duties.)

  Can I get a BNF/yacc/RE for the Perl language?

    There is no BNF, but you can paw your way through the yacc grammar in
    perly.y in the source distribution if you're particularly brave. The
    grammar relies on very smart tokenizing code, so be prepared to venture
    into toke.c as well.

    In the words of Chaim Frenkel: "Perl's grammar can not be reduced to
    BNF. The work of parsing perl is distributed between yacc, the lexer,
    smoke and mirrors."

-- 
People who deal with bits should expect to get bitten. --Jon Bentley


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

Date: 26 Feb 1999 18:52:24 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 7.2: What are all these $@%* punctuation signs, and how do I know when to use them?  
Message-Id: <36d74fd8@csnews>

(This excerpt from perlfaq7 - Perl Language Issues 
    ($Revision: 1.24 $, $Date: 1999/01/08 05:32:11 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq7.html
if your negligent system adminstrator has been remiss in his duties.)

  What are all these $@%* punctuation signs, and how do I know when to use them?

    They are type specifiers, as detailed in the perldata manpage:

        $ for scalar values (number, string or reference)
        @ for arrays
        % for hashes (associative arrays)
        * for all types of that symbol name.  In version 4 you used them like
          pointers, but in modern perls you can just use references.

    While there are a few places where you don't actually need these type
    specifiers, you should always use them.

    A couple of others that you're likely to encounter that aren't really
    type specifiers are:

        <> are used for inputting a record from a filehandle.
        \  takes a reference to something.

    Note that <FILE> is *neither* the type specifier for files nor the name
    of the handle. It is the `<>' operator applied to the handle FILE. It
    reads one line (well, record - see the section on "$/" in the perlvar
    manpage) from the handle FILE in scalar context, or *all* lines in list
    context. When performing open, close, or any other operation besides
    `<>' on files, or even talking about the handle, do *not* use the
    brackets. These are correct: `eof(FH)', `seek(FH, 0, 2)' and "copying
    from STDIN to FILE".

-- 
pos += screamnext[pos]  /* does this goof up anywhere? */
    --Larry Wall, from util.c in the v5.0 perl distribution


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

Date: Fri, 26 Feb 1999 21:07:41 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Getting PID at process start up time
Message-Id: <36D7536D.46276F0F@erols.com>

Tony Curtis wrote:
> 
<snip> > For ksh, you'd probably need to go the "ps" route.
> 

Then you better take a look at Tom C.'s psgrep.

-- 
Matthew O. Persico
http://www.erols.com/mpersico
http://www.digistar.com/bzip2


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

Date: Fri, 26 Feb 1999 21:17:46 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Newbie : bash doesn't want to run my script !
Message-Id: <36D755CA.D13FD8BD@erols.com>

I bet your current directory is not in the PATH. Don't add it to the
PATH. Simply execute ths script as

 ./script

Patrick Fichou wrote:
> 
> Hi,
> 
> I want to run a script file from bash. It maybe simple but doesn't seem to
> work !
> 1/ I add this (first) line in my script :
> 
> #!/usr/bin/perl
> 
> 2/ My PATH is correct (contains /usr/bin)
> 
> 3/ Perl is in this directory
> 
> 4/ I use Linux Redhat 5.2
> 
> Where I'm wrong ?
> 
> Thanx !
> Patrick

-- 
Matthew O. Persico
http://www.erols.com/mpersico
http://www.digistar.com/bzip2


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

Date: Sat, 27 Feb 1999 02:22:37 +0100
From: Werns <cw@dwc.ch>
Subject: Offtopic (Was: Re: custom dial script - simple if you know how - I  don't)
Message-Id: <36D748D1.FCF570B7@dwc.ch>

Kosta wrote:
> 
> Well  thanks, I appreciate the response:
> but it's not as if I have a choice.
> Catch 22

I don't get that last line - is it some TV series down under ?

-w


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

Date: Fri, 26 Feb 1999 21:13:50 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Offtopic (Was: Re: custom dial script - simple if you know how - I  don't)
Message-Id: <36D754DE.D3E938EC@erols.com>

Werns wrote:
> 
> Kosta wrote:
> >
> > Well  thanks, I appreciate the response:
> > but it's not as if I have a choice.
> > Catch 22
> 
> I don't get that last line - is it some TV series down under ?
> 
A famous English language book. Never read it myself. The plot had to do
with what would be called a 'deadlock' condition in a relational
database.

> -w

-- 
Matthew O. Persico
http://www.erols.com/mpersico
http://www.digistar.com/bzip2


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

Date: 26 Feb 1999 16:07:09 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl comment
Message-Id: <36d7291d@csnews>

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

In comp.lang.perl.misc, 
    bart.lateur@skynet.be (Bart Lateur) writes:
:>... instead of putting '#' at the beginning of each line
:>line by line?
:>
:>Nope. The pound sign is it.
:
:"pound" sign? The pound sign looks like a wobbly "L" with a hyphen
:through it. This thingy is not a pound sign.

I'm afraid you're wrong.  Currency is one symbol, weight another.
You need but hang out in England (for the first) and America (for the
second) a bit to see this.  

--tom
-- 
    echo "Your stdio isn't very std."
            --Larry Wall in Configure from the perl distribution


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

Date: Fri, 26 Feb 1999 16:51:38 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl comment
Message-Id: <MPG.1140e1749b01b049896a0@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36d81e33.962231@news.skynet.be> on Fri, 26 Feb 1999 22:25:45 
GMT, Bart Lateur <bart.lateur@skynet.be> says...
 ...
> >... instead of putting '#' at the beginning of each line
> >line by line?
> >
> >Nope. The pound sign is it.
> 
> "pound" sign? The pound sign looks like a wobbly "L" with a hyphen
> through it. This thingy is not a pound sign.
> 
> Granted, on some older systems (printers), both of these characters used
> the same Ascii code, so you could switch between them. But that still is
> not a reason to call this a pound sign. Yuck.
> 
> But what is it?

It *is* '#'.

<QUOTE really off-topic except to logicians, and aren't we all?>

>From Lewis Carroll's "Through the Looking-Glass", Chapter VIII

     `The name of the song is called "HADDOCKS' EYES."' 

     `Oh, that's the name of the song, is it?' Alice said, trying to 
feel interested. 

     `No, you don't understand,' the Knight said, looking a little 
vexed. `That's what the name is called. The name really is "THE AGED 
AGED MAN."' 

     `Then I ought to have said "That's what the song is called"?' Alice 
corrected herself. 

     `No, you oughtn't: that's quite another thing! The song is called 
"WAYS AND MEANS": but that's only what it's called, you know!' 

     `Well, what is the song, then?' said Alice, who was by this time 
completely bewildered. 

     `I was coming to that,' the Knight said. `The song really is "A-
SITTING ON A GATE": and the tune's my own invention.'

</QUOTE>

So here are eight (8!) choices for what '#' is *called*.
  
>From "The Original Hacker's Dictionary", 
<URL:http://www.parc.xerox.com/csl/members/dourish/goodies/jargon.html>:

CRUNCH 3. n. The character "#". Usage: used at Xerox and CMU, among 
other places. Other names for "#" include SHARP, NUMBER, HASH, PIG-PEN, 
POUND-SIGN, and MESH. GLS adds: I recall reading somewhere that most of 
these are names for the # symbol IN CONTEXT. The name for the sign 
itself is "octothorp".

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 26 Feb 1999 20:52:37 -0500
From: Pete Holsberg <pjh@mccc.edu>
Subject: Perl For A Mainframe???
Message-Id: <36D74FE5.5EE76DCA@mccc.edu>

Hi,

Please excuse this dumb question, but will perl compile on an IBM
mainframe? I think ours is a 9764 or something like that, and I think
that the software package we're working with has a WWW interface.

I'm assuming that there's a web server for it and I was wondering about
perl.

Thanks,
Pete


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

Date: Sat, 27 Feb 1999 01:19:17 GMT
From: Greg Hill <ghill@n2.net>
Subject: Re: Perl Xbase Module.
Message-Id: <7b7h6e$aap$1@nnrp1.dejanews.com>


> > My question is why would anybody be using Python or PHP or ODBIC if
> > the database connectivity is acheivable as simply as the sample that
> > I used to get started.
>
> You're contrasting unrelated things.  Python is a language, PHP is a
> server extension, and ODBC is database middleware.

If you read my post you will notice that I did not say ODBC I said ODB_I_C
which' I guess is a server extension? (which confuses me a bit I must admit).
What is the difference between a Server Extension and a program language like
Perl or Python?  I have an idea but I'm not sure I'm correct.


> The reason you'd want to use ODBC is that it gives you the ability to
> use a completely different back-end database without changing your
> code.  If you know that you'll always be using the same dbm, and if
> you get better performance or simpler design with a dbm-specific perl
> module, then by all means use it.

This I am aware of.

> > Plus if those other languages die your in trouble.
> I'd say there's very little chance of Python dying.

Okay, that is good to know.

Another question based on the above.  Would a server extension language like
PHP, be considered a complete tool to accomplish everything one would need
for accomplishing things like e-commerce WebSites or should I say most
WebSite that would interact with databases?

I'll re-phrase the question.  Are their people who are efficient that would
claim that "All I need to know is PHP or PHTML" or any extension language?

Thanks again.
Greg Hill

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


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

Date: Fri, 26 Feb 1999 22:44:49 GMT
From: jolsen.ns@multi-ad.ns.com (James Olsen)
Subject: Please help with Array of Array with a Hash, using pstore/Storable.pm
Message-Id: <36d71246.30567305@news.supernews.com>

Hello,

I've tried to read through the perldoc perllol, the FAQ pages, and
searching the web and this newsgroup, but I'm still stuck on the
problem I'm having. Perhaps I've overlooked the answer in the
archives/faq, but my problem seems obscure enough (at least to me it
does) I still don't know exactly where I'm going wrong.

Fasten your seatbelt, a detailed description is coming:

I'm attempting to use shared memory to store an array to be used
between processes. 

I'm using IPC::Shareable, which uses Storable.pm, which ultimately
uses the C functions "pstore" and "pretrieve". My problem lies in
these C functions. 

I have an array of arrays. The sub-arrays contain one hash each, which
is a handle to a database. It is this hash/handle to the database that
is getting mangled during the storage/retrieval process. The rest of
the sub-array values are left unharmed.

A little more detail about the arrays: The main array stores
sub-arrays containing information about all my open database handles.
One sub-array for each open connection. Each sub-array contains a
unique descriptor for each connection, the database handle (which
appears to be a blessed hash), a timestamp, and a status flag.

I created a test program that uses only Storable, which is just a
wrapper for "pstore" and "pretrieve". I create my array of arrays,
display it to the STDOUT, and then store it to a file. I then zap my
array of arrays to make sure it's clean, and then I retrieve it from
the file and display it to STDOUT again.

My array is the same for all the elements as it was before I zapped
it, except for the database handle. It still shows itself as
registered to DBI::db, but the actual value of it is no longer valid.

Can anyone point me to a better way of storing this data, hopefully in
such a way that pstore/pretreive don't botch up my DBI::db?

Here's my STDOUT dump from the first run:

Unique	Status	Handle				timestamp
1	0	DBI::db=HASH(0x2e8fe0)	0
2	0	DBI::db=HASH(0x2c49e8)	0
3	0	DBI::db=HASH(0x593efc)	0
4	0	DBI::db=HASH(0x597c20)	0

Here's what I get after I retrieve it:

Unique	Status	Handle				timestamp
1	0	DBI::db=HASH(0xbbc14)		0
2	0	DBI::db=HASH(0xbbdb8)		0
3	0	DBI::db=HASH(0xbbea8)		0
4	0	DBI::db=HASH(0xbbf98)		0

I've tried to find alternatives to pstore/pretreive, but nobody else
seems to ever have had this problem, so I assume it is something
unique to me.

I've also tried to nstore it, with the same mangled results.

Please offer any and all suggestions, no matter how simple they may
sound. I've exhausted my pragmatic creativity, and I'm turning to the
guru's of the newsgroup to aid me.

Thank you for your time,

--James



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

Date: Fri, 26 Feb 1999 18:28:38 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: weasel <lost_ark@yahoo.com>
Subject: Re: quick newbie question
Message-Id: <36D72E26.44999D07@giss.nasa.gov>

[courtesy copy of post sent to "weasel"]

weasel wrote:
> 
> I'm trying to read in a flat text file, however i'm trying to retain
> some simple  formating like indent and line break.  I can't append <pre>
> because it expands the size of the table cell, so i need to find a way
> to pull formating infomation when im reading/printing it in the perl
> script.  any ideas?

uh, you're printing the context of a plain text file
to an HTML table cell.  Right?

how 'bout:

perl -ne 's/ /&nbsp;/g; s/\n/<br>/g; print;' < index.html > outdex.html

> 
> thanks

	hth,
	Jay Glascoe
-- 
"They'll get my perl when they pry it
 from my cold, dead /usr/local/bin."
	-- Randy Futor in 
	   news:1992Sep13.175035.5623@tc.fluke.COM


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

Date: Fri, 26 Feb 1999 07:55:56 +0200
From: Alexander Avtanski <sasho@staff.mgu.bg>
Subject: Re: randomize sequence
Message-Id: <36D6376C.C100324E@staff.mgu.bg>

Hello,

I'm doing it that way:

  sub randomize {
    my $n=$#_+1;
    my $i,$t;
    for ($i=0;$i<$n;$i++) {
      $j=rand($n);
      $t=$_[$i]; $_[$i]=$_[$j]; $_[$j]=$t;
      }
    return @_;
    }

However, it's not perlish enough...  I'm looking for something
much more effective and elegant.

- Alexander

Kin Cho wrote:
> 
> I need an efficient function to randomize a sequence of
> numbers in the range 1..n.  For example:
> 
> @s = randomize(1..3);  # @s now contains 1, 2, and 3, but in random order
> 
> Thanks!
> 
> -kin


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

Date: 26 Feb 1999 23:14:20 GMT
From: jkekoni@cc.hut.fi (Joonas Timo Taavetti Kekoni)
Subject: Re: referer() for security?
Message-Id: <7b79sc$2t34$1@midnight.cs.hut.fi>

Joe (joe_t@joe10.com) wrote:
: from? Would this be relatively secure?

no. It can be faked too, html designer cant do that but most readers this ng
can. You can do that for example with the perl LWP.

If you want it to be secure check that no illegal arguments are not
accepted.


-- 
	_-  Joonas Kekoni       OH2MTF	    I                           -_
	_-internet:	jkekoni@cc.hut.fi   I       DO NOT EAT.         -_
	_-slowmail:	j{mer{ntaival 7a176 I                           -_
	_-		02150Espoo          I      It is a monitor      -_
	_-		Finland/Europe      I                           -_


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

Date: Fri, 26 Feb 1999 13:03:19 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Remove a specific member of an array
Message-Id: <7ln6b7.4ia.ln@magna.metronet.com>

Mike Wilson (wmwilson1@go.com) wrote:
: In article <7b68e1$cs$1@plug.news.pipex.net>,
:   "Artoo" <r2-d2@REMOVEbigfoot.com> wrote:
: >
: > how can you remove a specific member of an array.
: >
: > @array = ('fred','james','alex','andy');
: > and you want to delete james from the array.

: RTFM, check out pop, shift, splice..but the answer to this very specifice (I
: hope this is really what you want) question is:
: $array[1] = "";


   I thought the question was how to "remove a specific member of an array".

   Your code does not remove _any_ array members.

   I think you must have been answering some other question...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sat, 27 Feb 1999 03:08:57 +0100
From: Werns <cw@dwc.ch>
Subject: Re: Runing a perl script on one WEB Server and Writing a file on another  Web Server ??
Message-Id: <36D753B9.8EB664DD@dwc.ch>

Cristovao Morgado wrote:
> 
> Is it possible to execute a perl script on a web server A and to write the
> results of the script on a file on web server B , instead of writing it on
> the same server where the script was executed ??

Yes.

Maybe you don't have to talk about webserver A and webserver B. How
would you do it if you had to do it by hand ? Via ftp ? -> Net::FTP.

-w

P.S: comp.infosystems.www.authoring.cgi ?


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

Date: Fri, 26 Feb 1999 23:35:13 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Sorting trouble. Assistance appreciated.
Message-Id: <ebohlmanF7sC6p.789@netcom.com>

Jonathan Feinberg <jdf@pobox.com> wrote:
: Because your data have fixed-width fields, you get a big win by using
: unpack/pack. 

:    #!/perl -wl
:    my $format = 'a12a8a16a24a3a14'; #whatever
:    my @lines = map { [unpack $format, $_] } <FILE>;

:    @lines = sort {    $a->[4] cmp $b->[4] 
:                    || $a->[2] cmp $b->[2] } @lines;

:    for (@lines) { print NEWFILE  pack $format, @$_ }

How about making the first map() extract the sort-key information, arrange
it into the right order for sorting, and prepend it to the actual data? 
Then the data (with the keys prepended) could be sorted *without* a
comparison block (big speedup) and then run through another map() that
just strips off the added key information. 



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

Date: 27 Feb 1999 02:29:39 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: strip first character of string?
Message-Id: <7b7laj$a7$1@news.fsu.edu>


Hi, what is the easiest way to strip the first character off of a
string?  If you want to strip off the last character you can use

     chomp($word);  

How about the first character?

Thanks

  _____________________________________________________________________
 |                                                                     |
 |         Pete Bismuti                                                |
 |         Department of Computer Science                              |
 |         Florida State University                                    |
 |         bismuti@cs.fsu.edu  (850) 644-0516                          |
 |_____________________________________________________________________|


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

Date: Fri, 26 Feb 1999 16:58:20 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: syntax error?
Message-Id: <MPG.1140e309e67fe38e9896a1@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <yGFB2.20$EU1.484@nntp1.nac.net> on Fri, 26 Feb 1999 17:58:05 
-0500, Allan M. Due <Allan@Due.net> says...
> J. Daniel Paxton wrote in message <36D7081A.A182FCE0@ix.netcom.com>...
 ...
> :  $timesleft {$Account_Number} --;
> 
> Ok just a quick guess.  Is it my lame newsreader or are there extra spaces in
> there.
> $timesleft{$Account_Number}--;

So what if there were?  You seem to have forgotten that white-space is 
irrelevant in parsing Perl, except in string-like contexts or in 
identifiers and such.  You might have done a tiny experiment or two 
before posting that, Allan!

-- 
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 26 Feb 1999 20:18:37 -0500
From: "Allan M. Due" <Allan@Due.net>
Subject: Re: syntax error?
Message-Id: <uKHB2.28$EU1.537@nntp1.nac.net>

Larry Rosler wrote in message ...
:[Posted and a courtesy copy mailed.]
:In article <yGFB2.20$EU1.484@nntp1.nac.net> on Fri, 26 Feb 1999 17:58:05
:-0500, Allan M. Due <Allan@Due.net> says...
:> J. Daniel Paxton wrote in message <36D7081A.A182FCE0@ix.netcom.com>...
:...
:> :  $timesleft {$Account_Number} --;
:>
:> Ok just a quick guess.  Is it my lame newsreader or are there extra spaces
in
:> there.
:> $timesleft{$Account_Number}--;
:
:So what if there were?  You seem to have forgotten that white-space is
:irrelevant in parsing Perl, except in string-like contexts or in
:identifiers and such.  You might have done a tiny experiment or two
:before posting that, Allan!


The funny thing is I almost wrote that not all white space is magical.  Perl
is just too damn good at knowing what you want to do.  I just couldn't imagine
that  $    var    ++ could be the same as $var++.  Just shows how limited my
imagination is :-).  Seems I can't be reminded too much:

1)  Don't assume,
2)  Don't do things in a hurry,
3)  Test even (especially) when you know.

Thanks Larry, edification is always appreciated.

--
$email{'Allan M. Due'} = ' All@n.Due.net '
--random quote--
[End of diatribe.  We now return you to your regularly scheduled
programming...]
   Larry Wall in Configure from the perl distribution





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

Date: 27 Feb 1999 02:04:05 GMT
From: kirk@kaybee.org
Subject: Re: Tricky input problem...
Message-Id: <7b7jql$gmi$1@news-int.gatech.edu>

Philip Newton <Philip.Newton@datenrevision.de> wrote:
:> 1) Must return quickly if nothing is waiting
:> 2) Must not echo anything to the screen
:> 3) Must return after only one character typed w/ no carriage return reqd
:> 4) Must buffer the input

: I still don't get it... what does number 4 mean? If it means what I
: think it means, how do you reconcile it with "must return after only one
: character typed"? That sounds like "must be unbuffered" to me.

I guess that #4 is always true... what I mean by that is that key
presses must be stored until they can be read one character at a
time... ignore that one, as it's not what I'm having problems
with...

The following code is the best implementation I could find:

# Gets key from kbd
sub GetKey {
    my $Read = "";
    system ("stty -echo raw");
    $Read = ReadKey(.1,STDIN);
    system ("stty sane");
    return $Read;
}

The problem is that the character the user enters is *sometimes*
echoed on the screen... even though I use the '-echo' option to
the stty command.

It is not even consistent.  Sometimes the character is echoed,
sometimes it is not.  

For example, here is some code that uses the function (for
testing purposes):

open (OUT,">/tmp/out");
$Quit = 0;
until ($Quit) {
   $a = GetKey();
   if ($a) {
      print OUT 'Got Key [' . $a . "]\n";
      if ($a eq 'q') {
         $Quit = 1;
      }
   }
   else {
      print OUT "Got Nothing\n";
   }
}
close (OUT);

Okay... so let's say I run this and type the 'h' key nine
times real fast.  I would expect to see absolutely no
output on the screen, and the contents of /tmp/out to be:
Got Nothing
Got Nothing
Got Nothing
Got Nothing
Got Nothing
Got Nothing
Got Key [h]
Got Nothing
Got Key [h]
Got Nothing
Got Key [h]
Got Nothing
Got Key [h]
Got Key [h]
Got Nothing
Got Key [h]
Got Nothing
Got Key [h]
Got Nothing
Got Key [h]
Got Nothing
Got Key [h]
Got Nothing
Got Key [q]

What really happened was I saw the letter 'h' echoed to the
screen *three* times out of 9 keypresses.

How can I stop this?  As it really messes up the output of a
program that expects no keypresses to be echoed.  

I would *really* appreciate any help on this...

PS - I have to set the terminal back to 'sane' as I need to
do output intentionally, and leaving it set to 'raw' messes
that up...

-- 
Kirk Bauer -- Georgia Tech -- kirk@kaybee.org <== Finger for PGP
  http://www.kaybee.org/~kirk  ResNet RTA   Computer Engineering
 GT Sport Parachuting Club!  http://cyberbuzz.gatech.edu/skydive



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

Date: 26 Feb 1999 23:42:36 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: UTF-8 - Latin 1
Message-Id: <7b7bhc$qkf$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Bart Schuller
<schuller+news@lunatech.com>],
who wrote in article <920035341.563154@perla.rotterdam.luna.net>:
> In article <7atqai$pfi$1@mathserv.mps.ohio-state.edu>,
> Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> >So: what do I need?  There are many bugs in -Mutf8, and it would be
> >nice if I could look for them with some visual feedback...
> 
> Try the yudit text editor 
> http://metalab.unc.edu/pub/Linux/apps/editors/X/yudit-1.2.tar.gz
> 
> I can imagine that standard terminal emulators get confused when one
> byte doesn't equal one character.

In what sense then do they "support" UTF-8 locale?

Ilya


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

Date: Sat, 27 Feb 1999 00:09:16 GMT
From: mordasm@home.com (RedWine)
Subject: Re: Win32, How to delete a read only file?
Message-Id: <36d71fd5.4540660@C48381-a>

I think Win32::File is what maybe needed. If I can guess how to make
it work. Unfortunately the documention is less that ideal.

Cut & Pasted (not my spelling)

DESCRIPTION 
This module offers the retrieval and setting of file attributes. 

FUNCTIONS 

NOTE: all of the functions return FALSE (0) if they fail,
unless otherwise noted. 

GetAttributes(filename, returnedAttirbutes) Gets the attributes of a
file or directory 
SetAttributes(filename, newAttirbutes) Sets the attributes of a file
or directory 


I'm suppose to guess the form of returnedAttirbutes or newAttirbutes?

Thanks for the tip. I suppose I could also try system commands.

Mike



On Fri, 26 Feb 1999 00:25:34 -0800, "Dave Roth"
<xrxoxtxhxdx@xrxoxtxhx.xnxextx> wrote:

>RedWine wrote in message <36d5e631.11978649@C48381-a>...
>>I wrote a little program that will delete files older that X days from
>>Y directory and any sub directories.
>>
>>If Read-only file attributes are set the file is not deleted.
>>If Archive,System, or Hidden are set the program works fine.
>>
>>Win 98 OS with plans to move finished product to NT.
>>Perl version 5.004_02
>>
>>Can some one point me in the right direction?
>
>
>An easy approach to this is to use Win32::File and turn off the
>various flags you don't want.
>
>I suppose you could also use chmod as in:
>  chmod 0777, $File;
>Yes, you need to specify a zero-seven-seven-seven. The leading 0
>tells Perl you are referring to an octal number. Chmod works on
>5.004 & 5.005 on NT (and I think 95).
>
>dave



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

Date: Sat, 27 Feb 1999 04:03:40 -0500
From: Nico Swart <jnswart@stargate.net>
Subject: Win32::API
Message-Id: <36D7B4EB.1A68805C@stargate.net>

When using Win32::API, a  call is made to a DLL that returns a pointer
to a  C structure like this :

struct wtx {
    short int     len;
    char          *res;
};

How can I unpack this in perl ?

Thanks




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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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