[15648] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3061 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 16 11:05:29 2000

Date: Tue, 16 May 2000 08:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <958489513-v9-i3061@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 16 May 2000     Volume: 9 Number: 3061

Today's topics:
    Re: Accurate IP return? <jboesNOjbSPAM@qtm.net.invalid>
    Re: Accurate IP return? <flavell@mail.cern.ch>
    Re: Annoying -w messages from standard distributed modu <rootbeer@redcat.com>
        CVS for perl projects <jeanphil@sitepak.com>
        deleting from a hash by reference... jeff_stephens@my-deja.com
    Re: deleting from a hash by reference... <sweeheng@usa.net>
    Re: File lock? Help Needed!! <sue@pennine.com>
    Re: How to COPY a website <user0201@vjeran.com>
    Re: How to COPY a website <peckert@epicrealm.com>
    Re: How to COPY a website <alan-silver@prestwich-smile-gemach.freeserve.furryferret.co.uk>
    Re: How to COPY a website <root@127.0.0.1>
    Re: How to find distances? Gordon.Haverland@agric.gov.ab.ca
    Re: How to replace "\" , HELP! (Villy Kruse)
    Re: Math::TrulyRandom and Perl5.6.0? <rootbeer@redcat.com>
        Maxímum length of perl strings and system() args herbertka@my-deja.com
    Re: MySQL Iteration <billy@arnis-bsl.com>
        Nested while loop -- empty output daveleroy@my-deja.com
    Re: Nested while loop -- empty output <sariq@texas.net>
    Re: net user equivalent <rootbeer@redcat.com>
        Odd behaviour, I think its my use of map()? <care227@attglobal.net>
    Re: Odd behaviour, I think its my use of map()? <sariq@texas.net>
    Re: Odd behaviour, I think its my use of map()? <tony_curtis32@yahoo.com>
    Re: Odd behaviour, I think its my use of map()? <care227@attglobal.net>
    Re: Odd behaviour, I think its my use of map()? <care227@attglobal.net>
    Re: perl & apache conf (Gwyn Judd)
    Re: perl 5.6 build error <rootbeer@redcat.com>
    Re: perl on OS390 <rootbeer@redcat.com>
    Re: perl on OS390 <dan@tuatha.sidhe.org>
    Re: Perl vs ActivePerl <rootbeer@redcat.com>
        Reading file in nested WHILE -- blank output daveleroy@my-deja.com
    Re: Running a program through perl (Tad McClellan)
    Re: running a service as root <rootbeer@redcat.com>
    Re: Sorting hash of hash by first then second key <damon_jebb@nai.com>
    Re: Sorting hash of hash by first then second key <damon_jebb@nai.com>
    Re: Tanspose rows to columns (Randal L. Schwartz)
    Re: Tanspose rows to columns <mjcarman@home.com>
    Re: Tanspose rows to columns <sariq@texas.net>
        test <jeanphil@sitepak.com>
    Re: xs: getting a char* into my Perl script <dan@tuatha.sidhe.org>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 16 May 2000 06:06:36 -0700
From: Mur <jboesNOjbSPAM@qtm.net.invalid>
Subject: Re: Accurate IP return?
Message-Id: <00670a84.e32c3e15@usw-ex0101-006.remarq.com>

(By the way, this post really has nothing to do with Perl. Your
approach to solving this problem really isn't affected by the
choice of language. I suspect you are better off posting in
comp.infosystems.www.authoring.cgi.)

There's not a really good way to do this based on identification
coming from the browser. The approach I would use is to:

1) Invite a user to sign up by registering his/her email
address.

2) Generate a unique number or other identifier, and mail it to
them.

3) Require them to enter the unique identifier when they vote.
Only one vote per identifier will be recorded.

Depending on how you want to regulate this, you may wish to
restrict "free email" accounts (like Hotmail, Yahoo, etc.) from
participating.


Jeff Boes//ICQ=3394914//Yahoo!=jeffboes//AOL IM=jboes
  //home=jboes@qtm.net//professional=mur@consultant.com

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Tue, 16 May 2000 15:41:24 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Accurate IP return?
Message-Id: <Pine.GHP.4.21.0005161538090.23218-100000@hpplus01.cern.ch>

On Mon, 15 May 2000, [TNN]G.Bloke wrote:

> Is there a reliable method to return a users IP address?

No.  Sometimes "yes", but there's no way of assessing whether you're
dealing with one of those, so the answer is still "no".

> Why? Well I'm attempting to prevent multiple votes on a vote-system,

Your plan is misconceived, I'm afraid.  Try a CGI FAQ.  This is not a
Perl language issue. 

[f'ups]



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

Date: Tue, 16 May 2000 07:01:08 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Annoying -w messages from standard distributed modules
Message-Id: <Pine.GSO.4.10.10005160700440.25459-100000@user2.teleport.com>

On Tue, 16 May 2000, Scott Houck wrote:

> Maybe he could do something funky like $^W=0; use BuggyModule; $^W=1;

Well, he could - but it wouldn't help. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 16 May 2000 10:40:01 -0400
From: Jean-Philippe Bouchard <jeanphil@sitepak.com>
Subject: CVS for perl projects
Message-Id: <39215DC1.67CED0F4@sitepak.com>

Hello,
	We've decided to use CVS to maintain our perl sources tree. We looked
for perl specific issues but weren't able to find any precedent on the
web or in the documentation. If you are aware of such project going on
(using CVS or any other source control software) could you please let us
know.

	Thanks in advance.

-- 
---------------------------------
Jean-Philippe Bouchard            
Sitepak - http://www.sitepak.com/ 
jeanphil@sitepak.com              
---------------------------------


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

Date: Tue, 16 May 2000 14:22:29 GMT
From: jeff_stephens@my-deja.com
Subject: deleting from a hash by reference...
Message-Id: <8frlii$6c3$1@nnrp1.deja.com>

I can't seem to find an answer to this:

I would like to do the following, but of course it doesn't work:

  $ref = \$main{$node}{$key}{$text};
  delete ( $ref );

Essentially, I have a multi-level hash that I need to reference
elsewhere in the program.  I can get the value of the hash easily
with the ref, but no matter what de-ref I try, I can't get it to
delete the key from the hash.  What can I do?

TIA

Jeff


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 16 May 2000 23:15:39 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: deleting from a hash by reference...
Message-Id: <8fro1o$i30$1@coco.singnet.com.sg>

<jeff_stephens@my-deja.com> wrote in message
news:8frlii$6c3$1@nnrp1.deja.com...
> I can't seem to find an answer to this:
>
> I would like to do the following, but of course it doesn't work:
>
>   $ref = \$main{$node}{$key}{$text};
>   delete ( $ref );
>
> Essentially, I have a multi-level hash that I need to reference
> elsewhere in the program.  I can get the value of the hash easily
> with the ref, but no matter what de-ref I try, I can't get it to
> delete the key from the hash.  What can I do?

The following script should illustrate how one uses delete():

==== BEGIN ====
#!/usr/bin/perl -w

# TADA! introducing the Data::Dumper module!
use Data::Dumper;
#$Data::Dumper::Indent = 1;
#$Data::Dumper::Terse  = 1;

# set some values
$node  = 'a node';
$key   = 'a key';
$text  = 'some text';
$text2 = 'more text';
%main  = ();

# insert some values into the hash of hash of hash :-)
$main{$node}{$key}{$text } = 'a value';
$main{$node}{$key}{$text2} = 'another value';

# displays result, deletes value, displays again
print Dumper \%main;
delete $main{$node}{$key}{$text};
print Dumper \%main;
====  END  ====

Swee Heng




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

Date: 16 May 2000 06:51:42 -0700
From: Sue Spence <sue@pennine.com>
Subject: Re: File lock? Help Needed!!
Message-Id: <8frjpe$dc9@drn.newsguy.com>

In article <63opf8.905.ln@usenet-autoren.de>, Christian says...
>
>Kelvin <k2_1999@hotmail.com> schrob:
>> I thought that was the problem of the flock!
>> I've already put it in, but little confuse, can any help to solve?
>
>> Here is the code about read and write :
>
>open (WriteResult, ">vote.dat") or die $!;
> [...]
>You should test for success here, especially if using flock().
>If the file can't be created and you don't give 'or die' the
>flock will fail, in the loop I made below (which is neccesary
>on some systems) waisting 20 seconds.
>
>>     flock (WriteResult, 2);
>
>You don't test the result of flock, it may have failed.
>Do something like
>
>sleep 1 until( flock WriteResult, LOCK_EX );

 ...shouldn't that be:

sleep 1 until( flock WriteResult, LOCK_EX | LOCK_NB );


flock is a blocking function, Kelvin, which means that as long as everything
else is OK it will wait ("block") until it can do what it's been asked to do,
unless it has been instructed not to wait by or'ing the operation flag (LOCK_SH,
LOCK_EX, LOCK_UN) with LOCK_NB.  Your code snippet isn't in this followup, but
I've looked at it and it appeared that you weren't flock'ing the file you opened
for writing.  You need to fix that, if so.


>
>And even more better:
>
>my $i == 0;
>until( flock WriteResult, LOCK_EX | LOCK_NB )
  
                                    ^^^^^^^^^
ditto ;-)



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

Date: Tue, 16 May 2000 15:52:48 +0200
From: "Vjeran" <user0201@vjeran.com>
Subject: Re: How to COPY a website
Message-Id: <8frjun$1mf$1@as102.tel.hr>



Keith Smith <ksmith@firesnacks.com> wrote in message
news:CkFT4.5349$f12.123160@news1.rdc1.on.wave.home.com...

> Are there any good scripts out there for retrieving all the files found at
a
> website?  Essentially, I would like to point this tool at a URL and have
it
> decend all the local links and retrieve all the content associated with
> static html links.

Get yourself  TeleportPRO ( www.teleportpro.com ). Itdownloads whole sites,
goes into required deph of each site o maybe serveral sites, downloads all
or certain files and coverts HTML links into local links if you say so.


Vjeran





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

Date: Tue, 16 May 2000 14:11:32 GMT
From: Paul Eckert <peckert@epicrealm.com>
Subject: Re: How to COPY a website
Message-Id: <392155FA.65F1F7F8@epicrealm.com>

Vjeran:
  The website you supplied is bogus.  Try http://www.tenmax.com/
  This being said, don't use teleport--it doesn't respect robot exclusion
as Randal Schwartz mentioned in his prior email.  If I can quote:
"Which is blocked on my website because it has been shown not to
respect robots.txt.  Evil Product.  Do not buy.  Do not promote."
   Paul

Vjeran wrote:
> 
> Keith Smith <ksmith@firesnacks.com> wrote in message
> news:CkFT4.5349$f12.123160@news1.rdc1.on.wave.home.com...
> 
> > Are there any good scripts out there for retrieving all the files found at
> a
> > website?  Essentially, I would like to point this tool at a URL and have
> it
> > decend all the local links and retrieve all the content associated with
> > static html links.
> 
> Get yourself  TeleportPRO ( www.teleportpro.com ). Itdownloads whole sites,
> goes into required deph of each site o maybe serveral sites, downloads all
> or certain files and coverts HTML links into local links if you say so.
> 
> Vjeran

-- 
Paul Eckert
Sr. Software Engineer
Epicrealm Inc.
1651 N. Glenville Dr., Suite 212
Richardson, TX 75081
(972) 479-0135 x300
peckert@epicrealm.com


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

Date: Tue, 16 May 2000 15:01:43 +0100
From: Alan Silver <alan-silver@prestwich-smile-gemach.freeserve.furryferret.co.uk>
Subject: Re: How to COPY a website
Message-Id: <GiBzydAHTVI5Ewu9@prestwich-smile-gemach.freeserve.co.uk>

In article <CkFT4.5349$f12.123160@news1.rdc1.on.wave.home.com>, Keith
Smith <ksmith@firesnacks.com> writes
>Hi folks:
>
>Are there any good scripts out there for retrieving all the files found at a
>website?  Essentially, I would like to point this tool at a URL and have it
>decend all the local links and retrieve all the content associated with
>static html links.
>
>Thoughts/coments?

Have you thought about the legal implications of this ? Unless the site
author gives explicit permission for you to copy the site (or any part
of it), then it's illegal to copy it.

Check out some intellectual property law if you wan more info, but the
bottom line is that the creator of any intellectual property (song,
paining, web site, book, ...) owns the copyright automatically. It is
illegal for anyone else to copy the work without explicit permission.

-- 
Alan Silver
Please remove the "furryferret" if replying by e-mail


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

Date: Tue, 16 May 2000 14:42:33 GMT
From: "J. C." <root@127.0.0.1>
Subject: Re: How to COPY a website
Message-Id: <160520001042313969%root@127.0.0.1>

In article <GiBzydAHTVI5Ewu9@prestwich-smile-gemach.freeserve.co.uk>,
Alan Silver
<alan-silver@prestwich-smile-gemach.freeserve.furryferret.co.uk> wrote:

: Have you thought about the legal implications of this ? Unless the site
: author gives explicit permission for you to copy the site (or any part
: of it), then it's illegal to copy it.

I think the guy just wants to download it for perusal "offline."  Geez,
net lawyers are everywhere.
--


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

Date: Tue, 16 May 2000 13:27:34 GMT
From: Gordon.Haverland@agric.gov.ab.ca
Subject: Re: How to find distances?
Message-Id: <39214b40.953638633@news.gov.ab.ca>

On Tue, 16 May 2000 10:13:46 GMT, smnayeem@my-deja.com wrote:

>In article <WROT4.1279$Kc1.184697@news.dircon.co.uk>,
>  Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>> On Mon, 15 May 2000 07:15:56 GMT, smnayeem@my-deja.com Wrote:
>> > I need a module in perl so that I can find the distance between two
>> > different places. Does anyone know of any module or know where I can
>> > find one??

>Thanks for the link J. However it only allows locations within USA to
>be matched, it fetches the data from the census gov something. I was
>lookin for something that would allow me to look up distances all over
>the world from ANY cities to any other cities.

You are asking a problem in geographical information systems (GIS),
try comp.infosystems.gis.  GRASS is an opensource GIS originally
developed by the US Army Corps of Engineers, now maintained by
Baylor (sp?) University.  The development site is in Europe.  Within
GRASS are programs which can be used to calculate distances (I
normally work on a small scale, so my work is quasi Cartesian with
corrections for different "zones").

In general, your problem is "difficult" as the Earth is not a sphere,
but is squished and distorted.  There are different "geoids" fit to
different areas of the Earth.  Depending on your accuracy
requirements, you may have to call a program in C or FORTRAN from
GRASS (or other published GIS work) to calculate this distance for
you, and live with whatever assumptions go into that program.

Gord
#include <disclaimer.h>



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

Date: 16 May 2000 15:02:06 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: How to replace "\" , HELP!
Message-Id: <slrn8i2ond.t86.vek@pharmnl.ohout.pharmapartners.nl>

On Tue, 16 May 2000 03:18:25 -0700,
            LinkWorm Software, Inc. <webmaster@linkworm.com> wrote:

>
>Okay, let me make this clear, you can't name a file
>"afile\name.whatevwer". Windows won't allow you to have a "\" in the
>file _name_.
> 



It may be useful to make the distiction between file names and 
file path names.  File path names are the names including the
directories where a slash is used to separate each directory name
from its parent directory name and the file name from its parent
directory name.  A file name will then be the part of the file path name
that comes after the last slash.

It is quite common to use the term "file name" where a "file path name"
is meant, so the above comment might not as clear as it was entended.


Villy


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

Date: Tue, 16 May 2000 07:51:07 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Math::TrulyRandom and Perl5.6.0?
Message-Id: <Pine.GSO.4.10.10005160750000.25459-100000@user2.teleport.com>

On Mon, 15 May 2000, JoshNarins wrote:

>  make test hangs indefinitely for first call to
>  Math::TrulyRandom::rand() in Cryptix-1.16/Math-TrulyRandom/test.pl

Sounds like a bug. :-)  Have you contacted the module's author to ask
whether it's the module or Perl that's at fault? Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 16 May 2000 13:59:41 GMT
From: herbertka@my-deja.com
Subject: Maxímum length of perl strings and system() args
Message-Id: <8frk81$4s1$1@nnrp1.deja.com>

What is the maxmium length of ActiveState perl strings and strings
that are currently passable as arguments in a system() command to
the windows (NT) operating system ?

Bye
Herbert


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 16 May 2000 13:05:32 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: MySQL Iteration
Message-Id: <8frh2h$tg$1@nnrp1.deja.com>

In article <8fplkp$3hd$1@uranium.btinternet.com>,
  "Andy Chantrill" <andy@u2me3.com> wrote:
> Hey,
>
> I need to iterate through the records in an entity within one of my MySQL
> databases ...
>
> The pseudo code that I would have thought was best for this kind of
> operation would be the following:
>
> --
> 1. Get the total number of records (x),
> 2. Load chunks of (y) primary keys into array,
> 3. Iterate through array, pulling in data from database, using primary key,
> 4. Do operation on selected data,
> 5. End when total number of records (x) is reached.
> --
>
> Of course, the efficiency of using this method would be the value of (y), in
> step 2 (the number of records in the entity is too great to simply load them
> all into memory at once).
>

Hm-m, why so complicated ?
IMHO you need only *one* SELECT statement, then you simply fetch() records
(one record by one) in a loop and process them.
If you need records to come in some particular order - use ORDER BY.
If data comes from multiply tables - use some kind of JOIN.

Maybe you should consult DBI and DBD documentation for more (perl-related)
details and code examples. And, yes, don't miss MySQL tutorial.

Ilja.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 16 May 2000 13:39:53 GMT
From: daveleroy@my-deja.com
Subject: Nested while loop -- empty output
Message-Id: <8frj36$3fa$1@nnrp1.deja.com>

I am new to perl and I am trying to figure out why
my output is completely blank.  I have a while
statement (while <filehandle>) that reads in a
line.  I want to search a second file for info in
the original file, so I use another while
statement (while<filehandle2>).  The output is as
expected on the screen, but the exact same print
statement printed to an output file comes up
empty!  When I comment out the second while
(nested while), the output is printed to the file
just fine.  Why does it do this?  What do I need
to do to use while to read through the second
file while I am inside the first while loop?

THANKS!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 16 May 2000 09:21:53 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Nested while loop -- empty output
Message-Id: <39215981.A6EABDEB@texas.net>

daveleroy@my-deja.com wrote:
> 
> I am new to perl and I am trying to figure out why
> my output is completely blank.  I have a while
> statement (while <filehandle>) that reads in a
> line.  I want to search a second file for info in
> the original file, so I use another while
> statement (while<filehandle2>).  The output is as
> expected on the screen, but the exact same print
> statement printed to an output file comes up
> empty!  When I comment out the second while
> (nested while), the output is printed to the file
> just fine.  Why does it do this?

Show us an example (i.e., post working code).  It should be as short as
possible, while still demonstrating the behavior.

You *are* ensuring that your open statements are successful, aren't you?

- Tom


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

Date: Tue, 16 May 2000 07:49:17 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: net user equivalent
Message-Id: <Pine.GSO.4.10.10005160747280.25459-100000@user2.teleport.com>

On Mon, 15 May 2000 jeffhenke@my-deja.com wrote:

> is there easy a Perl equivalent to the net user command which will
> provide a list of all the groups for a user?

I don't know what "the net user command" is, but do the getgr* functions
do anything useful for you?

> I've been working with WIn32::NetAdmin and AdminMisc, but can't seem
> to find a single function to do it.  Someone suggested that I just run
> net user to a file and run a Perl script using a regex to parse out a
> list of groups...

Well, if there's no built-in, maybe you should make it a function in a
module. That would also make it easier to update the programs, should the
function ever become available through XS, say.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 16 May 2000 10:24:50 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Odd behaviour, I think its my use of map()?
Message-Id: <39215A32.3ACECDC@attglobal.net>


All,
 I am creating a text file based upon the contents of an array 
reference.  This is working (as far as I can see) just fine.  
I create the file with this line:

print DATA map $_ . "\n" => @$page; 

 This works.  While the script is executing, I can see that the
file is created, and has the correct structure.  For example:

 $ cat spanky.data 
   4:spec_num
   5:spec_proc
   1:price_plan
   3:css_queue
 
 When I later try to read the file line by line into an 
array, I use the following syntax: (tried both, same effect)
 
 chomp(@page_array = <DATA>);  -or-
  
 while (<DATA>){
 chomp;
 push(@page_array,$_); 
 }
  
 The problem is, the whole file reads in as $page_array[0].   
I am confused as to why it doesn't populate the array 
with one index per line of the file??  If _anyone_ can shed 
some light on that, I will think kind thoughts about them for
weeks on end. Im very confused, and have been trying other
methods, but I just can't get the correct behaviour.

TIA...


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

Date: Tue, 16 May 2000 09:33:00 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Odd behaviour, I think its my use of map()?
Message-Id: <39215C1C.D47AA709@texas.net>

Drew Simonis wrote:
> 
> All,
>  I am creating a text file based upon the contents of an array
> reference.  This is working (as far as I can see) just fine.
> I create the file with this line:
> 
> print DATA map $_ . "\n" => @$page;
> 
>  This works.  While the script is executing, I can see that the
> file is created, and has the correct structure.  For example:
> 
>  $ cat spanky.data
>    4:spec_num
>    5:spec_proc
>    1:price_plan
>    3:css_queue
> 
>  When I later try to read the file line by line into an
> array, I use the following syntax: (tried both, same effect)
> 
>  chomp(@page_array = <DATA>);  -or-
> 
>  while (<DATA>){
>  chomp;
>  push(@page_array,$_);
>  }
> 
>  The problem is, the whole file reads in as $page_array[0].

How are you printing @page_array?  You aren't just doing:

print @page_array;

are you?

- Tom


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

Date: 16 May 2000 09:38:08 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Odd behaviour, I think its my use of map()?
Message-Id: <87hfbyzhkf.fsf@shleppie.uh.edu>

>> On Tue, 16 May 2000 10:24:50 -0400,
>> Drew Simonis <care227@attglobal.net> said:

> print DATA map $_ . "\n" => @$page;

>  When I later try to read the file line by line into an
> array, I use the following syntax: (tried both, same
> effect)
 
>  chomp(@page_array = <DATA>); -or-
>  while (<DATA>){ chomp; push(@page_array,$_); }
  
How are you opening the filehandle here?  You do know that
DATA is a special handle in perl don't you?

    print while <DATA>;
    
    __DATA__
    this
    should
    appear

Do you have any special settings for $/ in your code
(perldoc perlvar).

hth
t


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

Date: Tue, 16 May 2000 10:43:09 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Odd behaviour, I think its my use of map()?
Message-Id: <39215E7D.C4029122@attglobal.net>



Tom Briles wrote:

> >  The problem is, the whole file reads in as $page_array[0].
> 
> How are you printing @page_array?  You aren't just doing:

I do this:

if (-e $filename){
		
	open (DATA, "< $filename") or die "can't open $filename: $!"; 
	chomp(@page_array = <DATA>); 
			
	close DATA;

	$val_page =  shift @page_array;
	print $val_page , "\n"; #this prints the entire file,
				#not just the first element?
 

> - Tom


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

Date: Tue, 16 May 2000 10:51:53 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Odd behaviour, I think its my use of map()?
Message-Id: <39216089.E61F8FEE@attglobal.net>



Tony Curtis wrote:
> 
> >> On Tue, 16 May 2000 10:24:50 -0400,
> >> Drew Simonis <care227@attglobal.net> said:
> 
> > print DATA map $_ . "\n" => @$page;
> 
> >  When I later try to read the file line by line into an
> > array, I use the following syntax: (tried both, same
> > effect)
> 
> >  chomp(@page_array = <DATA>); -or-
> >  while (<DATA>){ chomp; push(@page_array,$_); }
> 
> How are you opening the filehandle here?  You do know that

Like so: 

open (DATA, "< $filename") or die "can't open $filename: $!";


> DATA is a special handle in perl don't you?

I do now.  I didn't. I changed it to STATE but it didn't help
matters.  

> Do you have any special settings for $/ in your code

none.


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

Date: Tue, 16 May 2000 13:13:23 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: perl & apache conf
Message-Id: <slrn8i56ri.55h.tjla@thislove.dyndns.org>

I was shocked! How could Ian <duxbury@kentmere23.freeserve.co.uk>
say such a terrible thing:
>I have changed the shebang line as you suggested, I'm using Win98 so I have
>changed it as below. The error log is still reading:-
>
>[Tue May 16 11:42:29 2000] [error] [client 127.0.0.1] (2)No such file or
>directory: couldn't spawn child process: c:/program files/apache
>group/apache/cgi-bin/p20_5.pl
>
>
>#!c:\progra~1\apache~1\apache\cgi-bin\p20_5.pl

You need to change this line to point to the path to the "perl"
executable. Not to your script.

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
MULATTO

n. A child of two races, ashamed of both.


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

Date: Tue, 16 May 2000 07:54:19 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl 5.6 build error
Message-Id: <Pine.GSO.4.10.10005160751290.25459-100000@user2.teleport.com>

On Mon, 15 May 2000 prabhakar@chaganti.net wrote:

> I can build the default installation without any errors. 
> But I need an install with thread support. 

Have you seen the README.threads? I don't think that threads are
well-enough supported that anyone should rely upon them yet. At this
stage, it's like building your own log cabin: you can expect to get a few
painful splinters. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 16 May 2000 07:00:22 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl on OS390
Message-Id: <Pine.GSO.4.10.10005160658290.25459-100000@user2.teleport.com>

On 16 May 2000, Steffen Beyer corrected me:

> >> Does anybody know what is the last supported version of perl for OS390
> >> platform ?
> 
> > If it's not 5.6.0, it should be. :-)
> 
> Tom, you should know better!
> 
> Perl 5.6 is deliberately incompatible with any EBCDIC ports 

Ah, it never entered my brain that OS390 would be EBCDIC. I thought it was
cuneiform. :-)

> due to support for Unicode. Both strands of development are supposed
> to be re-unified in a later release.

I hadn't heard that. Thanks for the info!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 16 May 2000 14:51:49 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: perl on OS390
Message-Id: <9gdU4.86229$hT2.363265@news1.rdc1.ct.home.com>

Steffen Beyer <sb@muccpu1.muc.sdm.de> wrote:
> In article <Pine.GSO.4.10.10005151700410.25459-100000@user2.teleport.com>, Tom Phoenix <rootbeer@redcat.com> wrote:
>> On Mon, 15 May 2000, Matteo Palmieri wrote:

>>> Does anybody know what is the last supported version of perl for OS390
>>> platform ?

>> If it's not 5.6.0, it should be. :-)

> Tom, you should know better!

> Perl 5.6 is deliberately incompatible with any EBCDIC ports due to support
> for Unicode. Both strands of development are supposed to be re-unified in
> a later release.

> If I'm not mistaken, the latest OS390 port is Perl 5.005_03 - Peter Prymmer,
> is that correct?

Well, I'm not Peter, but 5.6.0's definitely got problems with non-ASCII
platforms. Whether that gets fixed in the future's still up in the air
AFAIK.

					Dan


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

Date: Tue, 16 May 2000 06:57:22 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Perl vs ActivePerl
Message-Id: <Pine.GSO.4.10.10005160656400.25459-100000@user2.teleport.com>

On Tue, 16 May 2000, Saddek Rehal wrote:

> I discovered now that if I put my program hdate.exe at the root directory
> and change the line $hdateprg = "/apache/ActivePerl/bin/hdate.exe"; to
> $hdateprg = "/hdate.exe";    than my script works correctly, Why???

Perhaps because you're using the correct path to that program rather than
the incorrect one? Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 16 May 2000 13:47:51 GMT
From: daveleroy@my-deja.com
Subject: Reading file in nested WHILE -- blank output
Message-Id: <8frji0$45f$1@nnrp1.deja.com>

I am new to Perl and have a frustrating problem.
I am trying to read in a file using WHILE (<INPUT1>) and after
I get the first line from the file, I try to compare it to all of the
lines in a second file using WHILE (<INPUT2>) which is nested inside the
first WHILE.   I have print statements in both of the WHILE loops which
print to filehandles OUTPUT1, OUTPUT2, etc.  (for example).  I also have
shadow print statements which print to the screen (exactly the same as
the other print statements, just without the filehandle).  Here is the
puzzling part:  the statements output to the screen look EXACTLY the
way I want them to... but all of the output files are empty.  Why is
this?  What can I do to fix it?

I am pretty sure it is the WHILE statement because when I comment the
WHILE (<INPUT2>) line and the corresponding {}, it prints to the output
just fine with no other changes... but without the second while it
doesn't give the results desired.  Please help!  (and thanks in advance)


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 16 May 2000 08:18:01 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Running a program through perl
Message-Id: <slrn8i2f3p.3ql.tadmc@magna.metronet.com>

On Tue, 16 May 2000 16:22:51 +1000, Amri, Kuross [WOLL:4009-I:EXCH] <kamri@asiapacificm01.nt.com> wrote:

>Is there any way of running a program through perl.


Perl FAQ, part 8:

 ------------------------------
=head2 How can I capture STDERR from an external command?

There are three basic ways of running external commands:
 ------------------------------


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


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

Date: Tue, 16 May 2000 07:59:38 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: running a service as root
Message-Id: <Pine.GSO.4.10.10005160754500.25459-100000@user2.teleport.com>

On Mon, 15 May 2000, Thomas Åhlen wrote:

> 5. All system calls are run with "exec 'program', '$arg1', '$arg2'"
> where all $args are matched with regexps.

I assume that you mean that the args are checked with
sufficiently-restrictive patterns. That's good. It's even better if you
use the list-form of exec, which will not involve shell-based quoting of
args:

   exec 'program', $arg1, $arg2
	or die "Can't exec 'program': $!";

> I know that buffer owerflows is a classic way to hack servers. What is
> the best way to prevent/avoid buffer overflow.

Use a language with proper string handling. May I recommend Perl? :-)

Of course, once you call a possibly-vulnerable external program, you
should ensure that you don't pass too much data to it. Using patterns or
checking the length of the arguments directly is a good idea. 

Of course, you're using Perl's taint checking, right? 

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




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

Date: Tue, 16 May 2000 15:30:05 +0100
From: "Damon Jebb" <damon_jebb@nai.com>
Subject: Re: Sorting hash of hash by first then second key
Message-Id: <8frm1r$22u$1@new-news.na.nai.com>

In irder for this to work the structure of the hash needs to be ...

%Hash = (
    key1 => {key1.2 => 'Val1'},
    key3 => {key3.1=> 'Val3.1', Key3.2=>'Val3.2'},
    key4 => {key4.2=> 'Val4.2'},
    );

The second dimension is a set of anonymous hashes containing the second
level keys and values and the first set of keys is a reference to the
required anonymous hash.  So sorting is a two level loop with the correct
de-reference of the value returned by the first key....

%Hash = (
 1 => {2 => "Value 1.2"},
 3 => {1 => "Value 3.1",
    2 => "Value 3.2"},
  4 => {1 => "£Value 4.1"}
  );

foreach $key1 (sort keys %Hash) {
 print "Found Key1 = $key1\n";

    foreach $key2 (sort keys %{$Hash{$key1}}) {
        print "Item $key1,$key2 has value ".$key1->{$key2}."\n";
    }
}

works as required I think

The important bit here is the use of the value given by the first key as a
reference to a hash in the inner loop.

HTH

Damon


Brian Orpin <abuse@borpin.co.uk> wrote in message
news:k082iscofpf50df58s7v1sqepbv2vvfql8@4ax.com...
> I have a hash
>
> $hash{key1}{key2} = val
>
> I want to sort it on the first key and then on the second key. So that on
> key value of;
>
> 3 - 2
> 3 - 1
> 1 - 2
> 4 - 2
>
> would sort to
> 1 - 2
> 3 - 1
> 3 - 2
> 4 - 2
>
> I have tried various combinations of sort with zero success.  I did
> manage to get the second key sorted but I seem to have lost that now:-((
>
> Help please.
>
> --
> Brian Orpin  **Reply to address is valid***
> Selfbuilding and It'll be finished one day.
> http://www.borpin.co.uk/  *I have exorcised the Demon*




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

Date: Tue, 16 May 2000 15:42:16 +0100
From: "Damon Jebb" <damon_jebb@nai.com>
Subject: Re: Sorting hash of hash by first then second key
Message-Id: <8frmom$281$1@new-news.na.nai.com>

My print statement wasn't quite right -

     print "Item $key1,$key2 has value ".$Hash{$key1}->{$key2}."\n";

Is right.

Damon

Damon Jebb <damon_jebb@nai.com> wrote in message
news:8frm1r$22u$1@new-news.na.nai.com...
> In irder for this to work the structure of the hash needs to be ...
>
> %Hash = (
>     key1 => {key1.2 => 'Val1'},
>     key3 => {key3.1=> 'Val3.1', Key3.2=>'Val3.2'},
>     key4 => {key4.2=> 'Val4.2'},
>     );
>
> The second dimension is a set of anonymous hashes containing the second
> level keys and values and the first set of keys is a reference to the
> required anonymous hash.  So sorting is a two level loop with the correct
> de-reference of the value returned by the first key....
>
> %Hash = (
>  1 => {2 => "Value 1.2"},
>  3 => {1 => "Value 3.1",
>     2 => "Value 3.2"},
>   4 => {1 => "£Value 4.1"}
>   );
>
> foreach $key1 (sort keys %Hash) {
>  print "Found Key1 = $key1\n";
>
>     foreach $key2 (sort keys %{$Hash{$key1}}) {
>         print "Item $key1,$key2 has value ".$key1->{$key2}."\n";
>     }
> }
>
> works as required I think
>
> The important bit here is the use of the value given by the first key as a
> reference to a hash in the inner loop.
>
> HTH
>
> Damon
>
>
> Brian Orpin <abuse@borpin.co.uk> wrote in message
> news:k082iscofpf50df58s7v1sqepbv2vvfql8@4ax.com...
> > I have a hash
> >
> > $hash{key1}{key2} = val
> >
> > I want to sort it on the first key and then on the second key. So that
on
> > key value of;
> >
> > 3 - 2
> > 3 - 1
> > 1 - 2
> > 4 - 2
> >
> > would sort to
> > 1 - 2
> > 3 - 1
> > 3 - 2
> > 4 - 2
> >
> > I have tried various combinations of sort with zero success.  I did
> > manage to get the second key sorted but I seem to have lost that now:-((
> >
> > Help please.
> >
> > --
> > Brian Orpin  **Reply to address is valid***
> > Selfbuilding and It'll be finished one day.
> > http://www.borpin.co.uk/  *I have exorcised the Demon*
>
>






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

Date: 16 May 2000 06:30:39 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Tanspose rows to columns
Message-Id: <m1wvkuk4g0.fsf@halfdome.holdit.com>

>>>>> "Christian" == Christian Treczoks <c.treczoks@ndh.net> writes:

Christian> And the he started the program on the biggest sparc we had back
Christian> in ye olden times, and, behold, it died after 5 minutes (out of
Christian> memory) and listed the first ~20 primes :-)

Christian> I never touched functional programming again...

The difference between theory and practice in theory is much less
than the difference between theory and practice in practice.

For me, give me a *practical* language.  I may not always be up on the
latest cool parsing techniques (for that I bow to people like Damian
Conway for giving me Very Cool Tools) or always completely understand
how memory allocations for closures work, but I can finish the task
with Perl long before people that are still trying to get their Java
program to compile.

OK, so I'm not quite *that* good.  But I hope you get the point.  I
gave a talk at Yale University a few weeks back on "The P in Perl
stands for Practical", and made jabs at Java with James Gosling
sitting in the front row. :)

One student asked me "doesn't Perl's lack of strong typing make it
harder to get your programs debugged?"  to which I replied a simple
"No".  I must've shocked his poor little world apart... he was visibly
hurt! :) I then went on to explain that with Perl's very high-level
constructs, I can keep enough of the routine in my head that I'm not
putting bugs in in the first place, whereas with C or C++ or Java, I
seem to keep having to write more of the code myself with more chances
to insert errors as well.  (Who uses a debugger? :)

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Tue, 16 May 2000 08:45:33 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Tanspose rows to columns
Message-Id: <392150FD.5F7CA0B1@home.com>

Xah wrote:
> 
> and that's so impressive for a Perl programer.
> Now witness a functional programer:
> 
[Snip of ~150 lines of module POD.]

Where's the Perl?

> code downloadable at
> 
>  http://xahlee.org/PerlMathematica_dir/perlMathematica.html

Oh, *there* it is... and blech! It builds a string for eval() every time
it's called. That ought to make it run nice & slow. Was that the only
way you could find to do it?

> In functional languages, such generalized function as above are a 
> dime a dozen, and people don't wet their pants over it.

Who's getting all excited? No, Bart's function is not as general and
flexible. Who cares? For the purpose stated, it is cleaner (less code
required) and more efficient. You don't need a sledgehammer to drive in
a  finishing nail.
 
>  Xah
>  xah@xahlee.org
>  http://xahlee.org/PageTwo_dir/more.html
>  "The three principle virtues of Perl programers: mundaneness,
> sloppiness, and fatuousness."

Please lead your .sig with '-- ' so that newsreaders can trim it. BTW,
Xah, if you despise Perl so much (a) why program in it? and (b) why post
here? Have a taste for masochism?

-mjc


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

Date: Tue, 16 May 2000 09:45:42 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Tanspose rows to columns
Message-Id: <39215F16.E09EA9EB@texas.net>

Michael Carman wrote:
> 
> Xah wrote:
> >
> > and that's so impressive for a Perl programer.
> > Now witness a functional programer:
> >
> [Snip of ~150 lines of module POD.]
> 
> Where's the Perl?
> 
> > code downloadable at
> >
> >  http://xahlee.org/PerlMathematica_dir/perlMathematica.html
> 
> Oh, *there* it is... and blech! It builds a string for eval() every time
> it's called. That ought to make it run nice & slow.

I got a chuckle when I read his recognition of assistance from that
"donkey" Larry Rosler.  :)

- Tom


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

Date: Tue, 16 May 2000 10:39:26 -0400
From: Jean-Philippe Bouchard <jeanphil@sitepak.com>
Subject: test
Message-Id: <39215D9E.9D2D4992@sitepak.com>

test
-- 
---------------------------------
Jean-Philippe Bouchard            
Sitepak - http://www.sitepak.com/ 
jeanphil@sitepak.com              
---------------------------------


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

Date: Tue, 16 May 2000 14:55:18 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: xs: getting a char* into my Perl script
Message-Id: <qjdU4.86230$hT2.363265@news1.rdc1.ct.home.com>

Ulrich Ackermann <uackermann@orga.com> wrote:
> The important part of my .xs-file looks like this:

>      40 char *
>      41 get_name()

You've just told xsubpp that this function returns a char * and takes no
parameters to speak of.

>      50     PUSHs(sv_2mortal(newSViv(1)));
>      51     PUSHs(sv_2mortal(newSVpv(name, len)));

Here you access the second parameter and push a pair of SV * onto the
stack.

Perhaps if you told xsubpp what you were really doing it'd work better...

					Dan


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 3061
**************************************


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