[25601] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7845 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 2 06:05:46 2005

Date: Wed, 2 Mar 2005 03:05:15 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 2 Mar 2005     Volume: 10 Number: 7845

Today's topics:
    Re: [perl-python] generate all possible pairings <xah@xahlee.org>
    Re: can someone help? <yyusenet@yahoo.com>
    Re: Importing records with both space and quoted text q <tadmc@augustmail.com>
    Re: Importing records with both space and quoted text q <flowerysong00@yahoo.com>
    Re: maximum size of a hash table <postmaster@castleamber.com>
    Re: perl problem with select and non-blocking sysread f <1usa@llenroc.ude.invalid>
    Re: Pure Perl OpenSSL Library <dkm@kataplop.net>
    Re: Pure Perl OpenSSL Library <nospam-abuse@ilyaz.org>
    Re: Pure Perl OpenSSL Library <dkm@kataplop.net>
    Re: Questions about Perl for Windows <jkeen_via_google@yahoo.com>
    Re: Questions about Perl for Windows <ebohlman@omsdev.com>
    Re: Questions about Perl for Windows <crypix@gmail.com>
    Re: Questions about Perl for Windows <bart.lateur@pandora.be>
    Re: Questions about Perl for Windows <newspost@kohombanDELETE.net>
    Re: Socket Send and Receive, Same local port, Different <for-spammers-only@web.de>
    Re: where is my magic (XS related) <pavel@gingerall.cz>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 1 Mar 2005 20:06:01 -0800
From: "Xah Lee" <xah@xahlee.org>
Subject: Re: [perl-python] generate all possible pairings
Message-Id: <1109736361.480229.285100@f14g2000cwb.googlegroups.com>

Answer to the previous exercise.
http://xahlee.org/perl-python/generate_pairings.html

# perl
sub genpair ($) {
my $partiSet = $_[0];
my @result;
for (my $head =0; $head <= ((scalar @$partiSet)-2); $head++ ) {
    for (my $tail = $head+1; $tail <= ((scalar @$partiSet)-1); $tail++
) {
        foreach my $ii (@{$partiSet->[$head]}) {
            foreach my $jj (@{$partiSet->[$tail]}) {
                push @result, [$ii,$jj]
            }
        }
    }
}
return \@result;
}

@# python
@def genpair (partiSet):
@    result=[]
@    for head in range(len(partiSet)-1):
@        for tail in range(head+1,len(partiSet)):
@            for ii in partiSet[head]:
@                for jj in partiSet[tail]:
@                    result.append((ii,jj))
@    return result
@
@# by Sean Gugler
@def genpair2 (partiSet):
@    return [(a,b) for s in range(len(partiSet))
@            for t in range(s)
@            for a in partiSet[t]
@            for b in partiSet[s]]
@
@ll=( [[9,1],[5],[2,8,7]])
@t=genpair(ll)
@t2=genpair2(ll)
@if (t.sort()==t2.sort()): print 'yay'


 Xah
 xah@xahlee.org
 http://xahlee.org/PageTwo_dir/more.html



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

Date: Tue, 01 Mar 2005 19:28:47 -0700
From: YYusenet <yyusenet@yahoo.com>
Subject: Re: can someone help?
Message-Id: <d038cv$f6i$1@news.xmission.com>

Roll wrote:
> #!/usr/bin/perl
> use warnings;
> use strict;
> my $out = '/root/a.conf';
> open(OUTF,">>", $out) or die "Cannot open $out for appending:$!";
> print OUTF "anc";
> close OUTF or die "Cannot close $out:$!";
> 
> how come when i use this code i got a 500 internal server error ? how do i
> solve this?
> 

1. Subject.
2. Does your server support Perl?
3. Is perl located inside of /usr/bin/perl or is it located in 
*/usr/bin/Perl*?
4. Check your logs.
5. Maybe it can't "die" because it needs "Content-Type: text/plain\n\n"
6. If you want a real indepth answer provide us with more information 
please.

-- 
k g a b e r t (at) x m i s s i o n (dot) c o m

*Support Mozilla Firefox*!
http://www.spreadfirefox.com/?q=user/register&r=71209


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

Date: Tue, 1 Mar 2005 22:31:55 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Importing records with both space and quoted text qualifiers...
Message-Id: <slrnd2agdr.6pd.tadmc@magna.augustmail.com>

L. D. James <ljames@apollo3.com> wrote:
> "Tad McClellan" <tadmc@augustmail.com> wrote in message 
> news:slrnd2a1g0.28j.tadmc@magna.augustmail.com...
>> L. D. James <ljames@apollo3.com> wrote:
>>
>> [snip]


>> Thanks for fixing the top-posting.


>      I'm insulted with the continued reference to top posting.  


I was *thanking* you for stopping, where is the insult in that?

I don't get it...


> I'm also 
> insulted about the references to my grammar and typos.  


I did not make any references to your grammar nor typos, did you
mean to put that in a followup to a post where such did occur?


> I don't mind a reference to 
> something you might see as a problem.


Your .sig does not have a correct sig-dash, and it is more than 4 lines.


>      If you think there is a reoccurring problem with me that requires 
> addressing, I respect your forum.  


You have broken netiquette at least 3 ways in this thread.

You should either go learn the expected way of composing a followup,
or take your lumps like a man when you get called on it. Your call.

Top-posting is universally reviled, but that one is moot since
you have fixed it already.

Second, the correct sig-dash is "-- " followed by a newline.

Third, you are not supposed to quote .sigs unless you are
commenting on the .sig.


> But you don't have to keep harping on 
> something that you saw once, and could have seen it was immediately 
> addressed if you cared to look at the thread.  


I *did* look at the thread you bonehead!

How else would I know to thank you for fixing the top-posting?


> Looking at the posts can go 
> more than one way.


I won't be looking at any more of your posts I don't think.

Good luck!


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 02 Mar 2005 02:51:53 -0500
From: Paul Arthur <flowerysong00@yahoo.com>
Subject: Re: Importing records with both space and quoted text qualifiers...
Message-Id: <pmra219d0b1f394ln6po633bvg5ktlujbm@4ax.com>

"L. D. James" <ljames@apollo3.com> wrote:
<snip excessive quote>
>
>     By the way, looking at my previous message it seems that some 
>application reformatted my signature.  The extra vertical spaces were not on 
>my copy.  They only appeared after the message was read from the group. 
>While I learn what might be the annoying culprit, I'll put everything on one 
>line as I did in this message.
>
>
>
>     However, as I mentioned in my previous message, it has nothing to do 
>with top posting.
>
>
>
>
>
>
>
>                                                            -- L. James
>
>
>
>------------------ L. D. James ljames@apollo3.com  www.apollo3.com/~ljames
>

That is one ugly message.

He said "fix your sig", not "make it broken in a different way".  He
was referring to the lack of a sig delimiter, which is used by
newsreaders to automatically remove signature blocks when replying to
a message.  A proper sig delimiter goes on a line by itself, and
consists of two dashes, followed by a space and then a newline.

-- 
Like that.  Additionally, it's generally preferable to try to keep
your sig to four lines or less, since some people are still paying
based on the amount of data transferred. The extra blank lines you
included in your messages are merely the icing on the cake of ugly


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

Date: 2 Mar 2005 05:16:44 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: maximum size of a hash table
Message-Id: <Xns960CECCE2FA30castleamber@130.133.1.4>

Ted Zlatanov wrote:

> On 28 Feb 2005, postmaster@castleamber.com wrote:
> 
>> I can't think of any advantage of an O(n) look up hash table, it works
>> like an unsorted list, see above. 
> 
> I have to disagree with the "any" part.

Well, I can't think of any :-D

> O(n) can mean a lot of things
> in practice.  If the constant part is large enough, it can make a
> difference in specific real-life situations.  Also if the n is known
> to be in specific ranges, an O(n) algorithm may well be better than an
> O(log(n)).

Example? (in the above context)

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


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

Date: Wed, 02 Mar 2005 04:22:33 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: perl problem with select and non-blocking sysread from multiple pipes
Message-Id: <Xns960CEDCD35614asu1cornelledu@127.0.0.1>

lqueryvg@yahoo.com (john) wrote in
news:9c8511e0.0503011554.381166af@posting.google.com: 

> 
> Sorry. More context is below (the last words are mine)...
> 
>> > > my $eofsFound = 0;
>> > > my $eofsExpected = 5;
>> > > my $taskNum = 0;
>> > > 
>> > > my $readBits = '';      # "bitlist" of parent reader filehandles
>> > > my($fh) = ('fh0000');   # indirect filehandle names, yuk
>> > 
>> > Yes, yuk - this is not necessary in 5.6.1 and later - is
>> > compatability with earlier Perl really needed?
>>
>> If there's a better way then I'll do it.
>> I don't like using the 'no strict refs' all over the place and
>> the indirect filehandle stuff is just plain confusing.
>> Can you give me any pointers ?
> 
> I'm still interested to hear what the "recommended"
> approach is to avoid the yucky indirect filehandle names.
> Is it IO::Handle ?

I am not sure :) Sorry, but I have never used 'indirect filehandles' and 
what your reason is for using them. However, what you are after might be 
lexical fiheandles:

E.g.

open my $fh, '<', 'fh0000' or die $!;

Sinan.


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

Date: Wed, 02 Mar 2005 08:36:23 +0100
From: "Marc" <dkm@kataplop.net>
Subject: Re: Pure Perl OpenSSL Library
Message-Id: <42256ce6@epflnews.epfl.ch>

Big and Blue <No_4@dsl.pipex.com> writes:

> Marc wrote:
>>
>>>    You will be *creating* thousands of certificates within
>>> minutes!?  Why?
>> Because I have thousands nodes that needs a certificate
>
>     But not new ones at each startup, surely?

Of course, only at first startup (just after installation).

>> Yes they are, but the bottleneck is the step just before this one. The
>> node needs a certificate if it wants to send it, right? So how do I
>> provide theses thousand certificates?
>
>     Create them once, save them on each node and get each node to use
> its saved one when it starts.
>> I was just looking for the fastest way to run a script that can make
>> some checks (I won't issu certificates for every request) and from a
>> certificate request, issu a signed certificate. That's all.
>
>     So get the client to save it and resuse it for some time (you can
> set your own expiry date...).

The first problem is still there (but now, maybe you understood what I
meant). When I'll install thousand of nodes (one cluster), all nodes
will request their certificates within minutes, so I must avoid as much
as possible heavy tasks that can be avoided. 
I can't avoid the maths behind the crypto, but I can avoid fork when
they are not needed.

Marc


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

Date: Wed, 2 Mar 2005 08:45:40 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Pure Perl OpenSSL Library
Message-Id: <d03ufk$c7j$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Marc
<dkm@kataplop.net>], who wrote in article <42256ce6@epflnews.epfl.ch>:
> I can't avoid the maths behind the crypto, but I can avoid fork when
> they are not needed.

AFAIK, openssl executable is just a tiny wrapper about openSSL
libraries.  Are these libraries dynamically linked on your target
platforms?  If yes, why not call these entry points from Perl?

Yours,
Ilya


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

Date: Wed, 02 Mar 2005 10:06:02 +0100
From: "Marc" <dkm@kataplop.net>
Subject: Re: Pure Perl OpenSSL Library
Message-Id: <422581ea@epflnews.epfl.ch>

Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:

> [A complimentary Cc of this posting was sent to
> Marc
> <dkm@kataplop.net>], who wrote in article <42256ce6@epflnews.epfl.ch>:
>> I can't avoid the maths behind the crypto, but I can avoid fork when
>> they are not needed.
>
> AFAIK, openssl executable is just a tiny wrapper about openSSL
> libraries.  Are these libraries dynamically linked on your target
> platforms?  If yes, why not call these entry points from Perl?

yes openssl executable is just a tool that uses directly the lib,
without much addition (I think). I will take a look at the internals and
see it is feasable or not.

Marc


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

Date: Wed, 02 Mar 2005 03:19:27 GMT
From: Jim Keenan <jkeen_via_google@yahoo.com>
Subject: Re: Questions about Perl for Windows
Message-Id: <3haVd.66852$8a6.66298@trndny09>

al2048@aol.com wrote:

> Bart Lateur wrote:
> 
>>>Is ActivePerl reliable?
>>
>>Yes. ActivePerl is pretty much *the* perl for Windows... though
>>technically, it and Indigoperl are virtually identical. Precompiled
>>modules for ActivePerl (AKA PPM distributions) will work just as well
>>for for both, too. The main difference between the two is what comes
>>with it for modules, and the module installation script itself that
>>comes with it. Each has a custom written script, comletely different
>>from that of the other.
>>
> 
> 
> 
> I need a version of Perl that can use modules. Can both IndigoPerl and
> ActivePerl do that?

All versions of Perl can use modules.

> 
> Also, I have dial-up Internet access. So, which Perl version is best to
> download?
> 

The only difference would be that the distribution whose .zip file is 
bigger would take longer to download.  Given that you're probably going 
to use whichever version you're going to download for a couple of years, 
the difference is immaterial.

BTW, did you read what I wrote in my first response to your OP?

 > The comp.lang.perl newsgroup is defunct and has
 > been for years; don't post to it.

And did you read the Posting Guidelines for comp.lang.perl.misc? 
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

jimk


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

Date: 2 Mar 2005 04:22:29 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Questions about Perl for Windows
Message-Id: <Xns960CE4DF67AAebohlmanomsdevcom@130.133.1.4>

Jim Keenan <jkeen_via_google@yahoo.com> wrote in news:3haVd.66852$8a6.66298
@trndny09:

> All versions of Perl can use modules.

<nitpick class="silly">If your version of Perl is a teenager, it probably 
can't use modules</nitpick>


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

Date: 1 Mar 2005 22:40:17 -0800
From: "crypix" <crypix@gmail.com>
Subject: Re: Questions about Perl for Windows
Message-Id: <1109745617.285612.97820@o13g2000cwo.googlegroups.com>

In my opinion Activestate with an independant install of Apache is more
stable and a lot more reliiable than indigo...just my .02
~crypix



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

Date: Wed, 02 Mar 2005 07:19:56 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Questions about Perl for Windows
Message-Id: <s2qa21divnp181co1i88v4k5iot2fnqeou@4ax.com>

Richard Williams wrote:

>In article <1109643855.662897.130360@z14g2000cwz.googlegroups.com>,
> <al2048@aol.com> wrote:
>
>>Also, at my job, I will have the Unix operating system. If I write a
>>Perl program on Unix, will this program run on
>>IndigoPerl or ActivePerl on Windows Millennium Edition?
>
>One other alternative that might be worth considering is cygwin:
>
>http://www.cygwin.com/
>
>which gives you a pretty complete unix-like environment for Windows, 
>including Perl (and Apache).

While we're discussing alternatives, here's another one I stumbled
across a few weeks ago:

	niPerl
	<http://www.numeninest.com/Perl/>

-- 
	Bart.


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

Date: Wed, 02 Mar 2005 16:41:40 +0800
From: GreenLeaf <newspost@kohombanDELETE.net>
Subject: Re: Questions about Perl for Windows
Message-Id: <38lckqF5opb54U1@individual.net>

John Bokma wrote:

> 
> I do a lot myscript.pl > out.txt, which works. I checked the otherway
> around ( < in.txt) which indeed doesn't work. Will look into that a bit
> more later. 

Yeah, it's actually the input redirection that has issues. :)

> 
> Well, if that's an komodo dragon ...

Guess I have to agree with you. I was misled by the icon assigned by 
ActiveState Komodo, which is indeed a komodo. :-)

> What I mean is that TextPad creates a top level entry (besides the Open
> With). So I still can easily start them with double click.

I _did_ mean top-level entries directly on context menu, not 'open-with' 
entries. They can be manually created from within Explorer, but 
obviously only one association can have double-click :o).


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

Date: Wed, 02 Mar 2005 09:54:16 +0100
From: Toni Erdmann <for-spammers-only@web.de>
Subject: Re: Socket Send and Receive, Same local port, Different Remote Port
Message-Id: <d03v05$inj$1@news.mch.sbs.de>

jeffburgoon@hotmail.com wrote:
> I'm having a problem opening a socket and receiving a response from a
> different IP/port than what I'm sending to.  Here is what I'm trying to
> do:
> 
> Open Socket with IP/Port (A,B)
> Send to location with IP/Port (C,D)
> Immediately receive response on IP/Port (A,B) from IP/Port (X,Y), or
> any IP/Port other than (C,D)
> 
> My problem is that in order for me to send to (C,D) I have to create
> the socket with peer address/port (C,D), so only responses from (C,D)
> are allowed.  I have tried setting up the socket to use (C,D), then
> tearing it down and recreating it with no peer IP/port specified but I
> think this is too slow, as the response comes back almost immediately
> and is missed by the recv() function.  Here is what I'm trying:
> 
> $socket=new IO::Socket::INET->new(PeerPort=>$dst_port_num

leave PeerPort undef

>                                   ,Proto=>$'udp'
                                             ^
does this realy work? ----------------------|

>                                   ,PeerAddr=>$dst_addr_str

leave PeerAddr undef

>                                   ,LocalPort=>5060
>                                   ,Reuse=>1);
> $socket->send($packet_text);

use $socket->send( BUF, FLAGS, TO );

> close($socket);

why do you close the socket?

> $socket->recv($response,1024);

Can you receive on a closed socket?
If your are using SIP, take at least 1500 (IP's MTU on Ethernet)
as buffer size.

On the other side 65535 is the max UDP packet size.
Why don't you use this value? Then a SIP messages arrives completely
in $response (you don't have to take care about fragmentation).

But then again SIP defines TCP to be used if the SIP messages is
longer than MTU-200. So with more then 1300 bytes, you should
use and be able to receive from TCP.

But, if your implementing a SIP client that uses a SIP proxy,
it should be OK to connect() this socket to communicate only
with the SIP proxy.

But, as a SIP client, you could use any LocalPort. 5060 is
recommended but not mandatory for SIP clients.

But, as a SIP proxy, you should use 5060 and be prepared to
receive SIP messages from any SIP client.

> close($socket);
> 
> The above code works as long as the response comes back from ip/port
> ($dst_addr_str, $dst_port_num).  If a packet is received from a

Yes, because by specifying 'PeerAddr'and 'PeerPort', even a UDP
socket performs a 'Socket::connect()' and therefor is dedicated to
communicate with (receive from) PeerAddr:PeerPort only.

> different IP or port, it is ignored as the socket is only listening on
> that pair.  I have tried adding in the code to recreate the socket but
> it appears to be too slow as the response is never received.  Here is
> what I add in, directly above the recv() line in the above code:
> 
>         $socket=new IO::Socket::INET->new(Proto=>$protocol_str
>                         ,LocalPort=>5060);
> 
> 
> I'm thinking what I need is to either
> 
> A) Allocate a socket with no remote port/ip and instead specify port/ip
> in send()
> or
> B) Change peer IP/port to nothing on the fly immediately after sending
> packet.
> 
> Any help would be greatly appreciated.
> 

Toni "use Socket;" User


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

Date: Wed, 02 Mar 2005 09:54:16 +0100
From: Pavel Hlavnicka <pavel@gingerall.cz>
To: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: where is my magic (XS related)
Message-Id: <42257F38.6040200@gingerall.cz>

Thanks,

you're right it seems. Actually meanwhile I've noticed formerly 
overlooked fact that perl allows only single concurrent iteration of the 
hash so storing my internal key with an object (not with key) is 
sufficient (or even conforming if you want).

What's strange (but understandable) is that my RETVAL with magic is 
copied with its type (SvMAGIC returns true) but no magic is retained. 
Keeping SV upgraded to PLMG seems to be obsolete. But it really doesn't 
hurt much - it was just a bit confusing.

Thank you for your help, I really appreciate it.

Pavel

> 
> Try adding it to the object instead of the key.  MAGIC isn't 
> preserved across an assignment, which is what perl must do here: 
> it makes an internal copy of FIRSTKEY's (mortal) RETVAL, to 
> eventually pass to NEXTKEY as "last".
> 


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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