[19917] in Perl-Users-Digest
Perl-Users Digest, Issue: 2112 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 12 03:05:41 2001
Date: Mon, 12 Nov 2001 00:05:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1005552315-v10-i2112@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 12 Nov 2001 Volume: 10 Number: 2112
Today's topics:
IO::Socket write fail <admin@asarian-host.net>
Anyone have a script to keep running totals of sales fi (J Capenos)
Calculation script needed (J Capenos)
Re: comp.lang.perl <djberg96@hotmail.com>
Re: comp.lang.perl <mgjv@tradingpost.com.au>
Re: comp.lang.perl <djberg96@hotmail.com>
Re: comp.lang.perl <tim@vegeta.ath.cx>
Re: comp.lang.perl <dha@panix.com>
Re: comp.lang.perl <mgjv@tradingpost.com.au>
Re: comp.lang.perl <rob_13@excite.com>
Re: converting ^M characters to \n <hugo@fractalgraphics.com.au>
Re: converting ^M characters to \n (J.B. Moreno)
Re: converting ^M characters to \n <uri@stemsystems.com>
Daemon --- Help <s4mu@yahoo.com>
Re: Daemon --- Help <wyzelli@yahoo.com>
Data::Dumper and array with undefed elements <Tassilo.Parseval@post.rwth-aachen.de>
Re: Data::Dumper and array with undefed elements <mgjv@tradingpost.com.au>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 12 Nov 2001 03:24:59 GMT
From: "Mark" <admin@asarian-host.net>
Subject: IO::Socket write fail
Message-Id: <fiHH7.17718$Wa.1735411@bin1.nnrp.aus1.giganews.com>
Dear people,
I am having a problem with writing to the client of a UNIX domain socket.
Ok, lets say I have a daemon, like this:
$sock = IO::Socket::UNIX -> new (Local => UXSOCKADDR,
Type => SOCK_STREAM,
Listen => 10) || exit 1;
while ($client = $sock -> accept ()) {
print STDERR "Got new connection! ($client)\n";
print $client "Hi, how are you?\n";
while (defined ($from_client = <$client>)) {
chomp ($from_client);
print $client ">$from_client<\n";
}
}
This works, but is incredibly crude. The program waits for input from the
client, and only then processes possible commands. Ok, so I did this:
$sock = IO::Socket::UNIX -> new (Local => UXSOCKADDR,
Type => SOCK_STREAM,
Listen => 10) || exit 1;
$sel = IO::Select -> new ($sock);
for (;;) {
foreach $client ($sel -> can_read (0.1)) {
if ($client == $sock) {
$client = $sock -> accept ();
$sel -> add ($client);
nonblock ($client);
} else {
my $input;
my $got = $client -> recv ($input, POSIX::BUFSIZ, 0);
unless (defined ($got) && length ($input)) {
disconnect ($client);
next;
}
$inbuffer{$client} .= $input;
push (@{$ready{$client}}, $2) while ($inbuffer{$client} =~
s/(<command>((.|\n)*?)<\/command>\n)//m);
}
}
foreach $client (keys %ready) {
while ($request = shift @{$ready{$client}}) {
print $client ......
}
delete $ready{$client};
}
}
This snippet of code iterates over the possible clients, and starts
processing commands until it receives a valid <command></command> pair from
its clients. So far so good. Except that I can no longer write to the
client! No matter what I do, the "print $client ......" does nothing.
Absolutely nothing gets parsed to the client. I did a ktrace on it, and it
reveals that no data of any kind gets parsed to the client.
I tried to do a send on it, like "send ($client, $buffer, $len, 0)" and
such, but nothing works. The only way I have been able to send something
back to the client, is after the "while (defined ($from_client = <$client>)"
loop in the first example, which is totally unacceptable.
Ideally, I want to check whether the client has input, not using the wait
"while (defined ($from_client = <$client>)" of the first example; that
happens in the second example, but there I can no longer write back to the
client!
Any suggestions would be highly appreciated,
- Mark
------------------------------
Date: 11 Nov 2001 17:29:04 -0800
From: jcapenos@yahoo.com (J Capenos)
Subject: Anyone have a script to keep running totals of sales figures??
Message-Id: <f417bbc8.0111111729.7da0f6f7@posting.google.com>
I need a script or set of scripts that keeps running totals from my
SQL databases that are fed by forms that the client enters in daily
sales numbers and figures for individual items that were sold.
Anyone have anything???
------------------------------
Date: 11 Nov 2001 17:42:31 -0800
From: jcapenos@yahoo.com (J Capenos)
Subject: Calculation script needed
Message-Id: <f417bbc8.0111111742.5d5f1ee@posting.google.com>
I need a script or set of scripts that can keep running totals from
figures entered from a form into a SQL database.
Something easily adaptable to fit the existing program.
If anyone is interested in doing some custom work, let me know.
Thanks
------------------------------
Date: Mon, 12 Nov 2001 01:13:10 GMT
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: comp.lang.perl
Message-Id: <GmFH7.3730$T6.190897@typhoon.mn.mediaone.net>
"Tim Hammerquist" <tim@vegeta.ath.cx> wrote in message
news:slrn9uu0et.5i7.tim@vegeta.ath.cx...
<snip>
> On top of everything else, many c.l.p'ers _know_ clpm exists and
> deliberately do _not_ use it because of it's "reputation" for being
> harsh and try to make the dead c.l.p a "kinder, gentler" dead group.
Gee, I wonder how it got that rap?
Seriously, I half wonder if some of the posters in here are actually just
bots programmed along these lines:
print $random_insult; # optional
print "Something about reading the FAQ " . $more_random_insults; # optional
perldoc -q "$subject_line\n"; # required
print $yet_more_random_insults; # optional
<obfuscated perl as sig line>
Seriously, folks, I have never understood the need to go after newbies in
the harsh manner that some do. The sky is blue, stocks will rise and fall,
and newbies are going to ask questions that are already in the FAQ and have
been answered 100 times before - ACCEPT IT. I guess what I don't understand
is why some people feel *compelled* to respond in the harsh manner that they
do.
Here's a novel concept - IGNORE THE THREAD! Move on your merry little way
to the next post and even put the offending newbie in your killfile if it
annoys you that much (and spare us that *PLONK* bologna). The subject line
usually says it all - pick and choose the ones that actually *interest* you
and ignore the newbies.
Regards,
Dan
------------------------------
Date: Mon, 12 Nov 2001 01:45:36 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: comp.lang.perl
Message-Id: <slrn9uuaem.2q5.mgjv@verbruggen.comdyn.com.au>
On Mon, 12 Nov 2001 01:13:10 GMT,
Daniel Berger <djberg96@hotmail.com> wrote:
>
> Here's a novel concept - IGNORE THE THREAD! Move on your merry little way
> to the next post and even put the offending newbie in your killfile if it
> annoys you that much (and spare us that *PLONK* bologna). The subject line
> usually says it all - pick and choose the ones that actually *interest* you
> and ignore the newbies.
*sigh*
Not again....
Ignoring these posts is not a good idea, because that means that there
is no education about the fact that topicality is important on
technical newsgroups. Not pointing people who are unaware of its
existence to the FAQ is a disservice to these people.
There are two issues here, which people keep confusing, or seeing as
one:
1) Whether or not topicality should be enforced/encouraged (pick your
own euphemism/term)
2) In which way this should happen
They are separate points, and should be discussed separately. You, in
the post I respond to, muddle the two quite successfully. It is
necessary to encourage topicality, lest this group loses the little
bit of utility it still has. The tone in which this happens is a
separate issue, and I'm not even going to go into that debate. It's
been debated on this group, lots of reasons have been given for any
side of it. if you're interested, do a search on groups.google.com.
But do NOT confuse the need for topicality enforcement with the
perceived rudeness of some posters.
Martien
--
|
Martien Verbruggen | You can't have everything, where
Trading Post Australia Pty Ltd | would you put it?
|
------------------------------
Date: Mon, 12 Nov 2001 02:44:03 GMT
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: comp.lang.perl
Message-Id: <THGH7.3742$T6.194466@typhoon.mn.mediaone.net>
"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrn9uuaem.2q5.mgjv@verbruggen.comdyn.com.au...
> Ignoring these posts is not a good idea, because that means that there
> is no education about the fact that topicality is important on
> technical newsgroups. Not pointing people who are unaware of its
> existence to the FAQ is a disservice to these people.
I never said the FAQ shouldn't be pointed out. It definitely should be. It
just shouldn't be pointed out by people who insist on adding insults to
their responses. It's *those* folks in general I'm aiming at.
> There are two issues here, which people keep confusing, or seeing as
> one:
>
> 1) Whether or not topicality should be enforced/encouraged (pick your
> own euphemism/term)
>
> 2) In which way this should happen
>
> They are separate points, and should be discussed separately.
Please, Martien. I realize they're separate issues, and I think it's clear
that I was referring to #2 there.
> You, in
> the post I respond to, muddle the two quite successfully.
Exactly the sort of stuff I was referring to. I'm not sure if English is
your first language Martien, but this really sounds like a subtle way of
calling me stupid (I hope it isn't), and this is how many newbies take it.
Compound that with the fact that many newbies will likely get 5 to 10 posts
calling them stupid in various subtle ways, and it's no wonder people feel
like they're getting beat over the head.
> It is
> necessary to encourage topicality, lest this group loses the little
> bit of utility it still has
Who said anything about topicality Martien? I was referring to newbie posts
that *are* on topic, but covered in the FAQ's. Even off-topic posters can be
redirected to other newsgroups in a polite manner. Again, I was referring
to #2 above. As for "losing utility", people have been saying that since I
started perusing this newsgroup four years ago. It's just as healthy now as
it was then. Well, ok - there *does* seem to be a rash of porn postings,
but that seems to be affecting every newsgroup of late, and it's not like we
can scold *them*. Besides, they might like it.
> The tone in which this happens is a
> separate issue, and I'm not even going to go into that debate
Ya know, I decided to search through the newsgroup looking for your past
posts, expecting to find various insults scattered here and there. Guess
what? I couldn't find any, and generally you've been polite and courteous,
even to the newbies (with the occasional mild scolding for top posting).
Given that, I'm surprised to see you come out against me like this.
That being said, let me just add........PACKERS 20, BEARS 12!
BWA-HA-HA!!!!! Oh, sorry. Was that OT? :-P
Regards,
Dan
------------------------------
Date: Mon, 12 Nov 2001 03:21:10 GMT
From: Tim Hammerquist <tim@vegeta.ath.cx>
Subject: Re: comp.lang.perl
Message-Id: <slrn9uuggg.f8m.tim@vegeta.ath.cx>
Daniel Berger <djberg96@hotmail.com> graced us by uttering:
[ snip ]
> That being said, let me just add........PACKERS 20, BEARS 12!
> BWA-HA-HA!!!!! Oh, sorry. Was that OT? :-P
LOL!
Tim Hammerquist
--
As a computer, I find your faith in technology amusing.
------------------------------
Date: 12 Nov 2001 03:38:04 GMT
From: "David H. Adler" <dha@panix.com>
Subject: Re: comp.lang.perl
Message-Id: <slrn9uuh0s.5oh.dha@panix2.panix.com>
In article <THGH7.3742$T6.194466@typhoon.mn.mediaone.net>, Daniel Berger wrote:
> As for "losing utility", people have been saying that since I started
> perusing this newsgroup four years ago. It's just as healthy now as it
> was then.
Sadly, this is not true. Many very knowledgable people who posted here
4 years ago are not here now. People like Tom Christiansen - perhaps
not the most gentile of responders, but certainly a great resource to
the perl community.
Then there's this Larry Wall fellow, of whom you may have heard. He's
posted here *once* over the last three years.
I'm quite sure that the signal to noise ratio here is a big factor in
that. In Tom's case, I am equally sure it is influenced by the fact that
the documentation he worked so hard to maintain (in particular, the
FAQs) were going wholly ignored. The fact that a huge number of people
who come to usenet now seem to have no concept of the traditions of
usenet (read the FAQ first, lurk to get the feel of a particular group,
etc.), doesn't help either.
I happen to agree with you that many people could be more polite in
their responses (although I can certainly understand their frustration),
but I disagree that the newsgroup is "just as healthy" as it was.
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"This is Mace's planet. We Just Live here."
------------------------------
Date: Mon, 12 Nov 2001 03:53:57 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: comp.lang.perl
Message-Id: <slrn9uuhvb.2q5.mgjv@verbruggen.comdyn.com.au>
On Mon, 12 Nov 2001 02:44:03 GMT,
Daniel Berger <djberg96@hotmail.com> wrote:
>
> "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
> news:slrn9uuaem.2q5.mgjv@verbruggen.comdyn.com.au...
>> Ignoring these posts is not a good idea, because that means that there
>> is no education about the fact that topicality is important on
>> technical newsgroups. Not pointing people who are unaware of its
>> existence to the FAQ is a disservice to these people.
>
> I never said the FAQ shouldn't be pointed out. It definitely should be. It
> just shouldn't be pointed out by people who insist on adding insults to
> their responses. It's *those* folks in general I'm aiming at.
It was clear that you were aiming at those people, but the final
paragraph of your post didn't really emphasise that. I realise now, on
rereading it, that you were only addressing those people, but it
wasn't clear to me when I first read it. Mea culpa.
>> There are two issues here, which people keep confusing, or seeing as
>> one:
>>
>> 1) Whether or not topicality should be enforced/encouraged (pick your
>> own euphemism/term)
>>
>> 2) In which way this should happen
>>
>> They are separate points, and should be discussed separately.
>
> Please, Martien. I realize they're separate issues, and I think it's clear
> that I was referring to #2 there.
>
>> You, in
>> the post I respond to, muddle the two quite successfully.
>
> Exactly the sort of stuff I was referring to. I'm not sure if English is
> your first language Martien,
English is not my first language, but I don't think that's an issue
here.
> but this really sounds like a subtle way of
> calling me stupid (I hope it isn't), and this is how many newbies take it.
I was in no way trying to call you stupid. If I meant to call you
stupid, I would probably have used the word :)
I am afraid you're reading more into my words than was actually
intended to be there. And yes, many newbies may read things that way,
but it's hardly everyone's responsibility to draw up the equivalent of
a legal document in which nothing can be taken the wrong way. It's too
hard to write that way, especially if you have to divide your time
between this and other things.
> Compound that with the fact that many newbies will likely get 5 to 10 posts
> calling them stupid in various subtle ways, and it's no wonder people feel
> like they're getting beat over the head.
On the other hand, many people are overly sensitive to criticism. I've
seen enough abusive threads start with an overreaction to a gentle
enough pointer to the FAQ, documentation or other resource, to be able
to say that the issue isn't as simple as it seems. Yes, some
non-answers are unnecessarily rude, but some receptions of some
answers are unnecessarily overly sensitive.
>> It is
>> necessary to encourage topicality, lest this group loses the little
>> bit of utility it still has
>
> Who said anything about topicality Martien? I was referring to newbie posts
> that *are* on topic, but covered in the FAQ's. Even off-topic posters can be
My use of the word "topicality" was too narrow.
> redirected to other newsgroups in a polite manner. Again, I was referring
> to #2 above. As for "losing utility", people have been saying that since I
> started perusing this newsgroup four years ago. It's just as healthy now as
> it was then. Well, ok - there *does* seem to be a rash of porn postings,
I don't see any of the porn postings. You need to get a news server
that homours cancels better :)
> but that seems to be affecting every newsgroup of late, and it's not like we
> can scold *them*. Besides, they might like it.
And this is probably something we would disagree on. I do not believe
that the utility of this newsgroup has stayed as healthy as it was 4
years ago. In fact, I just had the opportunity to reread a load of
archived posts[1] on groups.google.com from the first days the archive
starts (when Larry Wall was still posting here, BTW). The tone of the
posts, the S/N ratio and the amount of information in posts back then
was significantly better than it is nowadays. There were fewer posts
that asked offtopic questions, and fewer posts that asked for
information that is answered by the FAQ and the documentation. New
posters also seemed more willing to accept any help they got, even if
they were simply pointers to documentation, or a more appropriate
newsgroup.
This whole discussion comes up regularly, and it has been analysed a
few times as to what is causing this. People disagree on the primary
cause, but as far as I am concerned, the cause isn't that important.
Most people never had a problem with new, and inexperienced posters
asking questions that they could have looked up themselves, or even
offtopic questions. Most people have no problem with being pointed
towards the documentation or another newsgroup.
I know one thing though: The long, and often violent, threads about
this very issue do not do this newsgroup any good. Especially the fact
that the two points that I mentioned above often get mixed up as one
makes it very hard to distill any sense from these threads. The fault
for this lies with both "camps": the camp that is frustrated enough by
the perceived diminished utility of this group to become abrupt,
brusque, and sometimes insulting, and the camp that disputes that
anyone here has any right to decide which questions can and cannot be
asked and answered here (and I am in no way implying that you belong
to either of these camps).
The fact that these threads come up so often only make it harder to
deal with these issues when they come up again, because of a growing
frustration on both sides. Add to that the fact that people tend to
read more into anything posted on Usenet than was intended, and you
have a recipe for ever increasing cycles of flames; and that is
exactly what we're seeing.
>> The tone in which this happens is a
>> separate issue, and I'm not even going to go into that debate
>
> Ya know, I decided to search through the newsgroup looking for your past
> posts, expecting to find various insults scattered here and there. Guess
> what? I couldn't find any, and generally you've been polite and courteous,
> even to the newbies (with the occasional mild scolding for top posting).
> Given that, I'm surprised to see you come out against me like this.
Oh, but I'm not reacting because I feel personally attacked, just
because I have a view on this, and once I have an opinion you can't
stop me from airing it. :)
I've been guilty of being too brusque in the past, and probably, in
many people's eyes, still am (see for example a thread on clp.modules
where I was called a representative of this newsgroups police, or
something to that effect). However, I intend to reserve any harsh
words for repeat offenders[2]. A well-honed scorefile has saved me
from a lot of frustration over the years, and otherwise I probably
wouldn't have been around anymore. Many people have taken that route,
and no longer post here or read this group. The most important one of
these is Larry Wall, who left this group for exactly this reason: Not
enough signal in the noise, no decent crowd control.
I am not going to propose any fixes for this situation, because there
are none. Some people will continue to try to educate on correct
newsgroup usage, some people will continue doing this in ways that
other people find unpalatable. Some people will continue to attack
them for it. Some people will continue to defend anyone's right to
post anything here (again: I'm not suggesting that's what you are
doing). Some people will continue to take offense at even the gentlest
of pointers to the documentation or another newsgroup. clp.misc is a
large newsgroup, with a large variety of people, with a large variety
of backgrounds. You'll find purist hackers here, as well as graphical
designers trying to become programmers, and many others. The exacting
standards that hackers generally impose upon themselves and their
environment will continue to clash with the sort of environment that
the unsuspecting newbie might hope for.
No, clp.misc is not an ideal environment. These discussions are not
going to make it one. Instead of keeping on rehashing this fact, maybe
it's time we all accepted that, and got on with it.
> That being said, let me just add........PACKERS 20, BEARS 12!
> BWA-HA-HA!!!!! Oh, sorry. Was that OT? :-P
ObOfftopic:
My first response to top posters is generally a politely worded
request to cease and desist. Persistent top posting annoys me well
enough to get ticked off about it. I happen to believe that
top-posting is terribly disruptive, especially after the reasons why
have been explained to someone.
Who are the Packers and the Bears? Baseball? On second thought, don't
answer that. I'll do a web search if and when I want to know :)
Martien
[1] for a reason unrelated to this thread.
[2] What I see as an offense, of course, isn't necessarily what someone
else sees.
--
|
Martien Verbruggen | If at first you don't succeed,
Trading Post Australia Pty Ltd | destroy all evidence that you tried.
|
------------------------------
Date: Mon, 12 Nov 2001 07:19:00 GMT
From: "Rob - Rock13.com" <rob_13@excite.com>
Subject: Re: comp.lang.perl
Message-Id: <Xns9157175D8FB47rock13com@64.8.1.227>
Stuart Gall <news:9sms7o$14o$1@usenet.otenet.gr>:
[...]
In reference to sig line; its just two dashes. I've heard Outlook
does strange things with the space that's supposed to be there.
Sorry, for the OT f'up set.
> --
>
> Stuart Gall
--
Rob - http://rock13.com/
Web Stuff: http://rock13.com/webhelp/
------------------------------
Date: Mon, 12 Nov 2001 09:13:07 +0800
From: hugo <hugo@fractalgraphics.com.au>
Subject: Re: converting ^M characters to \n
Message-Id: <3BEF2223.525FCBE0@fractalgraphics.com.au>
Thanks everyone for your helpful replies. It seems that (inadvertently)
I also started a bit of a discussion on this topic.
Cheers
Hugo
hugo wrote:
>
> Hi
>
> I have a problem with an array which I would like to write out to a
> file. I would like each array element end with a \n newline character.
> Instead, each array value ends with a ^M character, but not at the end
> of the line (the line continues after the ^M character). Suppose I have
> an array with the following data:
>
> MyData (this, that, other );
>
> The data for the array come from a cgi script with a TEXTAREA window - I
> am using using a browser on a PC to enter the data. The data are entered
> into an array as follows:
>
> $search_file = query->param(search_file);
> (this is the contents of the TEXTAREA)
>
> @MyData = split ("\n", $search_file);
>
> Then I would like to write @Mydata to an output file (to /tmp/ on a unix
> machine) as follows (the code which follows is from my CGI script on the
> unix server):
>
> open (OUTFILE) ">/tmp/mylist || die "cannot open";
> foreach $x (@MyData) {
> print OUTFILE $x;
> }
>
> This gives me:
>
> this^Mthat^Mother^M
>
> What I want is
>
> this
> that
> other
>
> I have tried the following:
>
> open (OUTFILE) ">/tmp/mylist || die "cannot open";
> foreach $x (@MyData) {
> if ($x =~ /^M/ ) {
> $x =~ s/^M//;
> }
> print OUTFILE $x;
> print "\n";
> }
>
> But this does not help - I end up with exactly the same result ie with
> this^Mthat^Mother^M
>
> Can anyone help me with this?
>
> Any help will be greatly appreciated.
>
> Thanks
>
> Hugo
>
> --
> Dr Hugo Bouckaert
> R&D Support Engineer, Fractal Graphics
> 57 Havelock Street, West Perth 6005
> Western Australia 6009
> Tel: +618 9211 6000 Fax: +618 9226 1299
> Email:hugo@fractalgraphics.com.au
> Web: http://www.fractalgraphics.com.au
--
Dr Hugo Bouckaert
R&D Support Engineer, Fractal Graphics
57 Havelock Street, West Perth 6005
Western Australia 6009
Tel: +618 9211 6000 Fax: +618 9226 1299
Email:hugo@fractalgraphics.com.au
Web: http://www.fractalgraphics.com.au
------------------------------
Date: Mon, 12 Nov 2001 01:56:37 -0500
From: planb@newsreaders.com (J.B. Moreno)
Subject: Re: converting ^M characters to \n
Message-Id: <1f2qkwx.1jesrwi4vc5qoN%planb@newsreaders.com>
Alan J. Flavell <flavell@mail.cern.ch> wrote:
> On Nov 10, J.B. Moreno inscribed on the eternal scroll:
> > Alan J. Flavell <flavell@mail.cern.ch> wrote:
> > > Ref: http://www.perldoc.com/perl5.6/pod/perlport.html#Newlines
> >
> > That shows that \n is variable, it doesn't give any examples of \r being
> > variable,
>
> Quote from the above section:
> ___
-snip-
> \r | CR | CR | LF |
-snip-
> This doesn't cover EBCDIC-based platforms, however.
But it does show that I was totally wrong...
> > and perlop doesn't say that it is platform specific
>
> \r represents the logical \r function on all platforms. \015
OK. Let me say that I think it'd be nice if there was some simple and
standard (other than 0x0?) for the ASCII values CR and LF.
\R and \N?
--
JBM
"Your depression will be added to my own" -- Marvin of Borg
------------------------------
Date: Mon, 12 Nov 2001 07:28:46 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: converting ^M characters to \n
Message-Id: <x7itcgla4e.fsf@home.sysarch.com>
>>>>> "JBM" == J B Moreno <planb@newsreaders.com> writes:
JBM> OK. Let me say that I think it'd be nice if there was some simple and
JBM> standard (other than 0x0?) for the ASCII values CR and LF.
JBM> \R and \N?
what's wrong with \015 and \012? how hard are they to know or remember?
and as someone else said, Socket.pm will export CR and LF if requested
and they are OS independent.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Mon, 12 Nov 2001 14:55:45 +1000
From: "sean" <s4mu@yahoo.com>
Subject: Daemon --- Help
Message-Id: <3bef567e$0$1776$afc38c87@news.optusnet.com.au>
Hello,
I am attempting to write a forking daemon in perl (for some basic system
management)
Can someone point me to any tutorials, howtos that may help me get started?
Thanks,
------------------------------
Date: Mon, 12 Nov 2001 15:10:30 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Daemon --- Help
Message-Id: <wgJH7.37$a7.633@vicpull1.telstra.net>
"sean" <s4mu@yahoo.com> wrote in message
news:3bef567e$0$1776$afc38c87@news.optusnet.com.au...
> Hello,
>
> I am attempting to write a forking daemon in perl (for some basic system
> management)
> Can someone point me to any tutorials, howtos that may help me get
started?
>
www.stonehenge.com/merlyn
Some use things.
Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: Mon, 12 Nov 2001 01:41:13 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Data::Dumper and array with undefed elements
Message-Id: <9sn5r9$jcf$00$1@news.t-online.com>
Hi,
just out of curiosity: I played with the '$#a = 10;' idiom (inspired by
a reply to a previous post) and dumped this array:
ethan@ethan:~$ perl -Mstrict -MData::Dumper
my @a;
$#a = 5;
print Dumper \@a;
__END__
$VAR1 = [
undef,
${\$VAR1->[0]},
${\$VAR1->[0]},
${\$VAR1->[0]},
${\$VAR1->[0]},
${\$VAR1->[0]}
];
What does this stuff in element one to six actually mean? Does
Data::Dumper refer to the first element in order to represent undef?
Data::Denter gives me
@
?
?
?
?
?
?
just as one would expect.
Tassilo
--
When you are in it up to your ears, keep your mouth shut.
------------------------------
Date: Mon, 12 Nov 2001 01:37:54 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Data::Dumper and array with undefed elements
Message-Id: <slrn9uua05.2q5.mgjv@verbruggen.comdyn.com.au>
On Mon, 12 Nov 2001 01:41:13 +0100,
Tassilo v. Parseval <Tassilo.Parseval@post.rwth-aachen.de> wrote:
> Hi,
>
> just out of curiosity: I played with the '$#a = 10;' idiom (inspired by
> a reply to a previous post) and dumped this array:
>
> ethan@ethan:~$ perl -Mstrict -MData::Dumper
> my @a;
> $#a = 5;
> print Dumper \@a;
> __END__
> $VAR1 = [
> undef,
> ${\$VAR1->[0]},
> ${\$VAR1->[0]},
> ${\$VAR1->[0]},
> ${\$VAR1->[0]},
> ${\$VAR1->[0]}
> ];
>
> What does this stuff in element one to six actually mean? Does
> Data::Dumper refer to the first element in order to represent undef?
> Data::Denter gives me
Not all undefs are equal, but some are.
At the low level, I suspect that for uninitialised array elements the
same 'undef' is returned, while for initialised (but undefined)
elements a different undef gets returned. The Devel::Peek method
allows you to have a bit more of a look at these things:
$ perl -MDevel::Peek
$#a = 4;
$a[0] = undef;
Dump \@a, 10;
print "\n";
DumpArray 10, @a;
__END__
SV = RV(0x8104724) at 0x8106970
REFCNT = 1
FLAGS = (TEMP,ROK)
RV = 0x8100e40
SV = PVAV(0x80f6b3c) at 0x8100e40
REFCNT = 2
FLAGS = ()
IV = 0
NV = 0
ARRAY = 0x81037d8
FILL = 4
MAX = 4
ARYLEN = 0x80f562c
FLAGS = (REAL)
Elt No. 0
SV = NULL(0x0) at 0x80f5728
REFCNT = 1
FLAGS = ()
Elt No. 1
Elt No. 2
Elt No. 3
Elt No. 4
Elt No. 0 0x80f5728
SV = NULL(0x0) at 0x80f5728
REFCNT = 1
FLAGS = ()
Elt No. 1 0x80f4b98
SV = NULL(0x0) at 0x80f4b98
REFCNT = 2147483633
FLAGS = (READONLY)
Elt No. 2 0x80f4b98
SV = NULL(0x0) at 0x80f4b98
REFCNT = 2147483633
FLAGS = (READONLY)
Elt No. 3 0x80f4b98
SV = NULL(0x0) at 0x80f4b98
REFCNT = 2147483633
FLAGS = (READONLY)
Elt No. 4 0x80f4b98
SV = NULL(0x0) at 0x80f4b98
REFCNT = 2147483633
FLAGS = (READONLY)
This shows us that the array has 5 elements, all are undefined, but
the first one is undefined in a different way from the others. Element
0 has its own SV, which happens to be undef (at 0x80f5728). The other
4 are all uninitialised, and end up pointing to another undef (at
0x80f4b98).
I suspect that 0x80f4b98 is the address of PL_sv_undef, while
0x80f5728 is the address of an SV pointing to PL_sv_undef (or a copy
of it), but I don't know enough of the guts to be sure about that.
Note that information like this is normally not really of interest to
the Perl programmer (because from within Perl you can't distinguish
between the various undefs), but only to XS and perl API programmers.
While Data::Dumper probably does the right thing by storing those
references, instead of just an undef, I don't think it'll help when
you're restoring the array via an eval. In other words:
use Data::Dumper;
use Devel::Peek;
my @a;
$#a = 5;
Dump \@a;
my $d = Data::Dumper->Dump([\@a], [qw(*a)]);
@a = ();
eval $d;
Dump \@a;
The two Dump() statements above will show different structures. In the
second case, the array contains 5 SVs (undef). In the first case, as
above, the array will contain 5 uninitialised elements.
I'm sure someone will have a few things to say about this :)
Martien
--
|
Martien Verbruggen | Little girls, like butterflies, need
Trading Post Australia Pty Ltd | no excuse - Lazarus Long
|
------------------------------
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 2112
***************************************