[24406] in Perl-Users-Digest
Perl-Users Digest, Issue: 6594 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 21 14:10:53 2004
Date: Fri, 21 May 2004 11:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 21 May 2004 Volume: 10 Number: 6594
Today's topics:
Re: Password scheme/Persistent session... (krakle)
Re: Password scheme/Persistent session... (krakle)
Re: Password scheme/Persistent session... <remorse@partners.org>
Re: Password scheme/Persistent session... <jwkenne@attglobal.net>
Re: Password scheme/Persistent session... (dan baker)
Re: Pattern matching against a "use constant" character <dwilga-MUNGE@mtholyoke.edu>
Re: Pattern matching against a "use constant" character <nobull@mail.com>
Re: Pattern matching against a "use constant" character <uri@stemsystems.com>
Re: Pattern matching against a "use constant" character <usenet@morrow.me.uk>
Re: Perl array manipulation questions <raisin@delete-this-trash.mts.net>
Re: Perl vs PHP <noreply@gunnar.cc>
Re: Perl vs PHP (Randal L. Schwartz)
Re: Perl vs PHP <Juha.Laiho@iki.fi>
Re: Perl work? (Randal L. Schwartz)
Re: Perl work? <postmaster@castleamber.com>
Re: rmdir Question <georgekinley@hotmail.com>
Running remote commands on Windows <fb@i.am.nowhere.net>
Re: Sockets: receiving data <someone@somewhere.com>
Re: Sockets: receiving data <someone@somewhere.com>
Re: Sockets: receiving data <1usa@llenroc.ude>
Re: SOLVED: How do I scope a variable if the variable n (Kevin Collins)
Re: sort numeric lists <uri@stemsystems.com>
Re: Win32, FTP, line ends (Phil Hibbs)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 May 2004 09:51:04 -0700
From: krakle@visto.com (krakle)
Subject: Re: Password scheme/Persistent session...
Message-Id: <237aaff8.0405210851.31248537@posting.google.com>
"gnari" <gnari@simnet.is> wrote in message news:<c8kejl$f5s$1@news.simnet.is>...
> "krakle" <krakle@visto.com> wrote in message
> news:237aaff8.0405202021.2d9c43d0@posting.google.com...
> > Tad McClellan <tadmc@augustmail.com> wrote in message
> news:<slrncamk5q.692.tadmc@magna.augustmail.com>...
> > > Your question is not about Perl. Your question is about how to
> > > maintain state in CGI applications.
> >
> > Because mod_perl IS CGI? Actually buddy, mod_perl ISN'T CGI...
>
> if you are using mod_perl, you might want to take a look at
> Apache::AuthenDBI
>
> gnari
Thank you.
------------------------------
Date: 21 May 2004 10:02:09 -0700
From: krakle@visto.com (krakle)
Subject: Re: Password scheme/Persistent session...
Message-Id: <237aaff8.0405210902.17aa0985@posting.google.com>
"Alan J. Flavell" <flavell@ph.gla.ac.uk> wrote in message news:<Pine.LNX.4.53.0405191954000.25650@ppepc56.ph.gla.ac.uk>...
> The fact that you mentioned .htpasswd
I said "Please don't direct me to .htpasswd". My post wasn't
pertaining to .htpasswd.
> indicates that you were
> considering a method of authentication. Apache supports various
> authentication techniques. You haven't shown any cause yet why one of
> them would not meet your requirements.
I guess you didn't read WHY I don't want .htpasswd. I mentioned 1. it
does linear style lookups and this will be a very populated members
section. 2. I need MORE control over a session for expiration,
tracking etc. I think it's very clear WHY .htpasswd DOESN'T meet the
requirements.
>
> You state, without showing your working, that you "need a session".
>
> If that's truly so, then why were you considering a method of
> authentication - which by no means defines a session? So you
> in effect contradicted yourself, while bringing in what you claimed to
> be a reason ("linear search") that was completely irrelevant to the
> contradiction which you had produced.
If you consider that a contradiction be my guess but isn't this
"contradiction claim" more irrelevant than this "linear search". No
offense, but that was ridiculous...
> On the basis of what you've posted so far, I'd say that readers here
> are entitled to conclude that you haven't yet reached a proper
> decision about what to implement;
How did you come up with that? Ofcourse I have. I'm doing work for a
populated site. I'm using mod_perl. I need to create a members
section. I need a persistent session with each user logged in to
mantain state to keep them logged in within the restricted area. So I
asked whether there was a Perl module to keep state without using
cookies.
> so it's hard to believe that you're
> ready for Perl-specific advice on how to implement it. Of course I
> could be wrong - obviously we don't have the full background to your
> problem, so folks have to respond on the basis of what you chose to
> post.
I didn't ask on how to implement it. I KNOW how to implement the pass
protection. I just was curious if there was away OTHER than using
cookies or mungled URLs to mantain state. For instance, ASP has a
function specifically for this...
> > which is why my post WASN'T about .htpasswd.
>
> It didn't appear to be about programming in Perl, either, you know.
I did ask is there away to mantain state IN THE Perl LANGUAGE without
cookies perhaps through a module... IF I was to ask "How can one
mantain state without cookies" in a non-language specific newsgroup
i'm POSITIVE someone would refer me to ASP.
------------------------------
Date: Fri, 21 May 2004 13:21:37 -0400
From: Richard Morse <remorse@partners.org>
Subject: Re: Password scheme/Persistent session...
Message-Id: <remorse-FFE221.13213721052004@plato.harvard.edu>
In article <237aaff8.0405210902.17aa0985@posting.google.com>,
krakle@visto.com (krakle) wrote:
> I didn't ask on how to implement it. I KNOW how to implement the pass
> protection. I just was curious if there was away OTHER than using
> cookies or mungled URLs to mantain state. For instance, ASP has a
> function specifically for this...
[snip]
> I did ask is there away to mantain state IN THE Perl LANGUAGE without
> cookies perhaps through a module... IF I was to ask "How can one
> mantain state without cookies" in a non-language specific newsgroup
> i'm POSITIVE someone would refer me to ASP.
The Perl language has no inherent way to do this. No language does.
There might, however, be modules available that help do this.
However, by the nature of the way HTTP works, you somehow have to have
the client maintain some kind of key which you use to select which
session it is representing.
ASP uses cookies by default to keep track of the session id. However,
if cookies aren't available on the client, it probably falls back to URL
rewriting. There are no other available ways to maintain the session
identifier without creating undesirable situations. Basing it off of IP
is not good, with the multitude of NAT servers.
If you wish to maintain session state without using cookies, you too
will have to fall back to URL rewriting.
HTH,
Ricky
--
Pukku
------------------------------
Date: Fri, 21 May 2004 17:30:14 GMT
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: Password scheme/Persistent session...
Message-Id: <G0rrc.9423$cz5.1816627@news4.srv.hcvlny.cv.net>
krakle wrote:
> "John W. Kennedy" <jwkenne@attglobal.net> wrote in message news:<_55rc.106204$MH.21799388@news4.srv.hcvlny.cv.net>...
>>krakle wrote:
>>>The question IS ontopic to this group.
>>No, it is not. You are asking a question about how the web works, not
>>how Perl works.
> I never asked how the web works or any sort of question to that
> nature. It was a question pertaining to sessions in mod_perl. Yes it
> will be used for a web site obviously but it DOESN'T make sense to ask
> a PERL question in a regular newsgroup dealing with the web that
> doesn't relate to PERL... Why is this so hard for you guys to
> understand...
We understand perfectly. You are asking a question about how the web
works in a Perl group. I suppose you also ask questions about Chebyshev
polynomials on comp.lang.fortran, double-entry bookkeeping in
comp.lang.cobol, and catchwords and press figures in comp.lang.postscript.
By the way, you're also abusing the web with your design; cookies are
how sessions are supposed to be maintained; that's why they were
invented. So essentially you're going to alt.fan.circularsaws and
asking how to use your chisel to drive Phillips-head screws.
Once you have found out someplace /appropriate/ how you might succeed in
thus shooting yourself in the foot, and you have read the relevant Perl
documentation, maybe you can get someone here to help you shoot yourself
in the foot with Perl.
I'll even give you a hint: SCARLET O’NEIL.
--
John W. Kennedy
"Only an idiot fights a war on two fronts. Only the heir to the throne
of the kingdom of idiots would fight a war on twelve fronts"
-- J. Michael Straczynski. "Babylon 5", "Ceremonies of Light and Dark"
------------------------------
Date: 21 May 2004 11:03:22 -0700
From: botfood@yahoo.com (dan baker)
Subject: Re: Password scheme/Persistent session...
Message-Id: <13685ef8.0405211003.3ce3136b@posting.google.com>
krakle@visto.com (krakle) wrote in message news:<237aaff8.0405131046.4e887b84@posting.google.com>...
> I'm creating members only service with perl (I will be using mod_perl)
> for a busy web site. I need to create a Members Area that is pass
> protected.
> ---------------------------
cookies are not inherently evil, and might be the only real solution
for reasonably secure web-based "member's login" areas...you just have
to be thoughtful in how you expire the "session" and what you expose
in the cookie. People surfing from home might want to stay "logged
in", whereas you want to be sure to expire sessions that might be on
computers in public places.
You COULD try to do something with IP addresses, but not many people
have static IPs.
I ended up using a scheme in a similar situation that sets a cookie
which is a combination of the username, the time, and the user's
encrypted password. comparing it to what I have stored server-side. if
everything doesn't match, or if the time is "too old" then I kick'em
out to re-login where I can check against the password, etc. The nice
thing about managing it this way is you can do nice things like email
passwords (only to the user's previously defined address) when they
forget, etc.
d
------------------------------
Date: Fri, 21 May 2004 11:56:08 -0400
From: Dan Wilga <dwilga-MUNGE@mtholyoke.edu>
Subject: Re: Pattern matching against a "use constant" character
Message-Id: <dwilga-MUNGE-39CA61.11560821052004@nap.mtholyoke.edu>
Here's a related question. Assume the following snippet:
use constant MAGIC => 'FOO';
and I want to do:
/FOObar/;
using this constant, instead of the literal 'FOO' in the pattern. Can
this be done?
--
Dan Wilga dwilga-MUNGE@mtholyoke.edu
** Remove the -MUNGE in my address to reply **
------------------------------
Date: 21 May 2004 17:12:15 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Pattern matching against a "use constant" character
Message-Id: <u9oeohsqsg.fsf@wcl-l.bham.ac.uk>
Dan Wilga <dwilga-MUNGE@mtholyoke.edu> writes:
> Here's a related question.
Related to what? You quote no context. Have you seen the posting
guidelines that are posted frequently?
> Assume the following snippet:
>
> use constant MAGIC => 'FOO';
>
> and I want to do:
>
> /FOObar/;
>
> using this constant, instead of the literal 'FOO' in the pattern. Can
> this be done?
Constants declared via 'use constant' are functions so although it may
not be immediately obvious[1] this is, in fact, FAQ: "How do I expand
function calls in a string?".
/@{[MAGIC]}bar/
Unfortunately perl does not spot that this interpolation can be done
at compile time.
[1] The fact that the FAQ uses the word 'expand' rather than the more
obvious word 'interpolate' does not help either.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 21 May 2004 16:15:20 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Pattern matching against a "use constant" character
Message-Id: <x73c5tsqnb.fsf@mail.sysarch.com>
>>>>> "DW" == Dan Wilga <dwilga-MUNGE@mtholyoke.edu> writes:
DW> Here's a related question. Assume the following snippet:
DW> use constant MAGIC => 'FOO';
DW> and I want to do:
DW> /FOObar/;
DW> using this constant, instead of the literal 'FOO' in the pattern. Can
DW> this be done?
a few ways but none are particularly great. perl6 has $() as the
scalar() equivilent and it can be interpolated with any expression
including constants inside (though the whole constant pragma will
probably go as perl6 supports a readonly trait).
so in perl5 you can use a temp variable:
my $foo = FOO ;
/${foo}bar/ ;
or
/${\FOO}bar/ ;
or there is an interpolate.pm module that supports $() but i don't know
it well.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Fri, 21 May 2004 16:16:46 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Pattern matching against a "use constant" character
Message-Id: <c8la1e$91e$1@wisteria.csv.warwick.ac.uk>
Quoth Dan Wilga <dwilga-MUNGE@mtholyoke.edu>:
> Here's a related question. Assume the following snippet:
>
> use constant MAGIC => 'FOO';
>
> and I want to do:
>
> /FOObar/;
>
> using this constant, instead of the literal 'FOO' in the pattern. Can
> this be done?
Of course :). TMTOWTDI:
my $magic = MAGIV;
/${foo}bar/;
/@{[MAGIC]}bar/;
$_ =~ MAGIC;
Ben
--
I must not fear. Fear is the mind-killer. I will face my fear and
I will let it pass through me. When the fear is gone there will be
nothing. Only I will remain.
ben@morrow.me.uk Frank Herbert, 'Dune'
------------------------------
Date: Fri, 21 May 2004 08:10:58 -0500
From: Web Surfer <raisin@delete-this-trash.mts.net>
Subject: Re: Perl array manipulation questions
Message-Id: <MPG.1b17bbdd67db2c3a989820@news.mts.net>
[This followup was posted to comp.lang.perl.misc]
In article <TC9rc.69981$sL3.30678@newssvr25.news.prodigy.com>,
bryan@akanta.com says...
> Hi,
>
> Two questions, which may be related...
>
> 1. If I have an array:
> @a = (1, 2, 3, 4);
>
> And I want to process each element in the array with some algorithm,
> lets say multiply each element by 2, is there a way to do this without
> creating a temp array, and -without- looping?
>
You can use the map function as follows :
@a2 = map { $_ * 2 } @a;
> Something along the lines of @a * 2, and @a would then be (2, 4, 6, 8)?
>
> 2. If I have two arrays:
> @a = (1, 2, 3, 4);
> @b = (2, 4, 6, 8);
>
> Is there a way to create a 3rd array of the same size such that @c = @a
> + @b, and after the operation @c = (3, 6, 9, 12). Again, without using
> a for or a foreach loop??
@sum = map { $a[$_] + $b[$_] } ( 0 .. $#a );
>
> Thanks,
> Bryan
>
>
------------------------------
Date: Fri, 21 May 2004 17:03:35 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Perl vs PHP
Message-Id: <2h6k3vF9jcnaU1@uni-berlin.de>
Charlton Wilbur wrote:
> For instance, mod_perl can't really be run safely in a shared
> environment the way mod_php can, because mod_perl gives the user
> access to server internals, and an error can hose all the server
> children -- even those serving other virtual hosts.
I would find it valuable if somebody could expand on (or provide a
pointer to info about) what it is that can actually happen with
mod_perl but not with mod_php.
As regards mod_perl, there seems to be some progress in pipeline:
http://httpd.apache.org/docs-2.0/mod/perchild.html
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 21 May 2004 15:55:07 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Perl vs PHP
Message-Id: <47dfa345414f0ab30f05467b6c5c3655@news.teranews.com>
>>>>> "Andy" == Andy Hassall <andy@andyh.co.uk> writes:
Andy> Namespace support was added in the early development stages of PHP5 - and then
Andy> removed again in Beta 2. Which was a mistake IMHO.
PHP seems to be reinventing nearly every aspect of Perl, five years
later, and badly.
It started out as a "simple" language (in fact, it was written in Perl
originally!) But when it was discovered lacking for task $x, then
the features for task $x were added. Repeat for many $x.
If you want a mature stable useful scaleable PHP, just use Perl.
I've said in the past:
PHP is training wheels without the bicycle
print "Just another Perl hacker,"; # the original!
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Fri, 21 May 2004 17:32:02 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Perl vs PHP
Message-Id: <c8le5d$e0l$3@ichaos.ichaos-int>
Gunnar Hjalmarsson <noreply@gunnar.cc> said:
>Charlton Wilbur wrote:
>> For instance, mod_perl can't really be run safely in a shared
>> environment the way mod_php can, because mod_perl gives the user
>> access to server internals, and an error can hose all the server
>> children -- even those serving other virtual hosts.
>
>I would find it valuable if somebody could expand on (or provide a
>pointer to info about) what it is that can actually happen with
>mod_perl but not with mod_php.
Hmm.. messing up with PerlChildInitHandler might well make a server
completely inoperative - and I think PHP doesn't have comparable
functionality (i.e. any access to Apache internals). Also the various
request-phase handlers provide very good hooks for extending Apache
functionality (the same hooks naturally exist in Apache C API, but
I find Perl a more familiar language to work with).
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
------------------------------
Date: Fri, 21 May 2004 15:55:09 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Perl work?
Message-Id: <f0f3ec55f5fc28dd392f3f889ea537b1@news.teranews.com>
>>>>> "John" == John Bokma <postmaster@castleamber.com> writes:
John> I am looking for freelance Perl work. I already found
John> jobs.perl.org. But I am wondering if there are more sites that list
John> freelance perl projects.
Any time I see something listed anywhere else, I tell them to post it
to jobs.perl.org - we really want that to be a nexxus of activity.
The highest quality jobs are found there.
print "Just another Perl hacker,"; # the first
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Fri, 21 May 2004 11:24:01 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Perl work?
Message-Id: <40ae2d23$0$209$58c7af7e@news.kabelfoon.nl>
Randal L. Schwartz wrote:
>>>>>>"John" == John Bokma <postmaster@castleamber.com> writes:
>
> John> I am looking for freelance Perl work. I already found
> John> jobs.perl.org. But I am wondering if there are more sites that list
> John> freelance perl projects.
>
> Any time I see something listed anywhere else, I tell them to post it
> to jobs.perl.org - we really want that to be a nexxus of activity.
I agree. The site looks nice, and I heard that they want to add
programmers to it too.
> The highest quality jobs are found there.
That was my impression too. The so called bidding sites I have seen are
a waste of time.
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
------------------------------
Date: Fri, 21 May 2004 15:00:37 GMT
From: "George Kinley" <georgekinley@hotmail.com>
Subject: Re: rmdir Question
Message-Id: <pQorc.16923$k4.341086@news1.nokia.com>
Tad,
I must ask you at this point , Do you hate me , or my question. or my
Posting to this NG
Reasons:
You Wrote to me :
1 > [ Please do not top-post.
> Have you seen the Posting Guidelines that are posted here
frequently?
2 > >> He's made off-topic posts before too:
> >> I've arranged to ignore all of his posts since that one.
As an Experience person in this field you should not humiliate others,
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrncamv0s.6v0.tadmc@magna.augustmail.com...
>
> [ Please do not top-post.
> Have you seen the Posting Guidelines that are posted here frequently?
> ]
>
>
> George Kinley <georgekinley@hotmail.com> wrote:
> > "Tad McClellan" <tadmc@augustmail.com> wrote in message
> > news:slrncampsj.6k8.tadmc@magna.augustmail.com...
> >> Jürgen Exner <jurgenex@hotmail.com> wrote:
> >> > George Kinley wrote:
> >> >> On Win2K, When I use rmdir , if the directory is open in other
> >> >> command window or in Explorer, it does not delete , and prints our
> >> >> "cannot remove %"#" ,
> >> >> my question is , is it possible to override this limitation
> >> >
> >> > And your Perl question is ....?
> >>
> >>
> >> He's made off-topic posts before too:
> >>
> >> Message-ID: <jmk3c.11154$k4.233803@news1.nokia.com>
> >>
> >> I've arranged to ignore all of his posts since that one.
>
> > hey, what is wrong with the question,
>
>
> It is not about Perl.
>
> It is about your filesystem/OS.
>
>
> > I want to know if it is possible to delete the dir, even if it is being
> > used,
>
>
> It depends on your filesystem/OS, not on the programming language
> that you choose to use.
>
>
> > is it possible to do in perl,
>
>
> It depends on your filesystem/OS.
>
> If allowed by your system, then Perl's unlink() should do the job.
>
>
> > it is not good to see comments like > I've arranged to ignore all of his
> > posts since that one.
>
>
> If you do not want to be killfiled for socially unacceptable behavior
> then do not engage in socially unacceptable behavior.
>
> You build your reputation, and then you live with it.
> (so consider building a good one!)
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Fri, 21 May 2004 19:53:16 +0200
From: Filipe Bonjour <fb@i.am.nowhere.net>
Subject: Running remote commands on Windows
Message-Id: <pan.2004.05.21.17.53.16.90199@i.am.nowhere.net>
Hi,
I'm writing a series of scripts to be run on a Windows 2000 server to
control applications on a series of other Windows servers.
Most commands to control the application are network-transparent. But we
still need to launch from the controlling server some commands on the
running servers. For instance we need to run tlist.exe to gather
information on processes running remotely.
I tried to find both generic modules for launching commands remotely (e.g.
Net::Rsh) or more specific modules (e.g. Win32::Process) but I haven't
found anything 100% satisfactory. I also thought of building a small
daemon running on the remote servers that would accepts requests, run
tlist.exe and return the reply. (I was thinking Net::Daemon, because I
don't know enough about Windows to write a server in C).
Any thoughts would be appreciated!
TIA,
Filipe
------------------------------
Date: Fri, 21 May 2004 14:05:52 +0100
From: "Bigus" <someone@somewhere.com>
Subject: Re: Sockets: receiving data
Message-Id: <c8kurh$169i@newton.cc.rl.ac.uk>
> > my $email = 'my@email.address'
>
> Missing semi-colon at the end of the line above. Is this the code you
> actually ran?
No.. I had to change that line when copying it into the post, lest I be
spammed to eternity.
> > my $cmd = "review LISTNAME msg pw=password";
> >
> > # --- Connect to Listserv --- #
> >
> > use IO::Socket;
> > my $lsv = IO::Socket::INET->new(
> > Proto => "tcp",
> > PeerAddr => "localhost",
> > PeerPort => '2306')
> > or die print "Connection problem :$!";
>
> You create a TCP socket here.
> ...
>
> > # send command header
> > print $lsv "1B".$bin;
> > recv($lsv, my $ans, 100, 0);
> > if($ans !~ /^250/){print "Failed because $ans\n"; exit;}
>
> recv is for UDP.
Oh. Sounds kind of fudnamental.. it works for smaller amounts of data
though. The main reason I am using that is because there's an example script
in C that does what I'm trying to do here. I don't understand half of it,
but it does use the recv command and is definitely over TCP, since the
interface is called TCPGUI. Maybe C is different in the way it handles
sockets or something.
Is there a quick-fix TCP alternative to recv in this context, or am I going
to have to do a loop again and get into a loop again and revisit the block
scenario?
Thanks
Bigus
------------------------------
Date: Fri, 21 May 2004 14:27:31 +0100
From: "Bigus" <someone@somewhere.com>
Subject: Re: Sockets: receiving data
Message-Id: <c8l044$10ri@newton.cc.rl.ac.uk>
> > recv is for UDP.
>
> Oh. Sounds kind of fudnamental.. it works for smaller amounts of data
> though. The main reason I am using that is because there's an example
script
> in C that does what I'm trying to do here. I don't understand half of it,
> but it does use the recv command and is definitely over TCP, since the
> interface is called TCPGUI. Maybe C is different in the way it handles
> sockets or something.
>
> Is there a quick-fix TCP alternative to recv in this context, or am I
going
> to have to do a loop again and get into a loop again and revisit the block
> scenario?
OK. got it:
Read()
and it works a treat (maybe I should add "so far" just in case I come across
another stumbling block)
:-)
Regards
Bigus
------------------------------
Date: 21 May 2004 15:04:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: Sockets: receiving data
Message-Id: <Xns94F070A1B5CB1asu1cornelledu@132.236.56.8>
"Bigus" <someone@somewhere.com> wrote in
news:c8l044$10ri@newton.cc.rl.ac.uk:
>> > recv is for UDP.
>>
>> Oh. Sounds kind of fudnamental.. it works for smaller amounts of data
>> though. The main reason I am using that is because there's an example
>> script in C that does what I'm trying to do here. I don't understand
>> half of it, but it does use the recv command and is definitely over
>> TCP, since the interface is called TCPGUI. Maybe C is different in the
>> way it handles sockets or something.
TCPGUI seems to be a library for your platform.
>>
>> Is there a quick-fix TCP alternative to recv in this context, or am I
>> going to have to do a loop again and get into a loop again and revisit
>> the block scenario?
>
> OK. got it:
>
> Read()
>
> and it works a treat (maybe I should add "so far" just in case I come
> across another stumbling block)
>
>:-)
I am not a TCP/IP or sockets expert by any means. I have written a few
programs in C (Winsock), Java, and Perl that use sockets. So my humble
advice to you is to read some generic sockets related literature first.
--
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)
------------------------------
Date: Fri, 21 May 2004 15:55:21 GMT
From: spamtotrash@toomuchfiction.com (Kevin Collins)
Subject: Re: SOLVED: How do I scope a variable if the variable name contains a variable?
Message-Id: <slrncas9j9.5gl.spamtotrash@doom.unix-guy.com>
In article <x7fz9ul8nu.fsf@mail.sysarch.com>, Uri Guttman wrote:
>>>>>> "KC" == Kevin Collins <spamtotrash@toomuchfiction.com> writes:
>
> >> 1. Symrefs (using-a-variable-as-a-variable-name) only work with globals.
>
> KC> Please clarify that, because I don't believe it :)
>
> KC> sub foo
> KC> {
> KC> my @bar = qw(a b c); # create array bar
> KC> my $baz = 'bar'; #
> KC> my @bee = @{$baz} # @bee == @bar
> KC> }
>
> have you actually tested that code? why do you believe that last
> assignment worked?
No, I didn't - obviously I should have :)
> #!/usr/local/bin/perl
>
> #use strict ;
>
> print foo(), "\n" ;
>
> sub foo {
> my @bar = qw(a b c); # create array bar
> my $baz = 'bar'; #
> my @bee = @{$baz} # @bee == @bar
> }
>
> that printed a blank line as i would expect.
>
> when i enabled strict, it bombed with this:
>
> Can't use string ("bar") as an ARRAY ref while "strict refs" in use at
> /home/uri/perl/test/symref_lex.pl line 10.
>
> which is also as expected.
>
> so please believe that symrefs don't work with lexical/my vars. my vars
> are NOT in the symbol table so you can't access them via symrefs.
> lexicals only work with real/hard refs (but hard refs can also work with
> globals).
I have now run the code and seen for myself. Its good to learn these things - I
guess I've never had a case where I attempted to do this before, and it seemed
that it should work.
Thanks for the explanation - your last paragraph makes it clear why this
doesn't work.
Kevin
------------------------------
Date: Fri, 21 May 2004 14:52:38 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: sort numeric lists
Message-Id: <x7ekpdsuh6.fsf@mail.sysarch.com>
>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
AS> Uri Guttman <uri@stemsystems.com> wrote in comp.lang.perl.misc:
>> use Sort::Maker ;
>>
>> my $sorter = make_sorter(
>> plain => 1,
>> number => '$_->[0]',
>> number => '$_->[1]',
>> number => '$_->[2]',
>> ) ;
>>
>> my @sorted = $sorter->( @unsorted ) ;
>>
>> i may have an alpha version of this module ready in a few weeks if
>> anyone is interested in playing with it. the goal is to have it on cpan
>> before yapc which is in mid-june.
AS> I assume you'll announce the alpha on clpm. I'm watching.
i gave a warmup talk on it the other night to boston.pm. you can get an
alpha tarball from
http://stemsystems.com/sort/Sort-Maker-0.01.tar.gz
the dir sort/slides/slides has the slide show. the module is in fairly
good shape but it needs more tests, benchmarks, examples (in pod and
slides), and some minor things/features are still to be done. volunteer
help is welcome and will be paid in acknowledgement glory. i should have
a newer alpha/beta up next week after i do an edit pass this weekend. my
goal is to cpan it before yapc as i am giving the talk there.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 21 May 2004 06:34:08 -0700
From: gg@snark.freeserve.co.uk (Phil Hibbs)
Subject: Re: Win32, FTP, line ends
Message-Id: <a9ec249e.0405210534.17dd678e@posting.google.com>
Jussi Jumppanen <jussij@zeusedit.com> wrote in message news:<40AC9CE8.392B@zeusedit.com>...
> Take a look at the Zeus for Windows editor:
Thanks, I'll take a look, I'm always on the lookout for a good text
editior. I can't use it for this purpose, as the script needs to send
hundreds of files, and gets the list of files from a text config file.
Phil Hibbs.
------------------------------
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 6594
***************************************