[19750] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1945 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 17 09:10:27 2001

Date: Wed, 17 Oct 2001 06:10:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1003324212-v10-i1945@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 17 Oct 2001     Volume: 10 Number: 1945

Today's topics:
    Re: Net::FTP Problem in ascii mode <dump@the-core.net>
        Perl version of MSN Messenger? <alan@scotlpuk.com>
    Re: Perl version of MSN Messenger? <smash@floodbox.com>
        precedence question <rtrahan@monmouth.com>
    Re: precedence question <bernard.el-hagin@lido-tech.net>
    Re: precedence question <theaney@toadmail.toad.net>
    Re: Problems with this code <uri@sysarch.com>
    Re: Problems with this code <pimp23@swbell.net>
    Re: program to email text file (Glenn White)
    Re: reference as a sub name <pne-news-20011017@newton.digitalspace.net>
        Server Push on Apache localhost? <mh2@isis.co.za>
        Win32::ODBC (david wellock)
    Re: Win32::ODBC <simon.oliver@umist.ac.uk>
    Re: Writing and reading encrypted string (password) <dump@the-core.net>
    Re: Writing and reading encrypted string (password) <dump@the-core.net>
    Re: Writing and reading encrypted string (password) <dump@the-core.net>
    Re: Writing and reading encrypted string (password) <dump@the-core.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 17 Oct 2001 13:13:30 +0200
From: Lars Oeschey <dump@the-core.net>
Subject: Re: Net::FTP Problem in ascii mode
Message-Id: <sspqstskjoso9460pao9kdjrbi9ptnggq0@4ax.com>

On Tue, 16 Oct 2001 16:06:46 +0200, Kai Jendrian <kai@jendrian.de>
wrote:

>what happens if you set $debug = 1; ?
>Can you paste a useful part of this output?
>.kai

That won't help much, since the transfer itself is successful, so
there's no error Message in the debug.

Lars
Lars
-- 
GPZ900R xxMm+2,5Mm  http://www.oeschey.de
GS400 xxMm+1,5Mm  http://www.the-core.net


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

Date: Wed, 17 Oct 2001 11:07:54 +0100
From: "Alan Fleming" <alan@scotlpuk.com>
Subject: Perl version of MSN Messenger?
Message-Id: <TOcz7.11640$T05.1354345@news2-win.server.ntlworld.com>

Is there any code freely available on the net which would enable me to write
a web-based version of MSN Messenger? Even if I had a module which would
encrypt and decrypt the messenger communication, that would be great. Any
ideas?

Alan




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

Date: Wed, 17 Oct 2001 08:34:46 -0400
From: "Nerkto" <smash@floodbox.com>
Subject: Re: Perl version of MSN Messenger?
Message-Id: <zSez7.2176$os1.531039@news20.bellglobal.com>

it is not encrypted

I am building one

search google
for the
msn protocol

you should be able to find it.
"Alan Fleming" <alan@scotlpuk.com> wrote in message
news:TOcz7.11640$T05.1354345@news2-win.server.ntlworld.com...
> Is there any code freely available on the net which would enable me to
write
> a web-based version of MSN Messenger? Even if I had a module which would
> encrypt and decrypt the messenger communication, that would be great. Any
> ideas?
>
> Alan
>
>




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

Date: Wed, 17 Oct 2001 07:53:22 -0700
From: Richard Trahan <rtrahan@monmouth.com>
Subject: precedence question
Message-Id: <3BCD9B62.728E1FEB@monmouth.com>

Consider the following program:

use strict;
use warnings;
my @var = (0 .. 9);
my $value = 7;
my $a = 3;
$var[$a++] = $var[$a++] + $value; # (Wall, 3rd ed., p. 107)
print "$a: @var\n";

I cannot justify the answer based on my (apparently wrong)
understanding of precedence.

Could someone parenthesize the commented line above to illustrate
the order in which everything is done? Thanks.


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

Date: 17 Oct 2001 12:20:45 GMT
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: precedence question
Message-Id: <slrn9sqtgk.85e.bernard.el-hagin@gdndev25.lido-tech>

On Wed, 17 Oct 2001 07:53:22 -0700, Richard Trahan <rtrahan@monmouth.com>
wrote:
> Consider the following program:
> 
> use strict;
> use warnings;
> my @var = (0 .. 9);
> my $value = 7;
> my $a = 3;
> $var[$a++] = $var[$a++] + $value; # (Wall, 3rd ed., p. 107)
> print "$a: @var\n";
> 
> I cannot justify the answer based on my (apparently wrong)
> understanding of precedence.
> 
> Could someone parenthesize the commented line above to illustrate
> the order in which everything is done? Thanks.


I don't think parentheses would help here. You just have to
go from right to left and keep track of $a.


So starting from the right you have $value which always == 7,
then you have $var[$a++] which initially yields $var[3] and
increments $a to 4. Finally, you reach $var[$a++] on the left
when $a == 4. So the whole statement is equivalent to:


$var[4] = $var[3] + 7; # after this step $a is incremented again to 5


Cheers,
Bernard


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

Date: 17 Oct 2001 08:25:31 -0400
From: Tim Heaney <theaney@toadmail.toad.net>
Subject: Re: precedence question
Message-Id: <87k7xu78sk.fsf@susie.watterson>

Richard Trahan <rtrahan@monmouth.com> writes:

> Consider the following program:
> 
> use strict;
> use warnings;
> my @var = (0 .. 9);
> my $value = 7;
> my $a = 3;
> $var[$a++] = $var[$a++] + $value; # (Wall, 3rd ed., p. 107)
> print "$a: @var\n";
> 
> I cannot justify the answer based on my (apparently wrong)
> understanding of precedence.
> 
> Could someone parenthesize the commented line above to illustrate
> the order in which everything is done? Thanks.

I'm not sure parentheses are what you want; it is difficult to show
the post-increment that way. It's doing essentially this

  my $foo = $var[$a];
  $a++;
  $var[$a] = $foo + $value;
  $a++;

I hope this helps,

Tim


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

Date: Wed, 17 Oct 2001 04:36:12 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Problems with this code
Message-Id: <x7adyq6fx8.fsf@home.sysarch.com>

>>>>> "r" == randy5235  <randy5235@hotmail.com> writes:

  r> program(instead of using the quit command) about 10 to 20 seconds
  r> after they do so my CPU gets hammered (100% useage) and bam I have to
  r> kill the process. I assume that its trying to resend the info (and of
  r> course cannot) but it just keeps trying?


  r>   $nread = sysread($client, $msg, $max_msglen);

  r>    chop($msg); chop($msg);

you don't check the size of the data read. if a socket closes you will
get a read of 0 size. check that and close the socket and delete it from
you IO::select list and do any other cleanup you need.

there are many other weak parts to your code but that is the bug you
need to fix first.

for a simple chat system without any coding check out stem (at
stemsystems.com). it has a couple of basic chat server examples which
can be expanded to a more realistic system without much effort.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


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

Date: Wed, 17 Oct 2001 12:28:34 GMT
From: "Randy5235" <pimp23@swbell.net>
Subject: Re: Problems with this code
Message-Id: <SPez7.12539$6Z1.4061002914@newssvr30.news.prodigy.com>


"Uri Guttman" <uri@sysarch.com> wrote in message
news:x7adyq6fx8.fsf@home.sysarch.com...
> >>>>> "r" == randy5235  <randy5235@hotmail.com> writes:
>
>   r> program(instead of using the quit command) about 10 to 20 seconds
>   r> after they do so my CPU gets hammered (100% useage) and bam I have to
>   r> kill the process. I assume that its trying to resend the info (and of
>   r> course cannot) but it just keeps trying?
>
>
>   r>   $nread = sysread($client, $msg, $max_msglen);
>
>   r>    chop($msg); chop($msg);
>
> you don't check the size of the data read. if a socket closes you will
> get a read of 0 size. check that and close the socket and delete it from
> you IO::select list and do any other cleanup you need.
>
> there are many other weak parts to your code but that is the bug you
> need to fix first.
>
> for a simple chat system without any coding check out stem (at
> stemsystems.com). it has a couple of basic chat server examples which
> can be expanded to a more realistic system without much effort.
>
> uri
>
> --
> Uri Guttman  ---------  uri@sysarch.com  ----------
http://www.sysarch.com
> SYStems ARCHitecture and Stem Development ------
http://www.stemsystems.com
> Search or Offer Perl Jobs  --------------------------
http://jobs.perl.org

yeah there are Deffinately some problems all over with this code. its pretty
well my first project other than simple hello world type crap so....
I figure the only way to learn is to do. thanks for the advice Randy5235




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

Date: Wed, 17 Oct 2001 05:19:25 GMT
From: spam.killer@home.com_nospam (Glenn White)
Subject: Re: program to email text file
Message-Id: <Xns913CE2CA81AD4ccruizermydejacom@24.0.0.25>

Dave Tweed <dtweed@acm.org> wrote in <3BC9C95C.2802746B@acm.org>:

>Glenn White wrote:
>> Instead of reinventing the wheel, I'm looking for a NT Perl email
>> program that will help with the following task: I have a folder that
>> receives text files by FTP. I need a program that will read the first
>> few lines to get the To, CC, From, and subject lines, then place the
>> remaining text in the body. After that, then send the email.
>
>Here's a program I use for sending mail. It doesn't look for the
>Subject: field, but I'll leave that as a simple exercise for you. Be
>sure to set $server to something reasonable for your setup.
>
>-- Dave Tweed
>
>#!perl -w
>
># send-file.pl - Send a message from a file. The file must contain a
>header #                with at least a To: field and a From: field.
>
 <-- snip -->

Dave,

Thanks, your code is a gold mine. I've never used either Net or Mail. 
You've given me more than enough to point me in the direction I need to go. 
Your code also looks easy to read and is a good learning and expermentation 
aid. 

Thanks!


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

Date: Wed, 17 Oct 2001 09:28:17 +0200
From: Philip Newton <pne-news-20011017@newton.digitalspace.net>
Subject: Re: reference as a sub name
Message-Id: <m9cqst8f8ld4iku1njrdc1bm9126f6s3o2@4ax.com>

On 16 Oct 2001 04:22:23 -0700, perlmisk@yahoo.co.uk (perl misk) wrote:

>     no strict 'refs';
>     print @main::{$user};	# how can I access the users' array?

Use a hash instead. Symrefs are bad. See also
<x7y9mb5s0q.fsf@home.sysarch.com> .

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 17 Oct 2001 12:11:57 +0200
From: "Web Wizards - PHP/PERL Developers" <mh2@isis.co.za>
Subject: Server Push on Apache localhost?
Message-Id: <9qjlgq$ebc$1@ctb-nnrp2.saix.net>

Hi,

I am working on a chat script, and am busy implementing a server push option
into it.
Basically..

if ( $EnableServerPush eq "Yes" )
{
    # turn output buffering off...
    $| = 1;

    # definition of server-push starting.
    print "$ENV{'SERVER_PROTOCOL'} 200 OK\n";
    print "$Server: $ENV{'SERVER_SOFTWARE'}\n";
 }

 print "Content-type: text/html\n\n";
 print "<html>\n";
 print "<head>";
 print "<title>$ProgName</title>\n";
 print "<meta HTTP-EQUIV=\"Pragma\" Content=\"no-cache\">\n";
 print "</head>";

 if ( $EnableServerPush )
{
  print <<__Scroll__;
<SCRIPT>
function scroll() {
        window.scrollTo(0,50000);
        setTimeout("scroll()",500);
}
setTimeout("scroll()",100);
</SCRIPT>
__Scroll__

  # This code is for M$ IE.
  for($i=0;$i<=100;$i++){ print " "; }
  print "\n";
 }

### follows an infinite loop outputting new msgs as they arrive ###

Now, I cannot get this working on my apache localhost, is there anything I
must set up to make Apache do server push?
I took the method from another push chat, this one works across a virtual
server on the web, but wont work either on my localhost, which is why i
figured its a problem in my server setup rather than the code.

Any ideas?

Regards,
Mark

--------------------------------------------------------------
Web Wizards - PHP/PERL Developers
E-Mail: mh2 at isis.co.za
--------------------------------------------------------------




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

Date: 17 Oct 2001 01:11:51 -0700
From: dwellock@lakewood.co.uk (david wellock)
Subject: Win32::ODBC
Message-Id: <a30608a1.0110170011.bdc3c79@posting.google.com>

I am having some problems running the Win32:ODBC extension on my
server (NT 4).

Everything works fine on Win2000 but when I transfer it to the server
this is the error I get:

Can't call method "Sql" on an undefined value at
C:\Inetpub\wwwroot\test\test.pl line 94.

Any ideas ?

Thanks in advance

David


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

Date: Wed, 17 Oct 2001 12:34:49 +0100
From: Simon Oliver <simon.oliver@umist.ac.uk>
Subject: Re: Win32::ODBC
Message-Id: <3BCD6CD9.9CC68765@umist.ac.uk>

> I am having some problems running the Win32:ODBC extension on my
> server (NT 4).
> 
> Everything works fine on Win2000 but when I transfer it to the server
> this is the error I get:
> 
> Can't call method "Sql" on an undefined value at
> C:\Inetpub\wwwroot\test\test.pl line 94.

It sounds like you didn't make a connection.  Check that
Win32::ODBC->new returns a connection object:

$Data = new Win32::ODBC("MyDSN") 
  or die "Error connecting to database";

--
  Simon Oliver


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

Date: Wed, 17 Oct 2001 13:16:01 +0200
From: Lars Oeschey <dump@the-core.net>
Subject: Re: Writing and reading encrypted string (password)
Message-Id: <a0qqstc9h85tap2bpkgj5hougubqb4n8rq@4ax.com>

On 16 Oct 2001 12:36:55 -0500, logan@cs.utexas.edu (Logan Shaw) wrote:

>But you have to store the key somewhere so that you can decrypt the
>passwords.  If they can get the .ini file, they can get the key too,
>right?

That's right. But that wouldn't be the problem, since I don't want to
get a real high security here. The password is transferred over the
net in cleartext afterwards anyway. So if someone *wanted* the
password, it wouldn't be too hard to get.
I just want to prevent people from accidentally getting the password
by just tweaking the .ini file.

>  - Logan

Lars

Lars
-- 
GPZ900R xxMm+2,5Mm  http://www.oeschey.de
GS400 xxMm+1,5Mm  http://www.the-core.net


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

Date: Wed, 17 Oct 2001 13:17:52 +0200
From: Lars Oeschey <dump@the-core.net>
Subject: Re: Writing and reading encrypted string (password)
Message-Id: <l3qqstgvohdjrg1v81b8mo83mfjen52b81@4ax.com>

On Tue, 16 Oct 2001 14:30:58 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:

>Or just using the crypt() built-in perl function.

I thought about that, but couldn't think of a way to get it work in
both directions.
So I could for example run teh program with the parameter -p for
writing crypt(password) to the .ini file. But how would I then later
get the cleartext password from that from within the application? I
need to read the password, decrypt it, and use it as login to a ftp
server...

Lars
Lars
-- 
GPZ900R xxMm+2,5Mm  http://www.oeschey.de
GS400 xxMm+1,5Mm  http://www.the-core.net


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

Date: Wed, 17 Oct 2001 13:18:57 +0200
From: Lars Oeschey <dump@the-core.net>
Subject: Re: Writing and reading encrypted string (password)
Message-Id: <k7qqst4rsjacv920e8cle2ch6i4mc6bsts@4ax.com>

On Tue, 16 Oct 2001 14:47:17 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:

>	Crypt::Blowfish
>	Crypt::OpenPGP
>	Crypt::BeoWulf
>	Crypt::DES
>	Crypt::GOST

aren't those all (like the crypt() function) one-way encryptions? i.e.
I can't get the cleartext back from the encrypted password?

Lars
Lars
-- 
GPZ900R xxMm+2,5Mm  http://www.oeschey.de
GS400 xxMm+1,5Mm  http://www.the-core.net


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

Date: Wed, 17 Oct 2001 13:20:50 +0200
From: Lars Oeschey <dump@the-core.net>
Subject: Re: Writing and reading encrypted string (password)
Message-Id: <c9qqst4oj5c99kruhnc1uimv8cd4klscsi@4ax.com>

On Tue, 16 Oct 2001 09:46:16 -0500, trammell@haqq.hypersloth.invalid
(John J. Trammell) wrote:

>You could obfuscate it with MIME::Base64.

hm, that could work indeed. Though I wan't to stay away from Modules
not included with Activestate Perl a bit, since I don't know on how
much machines the program will be later, and everywhere would have to
be the module installed then (on NT with ppm and proxy settings that
is a bit work)

Lars
Lars
-- 
GPZ900R xxMm+2,5Mm  http://www.oeschey.de
GS400 xxMm+1,5Mm  http://www.the-core.net


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

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.  

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


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