[18257] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 425 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 6 06:06:23 2001

Date: Tue, 6 Mar 2001 03:05:10 -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: <983876710-v10-i425@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 6 Mar 2001     Volume: 10 Number: 425

Today's topics:
        "Use of uninitialized value" in AI::NeuralNet::Mesh <meisl@amvt.tu-graz.ac.at>
    Re: creating dos exectable from perl script <jasonahood@hotmail.com>
    Re: flock and close   with  empty read strangeness (Abigail)
    Re: flock and close   with  empty read strangeness (Martien Verbruggen)
    Re: flock and close   with  empty read strangeness (Martien Verbruggen)
    Re: flock and close   with  empty read strangeness (Martien Verbruggen)
    Re: flock and close   with  empty read strangeness (Martien Verbruggen)
    Re: flock and close   with  empty read strangeness (Abigail)
    Re: flock and close   with  empty read strangeness (Ilya Zakharevich)
    Re: flock and close   with  empty read strangeness (Anno Siegel)
    Re: flock and close   with  empty read strangeness (Logan Shaw)
        Grokking map and grep (Philip Lees)
        How do you find unique names in a hash? <todd_thal@hotmail.com>
    Re: How do you find unique names in a hash? (Logan Shaw)
    Re: How do you find unique names in a hash? <wyzelli@yahoo.com>
    Re: Is Perl right for me? (Martien Verbruggen)
    Re: Is Perl right for me? (Gwyn Judd)
        Legal Strings for form post methods <lerhaupt.2@osu.edu>
        md5 differences <tfiedler@zen.moldsandwich.com>
    Re: md5 differences <tfiedler@zen.moldsandwich.com>
    Re: md5 differences (Gwyn Judd)
    Re: Net::FTP <graham.wood@iona.com>
    Re: Perl, Cookies, and Apache. <bart.lateur@skynet.be>
    Re: perlpod docs? (Martien Verbruggen)
        PerlXS and inheritance <franck.caron@infineon.com>
    Re: pi day <gellyfish@gellyfish.com>
    Re: Regex question (newbie) <bart.lateur@skynet.be>
    Re: statement for(list); (Martien Verbruggen)
    Re: statement for(list); (Ilya Zakharevich)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 06 Mar 2001 10:44:52 +0100
From: Christian Meisl <meisl@amvt.tu-graz.ac.at>
To: Josiah Bryan <jdb@wcoil.com>
Subject: "Use of uninitialized value" in AI::NeuralNet::Mesh
Message-Id: <m3zoezqlij.fsf@famvtpc59.tu-graz.ac.at>

If I try the example from the 'man AI::NeuralNet::Mesh' page with a

#! /usr/bin/perl -w

I get *lots* of warnings:

Use of uninitialized value in string eq at
/usr/local/lib/perl5/site_perl/5.6.0/AI/NeuralNet/Mesh.pm line 1075. 

I use version

$Id: AI::NeuralNet::Mesh.pm, v0.44 2000/15/09 03:29:08 josiah Exp $

of AI::NeuralNet::Mesh and version v5.6.0 built for i686-linux of
Perl. Is the behaviour mentioned above a bug or an undocumented
feature?

Regards,
Christian

-- 
Christian Meisl <meisl@amvt.tu-graz.ac.at>        www.amft.tu-graz.ac.at
   Inst. f. Apparatebau, Mech. Verfahrenstechnik und Feuerungstechnik
------- Who's General Failure and why is he reading my harddisk? -------
PGP fingerprint:      DF48 2503 0411 F0EF 149C  851B 1EF0 72B9 78B6 034A


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

Date: Tue, 6 Mar 2001 08:34:42 -0000
From: "Jason Hood" <jasonahood@hotmail.com>
Subject: Re: creating dos exectable from perl script
Message-Id: <3aa4a0c9_1@news1.vip.uk.com>

Perl does come with a command line compiler that as far as I know can only
be described as beta!
It creates a binary executable that includes your code, and a copy of C perl
interpreter.  This turns your 23k script into something quite monstrous.
I myself have tried using this on several occasions unsuccessfully and have
never managed to get it to include modules that are outside of my own
script - ie in use statements.

If you are adamant about distributing executables, I would write your prog
in C/C++.

Hope this helped.

Jason

> I understand that it is possible to convert a perl script to a self
> contained .exe file that will run in windows/dos.  That way I just pass
> along the .exe file and the do not have to install perl on their machine.
>





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

Date: 6 Mar 2001 09:00:58 GMT
From: abigail@foad.org (Abigail)
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <slrn9a99qa.onq.abigail@tsathoggua.rlyeh.net>

ZepHead (groovyt@erols.com) wrote on MMDCCXLIV September MCMXCIII in
<URL:news:groovyt-21A9FE.02024406032001@virt-reader.news.rcn.net>:
&& In article <slrn9a7btj.8a8.abigail@tsathoggua.rlyeh.net>,
&&  abigail@foad.org (Abigail) wrote:
&& 
&& > 
&& > 
&& > So, while I'm reading /etc/passwd, the system administrator cannot
&& > add new accounts?
&& > 
&& > I don't think so.
&& > 
&& > 
&& > Abigail
&& 
&& there is no reason new accounts can't be added at the same time.
&& it just means the  cache flush would have to wait until
&& it can get a lock then flush.   


You mean, you want to turn your filesystem into a database?

&& if the OS is written well,  a write will have higher priority
&& than a read anyway so you will never get a backup of shared locked reads
&& staling a write.

Eh? So, what's the OS going to do if there's already a read lock, and
a request for a write comes? Close the filehandles that are reading?


Abigail
-- 
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;        
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";


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

Date: Tue, 6 Mar 2001 20:04:28 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <slrn9a9a0s.efn.mgjv@martien.heliotrope.home>

On 5 Mar 2001 11:29:30 GMT,
	Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> [A complimentary Cc of this posting was NOT sent to Martien Verbruggen
><mgjv@tradingpost.com.au>],
> who wrote in article <slrn9a6sst.9kp.mgjv@martien.heliotrope.home>:
>> Every locking sheme has its advanages and disadvantages. Perl was born
>> on Unix, and therefore uses the Unix model of (cooperative) locking.
> 
> Nope.
> 
>> Whether you like it or not, that's just how it is.
> 
> ??!!!  What makes you think so?  Perl uses the model of locking which
> is "native" on the architecture it is running.

I wasn't talking about what Perl uses internally, but what it exposes to
the programmer: In other words, it's interfaces for opening files,
locking them, and closing them. And that precisely mirrors unix system
calls, with some C stdio and shell syntax thrown in.

I fully understand that it HAS to implement this with native locking on
the system it runs on.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd.   | ain't.
NSW, Australia                  | 


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

Date: Tue, 6 Mar 2001 20:07:08 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <slrn9a9a5s.efn.mgjv@martien.heliotrope.home>

On Mon, 5 Mar 2001 08:40:03 -0500,
	Kevin Reid <kpreid@attglobal.net> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> 
>>  The current end-of-file can be moved around with the truncate function:
> 
> I got bitten by this assumption once. There is some operating system (I
> don't remember which) that doesn't change the file position after a
> truncate(), which resulted in nulls being written to the file from the
> truncated-to location to the current file position.
> 
> The file was a text file, and the text editor I was using didn't show
> nulls, so the result was a mysteriously growing file.

I'd be interested to know which platform that is. I habitually precede a
truncate with a seek to the position to truncate at (in C and Perl), and
have been ridiculed for being overly cautious for it. My caution
probably stems from the fact that I tend to mix Unix system calls with
stdio, which can go terribly wrong if one's not cautious.

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: Tue, 6 Mar 2001 20:13:23 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <slrn9a9ahj.efn.mgjv@martien.heliotrope.home>

On Tue, 06 Mar 2001 02:02:44 -0500,
	ZepHead <groovyt@erols.com> wrote:
> In article <slrn9a7btj.8a8.abigail@tsathoggua.rlyeh.net>,
>  abigail@foad.org (Abigail) wrote:
> 
>> 
>> 
>> So, while I'm reading /etc/passwd, the system administrator cannot
>> add new accounts?
>> 
>> I don't think so.
>> 
>> 
>> Abigail
> 
> there is no reason new accounts can't be added at the same time.
> it just means the  cache flush would have to wait until
> it can get a lock then flush.   

That would mean that while Abigail is reading the file, the admin might
add one account. THen go away for coffee. The admin's assistant comes
in, and check the password file (which is allowed, bevause it's only
opened for read). He would see the copy that isn't updated, so he
changes the file, to add another account, but he accidentally picks the
same user id.

Now we have a problem, and that problem is more than just queueing up
the file writes and correctly positioning file pointers.

What you are talking about is a database system. Not a file system. The
overhead would kill the machine.

> if the OS is written well,  a write will have higher priority
> than a read anyway so you will never get a backup of shared locked reads
> staling a write.

What does that mean? A backup of shared locked reads staling a write?
And how can a write have a higher priority? ou either have locking or
you don't. Locking, between equivalent users, would have to be
implemented on a first-come first-serve basis. If a user has a shared
lock, no one should be given an exclusive lock. That's the whole _point_
of locking.

I'm really not getting what you are saying. Can you tell me about at
least one OS or file system where this is implemented? If it's such a
good idea, it must be running somewhere.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd.   | reflects this.
NSW, Australia                  | 


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

Date: Tue, 6 Mar 2001 20:16:46 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <slrn9a9anu.efn.mgjv@martien.heliotrope.home>

On Tue, 06 Mar 2001 01:20:53 -0500,
	ZepHead <groovyt@erols.com> wrote:
> In article <90j6atcl9berv4rd0sg6dqr7pbqgtrh4eq@4ax.com>,
>  Bart Lateur <bart.lateur@skynet.be> wrote:
> 
> 
>> 
>> What's the purpose of creating a file that you can't write to? No, sis,
>> creating of and writing to a file are connected. No create without
>> write.
> 
> opps i meant write    lol
> 
> i want a simple  way to tell open
> to open for write but and create but not truncate

In other words, to prevent confusion again, you want an equivalent of

sysopen FH, $name, O_WRONLY|O_CREAT;

right?

And we're full circle. I just ave you that command :)

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd.   | ain't.
NSW, Australia                  | 


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

Date: 6 Mar 2001 10:13:56 GMT
From: abigail@foad.org (Abigail)
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <slrn9a9e34.plq.abigail@tsathoggua.rlyeh.net>

Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMDCCXLIV September
MCMXCIII in <URL:news:slrn9a9ahj.efn.mgjv@martien.heliotrope.home>:
?? 
?? What does that mean? A backup of shared locked reads staling a write?
?? And how can a write have a higher priority? ou either have locking or
?? you don't. Locking, between equivalent users, would have to be
?? implemented on a first-come first-serve basis. If a user has a shared
?? lock, no one should be given an exclusive lock. That's the whole _point_
?? of locking.
?? 

While the latter is true, that doesn't mean it's the same as a first-come,
first-serve basis. The following is entirely possible, and used in some
databases:


    There is no lock on a resource.
    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.


There is little sense in having processes wait if they could go ahead
because all they need is a shared lock. OTOH, you don't want exclusive
lockers to wait forever, so a compromise has to be made.



Abigail
-- 
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
          q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'


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

Date: 6 Mar 2001 10:19:02 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <982dim$avg$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was NOT sent to Martien Verbruggen
<mgjv@tradingpost.com.au>],
who wrote in article <slrn9a9a0s.efn.mgjv@martien.heliotrope.home>:
> >> Whether you like it or not, that's just how it is.
> > 
> > ??!!!  What makes you think so?  Perl uses the model of locking which
> > is "native" on the architecture it is running.
> 
> I wasn't talking about what Perl uses internally, but what it exposes to
> the programmer:

Me too.

> In other words, it's interfaces for opening files,
> locking them, and closing them. And that precisely mirrors unix system
> calls, with some C stdio and shell syntax thrown in.

Absolutely not.  Perl makes no effort to hide the platform's semantic
for opening closing and flocking.  What you get is what the system does.

If the platform locks on open, so does Perl.  If the platform has
mandatory locks, so does Perl.

Ilya


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

Date: 6 Mar 2001 10:27:16 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <982e24$rqt$1@mamenchi.zrz.TU-Berlin.DE>

According to Abigail <abigail@foad.org>:

[...]
 
> You mean, you want to turn your filesystem into a database?

If I had to design an OS, I'd give that serious consideration.

Anno


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

Date: 6 Mar 2001 04:41:26 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: flock and close   with  empty read strangeness
Message-Id: <982esm$cnl$1@boomer.cs.utexas.edu>

In article <slrn9a99qa.onq.abigail@tsathoggua.rlyeh.net>,
Abigail <abigail@foad.org> wrote:
>ZepHead (groovyt@erols.com) wrote on MMDCCXLIV September MCMXCIII in
><URL:news:groovyt-21A9FE.02024406032001@virt-reader.news.rcn.net>:
>&& if the OS is written well,  a write will have higher priority
>&& than a read anyway so you will never get a backup of shared locked reads
>&& staling a write.
>
>Eh? So, what's the OS going to do if there's already a read lock, and
>a request for a write comes? Close the filehandles that are reading?

Well, once a write lock has been requested but has blocked, the OS does
have a choice.  It can either block subsequent read lock requests until
the write lock request is satisfied, or it can let them continue.  If
it lets them continue, as a group they may starve the write lock
request even if they behave well individually.

No general solution can stop a process from holding a read lock
essentially forever, but making all reads block waiting for a write if
a write is blocked will at least prevent starvation in the case when
holders of read locks eventually release them.

So anyway, making blocked write locks block and take priority over read
locks doesn't solve the problem in every case, but it solves the
problem in all cases that it's possible to have a solution for.

  - Logan
-- 
my  your   his  her   our   their   *its*
I'm you're he's she's we're they're *it's*


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

Date: Tue, 06 Mar 2001 10:19:10 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Grokking map and grep
Message-Id: <3aa4b3e6.77051033@news.grnet.gr>

Hi. I had to write a script to read comma-delimited data from a file
in a format like this:

number, other data, other data, .....

(There are also some junk lines that I'm not interested in - I only
want the ones that begin with a number followed by a comma.)

The lines must then be sorted numerically on the first (number) column
and the output written to another file.

I managed that OK, then I started thinking about grep and map, which I
haven't fully grokked yet. I came up with the following:

#!perl -w

use strict;

open ( IN, "ECG_done.txt" ) || die "Can't open input file: $!";
open ( OUT, ">ECG_done_sorted.txt" ) || die "Can't open output file:
$!";

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

close IN;
close OUT;

Now this is amazingly cool, being able to do all the reading,
processing and writing with one line of code, but I have two
questions:

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
splitting the input explicitly to an arrayof lists, sorting, then
writing the new file from a foreach loop, as I did in the original
version? I have this horrible gut feeling that the memory overhead of
all those maps and greps could become huge. Is my feeling baseless?

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?

All comments appreciated.

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: Tue, 6 Mar 2001 00:19:03 -0800
From: "Todd Thal" <todd_thal@hotmail.com>
Subject: How do you find unique names in a hash?
Message-Id: <3aa49c51@news2.mibx.net>

Dear all:

I have been asked the following but am baffled as to how to do it as a
hash..
I easily got it to go as an array..

How do I find out if a name already exists in an array?

my @name_list = ();
foreach my $line ( @in )
{
    # get the name in this line.
    # write some code to crack the line, and get $name out....
    # probably want to use index(), substr()

    # $name holds the name we are currently considering

    my $found = 0;
    foreach my $n ( @name_list )
    {
 if ( $n eq $name )
 {
     $found = 1;
     last;
 }
    } # foreach

    if ( ! $found )
    {
 push( @name_list, $name );
    }
} # foreach

How would I do this with a hash?

my solution as an array
my @name_list = ();
foreach my $line (@everything)
{
$name_L = index ($line, '(') + 1;
$name_R = index ($line, ')') -1;
$name = substr($line, $name_L,$name_R - $name_L +1);
    my $found =0;
    foreach my $n (@name_list)
    {
            if ($n eq $name)
            {
                $found = 1;
                last;
            }
        }
            if (!found)
            {
                push(@name_list,$name)
            }
}




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

Date: 6 Mar 2001 02:27:26 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: How do you find unique names in a hash?
Message-Id: <98271e$c8v$1@boomer.cs.utexas.edu>

In article <3aa49c51@news2.mibx.net>, Todd Thal <todd_thal@hotmail.com> wrote:
>I have been asked the following but am baffled as to how to do it as a
>hash..
>I easily got it to go as an array..
>
>How do I find out if a name already exists in an array?
  :
  :
>How would I do this with a hash?

What are you trying to accomplish?  What do you mean by "name"?

Perhaps it would help if you were to give an example or two of some
arrays and what answer you'd expect for each array.

I'm really not sure if this is what you're looking for, but
you can check whether a key/value pair exists in a hash with
a certain key by doing something like this:

	if (exists $hash{$key})
	{
		print "\%hash does contain '$key' as a key\n";
	}

Also, keep in mind the keys() and values() functions.  You may be able
to use one of them to turn your array solution into a hash solution.
Or, you might consider using each() to iterate over the key/value pairs
in the hash.

Hope that helps.

  - Logan
-- 
my  your   his  her   our   their   *its*
I'm you're he's she's we're they're *it's*


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

Date: Tue, 6 Mar 2001 18:11:18 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: How do you find unique names in a hash?
Message-Id: <jd1p6.2$di2.708@vic.nntp.telstra.net>

"Todd Thal" <todd_thal@hotmail.com> wrote in message
news:3aa49c51@news2.mibx.net...
> Dear all:
>

Well, if the name is the key to the hash then simply test to see if that
key has a value:

if ($hash{$name}){
    # the key $name has a 'true' value
}

or, if the value may be 'untrue' ('' or 0) test for its definedness

if (defined $hash{$name}){
    # do stuff
}

If the value in $name is a value of the hash, then it may have one or
more keys, so you have to loop through the hash and chech the values.

Since it should be unique, then you should be using it as the key to the
hash anyway (if you don't need a corresponding value, just set it to 1
or some arbitrary value (1 is useful for counting.)).

foreach my $key (%hash) {
    if ($hash{$key} eq $name){
        #I found one... but it may not be unique...
    }
}

HTH

Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass
it around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";





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

Date: Tue, 6 Mar 2001 20:25:04 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Is Perl right for me?
Message-Id: <slrn9a9b7g.efn.mgjv@martien.heliotrope.home>

On Tue, 06 Mar 2001 06:15:06 GMT,
	Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
> I was shocked! How could Jonathan Stowe <gellyfish@gellyfish.com>
> say such a terrible thing:
>>On 4 Mar 2001 19:13:00 -0000 Jonathan Stowe wrote:
>>> On Sun, 04 Mar 2001 13:19:21 GMT Bart Lateur wrote:
>>>> Holly Bortfeld wrote:
>>>> 
>>>>>I can write HTML
>>>>>from scratch without an editor.
>>>> 
>>>> Wow, that is strong. So how do you write HTML? Using a speech
>>>> recognition system?
>>>> 
>>> 
>>>    copy CON: somefile.html
>>> 
>>> or
>>> 
>>>    cp /dev/tty somefile.html
>>> 
>>
>>or of course the editor of champions :
>>
>>  dd if=/dev/tty of=somefile.html
>                                     |
> cat /dev/random | sed -e $SOME_SCRIPT > somefile.html
> 
> I'm still working on it though

So... What did you use to write $SOME_SCRIPT? Or is this a recursive
solution?

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd.   | ain't.
NSW, Australia                  | 


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

Date: Tue, 06 Mar 2001 10:16:15 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Is Perl right for me?
Message-Id: <slrn9a9ei0.2mn.tjla@thislove.dyndns.org>

I was shocked! How could Martien Verbruggen <mgjv@tradingpost.com.au>
say such a terrible thing:
>On Tue, 06 Mar 2001 06:15:06 GMT,
>	Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>> I was shocked! How could Jonathan Stowe <gellyfish@gellyfish.com>
>> say such a terrible thing:
>>>On 4 Mar 2001 19:13:00 -0000 Jonathan Stowe wrote:
>>>> On Sun, 04 Mar 2001 13:19:21 GMT Bart Lateur wrote:
>>>>> Holly Bortfeld wrote:
>>>>> 
>>>>>>I can write HTML
>>>>>>from scratch without an editor.
>>>>> 
>>>>> Wow, that is strong. So how do you write HTML? Using a speech
>>>>> recognition system?
>>>>> 
>>>> 
>>>>    copy CON: somefile.html
>>>> 
>>>> or
>>>> 
>>>>    cp /dev/tty somefile.html
>>>> 
>>>
>>>or of course the editor of champions :
>>>
>>>  dd if=/dev/tty of=somefile.html
>>                                     |
>> cat /dev/random | sed -e $SOME_SCRIPT > somefile.html
>> 
>> I'm still working on it though
>
>So... What did you use to write $SOME_SCRIPT? Or is this a recursive
>solution?

Well, like, *duh*

SOME_SCRIPT=`cat /dev/random | sed -e $SOME_OTHER_SCRIPT`

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Take heart amid the deepening gloom that your dog is finally getting
enough cheese
		-- National Lampoon, "Deteriorada"


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

Date: Tue, 6 Mar 2001 04:27:03 -0500
From: "phitshaced" <lerhaupt.2@osu.edu>
Subject: Legal Strings for form post methods
Message-Id: <982agm$ncd$1@news.cis.ohio-state.edu>

I'm using a perl program to transfer some text as a hidden field in an html
form.  However, when the text has characters such as '(', '?', etc. I get
some real goofy behavior.

I would like to convert the string to something that is legal within an html
form but can't even begin to find out which characters are legal.  Any
thoughts on an easy conversion method so that I can use the post method and
then re-convert it back afterwards for later use?

Thanks.
-Gary




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

Date: Tue, 06 Mar 2001 10:10:24 GMT
From: Ted Fiedler <tfiedler@zen.moldsandwich.com>
Subject: md5 differences
Message-Id: <Pine.LNX.4.30.0103060509290.9587-100000@zen.moldsandwich.com>

why is it that when I run a script such as this:

open (P, "/etc/passwd") || die "cannot open password file: $!";

$pass=<P>;

$md5 = new MD5;
$md5->add($pass);
$digest = $md5->digest();

print("Digest is " . unpack("H*", $digest) . "\n");


I get a different md5sum than when I do

md5sum /etc/passwd

is it that in my script im not getting a checksum but a digets if this is
the case what is the difference between the two?


-- 
"We're not like the  |  Ted Fiedler
 others. We're your  |  tfiedler@zen.moldsandwich.com
 friends" --HST      |  http://www.moldsandwich.com



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

Date: Tue, 06 Mar 2001 10:17:48 GMT
From: Ted Fiedler <tfiedler@zen.moldsandwich.com>
Subject: Re: md5 differences
Message-Id: <Pine.LNX.4.30.0103060518040.9653-100000@zen.moldsandwich.com>

Forget this message Im tired I didnt use @pass and so it only read the 1st
line of /etc/pass....


Thanks anyway

Ted

On Tue, 6 Mar 2001, Ted Fiedler wrote:

> why is it that when I run a script such as this:
>
> open (P, "/etc/passwd") || die "cannot open password file: $!";
>
> $pass=<P>;
>
> $md5 = new MD5;
> $md5->add($pass);
> $digest = $md5->digest();
>
> print("Digest is " . unpack("H*", $digest) . "\n");
>
>
> I get a different md5sum than when I do
>
> md5sum /etc/passwd
>
> is it that in my script im not getting a checksum but a digets if this is
> the case what is the difference between the two?
>
>
>

-- 
"We're not like the  |  Ted Fiedler
 others. We're your  |  tfiedler@zen.moldsandwich.com
 friends" --HST      |  http://www.moldsandwich.com



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

Date: Tue, 06 Mar 2001 10:24:05 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: md5 differences
Message-Id: <slrn9a9f0n.2mn.tjla@thislove.dyndns.org>

I was shocked! How could Ted Fiedler <tfiedler@zen.moldsandwich.com>
say such a terrible thing:
>why is it that when I run a script such as this:
>
>open (P, "/etc/passwd") || die "cannot open password file: $!";
>
>$pass=<P>;

Gets the first line

>$md5 = new MD5;
>$md5->add($pass);
>$digest = $md5->digest();

Does the md5sum

>md5sum /etc/passwd

Sums the whole file

>is it that in my script im not getting a checksum but a digets if this is
>the case what is the difference between the two?

Insert the line 'undef $/' at the start. You're welcome :)

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

The Surf Maggots


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

Date: Tue, 6 Mar 2001 10:29:17 -0000
From: "Graham Wood" <graham.wood@iona.com>
Subject: Re: Net::FTP
Message-Id: <982el6$mf8$1@spider.iona.com>

Is your remote path also C:/uploads/abc.txt?  I believe that Net:FTP will
use the same filename/path for local and remote files if you don't specify a
different name. It could be that C:/uploads doesn't make sense as a remote
path.

Try giving a specific filename for the remote file.
$ftp->put_unique("C:/uploads/abc.txt","abc.txt");

Graham Wood

Hilda <hilda@invopower.com> wrote in message
news:3aa455ff$0$21785@wodc7nh7.news.uu.net...
> Hi,
>
> I am not sure whether my question is out of topic or not. Anyway, hope
that
> someone can answer me.
>
> I use Net::FTP to ftp some files to the ftp server, using:
>  put_unique('C:/uploads/abc.txt') function, but when i use it, it always
> return " 'STOU abc.txt': Invalid number of parameters". And the transfer
of
> file is unsuccessful. I already checked the remote path which didn't have
> the abc.txt file in it. So, just wonder anybody know what's matter of it.
> THanks very much!!!
>
> Hilda
>
>




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

Date: Tue, 06 Mar 2001 08:28:39 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl, Cookies, and Apache.
Message-Id: <dr79atks9746e0n8vb4euts3f19ek9fakh@4ax.com>

Parrot wrote:

>CGI?  Database?  Sendmail?  Heck, these are all related to Perl if the
>question is "How do I do it in Perl?"  This programming language covers a
>lot of area you know.

Agreed, on condition that there is still Perl content. You shouldn't ask
here what command line option you have to use to do FOO in sendmail.
Your prgrammming task involves a lot of subarea's, and even though
they're all connected TO YOU, it probably still isn't right to bring up
every problem related to this task, here.

-- 
	Bart.


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

Date: Tue, 6 Mar 2001 20:21:37 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: perlpod docs?
Message-Id: <slrn9a9b11.efn.mgjv@martien.heliotrope.home>

[Please, in the future, post your replies _after_ the suitably trimmed
text you reply to. It's the commonly accepted quoting style on this
group, and Usenet in general]

X-Real-Address: mgjv@tradingpost.com.au
Mail-Copies-To: never

On Mon, 05 Mar 2001 14:48:44 -0500,
	ivo welch <ivo.nospam@yale.edu> wrote:
> 
> Martien Verbruggen wrote:
>> 
>> extract from Pod::Html, 1.03:
> 
> thanks for all the responses.  I must have a buggy version.  I
> understand that pod2html accepts "--title=" nicely, but the head1
> inclusion in the text itself fails:
> 
> 	#!/usr/bin/perl
> 	=head1 NAME
> 	a name
> 	=head1 TITLE
> 	a title
> 	=cut
> 	print "hello world\n";
> 
> for me gets
>   /usr/bin/pod2html: no title for try.pl at
> /usr/lib/perl5/5.6.0/Pod/Html.pm line 402.
> 
> I tried to figure out what it was looking for in the source, but it was
> not too obvious...after all, I am still a perl newbie or else I would
> not have such stupid questions...

Well, I gave you the version and the code to look for on the system that
I have here. If your version is different, you could try upgrading it to
at least 1.03. You could find that code in your copy, and debug it to
see why it isn't reaching that branch. You could take a piece of pod
that is guaranteed to be correct, and run pod2html over it, to see what
that does (your perl installation has many, often in the form of
modules). But we can't do that for you. We can't even tell you what the
version number is of the one you have. Only you can :)

$ perl -MPod::Html -le 'print $Pod::Html::VERSION'

(on broken shells you may have to use double quotes)

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | We are born naked, wet and hungry.
Commercial Dynamics Pty. Ltd.   | Then things get worse.
NSW, Australia                  | 


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

Date: Tue, 06 Mar 2001 09:48:58 +0100
From: Caron Franck <franck.caron@infineon.com>
Subject: PerlXS and inheritance
Message-Id: <3AA4A47A.14EC082C@infineon.com>

Hi all

I want to create XS interface for 2 C++ class B and D where D is
dervived from B

EX :
class B{
public :
    B();
    ~B();
    meth0();
    meth1();
}
Class D : public B{
public :
     meth2();
}

I have a perl XS for class B and I want to create the XS for D without
rewiting interface for constructor, destructor , meth0  and meth1. just
meth2!!!
I want that D module and package inherite form B module and package!

Is there a solution to inherit the B methods in D XS?


Thanks Franck




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

Date: 6 Mar 2001 07:03:41 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: pi day
Message-Id: <98224d$akj$1@orpheus.gellyfish.com>

On Mon, 05 Mar 2001 16:30:14 -0000 Greg Bacon wrote:
> In article <3AA3B179.8D23610@rac.ray.com>,
>     Russ Jones  <russ_jones@rac.ray.com> wrote:
> 
> : I'm working on a web page in honor of the impending global holiday, pi
> : Day, March 14 [...]
> 
> Don't forget that it's also the birthday of Albert Einstein, Billy
> Crystal, and noted Perl plinker Greg Bacon.  Send Guinness. :-)
> 

I didnt think there was an implementation of the Network Guinness Transport
Protocol yet.

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Tue, 06 Mar 2001 08:33:29 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Regex question (newbie)
Message-Id: <s589at07ptk1n08kjagukujujhg65qm7c6@4ax.com>

Godzilla! wrote:

>Hmmm, maybe one-third ahead full. This regex method
>displayed is quite slow and inefficient. Consider
>using a substring method when possible.
>
>$_ = "this, is a test";
>$a = substr ($_, 0, index ($_, ",") + 1);

If the guy is trying to learn about regexes, there's no need to optimize
them away right now. Heck, if the rules change to "a comma wplus any
whitespace following it", you HAVE to fall back to regexes.

-- 
	Bart.


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

Date: Tue, 6 Mar 2001 20:01:50 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: statement for(list);
Message-Id: <slrn9a99ru.efn.mgjv@martien.heliotrope.home>

On 5 Mar 2001 16:31:48 GMT,
	Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> [A complimentary Cc of this posting was NOT sent to Martien Verbruggen
><mgjv@tradingpost.com.au>],
> who wrote in article <slrn9a6thv.9kp.mgjv@martien.heliotrope.home>:
>> >   $_ *= 3 if $some_condition for @a;
>> > 
>> > Do not have any mental picture of relative precedence of 'if' vs 'for'.
>> 
>> It's easy enough to define. process from right to left. n other words,
>> the right statement becomes the outer loop/block. My example would
>> become
> 
> This is not how Perl's syntax is defined.  One can define the same
> precedence for these operators and left associativity.  Is this what
> you have in mind?

Yes. Although I can't immediately see whether that would allow what I
want. Precedence would have to be low, maybe just below list ops..... or
maybe just above comma and =>. Somewhere around there anyway.

I was more wondering aloud why the decision was made to only allow one
of these modifiers, instead of extending it. Is it because these things
are currently not implemented as operators, and they would need to be?

>> >> do_something_with($foo) for my $foo (@a);
>> > 
>> > I'm missing it a lot too, but would hate it if it were implemented.
>> 
>> Why would you hate it? Perlformance?
> 
> Nope.  I hope you realize that by the current rules the first $foo has
> nothing to do with the second one.  Even for
> 
>   mirror_for my $foo @a do_something_with($foo);
> 
> it would not.

But that doesn't explain why you would hate it if it were implemented.
:)

Your statement implies that there would be a downside to having this
implemented, and I just don't see what that would be.

Martien
-- 
Martien Verbruggen              | Since light travels faster than
Interactive Media Division      | sound, isn't that why some people
Commercial Dynamics Pty. Ltd.   | appear bright until you hear them
NSW, Australia                  | speak?


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

Date: 6 Mar 2001 10:14:56 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: statement for(list);
Message-Id: <982db0$ass$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was NOT sent to Martien Verbruggen
<mgjv@tradingpost.com.au>],
who wrote in article <slrn9a99ru.efn.mgjv@martien.heliotrope.home>:
> >> It's easy enough to define. process from right to left. n other words,
> >> the right statement becomes the outer loop/block. My example would
> >> become
> > 
> > This is not how Perl's syntax is defined.  One can define the same
> > precedence for these operators and left associativity.  Is this what
> > you have in mind?
> 
> Yes. Although I can't immediately see whether that would allow what I
> want. Precedence would have to be low, maybe just below list ops..... or
> maybe just above comma and =>. Somewhere around there anyway.

Precedence is already defined (perldoc perlop) to be suitably low.
The key observation is that you want *equal* precedence with
left-associtivity.  While easy-to-define, I'm not sure that this is
100% intuitive.

> I was more wondering aloud why the decision was made to only allow one
> of these modifiers, instead of extending it. Is it because these things
> are currently not implemented as operators, and they would need to be?

Because you need to define the relative precedence and associativity.
Endless possibilities come into mind, which means that the readers
will have hard time parsing the statements in their heads.

(Parsing in C is not a problem, parsing in reader's heads is.  People
often confuse these two topics, resulting in observations like "TCL
has a very simple syntax".)

> > Nope.  I hope you realize that by the current rules the first $foo has
> > nothing to do with the second one.  Even for
> > 
> >   mirror_for my $foo @a do_something_with($foo);
> > 
> > it would not.
> 
> But that doesn't explain why you would hate it if it were implemented.
> :)
> 
> Your statement implies that there would be a downside to having this
> implemented, and I just don't see what that would be.

It cannot be implemented with the current rules of scoping of
lexicals.  Which means we need to add yet another batch of exceptions
to already unsurmountable heap of unconsistencies and non-intuitive
behaviours brought to us by DWIM madness.

Ilya


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

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


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