[7198] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 823 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 7 13:17:13 1997

Date: Thu, 7 Aug 97 10:00:25 -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, 7 Aug 1997     Volume: 8 Number: 823

Today's topics:
     Re: ? on Server Redirection with Perl (Mike Stok)
     Re: ? on Server Redirection with Perl <bruce@galileo.eng.wayne.edu>
     Re: [Q] Converter between ELM filter-rules file to proc (Paul Tomblin)
     [Q] Default top-of-page header, bug or feature? <martt@elsevier.nl>
     Distributing a Perl Installation. (Mark A. Lehmann)
     Re: Distributing a Perl Installation. (Mike Stok)
     File::Find question (terminating early) (Jete Software Inc.)
     find2perl (-follow ???) <sjt@star.sr.bham.ac.uk>
     Re: graphics, why doesn't this work (Mike Stok)
     Re: graphics, why doesn't this work <rootbeer@teleport.com>
     HELP: 2-D Arrays? (Chim Jason)
     Re: HELP: 2-D Arrays? <rootbeer@teleport.com>
     Re: HELP: 2-D Arrays? (Mike Stok)
     Re: How to execute remote Perl script from Perl? <rootbeer@teleport.com>
     Re: Java and Perl together (Tushar Samant)
     Re: Module installation <rootbeer@teleport.com>
     package/object confuses each others variables? (Calle ]sman)
     Re: package/object confuses each others variables? <jpm@iti-oh.comNOSPAM>
     Re: Passing Parameter in Perl <rootbeer@teleport.com>
     pattern match/replace <dan@clockwork.net>
     Re: Perl Interface to /etc/passwd (Matthew Burnham)
     Re: perl rpm ? <rootbeer@teleport.com>
     Re: Perl to EXE <jpm@iti-oh.comNOSPAM>
     Re: Perl to EXE (Viper)
     Re: perl-5.004 on UW prob (was: Re: perl-5.003 on UW: ' (Christopher Michael Ward)
     Re: Pre-forking server example needed <dougm@osf.org>
     Re: silencing system() (David Bonner)
     Re: Style and efficiency <rootbeer@teleport.com>
     Unclear documentation for map() (Jot Powers)
     Re: UNIX directory permissions in Perl <seay@absyss.fr>
     Re: Why is `command @ARRAY` rejected by Perl, sometimes <merlyn@stonehenge.com>
     Re: Why is `command @ARRAY` rejected by Perl, sometimes <rootbeer@teleport.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 7 Aug 1997 15:38:59 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: ? on Server Redirection with Perl
Message-Id: <5scq6j$jka@news-central.tiac.net>

In article <33E9E573.15FB@galileo.eng.wayne.edu>,
Bruce Hopkins  <bruce@galileo.eng.wayne.edu> wrote:
>Could anybody give some code on how to do it?
>What is the URL to CPAN?

http://www.perl.com/CPAN/ is Tom Christiansen's CPAN multiplexor, the
master FTP site for CPAN is at ftp://ftp.funet.fi/pub/languages/perl/CPAN/

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Thu, 07 Aug 1997 11:10:43 -0400
From: Bruce Hopkins <bruce@galileo.eng.wayne.edu>
Subject: Re: ? on Server Redirection with Perl
Message-Id: <33E9E573.15FB@galileo.eng.wayne.edu>

Could anybody give some code on how to do it?
What is the URL to CPAN?

Tom Phoenix wrote:
> 
> On Tue, 5 Aug 1997, John Barnett wrote:
> 
> > I would like to know if it is possible to redirect some to a WWW server
> > based on IP or DNS name.
> 
> > I'm not looking for a how to, just can to be done with Perl?
> 
> Yes. If you decide you need to know how to do redirection, check the docs
> for the web-related modules on CPAN. Hope this helps!
> 
> --
> Tom Phoenix           http://www.teleport.com/~rootbeer/
> rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
> Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/


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

Date: 7 Aug 1997 09:13:57 -0400
From: tomblin@ei.kodak.com (Paul Tomblin)
Subject: Re: [Q] Converter between ELM filter-rules file to procmailrc file?
Message-Id: <5schml$g3@apollo.ei.kodak.com>

In a previous article, millerb@PROBLEM_WITH_INEWS_GATEWAY_FILE (Bryan Miller) said:
>Dick Adams (rdadams@access5.digex.net) wrote:
>: Ricardo Marek  <ricky@ornet.co.il> wrote:
>
>: > Does such animal exist? (to convert the ELM filter-rules file 
>: > into a procmailrc file
>: >
>: > Please answer via e-mail
>
>: I was really hoping to see an answer to this question posted!!
>
>Perhaps a more logical place to see that happen would be
>news.software.readers

Maybe somebody should explain the difference between email and news to you,
Bryan.  Along with explaining what exactly it says about you when you post
with your domain set to "@PROBLEM_WITH_INEWS_GATEWAY_FILE".


-- 
Paul Tomblin, Current Product Engineering team leader.
I don't speak for Kodak, they don't speak for me.
(Email that is not work related should go to: ptomblin@xcski.com)
"You are in a twisty maze of Motif Widget resources, all inconsistent."


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

Date: Thu, 07 Aug 1997 15:13:56 +0200
From: Marten Trautwein <martt@elsevier.nl>
Subject: [Q] Default top-of-page header, bug or feature?
Message-Id: <33E9CA14.BB4F60D2@elsevier.nl>

Hi,

The FAQ http://www.perl.com/perl/faq/ does not address my problem, 
so I post it here. Maybe you can help.

I ran into a funny problem when using formats and top-of-page format,
with the following two versions of perl at AIX:
	This is perl, version 5.003 with EMBED
	This is perl, version 5.003_05

If the format of a handle is set before the handle is written
and the top-of-page format of the handle is not yet set, then
the value of the top-of-page format changes to the top-of-page
header corresponding to the format used.
However, if the top-of-page header is set (even if set to the
handle's default value), or a write is performed on the handle
before setting the handle's format, the value of the top-of-page
header is not changed.

The toy perl-script included at the end of this message shows what
happens.

Is this a well-known feature, an undocumented feature, a hidden 
feature or an ordinary bug?

Marten Trautwein
m.trautwein@syllogic.nl,

Syllogic B.V., Houten, The Netherlands

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

#!/usr/local/bin/perl
# This Perl script displays a hidden feature or bug for Perl version 5.
#
# Identified Perl releases that contain the feature / bug:
#	This is perl, version 5.003 with EMBED
# and
#	This is perl, version 5.003_05

# Toy formats
format STDOUT =
@>>> @<<<
$varA,  $varB
 .
format STDOUT_TOP =
Page @<<<			[STDOUT_TOP]
$%
 .

format MYFORMAT =
@>>> @<<<
$varB,  $varA
 .
format MYFORMAT_TOP =
Page @<<<			[MYFORMAT_TOP]
$%
 .
    
# Main
# Set toy variables
$varA = 'A';
$varB = 'B';
# Print default format settings
print STDERR "Default format: '" . $~ ."'; Default top-of-page: '" . $^
 ."'\n";
## Doing write here eliminates the feature/bug
## write;
# Select another format
select (( select(STDOUT),
##	 Setting $^ here eliminates the feature / bug
##	 $^ = "STDOUT_TOP",         
         $~ = "MYFORMAT"
         )[0]);
# Print current format settings before write
print STDERR "Set format to:'" . $~ ."'; top-of-page remains: '" . $^
 ."'\n";
# Use the current format settings
write;
# Print active format settings after write
print STDERR "Wrote with format:'" . $~. "'; top-of-page: '". $^ .
"'\n";


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

Date: 07 Aug 1997 10:29:09 -0500
From: mlehmann@prismnet.com (Mark A. Lehmann)
Subject: Distributing a Perl Installation.
Message-Id: <5bsowm3tbu.fsf@smokey.prismnet.com>

I want to have the same version of perl on all of my AIX computers.  All of
my AIX computers are at AIX level 4.1.4 or 4.1.5.  I have about 10 computers,
and only 2 of them have compilers.  Perl compiles well and the additional
CPAN packages install fine.  But I cannot use a distributed file system to
share the installation amoung the machines.  I have to a local copy on each
machine.

I store the perl libraries in /usr/local/lib/perl5 and the perl executables
in /usr/local/bin.  Can I safely copy those files to all of the machiens and
be safe?  I don't have the option to "make install" these files on most of
the machiens.

-- 
Mark Lehmann.


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

Date: 7 Aug 1997 15:44:05 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Distributing a Perl Installation.
Message-Id: <5scqg5$jvl@news-central.tiac.net>

In article <5bsowm3tbu.fsf@smokey.prismnet.com>,
Mark A. Lehmann <mlehmann@prismnet.com> wrote:
>I want to have the same version of perl on all of my AIX computers.  All of
>my AIX computers are at AIX level 4.1.4 or 4.1.5.  I have about 10 computers,
>and only 2 of them have compilers.  Perl compiles well and the additional
>CPAN packages install fine.  But I cannot use a distributed file system to
>share the installation amoung the machines.  I have to a local copy on each
>machine.

There is a section in the INSTALL document in the distribution which says:

       Creating an installable tar archive

       If you need to install perl on many identical systems, it
       is convenient to compile it once and create an archive
       that can be installed on multiple systems.  Here's one way
       to do that:

           # Set up config.over to install perl into a different directory,
           # e.g. /tmp/perl5 (see previous part).
           sh Configure -des
           make
           make test
           make install
           cd /tmp/perl5
           tar cvf ../perl5-archive.tar .
           # Then, on each machine where you want to install perl,
           cd /usr/local  # Or wherever you specified as $prefix
           tar xvf perl5-archive.tar

Hope this helps,

Mike


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 7 Aug 1997 11:59:34 -0400
From: jete@dgs.dgsys.com (Jete Software Inc.)
Subject: File::Find question (terminating early)
Message-Id: <5scrd6$pgs@dgs.dgsys.com>


I am looking for a way to prematively kick out of a find invocation. 
Users can copy a file into an established pool from a set of filesystems
(wyo* and foctable). There can be several instances of the file in the 
filesystem and the user generally knows which one he wants. So I need
to be able to end the find, once the user has chosen his file.

But return doesn't seem to end the session early. So how to do it??
I know that I can hack something together rather easily, but I would 
prefer to use these facilities.

Hope that this is understandable!!

 (@all_filesys) = `ls -d /wyo* /foctable*`;

 foreach $file ($keys %NEEDED) {
 	foreach $dir (@all_filesys) {
      chomp($dir);
      $stat = find(\&wanted, $dir);
	  if ($stat ne "FINISHED") {
		print "Couldn't find the file $file\n";
		exit(1);
	  }
	}
 }

##
## Used by the 'find' command
##
sub wanted {
    my($query, $answer, $name, $tail);

    if (/^$file$/) {
        $name = $File::Find::name;
        $head = $$File::Find::dir;
        $tail = $_;
        print "File $tail found at $head\n";
        print "Do you want to copy \"$name\" to pool \"$poolname\"? [Y]";
        $query = "Y";
        $answer = <STDIN>;
        if ($query =~ /\b[yY]/) {
            `poolcp $name $pool_name:$tail`;
            print "File \"$tail\": copied into pool \"$poolname\"\n\n";
            return "FINISHED";
        }
    }

}




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

Date: Thu, 07 Aug 1997 15:45:01 +0100
From: James Tappin <sjt@star.sr.bham.ac.uk>
Subject: find2perl (-follow ???)
Message-Id: <33E9DF6D.22C9@star.sr.bham.ac.uk>

Is there any way using the perl find routines to mimic the effect of the
-follow option to find. I know that there isn't a -follow option in
find2perl and looking at how the whole thing works it looks like some
kind of a hack in find.pl would be needed. 

Does anybody know if this can be done in a reliable way (in particular
one that doesn't depend on the setting of $dont_use_nlink for its
operation)? I'm sure I could make a kludge version but I'm not
sufficiently familiar with filesystem internals to be sure it would safe
from infinite loops etc. for all possible systems and arrangements of
links, files & directories.

Thanks in advance for any help.
	James Tappin

-- 
+------------------------+-------------------------------+---------+
| James Tappin,	         | School of Physics & Astronomy |  O__    |
| sjt@star.sr.bham.ac.uk | University of Birmingham	 | --  \/` |
| Ph: 0121-414-6462. Fax: 0121-414-3722			 |	   |
+--------------------------------------------------------+---------+


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

Date: 7 Aug 1997 13:59:10 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: graphics, why doesn't this work
Message-Id: <5sckbe$e25@news-central.tiac.net>

In article <01bca338$80c7e010$6e6fa1cd@www>,
Ryan <rmcguigan@ramresearch.com> wrote:
>I know this may not be the right newsgroup, but for some reason I'm having
>trouble posting messages to a cgi newsgroup.

>Why doesn't this work?  I just want to output a graphic to a browser! 
>Please help me...

>$file = 'f:/www/htdocs/rbm_pic.gif';
>open (FILE, $file) || die "Cant do it Captain";
>binmode FILE;
>print "Content-type: image/gif\n";
>$len = -s $file;
>print "Content-length: $len\n\n";
>binmode STDOUT;
>print STDOUT <FILE>;
>close FILE;

How doesn't it work?  The binmode documentation mentions that it should be
called on a file handle after the open but before any I/O, and you have
already done some IO on STDOUT before you call binmode - which may prevent
the binmode taking effect.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Thu, 7 Aug 1997 08:23:11 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ryan <rmcguigan@ramresearch.com>
Subject: Re: graphics, why doesn't this work
Message-Id: <Pine.GSO.3.96.970807081756.18326V-100000@kelly.teleport.com>

On 7 Aug 1997, Ryan wrote:

> I know this may not be the right newsgroup, but for some reason I'm
> having trouble posting messages to a cgi newsgroup. 

I know that this may not be the right newsgroup, but you probably 
wouldn't read my message if I merely posted it to alt.flame... :-) 

> Why doesn't this work?  I just want to output a graphic to a browser! 

> print STDOUT <FILE>;

That could take a lot of memory. It would be better to print the file in
bite-sized chunks, if there's any chance that you could run out of memory
(or if you're just cautious, and don't want to slow your system while it
tries to malloc hundreds of K). If you're worried that the die()  might
happen, you may want to trap it in one way or another. Other than that, I
didn't spot any Perl problems, so you may want to write to your newsadmin
for help in posting to a CGI newsgroup. :-) 

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 7 Aug 1997 13:39:45 GMT
From: 4jc9@qlink.queensu.ca (Chim Jason)
Subject: HELP: 2-D Arrays?
Message-Id: <5scj71$1mi@knot.queensu.ca>

Can Perl do 2-D arrays?

If yes, please show me a line of 
code assigning a value to a 2-D array.

Thanks,

Jason


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

Date: Thu, 7 Aug 1997 08:40:09 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Chim Jason <4jc9@qlink.queensu.ca>
Subject: Re: HELP: 2-D Arrays?
Message-Id: <Pine.GSO.3.96.970807083851.18326X-100000@kelly.teleport.com>

On 7 Aug 1997, Chim Jason wrote:

> Can Perl do 2-D arrays?
> 
> If yes, please show me a line of 
> code assigning a value to a 2-D array.

    $LoL[$x][$y] = func($x, $y);

That line came from the perllol(1) manpage. (Hint, hint.) Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 7 Aug 1997 15:29:05 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: HELP: 2-D Arrays?
Message-Id: <5scpk1$ivd@news-central.tiac.net>

In article <5scj71$1mi@knot.queensu.ca>,
Chim Jason <4jc9@qlink.queensu.ca> wrote:
>Can Perl do 2-D arrays?
>
>If yes, please show me a line of 
>code assigning a value to a 2-D array.

You can't do "real" 2D arrays, but you can make lists of scalars e.g.

@array = ([1, 2, 3, 4],
          [5, 6, 7, 8],
         );

makes @array have 2 elements, each of which refer to a list of 4 elements
so you can say

print "$array[0][3]\n";		# prints 4 and a newline

or $array[1][2] = 'banana';

or $array[5] = ['fee', 'fie', 'foe', 'fum']; 

Note that perl data structures don't have to be regular in shape or type
of content.

The perllol (list of lists,) perlref and perldsc (data structures
cookbook) and the FAQ address this in more detail.

The FAQ can be accessed via http://www.perl.com/FAQ/ and is distributes as
manual pages with recent perls (the perfaq manual page.)

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Wed, 6 Aug 1997 14:44:19 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: David Estornell <destornell@ProbityITC.com>
Subject: Re: How to execute remote Perl script from Perl?
Message-Id: <Pine.GSO.3.96.970806144058.12246E-100000@kelly.teleport.com>

On Wed, 6 Aug 1997, David Estornell wrote:

> Is it possible to execute a remote Perl script from Perl? 

You seem to want to fetch a script over the web and then run it. Sounds
like Penguin. But if you don't want that, you should be aware of the
security ramifications of running any piece of code which somebody gives
you. Once you've decided to do that, it's just a matter of using LWP to
load the script onto your machine and then either using eval or running
another Perl process. 

The modules I've mentioned should all be found on CPAN, with docs. 
Penguin is probably the best way to do what you're trying. Hope this
helps! 

    http://www.perl.com/CPAN/

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 7 Aug 1997 09:06:13 -0500
From: scribble@shoga.wwa.com (Tushar Samant)
Subject: Re: Java and Perl together
Message-Id: <5sckol$53c@shoga.wwa.com>

ken@forum.swarthmore.edu writes:
>(http://www.oreilly.com/catalog/prkunix/desc.html) and I'm intrigued by
>this line:
>
> Software tools on the Kit's CD include: 
>    -A Java-enhanced Perl compiler, written by Larry Wall, creator of Perl 
>
>What does that mean, "Java-enhanced"?

Here is what I got from O'Reilly:
---------------------------------

>From: O'Reilly Book Support <booktech@ora.com>
>Subject: Re: Perl Resource Kit 

>[...]

>I don't have a lot of information on it yet, but the compiler is
>supposed to be able to compile a perl program into a .class file that
>will work on the JVM!  A pretty impressive trick.
>
>I think more will be unveiled at the Perl conference.  

>[...]



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

Date: Thu, 7 Aug 1997 07:38:24 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Tony <tony@qsvideo.com>
Subject: Re: Module installation
Message-Id: <Pine.GSO.3.96.970807073617.18326N-100000@kelly.teleport.com>

On Wed, 6 Aug 1997, Tony wrote:

> When I type 'perl makefile.pl' everything is just fine.  When I type
> 'make' I get a a bad command error.  

You may not have the program 'make' in your path. You may wish to get and
install the GNU make.

> Also, what are these patches the readme file keeps referring to?  How do
> I use them:  perl5.004_01.pat, gd-1_14.pat, etc.?

You may want to get the GNU patch program as well. If you have more
questions about make and patch, your local expert or a newsgroup about
Unix utilities may be of help to you. Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 07 Aug 1997 10:33:23 +0200
From: md4calle@mdstud.chalmers.se (Calle ]sman)
Subject: package/object confuses each others variables?
Message-Id: <w7pg1sm4cks.fsf@fraggel74.mdstud.chalmers.se>

I wish to create a small object, but when I create different instances of it
they seem to stomp on each others variables?

package Meck;
sub new{    
    my $this = shift;
    my $class = ref($this) || $this;
    my $self = {};
    bless $self, $class;
    $self->init();
    return $self;
}

sub init{
  #these shall be "global" inside the pavkage"
  $q_maxQueLinks=2048;
  $q_antQueLinks=0;
  $q_worstPts=1200000000;
}

#some subroutines

package main;
my $ttR = new Meck;

$ttR->putQue("23","http://www.ake.com");
print $ttR->getQue();
print $ttR->getQue();
$ttR->putQue("15","http://www.sad.ake.com");
$ttR->putQue("45","http://www.ake.com");

my $Ata= new Meck;

print "\nAta:\n";
print $Ata->getQue();



when I run it, it will deliever:
kalle8:~/Perl> clasmeck.pl
http://www.ake.com/null
Ata:
http://www.sad.ake.com/



Since $Ata is declared new, the que shall contain nothing and therefore it
shall return null, but somehow they seem to share some variables?

anyone knows what it can be?

does it help to split up the packages in different files ? Does
it help to enclose {} around a package?

/Calle



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

Date: 7 Aug 1997 13:10:00 GMT
From: "Joshua Marotti" <jpm@iti-oh.comNOSPAM>
Subject: Re: package/object confuses each others variables?
Message-Id: <01bca333$27a20380$36601ec6@bach>

Try this (below)
-- 
Josh,
Gavin Dragon...
Remove NOSPAM from address...



Calle ]sman <md4calle@mdstud.chalmers.se> wrote in article
<w7pg1sm4cks.fsf@fraggel74.mdstud.chalmers.se>...
> I wish to create a small object, but when I create different instances of
it
> they seem to stomp on each others variables?
> 
> package Meck;
> sub new{    
>     my $class = shift;
>     my $self = {};
>     $self->{q_maxQueLinks}=2048;
>     $self->{q_antQueLinks}=0;
>     $self->{q_worstPts}=1200000000;
>     bless $self, $class;
> }
> 
Get rid of the sub init and put the vars as references above.

By making the vars references of the object reference, you are guarenteeing
that they will not be shared by other instances of the object.



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

Date: Thu, 7 Aug 1997 07:35:25 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Anthony Danh <danh@software.org>
Subject: Re: Passing Parameter in Perl
Message-Id: <Pine.GSO.3.96.970807072951.18326M-100000@kelly.teleport.com>

On Mon, 4 Aug 1997, Anthony Danh wrote:

> 	How many parameters can you pass using the below syntax?
> 
> "/cgi-bin/CGI2Perl.exe/mo/order.pl?id=10&name=testing...."

With that particular syntax, I can pass two. :-)

But if you want to know more about the CGI specification, you should
probably look up the CGI specification and see what it says. If you then
have questions, the folks in a newsgroup about CGI could give you a better
and more complete answer than we should in a Perl newsgroup. Of course,
once you've read the docs and FAQs, your Perl questions are welcome here.
Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 6 Aug 1997 16:16:19 -0500
From: "Dan Brian" <dan@clockwork.net>
Subject: pattern match/replace
Message-Id: <5sapcd$7ok@hurricane.jriver.com>

Perl users,

Can someone solve this one? I need this substitution to occur, and it must
occur in one line of code (I know this can be inefficient). Several lines
could also be doable.

Assuming this is my line of text:

   < blah blah KEYWORD blah blah KEYWORD blah blah blah > KEYWORD < blah
KEYWORD blah blah >

I then need a search/replace string that will remove KEYWORD from strings
where it occurs withing the < > brackets. Note that the word can occur
numerous times withing the brackets, and that there can be several bracket
sets on the text line. I need the above string to translate to:

   < blah blah blah blah blah blah blah > KEYWORD < blah blah blah >

Can someone offer me a clean solution?

Thanks,

Dan Brian
dan@clockwork.net














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

Date: Wed, 06 Aug 1997 19:02:50 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: Perl Interface to /etc/passwd
Message-Id: <33ff71d9.26048417@news.enterprise.net>

mjw101@york.ac.uk (Dirge ) wrote:

>Creeping stealthily through the corridors of comp.lang.perl,
I was not! :)
>I overheard Matthew Burnham say:
>: Does it matter what salt I use?
>: ie. can I do crypt($passwd, 'aa');?
>: or can I do crypt($passwd, 'bb');
>: and either one will work when htaccess validates the password?
>It's generally a bad idea to use a set salt. I don't know about htaccess,
>but when I was looking at crypt, ISTR that its process was to take a key
>(the salt) and repeadtedly encrypt the password through use of that key,
>with modifications happening each time. The encypted  password is then
>passed back with the initial salt tacked on the front so that the password
>can be checked in the future. It is exceptionally hard to decrypt the
>password, the only way a check can be made is by encrypting the passwd
>again. Using a set salt will reduce the effectiveness of crypt.
I never noticed in playing with crypt that it tacked the salt on the
front - this basically answers my main question now that it doesn't
matter on the salt.

>: I can't see how it will manage to do this, since it would have to go up
>: to at least (depending on how many different characters are valid) 26^2
>: crypts to check for all the valid two-letter salts, etc.
>Its higher than that.... around about 62^2, cos a slat can have
>upper+lowercase and numbers. I don't think punctuation is used...
IC.

>The point is that it is infeasible to try crakcing a passwd this way: you
>have to know the passwd and salt in order to compare the two.
But if the salt is tacked on the front... the security is reduced?

>: Or, since I can't get htpasswd to work properly when I use perl's crypt
>: function, has a particular salt got to be used?
>I doubt it. The problem may well be that perl and htaccess do not use the
>same crypt function.
Odd, I'd got a script to do it from someone that said it worked fine on
their system (perhaps it's system specific then?).

>: Will crypt yield the same results across platforms? ie. will I get the
>: same crypt from the same salt on my own win95 system as on a FreeBSD
>: system.
>Well, ideally it should. However... the version of Perl I have on my
>95machine doesn't have crypt due to "excessive paranoia" so I can't check.
I had a port like that - rather annoying isn't it! Try the port from
www.activeware.com as that's what I use and it has it.


-- 
Matthew Burnham, Manager, MindWeb | danew@enterprise.net
Commercial web design and hosting, reasonable rates
UKP24/Mb/Year for DIY space | mindweb@pobox.co.uk
FTP, CGI, password protection, etc. too!
http://www.mindweb.co.uk/


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

Date: Thu, 7 Aug 1997 07:50:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Daan <dvreijen@solair1.inter.nl.net>
Subject: Re: perl rpm ?
Message-Id: <Pine.GSO.3.96.970807075001.18326Q-100000@kelly.teleport.com>

On 7 Aug 1997, Daan wrote:

> I'm looking for the perl 5.004 rpm. 

 .rpm files are (AFAIK) specific to Red Hat Linux; if you can't find what
you want on their websites and mirrors, you may want to check in a
Linux-specific newsgroup. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 7 Aug 1997 13:20:47 GMT
From: "Joshua Marotti" <jpm@iti-oh.comNOSPAM>
Subject: Re: Perl to EXE
Message-Id: <01bca334$a95e2ec0$36601ec6@bach>

There is a pl2bat that makes scripts batch files.
-- 
Josh,
Gavin Dragon...
Remove NOSPAM from address...



Sergio Stateri Jr <serginho@alpha.hydra.com.br> wrote in article
<01bca261$4b83fd80$ca75e7c8@AFXTD_202.Autofax>...
> Hi ! Is tehre any way to transforma Perl program in a EXE runnable under
> Win32 ??
> 
> Thanks in advance !
> -- 
> ----------------------------------------------------------
> Sergio Stateri Jr
> Sco Paulo (SP) - Brazil
> e-mail: serginho@mail.serve.com
> ----------------------------------------------------------
> 


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

Date: Thu, 07 Aug 1997 14:00:06 GMT
From: lord_viper@mailrunner.net (Viper)
Subject: Re: Perl to EXE
Message-Id: <33e9d4c1.85718490@news.accesscom.net>

Check out http://www.4images.com/ntperl under the examples section.
The answer is yes and the solution is there.



On 6 Aug 1997 12:04:33 GMT, "Sergio Stateri Jr"
<serginho@alpha.hydra.com.br> wrote:

| Hi ! Is tehre any way to transforma Perl program in a EXE runnable under
| Win32 ??
| 
| Thanks in advance !
| -- 
| ----------------------------------------------------------
| Sergio Stateri Jr
| Sco Paulo (SP) - Brazil
| e-mail: serginho@mail.serve.com
| ----------------------------------------------------------


-------------------------------------------------
Remove the underscore from the email address!


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

Date: Thu, 7 Aug 1997 07:37:39 -0600
From: mtnlover@sprynet.com (Christopher Michael Ward)
Subject: Re: perl-5.004 on UW prob (was: Re: perl-5.003 on UW: 'make test' fails)
Message-Id: <MPG.e537d90a18ac9d7989680@news.sprynet.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <nok9hy5otf.fsf_-_@ra.syscomp.de>, schludi@ra.syscomp.de 
says...
> hi,
> 
> I now switched to perl-5.004 and the above tests passed ok.
> The only test that fails now is the "lib/io_sel":
> [...]
> > lib/io_sel..........select not implemented at ../lib/IO/Select.pm line 259.
> > dubious
> > 	  Test returned status 2 (wstat 512)
> > DIED. FAILED tests 11-21
> > 	  Failed 11/21 tests, 47.62% okay
> [...]
> > Failed Test  Status Wstat Total Fail  Failed  List of failed
> > ----------------------------------------------------------------------------
> > lib/io_sel.t      2   512    21   11  52,38%  11-21
> > Failed 1/152 test scripts, 99.34% okay. 11/4163 subtests failed, 99.74% okay.
> > 
> 
> any hints?

I just spend the better part of a weekend working on this, what I did to 
fix the lib/io_sel.t test is to add this to the hints/svr4.sh file:

d_select='define'

Apparantly, the Configure program looks in the wrong libraries to get the 
list of names.  select() is in the /usr/ccs/lib/libc.so file, but 
Configure looks in /usr/lib/libc.so.1.1.

Also, if you have installed the perl with the broken test, you'll have to 
remove it before you run the tests again, since they will use the shared 
library built and installed the first time, and not the newly compiled 
one.  This little "twist" had me scratching my head for a day!

Also, I did this on UW 2.0.3, so Y.M.M.V.  Good luck!

-Christopher


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

Date: Thu, 07 Aug 1997 09:12:32 -0400
From: Doug MacEachern <dougm@osf.org>
To: Robert Sturrock <rns@ariel.ucs.unimelb.EDU.AU>
Subject: Re: Pre-forking server example needed
Message-Id: <33E9C9C0.3EAF@osf.org>

Robert Sturrock wrote:
> 
> Hi.
> 
> Does anyone have any examples of server code (in Perl) that "pre-fork()s"
> a number of child processes, and then uses those children to service
> client requests when they arrive.  Similar to the way servers like
> squid operate, but in Perl?

Well, Apache is a pre-forking server written in C, but when configured 
with mod_perl (http://perl.apache.org/), the pre-forking, process 
management, etc. is all done for you by apache, you can do the rest (e.g. 
squid-like functionality) in Perl.

-Doug


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

Date: 7 Aug 1997 13:51:08 GMT
From: davidb@news.kenan.com (David Bonner)
Subject: Re: silencing system()
Message-Id: <5scjsc$oe4@pony.kenan.com>

Jason Varsoke (jjv@caesun.msd.ray.com) wrote:
: system("tar cfv foo.tar *"); or similar system() statement throws its
: output to my screen.  How do I redirect it from inside perl?
: I would use an open (SYSTEM, "command @args|"); but I need the return
: code from the system statement.

Try running tar without the v option (v = verbose).

--
#==========================================================================#
#"it's the word's suppression that gives it the power, | david bonner      #
# the violence, the viciousness"   - lenny bruce       | dbonner@cs.bu.edu #
#==========================================================================#


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

Date: Thu, 7 Aug 1997 07:57:50 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Thomas Lachlan XMS x4206 <etltsln@etlxd30.ericsson.se>
Subject: Re: Style and efficiency
Message-Id: <Pine.GSO.3.96.970807075249.18326R-100000@kelly.teleport.com>

On 7 Aug 1997, Thomas Lachlan XMS x4206 wrote:

> 	The following sub, that is called many times 
> 	is helpling itself to all my processors memory.

How do you know that it's this sub? It could be the code which calls it,
couldn't it?

There have been a number of memory leaks in earlier versions of Perl.
Which version are you using?

You use a lot of global variables. Could any of them have large amounts of
data?

> 			chomp($sum %= 65536);

That's odd. :-)  

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 6 Aug 1997 20:14:21 GMT
From: jot.news@bofh.com (Jot Powers)
Subject: Unclear documentation for map()
Message-Id: <5salut$m98$1@gazette.corp.medtronic.com>

I wanted a way to convert a numerically subscripted array (ie @bob) into
a hash array (%bob) without having to step through all of @bob.  Being
the good little perl programmer, I thought that map() might be of
help and I broke out my second edition camel.

The section on map() (pages 186-187) seemed pretty obvious, since
what I wanted was the one-to-two mappings which gives the following 
code:

%hash = map { genkey($_), $_} @array;

However, I couldn't find a reference for genkey().  

So, I looked at my man pages and found the following:

%hash = map { getkey($_) => $_ } @array;

which didn't help, since I couldn't find anything but the
two occurences that are in that example.

(node127% cd /usr/local/man/man1
node127% grep getkey perl*
perlfunc.1:\&    %hash = map { getkey($_) => $_ } @array;
perlfunc.1:\&        $hash{getkey($_)} = $_;
)

I also checked Tom's on-line errata and found no corrections for
that section.

About then I realized that both getkey() and genkey() were probably
there to let people know that they needed to use a function to tell
perl what the mappings were.  Now, in my case I wanted the hash 
for doing a poor man's 'sort -u', so I resorted to:

%hash = map { $_ => '1'} @array; 

Which I think does what I want.  (I also noted that LWP::Debug also
does this).

So, what I was thinking might help the neophyte would be a sentence
to the affect:

"Here, getkey refers to a user defined function that returns the
index that you wish to create."

Or, something more correct, if one of the guru's want's to write something
better.

-Jot

[postings or email happily read]
-- 
Jot Powers  news@bofh.com
Unix System Administrator
"Sometimes you just have to grab the bull by the tail and face the situation."


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

Date: Thu, 07 Aug 1997 15:23:37 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: UNIX directory permissions in Perl
Message-Id: <33E9CC59.4E3DB8DD@absyss.fr>

Bob Fawcett wrote:
> 
> I have a question regarding the easiest way for a Perl program to find
> the read/write permission settings of a specified UNIX directory.
> 
> Are ther any Perl functions for this?
> 
> Am I going to have to execute UNIX commands to do this?

"perldoc -f stat" or read about the -X test options.

- doug


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

Date: 07 Aug 1997 07:10:06 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Ronald Fischer <rovf@earthling.net>
Subject: Re: Why is `command @ARRAY` rejected by Perl, sometimes.
Message-Id: <8cg1smnkxt.fsf@gadget.cscaper.com>

>>>>> "Ronald" == Ronald Fischer <rovf@earthling.net> writes:

Ronald> Is this a bug?

Not a bug, but it's hard for Perl to scan all the source and
then come back to the first place where you used @ARRAY.
Perl is a one-pass compiler.

Ronald>  Does Perl 5.004 exhibit the same behaviour?

Yes, as will all Perl versions after that.  One workaround is to not
use global package variables, but to use lexical variables instead
(declared with my):

	use strict;
	my @ARRAY;
	&foo();
	print "now @ARRAY is safe\n";
	sub foo {
		@ARRAY = qw(my data);
	}

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 390 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 7 Aug 1997 07:43:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ronald Fischer <rovf@earthling.net>
Subject: Re: Why is `command @ARRAY` rejected by Perl, sometimes.
Message-Id: <Pine.GSO.3.96.970807073936.18326O-100000@kelly.teleport.com>

On 7 Aug 1997, Ronald Fischer wrote:

> &init;
> print qx(echo @OUTFILES);
> sub init
> {
>   @OUTFILES=(1);
> }
> 
> gives the error message
> 
> Literal @OUTFILES now requires backslash at t.pl line 4, within string
> Execution of t.pl aborted due to compilation errors.

The rule is that if the compiler needs to see the array @OUTFILES
somewhere else before it sees it in a double-quotish string (which qx//
is). You can do this in various ways such as 'use vars', which seems most
likely to be what you want in this case. (But it wouldn't hurt to make
your script 'use strict'.) Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

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

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