[18265] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 433 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 7 09:05:47 2001

Date: Wed, 7 Mar 2001 06:05:17 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <983973917-v10-i433@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 7 Mar 2001     Volume: 10 Number: 433

Today's topics:
    Re: (Linux beginner) How to de-install and re-install P (Martien Verbruggen)
    Re: (Linux beginner) How to de-install and re-install P nobull@mail.com
        cookie <Waarddebon@chello.nl>
    Re: cookie <parrot0123@yahoo.ca>
    Re: difference between <> and <ARGV> (Anno Siegel)
    Re: difference between <> and <ARGV> <bart.lateur@skynet.be>
    Re: flock and close   with  empty read strangeness <bart.lateur@skynet.be>
    Re: flock and close   with  empty read strangeness <bart.lateur@skynet.be>
    Re: flock and close   with  empty read strangeness (Abigail)
        formatting text <a.v.a@home.nl>
    Re: formatting text (Philip Lees)
    Re: Grokking map and grep (Philip Lees)
    Re: Grokking map and grep (Philip Lees)
    Re: Grokking map and grep (Gwyn Judd)
    Re: Grokking map and grep (Philip Lees)
        Help to Install Perl <dream1625@aol.com>
    Re: Help to Install Perl <A7654323467897654@hotmail.com>
    Re: Help to Install Perl nobull@mail.com
    Re: How Do I UUEncode <matt@sergeant.org>
        How to solve class context problem with inherited class <mlw@nortelnetworks.com>
    Re: is there a better way ? <bart.lateur@skynet.be>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 7 Mar 2001 22:19:14 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: (Linux beginner) How to de-install and re-install Perl on Linux
Message-Id: <slrn9ac69i.k18.mgjv@martien.heliotrope.home>

On Tue, 6 Mar 2001 22:35:24 -0000,
	Garry Heaton <garry@heaton6.freeserve.co.uk> wrote:
> I'm new to Linux/Unix and want to remove the default Perl installation, then
> re-install from source code because I read somewhere that the Perl libraries
> on some Linux distributions are incomplete. How do I remove and re-install?

It's better to leave the original installed, otherwise all other
packages managed by rpm will start whinging that you don't have perl
installed (and that includes bind, for crying out loud!).

Install perl 5.6.0 in /opt/perl or in /usr/local if you like that
better. Once it's finished:

# cd /usr/bin
# mv perl perl.redhat
# ln -s /opt/perl/bin/perl

Do the same for perldoc, h2ph and the other goodies. Record what you did
in a log, or write a script. you may need it again (see below).

Be very, very careful when upgrading the OS or packages. Upgrading your
perl package may overwrite your links. 

I personally normally remove the default perl, and install my onw
package, which is just a little stub that insert those symlinks for me.
Most other RPMs that have dependencies on perl fall for this.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd.   | again. Then quit; there's no use
NSW, Australia                  | being a damn fool about it.


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

Date: 07 Mar 2001 13:03:57 +0000
From: nobull@mail.com
Subject: Re: (Linux beginner) How to de-install and re-install Perl on Linux
Message-Id: <u9y9uhyblu.fsf@wcl-l.bham.ac.uk>

"Garry Heaton" <garry@heaton6.freeserve.co.uk> writes:

> I'm new to Linux/Unix and want to remove the default Perl
> installation,

Use the appropriate package management tool for your Linux
distribution.

For example on SuSE Linux that uses RPM you'd do:

rpm -e perl

> then re-install from source code

Download, follow the instructions.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 07 Mar 2001 13:47:58 GMT
From: "Waarddebon" <Waarddebon@chello.nl>
Subject: cookie
Message-Id: <i_qp6.1864616$%C1.24086918@Flipper>

If i set up a cookie like this:
<script language="javascript>SetCookie: (name=dewaard)</script>

I can read it out with this :

read (STDIN,$buffer, $ENV{'CONTENT_LENGTH'});
@pairs=split(/&/, $buffer);
foreach $pair(@pairs) {
local ($name, $value)= split (/=/, $pair);
$value=! tr/+/ /;
$value=~ s/% ([a-fA-F0-9] [a-fA-F0-9])/pack("C",hex($1))/eg;
$value=~ s/<!--(.|\n)*-->//g;
$in{$name}=$value;}

But somehow it doesn't work, who can help me out ?




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

Date: Wed, 07 Mar 2001 13:59:20 GMT
From: "Parrot" <parrot0123@yahoo.ca>
Subject: Re: cookie
Message-Id: <Y8rp6.327547$Pm2.4828321@news20.bellglobal.com>


Waarddebon <Waarddebon@chello.nl> wrote in message
news:i_qp6.1864616$%C1.24086918@Flipper...
> If i set up a cookie like this:
> <script language="javascript>SetCookie: (name=dewaard)</script>
>
> I can read it out with this :
>
> read (STDIN,$buffer, $ENV{'CONTENT_LENGTH'});
> @pairs=split(/&/, $buffer);
> foreach $pair(@pairs) {
> local ($name, $value)= split (/=/, $pair);
> $value=! tr/+/ /;
> $value=~ s/% ([a-fA-F0-9] [a-fA-F0-9])/pack("C",hex($1))/eg;
> $value=~ s/<!--(.|\n)*-->//g;
> $in{$name}=$value;}
>
> But somehow it doesn't work, who can help me out ?
>

This should help you, it's code to retrieve all the cookies you've sent:

sub getCookies {
 # cookies are seperated by a semicolon and a space, this will split
 # them and return a hash of cookies
 local(@rawCookies) = split (/; /,$ENV{'HTTP_COOKIE'});
 local(%cookies);

 foreach(@rawCookies){
     ($key, $val) = split (/=/,$_);
     $cookies{$key} = $val;
 }

 return %cookies;
}

I got this code from http://www.bewley.net/perl/cookie-test.html

What this does is retrieve the cookies from the environment variable
HTTP_COOKIE.  That's what you need to do if you want to get your cookies to
work.




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

Date: 7 Mar 2001 09:41:27 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: difference between <> and <ARGV>
Message-Id: <984vo7$m3j$1@mamenchi.zrz.TU-Berlin.DE>

According to John Lin <johnlin@chttl.com.tw>:
> Dear all,
> 
> Is there any difference between <> and <ARGV>?
> 
> If they are equivalent,
> in what situation will you write <ARGV> instead of <>?
> 
> Thank you.
> 
> John Lin
> 
> 
> P.S.  This question is aroused from a bug in my program
> which processes input from @ARGV
> 
>     while(<>) { print }
> 
> It will hang there to wait for STDIN inputs when @ARGV is empty.
> I just want @ARGV not STDIN, so I cutesily modified it into
> 
>     while(<ARGV>) { print }
> 
> thinking that ARGV is only related to @ARGV, not STDIN.

This is described in detail in perlop under the <>-operator (<ARGV>
and <> are aliases of each other).

The upshot is that reading from <> will return undef once after
all the files in @ARGV have been processed.  If you continue reading
<> after that, it will switch to STDIN (unless you have re-filled
@ARGV in the meantime).

So I guess you'll just have to check scalar @ARGV before you
enter the read loop.

Anno


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

Date: Wed, 07 Mar 2001 10:12:22 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: difference between <> and <ARGV>
Message-Id: <ia2cat0r7qg25ct6gnvipjp3euq31imro5@4ax.com>

John Lin wrote:

>    while(<>) { print }
>
>It will hang there to wait for STDIN inputs when @ARGV is empty.
>I just want @ARGV not STDIN, so I cutesily modified it into

	if(@ARGV) {
	    while(<>) { print }
	}

Sometimes I set @ARGV to a default filename if it was empty.

BTW I don't really know the answer to your question. I thought that ARGV
was the handle of the *currently opened file* from @ARGV. If nothing was
read yet, the file hasn't been opened.

-- 
	Bart.


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

Date: Wed, 07 Mar 2001 08:05:29 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <pjqbat8of276mm1b7i787lpvpmn7c2vsim@4ax.com>

Abigail wrote:

>,, The compromise, IMO, would be to queue demands for shared locks if a
>,, demand for exclusive lock is in the queue.
>
>
>And what compromise is that? My example shows a compromise.

Here's your version:

>    Process A asks for a shared lock on the resource, and it's granted.
>    Process B asks for an exclusive lock, and is put in the queue.
>    Process C asks for a shared lock, and it's granted.
>    Process A releases the shared lock.
>    Process D asks for a shared lock, and it's granted.
>    ...
>    Process M asks for a shared lock, and it's granted.
>    Process N asks for a shared lock, and is put in the queue.
>    Processes D to M release their lock.
>    Process B gets the exclusive lock.
>    Process B releases the exclusive lock.
>    Process N gets the shared lock.

Here's mine:

    Process A asks for a shared lock on the resource, and it's granted.
    Process B asks for an exclusive lock, and is put in the queue.
    Process C asks for a shared lock, and it's put in the queue.
	(because of B)
    Process A releases the shared lock.
    Process B gets the exclusive lock.
    Process D asks for a shared lock, and it's put in the queue.
    ...
    Process M asks for a shared lock, and it's put in the queue.
    Process N asks for a shared lock, and is put in the queue.
    Process B releases the exclusive lock.
    Process D to M get their shared lock.
	Process N still is in the queue.

In your version, B has to wait until all processes with a shared lock
have released their lock. In my version, NO PROCESS can get a shared
lock if an exclusive lock for this resource is in the queue.

If A holds on to this shared lock forever, nobody ever gets a lock.

-- 
	Bart.


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

Date: Wed, 07 Mar 2001 08:08:27 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <i2rbat0051vq1sgim6nqknhgtgj4on6fc8@4ax.com>

ZepHead wrote:

>you have open >   that truncates before the lock etc....
>well the reads come in and gets an empty file
>
>these reads are reading from cache not HD
>since the write has not happened yet and 
>no flush and buffer shut down occurred.

Eh, no. As soon as you write to the file, the cache will be updated,
even if the disk isn't, yet. 

-- 
	Bart.


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

Date: 7 Mar 2001 09:09:39 GMT
From: abigail@foad.org (Abigail)
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <slrn9abumj.fkd.abigail@tsathoggua.rlyeh.net>

Bart Lateur (bart.lateur@skynet.be) wrote on MMDCCXLV September MCMXCIII
in <URL:news:pjqbat8of276mm1b7i787lpvpmn7c2vsim@4ax.com>:
!! Abigail wrote:
!! 
!! >,, The compromise, IMO, would be to queue demands for shared locks if a
!! >,, demand for exclusive lock is in the queue.
!! >
!! >
!! >And what compromise is that? My example shows a compromise.
!! 
!! Here's your version:
!! 
!! >    Process A asks for a shared lock on the resource, and it's granted.
!! >    Process B asks for an exclusive lock, and is put in the queue.
!! >    Process C asks for a shared lock, and it's granted.
!! >    Process A releases the shared lock.
!! >    Process D asks for a shared lock, and it's granted.
!! >    ...
!! >    Process M asks for a shared lock, and it's granted.
!! >    Process N asks for a shared lock, and is put in the queue.
!! >    Processes D to M release their lock.
!! >    Process B gets the exclusive lock.
!! >    Process B releases the exclusive lock.
!! >    Process N gets the shared lock.
!! 
!! Here's mine:
!! 
!!     Process A asks for a shared lock on the resource, and it's granted.
!!     Process B asks for an exclusive lock, and is put in the queue.
!!     Process C asks for a shared lock, and it's put in the queue.
!! 	(because of B)
!!     Process A releases the shared lock.
!!     Process B gets the exclusive lock.
!!     Process D asks for a shared lock, and it's put in the queue.
!!     ...
!!     Process M asks for a shared lock, and it's put in the queue.
!!     Process N asks for a shared lock, and is put in the queue.
!!     Process B releases the exclusive lock.
!!     Process D to M get their shared lock.
!! 	Process N still is in the queue.
!! 
!! In your version, B has to wait until all processes with a shared lock
!! have released their lock. In my version, NO PROCESS can get a shared
!! lock if an exclusive lock for this resource is in the queue.

I perfectly understood what you meant without giving an example.
There's still no compromise, because you let *all* of the processes
requesting a shared lock wait, even while they could have continued.

The comprose I showed let *some* processes requesting a shared lock
skip ahead of the process requesting an exclusive lock - until that
happened a few times aftwer which the process requesting an exclusive
lock gets priority.



Abigail
-- 
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'


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

Date: Wed, 07 Mar 2001 11:11:06 GMT
From: AvA <a.v.a@home.nl>
Subject: formatting text
Message-Id: <3AA5DFE6.D406E93@home.nl>

hi all,

i have a little text file of wich i want the first 5 lines be
represented on a webpage with a format
of 20 chars.

ive been puzzling a bit (read alot) on that.

could someone give me a helping hand?

thanks.

AvA

irc.xchat.org #perl (port 6667)



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

Date: Wed, 07 Mar 2001 13:39:23 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: formatting text
Message-Id: <3aa631b6.84643981@news.grnet.gr>

On Wed, 07 Mar 2001 11:11:06 GMT, AvA <a.v.a@home.nl> wrote:

>i have a little text file of wich i want the first 5 lines be
>represented on a webpage with a format
>of 20 chars.

If I understand you correctly, you have three separate tasks here:

1. Open a text file and read the first five lines, joining them
together into a string, then close the file.

2. Format the string into lines no more than 20 characters long.

3. Send the output to a Web browser.

I'll help you with the first part.

open ( INFILE, "myfile.txt" ) || die "Couldn't open myfile.txt: $!";
# see 'Simple opens' in perlopentut for more explanation of this

my $string;	# the string to contain the data
my $count;	# used to count the lines

while (<INFILE>){					# read file one line at a time
	chomp;									# remove newline character (see chomp in
perlfunc)
	$string .= "$_ ";				# add the line to your string, with a space
at the end (see perlvar for more info about $_)
	last if ++$count == 5;	# we've read five lines, so exit the loop
}

close INFILE;	#close the file

That's part 1 done.

For part 2, there is 'How do I reformat a paragraph?' in perlfaq4, but
I don't find that very helpful. Note: this is not a simple problem.
Suppose your file contains the name of the Welsh village,
Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch, for
example, or the word floccinaucinihilipilification. How do you want to
handle that?

Maybe someone else will help you with this.

For part 3 you will need to use the CGI.pm module that comes with the
standard Perl installation. However, I suggest that you leave that
part until you have 1 and 2 working correctly.

HTH.

Phil
--
@x=split//,'Just another Perl decoder,';split//,'*'x@x;%i=split/=/,
'AA=a=aa= =1=,';for$i(0..$#x){$_[$i]=chr($=+5);while($_[$i]ne$x[$i])
{$_[$i]=$i{$_[$i]}if$i{++$_[$i]};print@_,"\r";while(rand!=rand){}}}
Ignore coming events if you wish to send me e-mail


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

Date: Wed, 07 Mar 2001 11:07:55 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: Grokking map and grep
Message-Id: <3aa613d9.76998187@news.grnet.gr>

On Tue, 06 Mar 2001 12:48:12 +0100, Philip Newton
<pne-news-20010306@newton.digitalspace.net> wrote:

>On Tue, 06 Mar 2001 10:19:10 GMT, pjlees@ics.forthcomingevents.gr
>(Philip Lees) wrote:
>
>> print OUT map { ++$count; join ',', @$_ } sort { $$a[0] <=> $$b[0] }
>> map { [ split /,/ ] } grep { /^\d+,/ } (<IN>);
>
>Or you could remember the original line:
>
>my @lines = map { $_->[1] } 
>            sort { $a->[0] <=> $b->[0] } 
>            map { [ (split /,/, $_, 2)[0], $_ ] }
>            grep { /^\d+,/ }
>            <IN>;

This is similar to the Schwartzian Transform example in the FAQ, which
I don't understand. I don't understand how your above code works,
either, although I see that it avoids rejoining the split sublists.

Using the third argument for split is a good idea, since I'm only
interested in the first fields anyway, and the [0] following the split
just returns a list of those first fields, right?

In the sort, $a->[0] is the same as $$a[0], as far as I understand.

What I really can't get is what the $_->[1] is doing in the leftmost
map.

>> 2. Is there any trick for getting the scalar result of the leftmost
>> map _as well as_ the list ouput, so that I could get rid of that
>> annoying $count variable?
>
>Well, the scalar result of map is the number of elements generated --
>so assigning to an array and using that array in scalar context will
>give you the answer. I can't think of how to do it without the
>intermediate array variable, however.[1]

I was afraid of that. What I was hoping for was some environment
variable that counts the elements in a map. I couldn't find one in
perlvar, but I suppose that Perl must 'know' how many elements map has
processed.

It's no big deal - it would just have been nice to do the whole thing
without declaring any variables at all.

Thanks for the help, Philip.

Phil
--
@x=split//,'Just another Perl decoder,';split//,'*'x@x;%i=split/=/,
'AA=a=aa= =1=,';for$i(0..$#x){$_[$i]=chr($=+5);while($_[$i]ne$x[$i])
{$_[$i]=$i{$_[$i]}if$i{++$_[$i]};print@_,"\r";while(rand!=rand){}}}
Ignore coming events if you wish to send me e-mail


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

Date: Wed, 07 Mar 2001 11:19:25 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: Grokking map and grep
Message-Id: <3aa616a8.77717772@news.grnet.gr>

On 6 Mar 2001 13:47:04 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>According to Philip Lees <pjlees@ics.forthcomingevents.gr>:

>> my $count;
>> print OUT map { ++$count; join ',', @$_ } sort { $$a[0] <=> $$b[0] }
>> map { [ split /,/ ] } grep { /^\d+,/ } (<IN>);

>> 1. For the small file I was dealing with, this is not a problem, but
>> if I was working with a very large file would there be any
>> advantages/disadvantages to doing it in the above way, rather than by

>Well, since you need to sort the data you'll need all of them in
>memory anyway (unless let an external program do the sort).  So this
>is one of the cases where reading the whole file is justified. [1]

Sure, I understand that the sort requires that all the data be in
memory.

>Still other stages in the grep/map "pipeline" may duplicate or
>triplicate the overhead.  In simple cases like "for ( 0 .. 1000000 )"
>there are optimizations in place, but in cases like this I believe
>the intermediate lists are fully expanded.

That's what I was wondering about. If I specify an array variable to
hold the data during processing, I assume that Perl will use that
variable and avoid allocating other space. Without a specific variable
assignment each grep or map could use its own separate memory space,
with the consequences you refer to above.

I remember reading somewhere recently, either here, or in the docs (or
even both), that Perl's way of approaching a task is to throw memory
at it. Hence my question.

>> 2. Is there any trick for getting the scalar result of the leftmost
>> map _as well as_ the list ouput, so that I could get rid of that
>> annoying $count variable?
>
>I don't think so.  You could assign the whole list to a variable
>and use it in scalar context for the count.  This would get rid
>of the $count variable at the cost of keeping the list, not a
>good deal, memory-wise.

No, not a good deal, I agree. I was afraid I couldn't have it both
ways. What I was hoping for was some environment variable that counts
the elements in the last map. I couldn't find one in perlvar, but I
suppose that Perl must 'know' how many elements map has processed and
I wondered if there was some way to access that, while still keeping
the list output of map.

It's no big deal - it would just have been nice to do the whole thing
without declaring any variables at all.

Thanks for the help, Anno.

Phil
--
@x=split//,'Just another Perl decoder,';split//,'*'x@x;%i=split/=/,
'AA=a=aa= =1=,';for$i(0..$#x){$_[$i]=chr($=+5);while($_[$i]ne$x[$i])
{$_[$i]=$i{$_[$i]}if$i{++$_[$i]};print@_,"\r";while(rand!=rand){}}}
Ignore coming events if you wish to send me e-mail


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

Date: Wed, 07 Mar 2001 12:03:34 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Grokking map and grep
Message-Id: <slrn9ac8sl.fds.tjla@thislove.dyndns.org>

I was shocked! How could Philip Lees <pjlees@ics.forthcomingevents.gr>
say such a terrible thing:
>On Tue, 06 Mar 2001 12:48:12 +0100, Philip Newton
><pne-news-20010306@newton.digitalspace.net> wrote:
>>
>>Or you could remember the original line:
>>
>>my @lines = map { $_->[1] } 
>>            sort { $a->[0] <=> $b->[0] } 
>>            map { [ (split /,/, $_, 2)[0], $_ ] }
>>            grep { /^\d+,/ }
>>            <IN>;
>
>This is similar to the Schwartzian Transform example in the FAQ, which
>I don't understand. I don't understand how your above code works,
>either, although I see that it avoids rejoining the split sublists.
>
>What I really can't get is what the $_->[1] is doing in the leftmost
>map.

It may help if you consider that the sort is on the zero'th item and yet
the left-most map is recovering the first item. That would indicate that
what we are sorting on is not what we are getting out of the sort. Then
we look at the first map and we see it is creating a list of anonymous
arrays, each with two elements, the zero'th being everything before the
',' and the first being the whole string. So what we are doing then, is
sorting based on everything before the comma but returning the whole
string. (That is a little simplified).

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Fortune's real live weird band names #103:

Buck Naked and the Bare Bottom Boys


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

Date: Wed, 07 Mar 2001 12:57:01 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: Grokking map and grep
Message-Id: <3aa62f05.83954910@news.grnet.gr>

On Wed, 07 Mar 2001 12:03:34 GMT, tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
wrote:

>I was shocked! How could Philip Lees <pjlees@ics.forthcomingevents.gr>
>say such a terrible thing:
>>On Tue, 06 Mar 2001 12:48:12 +0100, Philip Newton
>><pne-news-20010306@newton.digitalspace.net> wrote:
>>>
>>>my @lines = map { $_->[1] } 
>>>            sort { $a->[0] <=> $b->[0] } 
>>>            map { [ (split /,/, $_, 2)[0], $_ ] }
>>>            grep { /^\d+,/ }
>>>            <IN>;
>>
>>What I really can't get is what the $_->[1] is doing in the leftmost
>>map.
>
>It may help if you consider that the sort is on the zero'th item and yet
>the left-most map is recovering the first item. That would indicate that
>what we are sorting on is not what we are getting out of the sort. Then
>we look at the first map and we see it is creating a list of anonymous
>arrays, each with two elements, the zero'th being everything before the
>',' and the first being the whole string. So what we are doing then, is
>sorting based on everything before the comma but returning the whole
>string. (That is a little simplified).

Ah, now I get it. I had somehow overlooked the second $_ in the 

	map{ [ split ...

part. That's a smart trick. Thanks again to Philip for showing me it
and to Gwyn for explaining it so clearly.

Phil

--
@x=split//,'Just another Perl decoder,';split//,'*'x@x;%i=split/=/,
'AA=a=aa= =1=,';for$i(0..$#x){$_[$i]=chr($=+5);while($_[$i]ne$x[$i])
{$_[$i]=$i{$_[$i]}if$i{++$_[$i]};print@_,"\r";while(rand!=rand){}}}
Ignore coming events if you wish to send me e-mail


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

Date: Wed, 07 Mar 2001 09:54:31 GMT
From: "Suzanne" <dream1625@aol.com>
Subject: Help to Install Perl
Message-Id: <rznp6.158615$B6.35509388@news1.rdc1.md.home.com>

Hi,

My boss wants to use Analog stats program with Report Magic, an add-on to
Analog that needs Perl to run.  My host told me to install the Report Magic
on my computer and run it from there.  I have checked out and dowloaded what
I thought would be Perl to install it on my computer at work.  As it turns
out, there is no executable (setup or install.exe) to install it.  How does
a non-programmer install Perl for a Windows 98 system?  Is there an
executable file available somewhere?  Appreciate any help offered.
__________________________________________
Suzanne @CampusTech
http://www.campustech.com   Beta Site: http://campust.iserver.net/
Big Discounts on Software for Students & Teachers







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

Date: Wed, 7 Mar 2001 23:15:45 +1100
From: "Tony" <A7654323467897654@hotmail.com>
Subject: Re: Help to Install Perl
Message-Id: <Gnpp6.10134$v5.40883@newsfeeds.bigpond.com>


Suzanne wrote in message ...
>Hi,
>
>My boss wants to use Analog stats program with Report Magic, an add-on to
>Analog that needs Perl to run.  My host told me to install the Report Magic
>on my computer and run it from there.  I have checked out and dowloaded
what
>I thought would be Perl to install it on my computer at work.  As it turns
>out, there is no executable (setup or install.exe) to install it.  How does
>a non-programmer install Perl for a Windows 98 system?  Is there an
>executable file available somewhere?  Appreciate any help offered.


Download the MSI version if you haven't already and also the
 Windows installer, Windows 95/98 for the setup.exe
http://www.activestate.com/Products/ActivePerl/Download.html




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

Date: 07 Mar 2001 13:07:28 +0000
From: nobull@mail.com
Subject: Re: Help to Install Perl
Message-Id: <u9vgplybfz.fsf@wcl-l.bham.ac.uk>

"Suzanne" <dream1625@aol.com> spams.

Please do not spam.  Not ever.  Not even a little bit.  No for any
reason.  Just say "no!" to spam.  Get it? 

Question answered in .modules where, as I pointed out, it is off-topic.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Wed, 07 Mar 2001 11:01:56 +0000
From: Matt Sergeant <matt@sergeant.org>
Subject: Re: How Do I UUEncode
Message-Id: <3AA61524.F6500CE3@sergeant.org>

Bjoern Kaiser wrote:
> 
> Hi
> how do I uuencode a binary file to send it as an Email-Attachment with
> sendmail.

perldoc -f pack

-- 
<Matt/>

    /||    ** Founder and CTO  **  **   http://axkit.com/     **
   //||    **  AxKit.com Ltd   **  ** XML Application Serving **
  // ||    ** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
     \\//
     //\\
    //  \\


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

Date: Wed, 7 Mar 2001 13:03:58 -0000
From: "Malcolm Wallace" <mlw@nortelnetworks.com>
Subject: How to solve class context problem with inherited class method?
Message-Id: <985bfv$ggh$1@qnsgh006.europe.nortel.com>

I want my class to contain some global data which can be accessed through
inherited class methods, but have been unable to come up with a way of
achieving this. I have resorted to overriding the class methods I wanted to
inherit, and hard coding the relevant variable names into the methods. This
seems a poor solution. Can anyone suggest a better way of implementing this?

I checked the FAQ and found 'CLASS CONTEXT AND THE OBJECT', which described
how the object could be used to define the context of a method, but what if
I don't have an object?

Any help would be much appreciated.

Regards,
    Malcolm.

        package Bar;
        %fizzle = ( 'Password' => 'XYZZY' );
        sub new {
                my $type = shift;
                my $self = {};
                $self->{'fizzle'} = \%fizzle;
                bless $self, $type;
        }

        sub enter {
                my $self = shift;
                # Don't try to guess if we should use %Bar::fizzle
                # or %Foo::fizzle.  The object already knows which
                # we should use, so just ask it.
                #
                my $fizzle = $self->{'fizzle'};
                print "The word is ", $fizzle->{'Password'}, "\n";
        }

        sub enter_class_method {
                my $class = shift;
                # Want to get to the correct %fizzle for the object's
context
        }

        package Foo;
        @ISA = qw( Bar );
        %fizzle = ( 'Password' => 'Rumple' );

        sub new {
                my $type = shift;
                my $self = Bar->new;
                $self->{'fizzle'} = \%fizzle;
                bless $self, $type;
        }

        package main;
        $a = Bar->new;
        $b = Foo->new;
        $a->enter;
        $b->enter;
        Foo->enter_class_method; # How to implement this?
        Bar->enter_class_method;






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

Date: Wed, 07 Mar 2001 10:09:31 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: is there a better way ?
Message-Id: <8i1catss4ohglsg4jnuflq4htnjc0n2h61@4ax.com>

Ralph Osle wrote:

># given a text with records...
># ...
>my $text = <<'EOF';
>To : John
>From : Tom
>Subject : Hello
>
>To : Edgar
>From : Raven
>Subject : NeverMore
 ...
>EOF

># and a regex 
>my $regex = 'To : (\w+)\s+From : (\w+)\s+Subject : (\w+)';
>
># i want to extract fields To,From,Subject by iterating
># the regex (\g) over $text and get records in a bidimensional array like
># @records = ( 
>['John','Tom','Hello'],['Edgar','Raven','NeverMore'],['Newbie','Larry','TMTO
>WTDI'])
>
># sub should accept a regex and a text as params
># that is : number of fields per record is unknown until run-time
>
># it seems perl 's missing a token for the array ($1,$2,$3, ... , $+) after 
>a match occurs

Yes... I don't understand your obsession with $+, it's just the last
succesful capture, and is always one of ($1, $2, $3, ...). But that
array is indeed missing. I lamented about this a few years ago, and the
thing they came up with, is very clunky indeed, all in the name of
efficiency (for the cases where you DON'T need it): @+ and @-, which are
an array of starting and ending positions of the submatches. See perlvar
for more info.

># is there a better way than simulate missing array by eval? tnx anyways
>
>my @recs = extract($regex,$text);

	sub extract {
	    my $regex = shift;
	    local $_ = shift;
	    my @result;
	    while(/$regex/g) {
	        my @submatch = map
	          { substr $text, $-[$_], $+[$_]-$-[$_] } 1 .. $#+;
	        push @result, \@submatch;
	    }
	    return @result;
	}

At least, it works.

-- 
	Bart.


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

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 V10 Issue 433
**************************************


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