[25544] in Perl-Users-Digest
Perl-Users Digest, Issue: 7788 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 16 09:06:00 2005
Date: Wed, 16 Feb 2005 06:05:40 -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, 16 Feb 2005 Volume: 10 Number: 7788
Today's topics:
Re: Setting RTS with Win32::SerialPort <ron@savage.net.au>
Re: [perl-python] problem: reducing comparison <cam.ac.uk@mh391.invalid>
Re: A wide open niche in Perl publishing... <amead@comcast.net>
Re: A wide open niche in Perl publishing... ioneabu@yahoo.com
Re: A wide open niche in Perl publishing... (Peter Scott)
backticks with threads or forks hang program (Warren)
Re: CGI System Call in perl <ganchrow@gmail.com>
Re: copy directory structure without files <news@chaos-net.de>
Re: Don't understand this syntax - ioneabu@yahoo.com
Re: Don't understand this syntax - <spamtrap@dot-app.org>
Re: Don't understand this syntax - ioneabu@yahoo.com
Re: Don't understand this syntax - <spamtrap@dot-app.org>
Re: Feeding false an App <hackeras@gmail.com>
Re: Feeding false an App <cwilbur@mithril.chromatico.net>
Re: Feeding false an App <hackeras@gmail.com>
Re: Logging into and parsing a website using Perl (Peter Scott)
Re: perl corrupting my open files - mkfifo? <nobull@mail.com>
POD documentation (Abhijit)
Re: POD documentation <No_4@dsl.pipex.com>
Problem with IO::Socket <news@chaos-net.de>
Re: Problem with IO::Socket <1usa@llenroc.ude.invalid>
Re: problem: reducing comparison <xah@xahlee.org>
Re: Record Hash Data Structure (Newbie) rajasekaran.natarajan@gmail.com
Re: regexp experts, need some help <josef.moellers@fujitsu-siemens.com>
SET Operations in Perl <georgekinley@hotmail.com>
Re: SET Operations in Perl <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: SET Operations in Perl <georgekinley@hotmail.com>
Re: SET Operations in Perl <phaylon@dunkelheit.at>
Re: SET Operations in Perl <toreau@gmail.com>
Re: The Problem with Perl <dformosa@zeta.org.au>
Re: The Problem with Perl <cwilbur@mithril.chromatico.net>
Re: Weird Error message <phaylon@dunkelheit.at>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 16 Feb 2005 19:59:07 +1100
From: Ron Savage <ron@savage.net.au>
Subject: Re: Setting RTS with Win32::SerialPort
Message-Id: <200521619597.557732@ron>
On Mon, 14 Feb 2005 20:12:41 +1100, Klaus.Kleiner@gmx.net wrote:
Hi Klaus
>=A0I'm trying to set RTS via Win32::SerialPort. I'm using
Lateral thinking: http://realterm.sourceforge.net/
--
Cheers
Ron Savage, ron@savage.net.au on 16/02/2005
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company
------------------------------
Date: Wed, 16 Feb 2005 11:49:38 +0000
From: Michael Hoffman <cam.ac.uk@mh391.invalid>
Subject: Re: [perl-python] problem: reducing comparison
Message-Id: <cuvc0l$45v$1@gemini.csx.cam.ac.uk>
Xah Lee wrote:
> attached below is the Perl documentation that i wrote for a function
> called "reduce", which is really the heart of a larger software.
Don't shadow built-ins. Especially for a function name.
--
Michael Hoffman
------------------------------
Date: Tue, 15 Feb 2005 23:18:10 -0600
From: Alan Mead <amead@comcast.net>
Subject: Re: A wide open niche in Perl publishing...
Message-Id: <pan.2005.02.16.05.18.09.64267@comcast.net>
On Tue, 15 Feb 2005 15:04:30 +0000, J Krugman wrote:
> Unless I've been looking in all the wrong places, it seems to me
> that there's a wide open niche in Perl-related publishing (and in
> all of programming-related publishing, for that matter). I don't
> even know what to call the type of book I'm thinking of. It's
> something in the spirit of the (awesome) Perl Cookbook, but dedicated
> to larger-scale design issues, instead of bite-sized solutions.
I agree. I also agree that it's a Perl issue. Honestly, if you
get a pattern book that is devoid of executable code then how much have
you learned? And if an application book is written using PHP or C then
you'll probably start using PHP or C. I think Perl could use more
literature on this.
But I don't think it is a complete vacuum.
The book "Writing apache modules with Perl and C" has a fair discussion of
authentication. A lot of people will tell you that authentication should
be left to the server and this book is perfect for Perl programmers who
are using Apache and who can control their webserver. If you get hosted
somewhere (so you cannot load modules), this information is still somewhat
helpful in creating application-level authentication. (Since creating
sessions is a basic issue with any web application, authentication
discussions are germane to all CGI applications, I think.)
Then there is "Writing CGI Applications with Perl" which is the great book
on this topic. The authors discuss a complete content management system
and supply all the code. I seem to have lost my copy and I'm going to go
buy another.
Also, if you look at any of the framework-ish projects (e.g., Mason),
they provide a model for applications. If those models work for you then
you're time will be better spent learning to use them than re-creating the
wheel. I've found that learning any one system takes quite a bit of time
and energy and they all have purposes for which they are suited better or
worse. Unless you can leverage someone else's work (e.g., "The
competition is using Mason, so obviously we could as well") it's hard to
shop around.
I've considered trying to write something myself on this sort of topic
with a slant towards people who collect data. You can see my latest
creation at the link below. I thought I would describe my code in
Schwartz's line-by-line style. Who knows if I will have the time...
-Alan
--
Help out our research and get a free
personality profile:
http://www.web-data-collection.org
------------------------------
Date: 15 Feb 2005 22:24:30 -0800
From: ioneabu@yahoo.com
Subject: Re: A wide open niche in Perl publishing...
Message-Id: <1108535070.215549.52840@z14g2000cwz.googlegroups.com>
Alan Mead wrote:
> I've considered trying to write something myself on this sort of
topic
> with a slant towards people who collect data. You can see my latest
> creation at the link below. I thought I would describe my code in
> Schwartz's line-by-line style. Who knows if I will have the time...
1) Reading books and usenet and practicing writing code is no
substitute for getting a computer science degree and having years of
experience in the industry. To make up for this, I am trying to learn
the discipline of using as much of other people's code and as little of
mine as possible. It has not been that easy.
2) Books that make me follow the building of big programs with long,
drawn out code examples put me to sleep. I also can't stand when they
leave the code out because it's on the disk or online.
3) Programming takes more time and effort than I thought it would when
I first got started.
4) Is it just me or do other people find Perl to be highly addictive,
unlike any other computer language?
5) Isn't it a scary thought that one individual human being created
Perl? It seems like the Bachs and Mozarts of today are working on
software and not music.
6) I had a few more points but I forgot them. I need to go look at
that Mason thing...
wana
------------------------------
Date: Wed, 16 Feb 2005 13:17:47 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: A wide open niche in Perl publishing...
Message-Id: <%JHQd.407523$8l.262775@pd7tw1no>
In article <cuuja1$sjs$1@reader2.panix.com>,
J Krugman <jkrugman345@yahbitoo.com> writes:
>First, a working extended example cannot be content with presenting
>beautiful theoretical schemes, featuring infinitely sensible
>abstractions out the wazoo and layer upon layer of clever indirections,
>if come run time the code ends up being slower than molasses in
>January, or if, in the concrete problem at hand, the implementation
>of gorgeous design pattern A happens to conflict in subtle ways
>with the implementation of exquisite pattern B. A real example
>has to be, above all, functional, which may or may not agree with
>higher-level considerations. (Have you seen the guts of perl???
>How's *that* for pretty? Most of perl internals would give the
>GoF seizures.)
Heh. Well said. Developing something like, say, the
aforementioned database application runs into so many real-world
issues that force pragmatism to supersede idealism. Add in
error checking, exception handling, logging, authentication,
authorization, and other cross-cutting requirements and the
beautiful patterns will be buried under a pile of... code.
Waving a hand and mumbling, "Aspect-Oriented Programming" ain't
good enough.
>(I sure hope that someone at O'Reilly, or Manning, or New Riders,
>or Apress, etc. is reading this.)
Someone will.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: 16 Feb 2005 05:18:06 -0800
From: warren@netlab.co.za (Warren)
Subject: backticks with threads or forks hang program
Message-Id: <d10285b8.0502160518.20088b34@posting.google.com>
Greetings
The function of the script below is to execute scripts (perl) at
regular intervals. As I have no idea how long these external scripts
will take to excute I decided to use threads and execute each script
from its own thread. This appeared to work until the number of threads
increased. The greater the number of threads the more lightly the
program will hang. As the output of the external scripts is required
the backticks are used.
I then tried fork very quickly (a very simple test implementation is
in the execute script but commented out, remove the # and add # to the
two lines with $Thread in them to test). This produced the same
problem.
I have also tried system() which does not appear to have the problem,
but without the output it is of no use.
How to reproduce:
The first program is the 'executer' and the second is the script
executed by the 'executer'. In order to reproduce make 13 files of the
'executed' script(containing the TargetFunction) called
Script0.script
Script1.script
....
Script13.script
Then run the 'executer'. You may have to run it a few times for the
problem to show. If the executer runs for about 15 seconds then ctrl+c
it and re-run. At some point the program should (does for me) stop at
the backtick statement.
Any help in resolving the issue would be greatly appreciated.
Code for executer:
###########################################################3
#!/usr/bin/perl -w
use strict;
use threads;
use threads::shared;
#use IO::Socket;
use Sys::Hostname;
my @PassiveIDs=();
sub ExecuteThread
{
(my $ListID)=@_;
#sleep($ListID);
my $TimeOfStart;
while (1)
{
$TimeOfStart=time();
my $Command="perl Script".$ListID.".script ";
print "Command: ".$Command."\n";
print "Start Cmd $ListID\n";
my $Retval=`$Command`;
print "End Cmd $ListID\n";
print "Result: ".$Retval."\n";
my $SleepTime=(5)-(time()-$TimeOfStart);
if ($SleepTime<0)
{
$SleepTime=2;
}
sleep($SleepTime);
}
}
sub StartTCPClient
{
@PassiveIDs=(0,1,2,3,4,5,6,7,8,9,10,11,12,13);
print "Processing result\n";
my $IDCount=0;
foreach my $ID (@PassiveIDs)
{
$ID=~ s/[\r\n\0\000]//g;
print "Doing PassiveID -".$ID."-\n";
# my $newpid=fork();
# if (! defined $newpid) { #hosed
# die "fork() error: $!\n";
# }
# elsif ($newpid == 0)
# {
# #child
# ExecuteThread ($IDCount);
# }
my $Thread = threads->create("ExecuteThread",$IDCount );
$Thread->detach();
++$IDCount;
}
}
StartTCPClient ();
while (1)
{
sleep(10);
}
########################################################################
Executed script: This script is executed by the above program, need to
make 13 copies with the file names specified above (ie Script0.script,
Script1.script .... Script13.script).
#########################################################################
sub TargetFunction
{
}
my ($a,$b,$c,$d);
($a,$b,$c,$d)=@_;
print TargetFunction($a,$b,$c,$d);
##########################################################################
Op-system: win2000 server
perl: This is perl, v5.8.4 built for MSWin32-x86-multi-thread
Regards
------------------------------
Date: 16 Feb 2005 05:20:56 -0800
From: "ganchrow" <ganchrow@gmail.com>
Subject: Re: CGI System Call in perl
Message-Id: <1108560056.910220.24610@z14g2000cwz.googlegroups.com>
Yeah, I was kind of afraid this wasn't at heart really a Perl question.
Thanks for your help, though.
------------------------------
Date: Wed, 16 Feb 2005 09:51:04 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: copy directory structure without files
Message-Id: <slrnd162bo.srt.news@maki.homeunix.net>
Darren Dunham wrote :
> or for other non-perl solutions, I like this, especially if you have to
> do it more than once in the same location.
>
> rsync -a --include "*/" --exclude "*" source/ target
To do the same thing, but creating a file that can be reused:
To create the DIRLIST-file:
find . -type d -print0 | cpio -o -O > DIRLIST
To extract it:
cpio -i < DIRLIST
HTH
Martin
--
perl -e 'print 7.74.117.115.116.11.32.13.97.110.111.116.104.101.114.11
.32.13.112.101.114.108.11.32.13.104.97.99.107.101.114.10.7'
------------------------------
Date: 15 Feb 2005 21:24:29 -0800
From: ioneabu@yahoo.com
Subject: Re: Don't understand this syntax -
Message-Id: <1108531469.632236.180700@l41g2000cwc.googlegroups.com>
Sherm Pendley wrote:
> Check the docs for the function - "perldoc -f split" and see what it
says.
> Notice how the first argument is listed as /PATTERN/? That means it's
a
> regex, so the escapes and asterisks have the same meaning they do in
other
> regexes. Let's break it down:
if I have a string:
my $string = "hello, how are you?";
my @string = split ' ', $string;
The extra white spaces are all removed as if I had used /\s+/, except,
the docs say that they are not quite the same because leading white
space is removed with ' '. By 'leading white space' do they mean
before each word or just at the beginning of the string? Because this
produces completely different results:
my $string = "hello::::how::::are:::::::you?";
my @string = split ':', $string;
now you get a bunch of null fields throughout the array.
There seems to be more to the special properties of ' ' then the docs
state.
wana
------------------------------
Date: Wed, 16 Feb 2005 00:56:43 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Don't understand this syntax -
Message-Id: <SIednb5bwtkAfY_fRVn-1A@adelphia.com>
ioneabu@yahoo.com wrote:
> if I have a string:
>
> my $string = "hello, how are you?";
> my @string = split ' ', $string;
>
> The extra white spaces are all removed as if I had used /\s+/, except,
> the docs say that they are not quite the same because leading white
> space is removed with ' '. By 'leading white space' do they mean
> before each word or just at the beginning of the string?
The beginning of the string. Try it and see:
#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;
my $string = ' Hello, I am fine, thanks.';
my @string = split ' ', $string;
print Dumper(\@string);
my @string2 = split /\s+/, $string;
print Dumper(\@string2);
Notice the difference. Splitting on ' ' doesn't give an empty element at the
beginning of the list, whereas /\s+/ does give them.
> There seems to be more to the special properties of ' ' then the docs
> state.
Not at all. The docs state:
... If PATTERN is also omitted, splits on whitespace (after skipping
any leading whitespace). ...
Later on, they say:
As a special case, specifying a PATTERN of space (' ') will
split on white space just as "split" with no arguments does.
Thus, "split(' ')" can be used to emulate awk's default behav-
ior, whereas "split(/ /)" will give you as many null initial
fields as there are leading spaces.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 15 Feb 2005 23:10:38 -0800
From: ioneabu@yahoo.com
Subject: Re: Don't understand this syntax -
Message-Id: <1108537838.711862.36350@f14g2000cwb.googlegroups.com>
Sherm Pendley wrote:
> > There seems to be more to the special properties of ' ' then the
docs
> > state.
>
> Not at all. The docs state:
>
> ... If PATTERN is also omitted, splits on whitespace (after
skipping
> any leading whitespace). ...
>
> Later on, they say:
>
> As a special case, specifying a PATTERN of space (' ') will
> split on white space just as "split" with no arguments does.
> Thus, "split(' ')" can be used to emulate awk's default behav-
> ior, whereas "split(/ /)" will give you as many null initial
> fields as there are leading spaces.
so
my @string = split ' ', $string;
is like
$string =~ s/^\s*//;
my @string = split /\s+/, $string;
which is two special properties that make it different from 'c' where c
is any single character other than a single white space character. The
first special property is the trimming of leading white space. The
second is to match one or more white space characters as the delimiter.
I just thought that maybe this wasn't clear in the doc's explanation.
The comparison to awk is wasted on me because I don't have experience
with it. I only started learning how to use a Unix-type system
relatively recently. It's too bad it took Apple so long to adopt Jobs'
concept of a Unix OS for the Mac or I might have had an additional 15
years or so experience with it. I know, there's Linux, but hardware
support was poor until now.
wana
------------------------------
Date: Wed, 16 Feb 2005 03:35:44 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Don't understand this syntax -
Message-Id: <fcmdnZb3pNt8mI7fRVn-gA@adelphia.com>
ioneabu@yahoo.com wrote:
> so
>
> my @string = split ' ', $string;
>
> is like
>
> $string =~ s/^\s*//;
> my @string = split /\s+/, $string;
Except that it doesn't change $string, so it's more like:
$string =~ m/^\s*(.*)/;
my @string = $1 ? split(/\s+/, $1) : ();
> It's too bad it took Apple so long to adopt Jobs'
> concept of a Unix OS for the Mac or I might have had an additional 15
> years or so experience with it.
There was MacPerl. There was also MachTen, although that wasn't all that
great an environment to work in.
But anyway - I don't see the reference to awk as being all that important.
"Splits on whitespace (after skipping any leading whitespace)" is pretty
clear all by itself, and you don't have to be familiar with awk or any
other Unix-isms to understand that.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Wed, 16 Feb 2005 10:49:11 +0000 (UTC)
From: Richard Anderson <hackeras@gmail.com>
Subject: Re: Feeding false an App
Message-Id: <Xns95FF82B16918Ehackerasgmailcom@194.177.210.210>
Richard Anderson <hackeras@gmail.com> wrote in
news:Xns95FE8294BC490hackerasgmailcom@194.177.210.210:
Can you help me implement my suggestion please?
------------------------------
Date: Wed, 16 Feb 2005 13:09:25 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Feeding false an App
Message-Id: <87acq4pse8.fsf@mithril.chromatico.net>
>>>>> "RA" == Richard Anderson <hackeras@gmail.com> writes:
RA> Richard Anderson <hackeras@gmail.com> wrote in
RA> news:Xns95FE8294BC490hackerasgmailcom@194.177.210.210:
RA> Can you help me implement my suggestion please?
Sure. You have two choices: learn Perl or hire a programmer. If you
want to pursue the former, take your best effort, and when you get
stuck, post a specific question and the code you're having a problem
with. If you want to pursue the latter, you can try http://jobs.perl.org.
Here's a hint: what you're asking to do is probably going to take a
fair bit of work, and you're going to need to learn quite a bit. If
you're not willing to put in any effort -- and it seems from your
posts so far that you're not only not willing to put in much effort,
you're willing to invest more effort into pestering others into
writing the code for you -- then you're probably better off just
giving up now.
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
Date: Wed, 16 Feb 2005 13:59:02 +0000 (UTC)
From: Richard Anderson <hackeras@gmail.com>
Subject: Re: Feeding false an App
Message-Id: <Xns95FFA2DDDC1FEhackerasgmailcom@194.177.210.210>
Charlton Wilbur <cwilbur@mithril.chromatico.net> wrote in
news:87acq4pse8.fsf@mithril.chromatico.net:
>>>>>> "RA" == Richard Anderson <hackeras@gmail.com> writes:
>
> RA> Richard Anderson <hackeras@gmail.com> wrote in
> RA> news:Xns95FE8294BC490hackerasgmailcom@194.177.210.210:
>
> RA> Can you help me implement my suggestion please?
>
> Sure. You have two choices: learn Perl or hire a programmer. If you
> want to pursue the former, take your best effort, and when you get
> stuck, post a specific question and the code you're having a problem
> with. If you want to pursue the latter, you can try
> http://jobs.perl.org.
>
> Here's a hint: what you're asking to do is probably going to take a
> fair bit of work, and you're going to need to learn quite a bit. If
> you're not willing to put in any effort -- and it seems from your
> posts so far that you're not only not willing to put in much effort,
> you're willing to invest more effort into pestering others into
> writing the code for you -- then you're probably better off just
> giving up now.
Actually, you are right. I'll stick to the former solution and then when
i am stuck i'll pop my specific question :-)
------------------------------
Date: Wed, 16 Feb 2005 13:25:23 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Logging into and parsing a website using Perl
Message-Id: <7RHQd.407246$Xk.367396@pd7tw3no>
In article <a4yQd.6434$dZ.349666@news20.bellglobal.com>,
"Antwerp" <bonjo90@yahoo.co.in> writes:
>Hi,
>
> I'm trying to create a perl script that will log into a website (the login
>form uses POST), navigate to several pages, and append the (html) content parsed
>from those pages to a seperate log file. I'm not very familiar with this aspect
>of perl, and have been having some trouble in the POSTing of the form data,
>while using cookies to log in.
Way too much work to go to. Get WWW::Mechanize from CPAN and you can get
rid of most of your code.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: Wed, 16 Feb 2005 13:21:18 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: perl corrupting my open files - mkfifo?
Message-Id: <cuvh26$2m3$1@sun3.bham.ac.uk>
Jeremy Slade wrote:
> I'm running perl 5.6.1 on linux i686 kernel 2.6.8
>
> I had a very strange experience this morning that is rather alarming to
> me. I was running a perl script that has been running many hundreds of
> times before... I had executed it with the incorrect options, so I hit
> Ctrl-C to kill it.
>
> Somehow the result of this is that every file to which I had an open
> handle became a unix FIFO on disk -- as though the file was removed,
> then mkfifo was run in it's place. e.g. it look like this afterwards:
>
> % ls -lF foo
> prw-rw-r-- 1 jgs jgs 0 Feb 15 10:39 foo|
I have seen similar corruption to files that had been recently open (not
necessarily by Perl) on Linux ext2 filesystems that were not cleanly
unmounted. Has there perhaps been a system crash, power outage or disk
hardware falure?
Anyhow this is more likely a Linux problem than a Perl one so I suggest
you ask in a Linux newsgroup. Upgrading to a resilient FS seems to have
stopped the problem.
------------------------------
Date: 15 Feb 2005 22:03:26 -0800
From: abhi_vlsi02@yahoo.com (Abhijit)
Subject: POD documentation
Message-Id: <451895e.0502152203.638ae580@posting.google.com>
Hello everyone,
When I write a POD document, it is not aligned properly. Some of the
words of next line have come to the previous one, some of the words
from one line exceeding column number 76 are being wrapped to next
line. Finally, the document will not be so readable.
Is there any utility to align the POD document? If not, then how do I
align the lines? just spaces and tabs are just too complex and above
all at the console, we don't get what we see in the POD document in
the .pm file !!!!
thanks in advance
-Abhijit
------------------------------
Date: Wed, 16 Feb 2005 09:43:24 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: POD documentation
Message-Id: <NoqdnQ10JIYgiI7fRVnyhg@pipex.net>
Abhijit wrote:
>
> When I write a POD document, it is not aligned properly. Some of the
> words of next line have come to the previous one, some of the words
> from one line exceeding column number 76 are being wrapped to next
> line.
That is what is supposed to happen. The "standard" terminal is 80
characters wide, and you don't want lines longer than that.
> Finally, the document will not be so readable.
Actually, it will, in general, be more readable.
> Is there any utility to align the POD document?
Pod is aligning it - I take it you really mean "keep the line splitting
I have set".
Just indent everything you want left alone with one space.
> and above
> all at the console, we don't get what we see in the POD document in
> the .pm file !!!!
You get to see the logical contents. POD documentation can be turned
into "text", html, PostScript, latex (and thence PDF). Each of these has
different widths and so you shouldn't be interested in line breaks except
in things such as code examples.
--
Just because I've written it doesn't mean that
either you or I have to believe it.
------------------------------
Date: Wed, 16 Feb 2005 08:50:14 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Problem with IO::Socket
Message-Id: <slrnd15upm.srt.news@maki.homeunix.net>
Hello group,
I am trying to use a script from the book "Networkprogramming with Perl"
by Lincoln D. Stein.
----
#!/usr/bin/perl
use warnings;
use strict;
use IO::Socket;
my $server = shift;
my $fh = IO::Socket::INET->new($server);
my $line = <$fh>;
print $line;
----
It is supposed to read the first line from a remote server's welcome
message.
% ./lgetr.pl wuarchive.wustl.edu:daytime
is supposed to output the current date of that server.
% ./lgetr.pl wuarchive.wustl.edu:ftp
should print the welcome message of the ftp service on
wuarchive.wustl.edu
% ./lgetr.pl mail.hotmail.com:smtp
should print the welcome message of the smtp-server on mail.motmail.com
and so on.
In my case the script hangs infinitely without any output.
I have even tried my local smtp server wuth the sam result.
What could be wrong?
Any help will be appreciated.
Regards
Martin
--
perl -e 'print 7.74.117.115.116.11.32.13.97.110.111.116.104.101.114.11
.32.13.112.101.114.108.11.32.13.104.97.99.107.101.114.10.7'
------------------------------
Date: 16 Feb 2005 13:58:09 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Problem with IO::Socket
Message-Id: <Xns95FF5B3D96B50asu1cornelledu@132.236.56.8>
Martin Kissner <news@chaos-net.de> wrote in
news:slrnd15upm.srt.news@maki.homeunix.net:
> What could be wrong?
I am not sure.
> Any help will be appreciated.
FWIW, the services you are trying
1) May not be enabled on the computers you have tried
2) May be behind a firewall
3) May require prior authentication
Sinan
------------------------------
Date: 16 Feb 2005 01:16:50 -0800
From: "Xah Lee" <xah@xahlee.org>
Subject: Re: problem: reducing comparison
Message-Id: <1108545410.285927.153320@c13g2000cwb.googlegroups.com>
=A9someone sent me the following code, which performs identically with
the original reduce. (tested for pairings of comb(n) with large n)
Superb.
=A9
=A9def reduce2( pairings, pair ):
=A9 result=3D{}
=A9 for i,j in pairings.itervalues():
=A9 if i in pair: i=3Dpair[0]
=A9 if j in pair: j=3Dpair[0]
=A9 if i>j: (i,j) =3D (j,i)
=A9 if i!=3Dj: result["%d,%d"%(i,j)] =3D (i,j)
=A9 return result
=A9
=A9
=A9def reduce(pairings, pair):
=A9 ps=3Dpairings.copy(); j=3Dpair;
=A9 ps.pop("%d,%d"%(j[0],j[1]),0)
=A9 for k in pairings.itervalues():
=A9 if (k[0]=3D=3Dj[0]):
=A9 if (j[1] < k[1]):
=A9 ps.pop("%d,%d"%(j[1],k[1]),0)
=A9 else:
=A9 ps.pop("%d,%d"%(k[1],j[1]),0)
=A9 if (k[1]=3D=3Dj[0]):
=A9 if (k[0] < j[1]):
=A9 ps.pop("%d,%d"%(k[0],j[1]),0)
=A9 else:
=A9 ps.pop("%d,%d"%(j[1],k[0]),0)
=A9 return ps
=A9
=A9is reduce2 more efficient? It works entirely differently. I'll have
to think about it... besides algorithmic... onto the minute academic
diddling, i wonder if it is faster to delete entries in dict or add
entries...
Xah
xah@xahlee.org
http://xahlee.org/PageTwo_dir/more.html
Xah Lee wrote:
> here are the answers:
>
> Perl code:
>
> sub reduce ($$) {
> my %hh=3D %{$_[0]}; # e.g. {'1,2'=3D>[1,2],'5,6'=3D>[5,6],...}
> my ($j1,$j2)=3D($_[1]->[0],$_[1]->[1]); # e.g. [3,4]
> delete $hh{"$j1,$j2"};
> foreach my $k (keys %hh) {
> $k=3D~m/^(\d+),(\d+)$/;
> my ($k1,$k2)=3D($1,$2);
> if ($k1=3D=3D$j1) {
> if ($j2 < $k2) {
> delete $hh{"$j2,$k2"};
> }
> else {
> delete $hh{"$k2,$j2"};
> };
> };
> if ($k2=3D=3D$j1) {
> if ($k1 < $j2) {
> delete $hh{"$k1,$j2"};
> }
> else {
> delete $hh{"$j2,$k1"};
> };
> };
> }
> return \%hh;
> }
>
> ...
> In imperative languages such as Perl and Python and Java, in general
it
> is not safe to delete elements when looping thru a list-like entity.
> (it screws up the iteration) One must make a copy first, and work
with
> the copy.
>
> Note also that in Python there's already a function called reduce.
(it
> is equivalent to Mathematica's Fold.) In Python, looks like user can
> over-ride default functions.
>
> This post is archived at
> http://xahlee.org/perl-python/pairing_reduce.html
> Possible errata or addenda will appear there.
>=20
> Xah
> xah@xahlee.org
> http://xahlee.org/PageTwo_dir/more.html
------------------------------
Date: 15 Feb 2005 22:19:52 -0800
From: rajasekaran.natarajan@gmail.com
Subject: Re: Record Hash Data Structure (Newbie)
Message-Id: <1108534792.380446.310600@g14g2000cwa.googlegroups.com>
>use strict
I have implemented after reading man pages, i think now have some
prelim idea abt how to use my. (thanks for Gibson too).
>parallel hash
parrellel hash you mean using references, I am not yet caught upto
references
(esp to arrays and hashes) may be I will try that after this iteration
with hashes. Actually I am doing this problem to learn Perl.
>>memory
I also thought so, after reading abt hash performance in some webpage.
but I dont know much abt these kind of stuff, but I have a decent
machine HP VISUALISE3750 or SGI OCTANE with good config, hope these
will do.
xhoster@gmail.com wrote:
> rajasekaran.natarajan@gmail.com wrote:
> >
> > I have also given the input data format. I need to link the
generated
> > hash data to the element hash which I am gonna do later in the
second
> > part. Basically every element has four grids and each grid has
x,y,z
> > corordinates. + 2 more field. which kind of format is better to
store
> > this and retrieve it for almost a 300,000 elements.
>
> If you try to store this as 300,000 hashes, you may run into memory
> problems due the large amount of overhead with hashes. It depends on
> how much memory you have, of course. I might be tempted to switch to
> parallel hashes for each field, each with 300,000 entries. More
annoying
> to work with in some ways, but more memory efficient.
>
> > ps: I tried to use `use strict` but it makes life harder for a
newbie
> > like me. any better detailed source abt the use strict stuff.
>
> We were all newbies at one point, and trust us, "use strict" does not
make
> your life harder. It may seem that way at first, but remember that
you
> came here for our wisdom, and this is the centerpiece of that wisdom.
Use
> strict.
>
> For detailed info, see perldoc strict, and the section on "my" in
> perldoc perlfunc. And perldoc perlsub.
>
> Xho
>
> --
> -------------------- http://NewsReader.Com/ --------------------
> Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Wed, 16 Feb 2005 08:49:41 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: regexp experts, need some help
Message-Id: <cuutul$jsk$2@nntp.fujitsu-siemens.com>
phaylon wrote:
> Josef Moellers wrote:
>=20
>=20
>>One can specify this in as much detail as desired:
>=20
>=20
> Yes. but there's also, like almost everywhere, a too much.
>=20
I prefer to specify anything that is fixed, to adhere to the principle=20
of least surprise. You never know what's lurking behind the corner.
OTOH, this can backfire, I agree.
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Wed, 16 Feb 2005 13:08:21 GMT
From: "George" <georgekinley@hotmail.com>
Subject: SET Operations in Perl
Message-Id: <xn0dykqms1gtmua000@news.europe.nokia.com>
Hi,
how can we do SET Operations in perl using two hashes or arrays
in case it is too easy , please redirect me to some link
thanks
------------------------------
Date: Wed, 16 Feb 2005 14:24:02 +0100
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: SET Operations in Perl
Message-Id: <Xns95FF927D55D46elhber1lidotechnet@62.89.127.66>
"George" <georgekinley@hotmail.com> wrote:
> Hi,
> how can we do SET Operations in perl using two hashes or arrays
> in case it is too easy , please redirect me to some link
www.whatthehellareyoutalkingabout.com
--
Cheers,
Bernard
------------------------------
Date: Wed, 16 Feb 2005 13:29:16 GMT
From: "George" <georgekinley@hotmail.com>
Subject: Re: SET Operations in Perl
Message-Id: <xn0dykr5d1hkhz4001@news.europe.nokia.com>
Bernard El-Hagin wrote:
> "George" <georgekinley@hotmail.com> wrote:
>
> > Hi,
> > how can we do SET Operations in perl using two hashes or arrays
> > in case it is too easy , please redirect me to some link
>
>
> www.whatthehellareyoutalkingabout.com
what was that you could not understand,
dude
------------------------------
Date: Wed, 16 Feb 2005 14:41:37 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: SET Operations in Perl
Message-Id: <pan.2005.02.16.13.41.37.658793@dunkelheit.at>
George wrote:
> what was that you could not understand, dude
I think the problem relies in "SET operations".. I've got no clue also.
--
http://www.dunkelheit.at/
»Better to reign in hell than to serve in heaven«
-- John Milton, »Paradise Lost«
------------------------------
Date: Wed, 16 Feb 2005 14:53:01 +0100
From: Tore Aursand <toreau@gmail.com>
Subject: Re: SET Operations in Perl
Message-Id: <YeIQd.8943$Sl3.274121@news4.e.nsc.no>
Bernard El-Hagin wrote:
>>how can we do SET Operations in perl using two hashes or arrays
>>in case it is too easy , please redirect me to some link
> www.whatthehellareyoutalkingabout.com
I think he is talking about this:
<http://www.google.no/search?&q=%22SET+operations%22+programming>
--
Tore Aursand <toreau@gmail.com>
------------------------------
Date: 16 Feb 2005 22:35:52 +1100
From: ? the Platypus {aka David Formosa} <dformosa@zeta.org.au>
Subject: Re: The Problem with Perl
Message-Id: <m33bvw20vb.fsf@dformosa.zeta.org.au>
Charlton Wilbur <cwilbur@mithril.chromatico.net> writes:
> But I think that odds favor a large team of mediocre coders working in
> a bondage-and-discipline language over a small team of possibly-brilliant
> coders working in a more freeform language.
However history proves you wrong. Big teams tend to start treading on
each others toes. Most good programs end up being programed by very
small groups.
--
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.
------------------------------
Date: Wed, 16 Feb 2005 12:59:40 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: The Problem with Perl
Message-Id: <87ekfgpsm8.fsf@mithril.chromatico.net>
>>>>> "?" == ? the Platypus {aka David Formosa} <dformosa@zeta.org.au> writes:
?> Charlton Wilbur <cwilbur@mithril.chromatico.net> writes:
>> But I think that odds favor a large team of mediocre coders
>> working in a bondage-and-discipline language over a small team
>> of possibly-brilliant coders working in a more freeform
>> language.
?> However history proves you wrong. Big teams tend to start
?> treading on each others toes. Most good programs end up being
?> programed by very small groups.
And is it easier for a manager to prevent teams from treading on each
others' toes, or to turn a programmer with no self-discipline into
one? If history proves me wrong, I'd like to see more examples. I'm
willing to accept that many successful programs are developed by small
teams, but that says nothing about how many small teams fail at
producing anything at all or about the comparative success and failure
rates of large teams on bespoke software projects.
In other words: just because three people wrote $program successfully
does not mean that a team of three to five people is the optimal size
for *any* development effort, and it's a safe bet that in larger
software projects, such as anything done internally by a large
company, entrusting something critical to three people of potentially
unknown ability in a freeform language is just plain moronic.
The question here is not whether you'd choose a small team of good
programmers or a large team of mediocre ones. The question is, if you
had to develop a project and had no better than the usual tools for
distinguishing good programmers from mediocre ones, would you build a
plan around the assumption that you'd have only good programmers who
were capable of sufficient self-discipline to work smoothly together
in a freeform language? I sure as hell wouldn't, *especially* if I
had to go out on a limb to reassure my management that Perl was a good
choice because it was a more powerful language.
That might change if I could easily eliminate programmers from the
team, replacing the ones who were incapable of demonstrating or
developing that self-discipline, or if I had a magic tool that could
tell me in under an hour which programmers had good technical skills,
good interpersonal skills, and good self-discipline and which ones
merely had good resumes and references and could fake it well in an
interview. But until employment law and human resource departments
allow the former and the Good Fairy makes the latter posible,
bondage-and-discipline languages are a safer tool to use.
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
Date: Wed, 16 Feb 2005 12:42:04 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: Weird Error message
Message-Id: <pan.2005.02.16.11.42.04.896305@dunkelheit.at>
Anno Siegel wrote:
> "string @{ [ lc $obj->meth] } more string"
>
> is a common, though not very popular idiom.
Argh, thx, Have to read something in perldoc now ..
--
http://www.dunkelheit.at/
codito, ergo sum.
------------------------------
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 7788
***************************************