[9411] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3007 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 30 13:57:20 1998

Date: Tue, 30 Jun 98 10:39:39 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 30 Jun 1998     Volume: 8 Number: 3007

Today's topics:
    Re: An interesting observation (Jeremy D. Zawodny)
    Re: An interesting observation <rra@stanford.edu>
    Re: An interesting observation (John Stanley)
    Re: An interesting observation (John Stanley)
    Re: An interesting observation <rra@stanford.edu>
    Re: An interesting observation birgitt@my-dejanews.com
    Re: An interesting observation (Mark-Jason Dominus)
    Re: An interesting observation <rra@stanford.edu>
    Re: An interesting observation (John Stanley)
    Re: An interesting observation (Josh Kortbein)
        ANNOUNCE: Set::Object <jll@skynet.be>
    Re: ANNOUNCEMENT: clpa doesn't accept perl announcement (Chip Salzenberg)
    Re: ANNOUNCEMENT: clpa doesn't accept perl announcement (Gabor)
    Re: Any idea about ...... (Larry Rosler)
    Re: Any idea about ...... (Jonathan Stowe)
    Re: Any idea about ..... <davidc@selectst.com>
    Re: Any idea about ..... (Abigail)
    Re: Apology (Gary M. Greenberg)
        Are random writes POSSIBLE in perl? uunet!netcom.com!bobmacd+62898Nclpm
    Re: Are random writes POSSIBLE in perl? <tchrist@mox.perl.com>
    Re: Are random writes POSSIBLE in perl? uunet!netcom.com!bobmacd+6291998Nclpm
    Re: Are random writes POSSIBLE in perl? <tchrist@mox.perl.com>
    Re: Are random writes POSSIBLE in perl? (Abigail)
    Re: autovivification and tie questions <lehman@javanet.com>
    Re: autovivification and tie questions <lehman@javanet.com>
    Re: autovivification and tie questions <lehman@javanet.com>
    Re: autovivification and tie questions <rootbeer@teleport.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 27 Jun 1998 23:02:22 -0400
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: An interesting observation
Message-Id: <m3g1gq44ap.fsf@peach.z.org>

Russ Allbery <rra@stanford.edu> writes:

> The past few days, I've had more time to read this group and respond to
> posts than I normally do, so I've been scanning through looking for
> unanswered questions to answer.  Ever since I started doing this, I've
> found something very interesting.

Same here...

> There usually aren't any.  Unanswered questions, that is.

Yes. Quite ironic in light of people's perceptions.

It all comes down to what you think an "answered" question is. I
happen to agree with your definition.

Jeremy
-- 
Jeremy D. Zawodny                   Web Geek, Perl Hacker, etc.
http://www.wcnet.org/~jzawodn/      jzawodn@wcnet.org

LOAD "LINUX",8,1


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

Date: 27 Jun 1998 20:27:38 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: An interesting observation
Message-Id: <m3k96219zp.fsf@windlord.Stanford.EDU>

Jeremy D Zawodny <jzawodn@wcnet.org> writes:

> It all comes down to what you think an "answered" question is. I happen
> to agree with your definition.

Well, I used to work tech support and we even used a newsgroup to track
answered and unanswered questions, so I have a lot of instincts
surrounding what it takes for me to consider a question answered.  The
basic definition is that someone has responded and the original person has
not asked for further clarification.

Directing someone to a resource that answers their questions is certainly
a way to answer a question; I used to do that all the time in tech
support.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 28 Jun 1998 05:01:55 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: An interesting observation
Message-Id: <6n4io3$km8$1@news.NERO.NET>

In article <6n49v5$vlk$1@strato.ultra.net>,
Bob Trieger <sowmaster@juicepigs.com> wrote:
>Russ Allbery <rra@stanford.edu> wrote:
>-> I think that's an interesting thing to be aware of, particularly in light
>-> of the recent complaints about how this group has been working.
>
>They aren't whining about posts not being answered. they are whining because 
>they aren't being answered with kids' gloves or handed a script on a silver 
>platter. 

This is a very convenient misinterpretation of what the real complaint
is.



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

Date: 28 Jun 1998 05:04:18 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: An interesting observation
Message-Id: <6n4isi$kr2$1@news.NERO.NET>

In article <m3k96219zp.fsf@windlord.Stanford.EDU>,
Russ Allbery  <rra@stanford.edu> wrote:
>Well, I used to work tech support and we even used a newsgroup to track
>answered and unanswered questions, so I have a lot of instincts
>surrounding what it takes for me to consider a question answered.  The
>basic definition is that someone has responded and the original person has
>not asked for further clarification.

Then the response "you are a freeloading poopiehead who should not be
using a computer, must less pretending to be a programmer" would be, by
your definition, a "question answered", as long as the offender was
smart enough to go elsewhere seeking help?



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

Date: 27 Jun 1998 22:05:41 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: An interesting observation
Message-Id: <m3sokqyv2y.fsf@windlord.Stanford.EDU>

John Stanley <stanley@skyking.OCE.ORST.EDU> writes:

> Then the response "you are a freeloading poopiehead who should not be
> using a computer, must less pretending to be a programmer" would be, by
> your definition, a "question answered", as long as the offender was
> smart enough to go elsewhere seeking help?

Nope.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Sun, 28 Jun 1998 18:45:40 GMT
From: birgitt@my-dejanews.com
Subject: Re: An interesting observation
Message-Id: <6n630k$m6u$1@nnrp1.dejanews.com>

In article <m3af6y2rrs.fsf@windlord.Stanford.EDU>,
  Russ Allbery <rra@stanford.edu> wrote:

> There usually aren't any.  Unanswered questions, that is.
[snip]

> I think that's an interesting thing to be aware of, particularly in light
> of the recent complaints about how this group has been working.

I would say even better, you get a lot of questions answered
you didn't expect fo find an answer for or you were not aware
you had. :-)

I think the recent complaints are really not complaints about the
excellent job the sum of all volunteers produce here.

It seems to me there are basically three things which stretch
peoples' nerves:

1.     That some people don't want c.l.p.m to become a helpdesk
       and put into their answers an 'educational' twist,
       sarcasm or plain talk, when a FAQ questions was asked.
       Others don't mind to answer with pointers to the FAQs without
       that 'twist'.

       Then the discussion evolves which approach is wrong and which
       one is right and why. That's a loooonnng discussion.

       It is the lack of definition of what c.l.p.m wants to be (versus
       what it actually is) and the lack of technical solutions to
       enforce whatever rules, standards or etiquettes 'ya all might
       agree upon one day'.

       The end result is nevertheless an excellent one, as whatever
       answer you get, with 'twist' or without, you got an answer _and_
       you are made aware of other issues which are worth while thinking
       about. You can learn a lot from the 'twists'. So it is not
       _that_ much of a problem (at least to me).

2.     Threads which reflect 'philosophies, politics and the rebellious
       soul' of the programmer community at large, which are cross
       posted and followed up with missionary zealotry.
       But again, nevertheless, they are educative and can clear up
       important issues.

3.     The occasional 'What a crappy world'-syndrome.

As mentioned in another thread today, the reason why these things
appear sometimes to get out of hand, is, IMHO, a matter of the medium.

If every poster had to post face to face, eye to eye in the physical
world, they would understand 'the point' within minutes and the
responding party would not make assumptions upfront about the poster
without having obvious reasons.

May be James Carville would say: "It's the medium, stupid!"

Birgitt Funk

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 28 Jun 1998 16:57:35 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: An interesting observation
Message-Id: <6n6anv$7r1$1@monet.op.net>
Keywords: atrophic Carey day decathlon


In article <m3af6y2rrs.fsf@windlord.Stanford.EDU>,
Russ Allbery  <rra@stanford.edu> wrote:
>There usually aren't any.  Unanswered questions, that is.

My question last week at <6m7rd5$m7k$1@monet.op.net> went unanswered.
(So far.)

Any thoughts?  I probably should have crossposted to comp.editors.emacs.


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

Date: 28 Jun 1998 19:48:53 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: An interesting observation
Message-Id: <m3ra08vs6i.fsf@windlord.Stanford.EDU>

Mark-Jason Dominus <mjd@op.net> writes:

> My question last week at <6m7rd5$m7k$1@monet.op.net> went unanswered.
> (So far.)

> Any thoughts?  I probably should have crossposted to comp.editors.emacs.

Actually, yeah.  Let me go find it.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 29 Jun 1998 02:51:48 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: An interesting observation
Message-Id: <6n6vg4$ful$1@news.NERO.NET>

In article <6n6anv$7r1$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
>My question last week at <6m7rd5$m7k$1@monet.op.net> went unanswered.
>(So far.)

My request for comments on improving a bit of code went unanswered. 

My first request for information about the proposed clpm registration
process went unanswered for a month. My current request for the real
registration process has gone unanswered.

What's your point?



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

Date: 29 Jun 1998 14:36:18 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: An interesting observation
Message-Id: <6n88p2$dml$1@news.iastate.edu>

Russ Allbery (rra@stanford.edu) wrote:
: Jeremy D Zawodny <jzawodn@wcnet.org> writes:

: > It all comes down to what you think an "answered" question is. I happen
: > to agree with your definition.

: Well, I used to work tech support and we even used a newsgroup to track
: answered and unanswered questions, so I have a lot of instincts
: surrounding what it takes for me to consider a question answered.  The
: basic definition is that someone has responded and the original person has
: not asked for further clarification.

: Directing someone to a resource that answers their questions is certainly
: a way to answer a question; I used to do that all the time in tech
: support.

I certainly hope you didn't do it when the customer wasn't able to
deal with the information, as often seems to be the case on clpm.
When we do that it's called a blowoff.


cheers,

Josh

--

_________________________________________________________
I do not trust your bitch.
	- Frederich Nietzche, in _Also Sprach Zarathustra_



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

Date: 30 Jun 1998 16:02:35 GMT
From: Jean-Louis Leroy <jll@skynet.be>
Subject: ANNOUNCE: Set::Object
Message-Id: <6nb26r$7dj$1@news.neta.com>

Hello,

I am pleased to announce that the initial release of Set::Object has 
entered CPAN as:
 
  file: $CPAN/authors/id/J/JL/JLLEROY/Set-Object-0.001.tar.gz
  size: 6345 bytes
   md5: 370c6988892b22688a3229f1d7f9aa42
 
Here is the content of the README file:

NAME

   Set::Object

DESCRIPTION

   This module implements a Set of objects, that is, a collection of
   objects without duplications. It is similar to a Smalltalk
   IdentitySet.

SYNOPSIS

   use Set::Object;
   $simpsons = Set::Object->new($homer, $marge, $lisa);
   $simpsons->insert($bart, $lisa, $maggie); # only one $lisa
   $simpsons->remove($bart, $burns); # $burns not there; ok
   foreach $member ($simpsons->members) { ... }
   # etc

INSTALLATION

   perl Makefile.PL
   make
   make test
   make install (If all tests pass)

REQUIREMENTS

   perl 5.004 or later
   a C compiler

   This module was developed on MS Windows NT 4.0 using MS Visual C++
   5.0 with Service Pack 2. It was also tested on AIX 4.1.5 using
   IBM's xlc compiler.

LICENSE

   Copyright (c) 1998, Jean-Louis Leroy. All Rights Reserved.
   This module is free software. It may be used, redistributed
   and/or modified under the terms of the Perl Artistic License

SUPPORT

   email me or post in comp.lang.perl.modules

AUTHOR

   Jean-Louis Leroy, jll@skynet.be

DO YOU WANT TO KNOW MORE?

   See the pod embedded in module.

Jean-Louis Leroy
http://ourworld.compuserve.com/homepages/jl_leroy/




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

Date: Sat, 27 Jun 1998 23:50:41 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: ANNOUNCEMENT: clpa doesn't accept perl announcements!
Message-Id: <6n40jc$iam$1@cyprus.atlantic.net>

According to tchrist@mox.perl.com (Tom Christiansen):
>Not merely has every Perl user queried wanted to see the censored
>announcements posted to the Perl announce group, even some of Randal's
>fellow moderators have publicly denounced this flagrant miscarriage of
>justice and questioned its very legality vis-a-vis the group charter.

"Proof by anonymous anecdote isn't."  -- Tom C.
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: 28 Jun 1998 12:51:08 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: ANNOUNCEMENT: clpa doesn't accept perl announcements!
Message-Id: <slrn6pcf4v.6n.gabor@localhost.vmunix.com>

In comp.lang.perl.misc, Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> wrote :
# Tom Christiansen wrote:
# !
# ! I tried to be nice, but it failed.  Randal is derelict in his
# ! duties, plain and simple.
# [snip]
# 
# ! We need either a Perl announcement group that actually contains
# ! Perl announcements, or else we need a new moderator.  It can be
# ! trivially fixed, right now.  We don't need a committee.  We just
# ! need someone doing their job.
# 
# seems Randal has clearly stated his intentions and the steps he
# is taking regarding this matter ...
# 
# ! Send Randal mail.  
# 
# oh, by all means... I'm sure that an additional mail load will
# improve Randal's efficiency in addressing the issue.
# 
# ! Or volunteer to be the new moderator. :-)
# 
# but it is so much easier to simply voice your frustration at the
# way someone else handles the job you don't want to do :-0

There is a lot of love in this group. :(  I would argue that it is fair
to criticize if you do offer a working solution.  That solution may or
may not involve you.  Tom did offer a solution.  He obviously has no
time to do the moderation and maybe Randal doesn't either.  That doesn't
change the fact that Tom's complaint is valid.


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

Date: Sat, 27 Jun 1998 20:31:30 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Any idea about ......
Message-Id: <MPG.fff58e8a3b7de989896fc@nntp.hpl.hp.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <3595912e.15217630@news.btinternet.com> on Sun, 28 Jun 1998 
01:00:07 GMT, Jonathan Stowe <Gellyfish@btinternet.com> says...
> On Sat, 27 Jun 1998 19:30:37 +0200, delta wrote :
 ...
> >while (!(@info->[$cnt] =~ /---------------/))
> >@info->[$cnt] =~ s/\n/<BR>/g;
 ...
> Sorry chief but I cant make head nor tale of this.  I think that it
> probably should read like:
> 
 ...
> while (!(@info->[$cnt] =~ /---------------/))
> {
> @info->[$cnt] =~ s/\n/<BR>/g;
> print @info->[$cnt];

I think Jonathan needs to give us another D'oh.  Those don't look like  
scalars to me!

The original post wasn't clear (to say the least), but I'll wager it 
meant $info[$cnt] for each of those variables.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 28 Jun 1998 11:29:10 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Any idea about ......
Message-Id: <35962504.2530779@news.btinternet.com>

[This followup was posted to comp.lang.perl.misc and a completely
different message was sent to the cited author. ;-}]
On Sat, 27 Jun 1998 20:31:30 -0700, Larry Rosler wrote :

>[This followup was posted to comp.lang.perl.misc and a copy was sent to 
>the cited author.]
>
>In article <3595912e.15217630@news.btinternet.com> on Sun, 28 Jun 1998 
>01:00:07 GMT, Jonathan Stowe <Gellyfish@btinternet.com> says...
>> On Sat, 27 Jun 1998 19:30:37 +0200, delta wrote :
>...
>> >while (!(@info->[$cnt] =~ /---------------/))
>> >@info->[$cnt] =~ s/\n/<BR>/g;
>...
>> Sorry chief but I cant make head nor tale of this.  I think that it
>> probably should read like:
>> 
>...
>> while (!(@info->[$cnt] =~ /---------------/))
>> {
>> @info->[$cnt] =~ s/\n/<BR>/g;
>> print @info->[$cnt];
>
>I think Jonathan needs to give us another D'oh.  Those don't look like  
>scalars to me!
>
Oh ok then.
Jonathan : Give me a "D"
Crowd    : "Shut up with that crap"

 ...

>The original post wasn't clear (to say the least), but I'll wager it 
>meant $info[$cnt] for each of those variables.
>
Yes in the cold light of day that does appear to be the case doesnt
it. And given that I can see what the code does now.  However I still
dont understand the "<img src" stuff - perhaps delta could illuminate
us further.

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sun, 28 Jun 1998 18:17:20 +1000
From: David Coldrick <davidc@selectst.com>
Subject: Re: Any idea about .....
Message-Id: <3595FC10.64FAC86B@selectst.com>

Don't understand. What's the diff between crossposting and posting
twice, and what do you mean by "setting a followup"?

Regards,
David

Tom Phoenix wrote:
> 
> On Sat, 27 Jun 1998, delta wrote:
> 
> > Newsgroups: comp.lang.perl.modules
> 
> Your question was also posted to comp.lang.perl.misc. Don't do that. If a
> message is appropriate for more than one newsgroup, crosspost and set
> followups. In this case, it doesn't look like your question has anything
> to do with modules, so I've set followups.
<snip>


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

Date: 28 Jun 1998 09:55:18 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Any idea about .....
Message-Id: <6n53u6$838$10@client3.news.psi.net>

David Coldrick (davidc@selectst.com) wrote on MDCCLXII September MCMXCIII
in <URL: news:3595FC10.64FAC86B@selectst.com>:
++ Don't understand. What's the diff between crossposting and posting
++ twice, and what do you mean by "setting a followup"?

A crossposting is one posting, with more than one newsgroup mentioned
in the Newsgroup line. All, but the stupiest newsreaders will show the
message only once to the reader. But if something is posted twice,
not only takes it up twice the amount of diskspace and bandwidth, a
newsreader cannot know the reader has seen the message. The message-ID
will be different, and the Xref header too.

Of course, this discussion has nothing to do with perl, it's fundamental
nettiquette. Something you ought to know before your newsreader enables
its posting function for you.

Followups set.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Sun, 28 Jun 1998 22:00:26 GMT
From: garyg@gator.net (Gary M. Greenberg)
Subject: Re: Apology
Message-Id: <MPG.1000861c5c2d76b989687@news.gator.net>

In article <358f4a28.0@news.plymouth.edu>, c_lamson@oz.plymouth.edu 
says...
> I ... looked at my "camel" book... and realized how silly of me it
> was to ask here a question which had an extremely obvious and easy-to-find
> answer.  In the future, I will humbly consult every resource available
> before wasting bandwidth and time posting a stupid question.  Thank you. 

Bravo. Beautiful. Every poster here should follow suit. Good luck with
your programming endeavors; with your new (?) attitude, you'll go far.

And, thank you.

Cheers,
gary         -=-  The C Programmers' Reference  -=-
              http://www.gator.net/~garyg/C/c.html
        -=-  Avenue Programmers' Classes' Requests  -=-
             http://www.gator.net/~garyg/class.htm


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

Date: Mon, 29 Jun 1998 03:45:14 GMT
From: uunet!netcom.com!bobmacd+62898Nclpm
Subject: Are random writes POSSIBLE in perl?
Message-Id: <bobmacdEvAnrF.5qK@netcom.com>

I cannot get random writing to work in perl.  I want to seek to a location,
then write a fixed amount of text to that location.  As you might do in 
a random-access, fixed-length database using PACK etc.
Perl will NOT cooperate.  Perl4 and Perl5 makes no difference.
print or syswrite makes no difference. 
If I do a SEEK, then a write, then a TELL, the TELL always says the 
pointer is where I put it at the SEEK, but the data is written to the 
end of the file. 
  
I write
  #!/usr/local/nuglops/bin/perl 
  
  open (FILE, "+>>zz"); 
  seek (FILE, 0, 0); 
  print FILE "line 1\n";
  print "After line 1 now at ", tell (FILE), "\n";
  seek (FILE, 3, 0); 
  print FILE "line 2\n"; 
  print "After line 2 now at ", tell (FILE), "\n";
  
I get 
  line 1
  line 2
  
I want
  linlin2

If I change the first line to
  open (FILE, "+>zz");

then everything works.  I have no idea why.  But this is useless. The 
entire point of a random-access disk database is lost if it is clobbered
on program startup. 

So how do I do this? 

-Bob


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

Date: 29 Jun 1998 03:54:25 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Are random writes POSSIBLE in perl?
Message-Id: <6n735h$f06$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    uunet!netcom.com!bobmacd+62898Nclpm writes:
:  open (FILE, "+>>zz"); 

That's a screwy mode.  Why are you using it?
Do you perhaps mean

sysopen(FH, $path, O_RDWR|O_CREAT)            || die $!;

:  seek (FILE, 0, 0); 
:  print FILE "line 1\n";

You can't seek to some place and then try to print
to that place if you've opened with O_APPEND, as you have.

--tom
-- 
    That means I'll have to use $ans to suppress newlines now.  
    Life is ridiculous. 
        --Larry Wall in Configure from the perl distribution


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

Date: Mon, 29 Jun 1998 20:59:12 GMT
From: uunet!netcom.com!bobmacd+6291998Nclpm
Subject: Re: Are random writes POSSIBLE in perl?
Message-Id: <bobmacdEvBzMp.Jzv@netcom.com>

Wow. Thank God for wizards. 

Tom Christiansen <tchrist@mox.perl.com> writes:

>In comp.lang.perl.misc, 
>    uunet!netcom.com!bobmacd+62898Nclpm writes:
>:  open (FILE, "+>>zz"); 

>That's a screwy mode.  Why are you using it?

If it exists I want to open it, but if it doesn't I want to create it. 

>Do you perhaps mean

>sysopen(FH, $path, O_RDWR|O_CREAT)            || die $!;

yes! yes!  Exactly what I want.   But I haven't been able to access the 
(html, individual) manpage for sysopen on perl.com, and anyway I use 
perl4, which doesn't have the command, far more than I use perl5, so I
sechew perl5 idioms.

After seeing how you used "|" above, I gave this a try and it worked: 

  open (FH, "+<$path") || open (FH, "+>$path")     || die $!; 

Better, perhaps, would be this, which also happens to be a rather precise 
statement of what I really want: 

  ( (-f $path) ? open (FH, "+<$path") : open (FH, "+>$path") ) || die $!; 

I was under the delusion that opening to append had the same effect 
as the above.  I've worked in other languages where it was.  Clearly, 
perl/unix is a bit more "magical"  :-) 

-Bob

P.S. I'm sure people will ask where I still use perl4.  I do a lot of 
interplatform desktop support, and I publish code.  In a Unix realm, I 
can count on my users having perl4.  Hell, perl4 is what Netcom gives 
shell users.  And in the PC/Macintosh realm, perl4's small size means 
easy to distribute to users, and it'll run OK in small environments
like obsolete Macintoshes or off a DOS bootable diskette.  :-)  


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

Date: 29 Jun 1998 22:23:17 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Are random writes POSSIBLE in perl?
Message-Id: <6n944l$l9$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    uunet!netcom.com!bobmacd+6291998Nclpm writes:
:>Do you perhaps mean
:
:>sysopen(FH, $path, O_RDWR|O_CREAT)            || die $!;
:
:yes! yes!  Exactly what I want.   

:But I haven't been able to access the 
:(html, individual) manpage for sysopen on perl.com, and anyway I use 
:perl4, which doesn't have the command, far more than I use perl5, so I
:eschew perl5 idioms.

You really shouldn't do that, you know. :-)  

I don't think there's any excuse whatsoever for being locked into 
Perl4.  None.  

Here are things you might have missed.  They'll be in the faq included
with the 5.005 release.

To open file for reading:

    open(FH, "< $path")                                 || die $!;
    sysopen(FH, $path, O_RDONLY)                        || die $!;

To open file for writing, create new file if needed or else truncate old file:

    open(FH, "> $path") || die $!;
    sysopen(FH, $path, O_WRONLY|O_TRUNC|O_CREAT)        || die $!;
    sysopen(FH, $path, O_WRONLY|O_TRUNC|O_CREAT, 0666)  || die $!;

To open file for writing, create new file, file must not exist:

    sysopen(FH, $path, O_WRONLY|O_EXCL|O_CREAT)         || die $!;
    sysopen(FH, $path, O_WRONLY|O_EXCL|O_CREAT, 0666)   || die $!;

To open file for appending, create if necessary:

    open(FH, ">> $path") || die $!;
    sysopen(FH, $path, O_WRONLY|O_APPEND|O_CREAT)       || die $!;
    sysopen(FH, $path, O_WRONLY|O_APPEND|O_CREAT, 0666) || die $!;

To open file for appending, file must exist:

    sysopen(FH, $path, O_WRONLY|O_APPEND)               || die $!;

To open file for update, file must exist:

    open(FH, "+< $path")                                || die $!;
    sysopen(FH, $path, O_RDWR)                          || die $!;

To open file for update, create file if necessary:

    sysopen(FH, $path, O_RDWR|O_CREAT)                  || die $!;
    sysopen(FH, $path, O_RDWR|O_CREAT, 0666)            || die $!;

To open file for update, file must not exist:

    sysopen(FH, $path, O_RDWR|O_EXCL|O_CREAT)           || die $!;
    sysopen(FH, $path, O_RDWR|O_EXCL|O_CREAT, 0666)     || die $!;

To open a file without blocking, creating if necessary:

    sysopen(FH, "/tmp/somefile", O_WRONLY|O_NDELAY|O_CREAT)
            or die "can't open /tmp/somefile: $!":

--tom
-- 
    I dunno, I dream in Perl sometimes...
                    --Larry Wall in  <8538@jpl-devvax.JPL.NASA.GOV>


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

Date: 30 Jun 1998 03:49:31 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Are random writes POSSIBLE in perl?
Message-Id: <6n9n8b$qoj$2@client3.news.psi.net>

uunet!netcom.com!bobmacd+6291998Nclpm
(uunet!netcom.com!bobmacd+6291998Nclpm) wrote on MDCCLXIII September MCMXCIII in <URL: news:bobmacdEvBzMp.Jzv@netcom.com>:
++ 
++ P.S. I'm sure people will ask where I still use perl4.  I do a lot of 
++ interplatform desktop support, and I publish code.  In a Unix realm, I 
++ can count on my users having perl4.


Eh? It has been many, many moons since I was using a system that
had perl4 installed. But for the past 3 or 4 years, I haven't
worked on a Unix system without perl5.



Abigail
-- 
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
           print+Just (), another (), Perl (), Hacker ();'


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

Date: Mon, 29 Jun 1998 00:34:50 GMT
From: Todd Lehman <lehman@javanet.com>
Subject: Re: autovivification and tie questions
Message-Id: <3596F0E9.1BD90EEE@javanet.com>

Tye McQueen wrote:
> Perl5.004_02 certainly had some bugs with tied hashes.  I got the
> symptoms you describe in Perl5.004_02 even though I'm not doing what
> you describe.  I haven't noticed any bugs with tied hashes in
> Perl5.004_04.
> 
> So if you were having the problem prior to Perl5.004_04, I suggest
> you try again.
> 
> Now Perl5.004_04 _does_ seem to have some strange ideas about tied
> arrays, but the documentation warns that they "aren't finished" so
> I guess I can't complain too much.

Good guess -- I was using 5.004_02.  Am downloading 5.004_68 now.

I remembered wrong about the error message.  I just rewrote a little test
program to get it to gack again.  The bogus message was actually "Use of
uninitialized variable."

When I use STORE1, I get garped on like this:

   Foo::TIEHASH("Foo", "HASH(0x74b29c)")
   Foo::FETCH("Foo=HASH(0x74b254)", "a")
   Foo::STORE("Foo=HASH(0x74b254)", "a", "HASH(0x753928)")
   Foo::TIEHASH("Foo", "HASH(0x753940)")
   Foo::FETCH("Foo=HASH(0x74b254)", "a")
   Foo::FETCH("Foo=HASH(0x753958)", "b")
   Use of uninitialized value at tiebug.pl line 92.

   Foo::DESTROY("Foo=HASH(0x74b254)")
   Foo::DESTROY("Foo=HASH(0x753958)")
   Foo::DESTROY("Foo=HASH(0x753958)")

But when I use STORE2, I get what the right answer:

   Foo::TIEHASH("Foo", "HASH(0x74b29c)")
   Foo::FETCH("Foo=HASH(0x74b254)", "a")
   Foo::STORE("Foo=HASH(0x74b254)", "a", "HASH(0x753928)")
   Foo::TIEHASH("Foo", "HASH(0x753940)")
   Foo::STORE("Foo=HASH(0x75394c)", "b", "7")
   Foo::FETCH("Foo=HASH(0x74b254)", "a")
   Foo::FETCH("Foo=HASH(0x75394c)", "b")
   7
   Foo::DESTROY("Foo=HASH(0x74b254)")
   Foo::DESTROY("Foo=HASH(0x75394c)")
   Foo::DESTROY("Foo=HASH(0x75394c)")

STORE2 moves everything inside the regular hash down into the object which
gets tied to that original hash, so that the reference to the original hash
can be stored as requested.

STORE1, on the other hand, preserves the original hash -- it copies the
contents into a new hash instead of moving the contents.  The new hash forms
the core of the object to which a new hash is tied.

--Todd

_____________________________________________________________________________
#!/usr/local/bin/perl5

use strict;
$^W = 1;


package Foo;

sub new
{
   my $self = {};
   tie %$self, 'Foo', {};
   return $self;
}

sub TIEHASH
{
   my ($class, $val) = @_;
   print qq{Foo::TIEHASH("$class", "$val")\n};
   return bless { DATA => $val }, $class;
}

sub DESTROY
{
   my ($self) = @_;
   print qq{Foo::DESTROY("$self")\n};

   foreach (grep {ref $_ eq 'HASH'} values %{$self->{DATA}})
   {
      my $tied = !! tied %$_;
      (tied %$_)->DESTROY() if $tied;
      untie %$_ if $tied;
   }
}

sub EXISTS
{
   my ($self, $k) = @_;
   return exists $self->{DATA}{$k};
}

sub FETCH
{
   my ($self, $k) = @_;
   print qq{Foo::FETCH("$self", "$k")\n};

   return $self->{DATA}{$k}
      if ref $self->{DATA}{$k} ne 'HASH'
      or tied %{$self->{DATA}{$k}};

   my $v = {};
   tie %$v, 'Foo', delete $self->{DATA}{$k};
   return $self->{DATA}{$k} = $v;
}

sub STORE1
{
   my ($self, $k, $v) = @_;
   print qq{Foo::STORE("$self", "$k", "$v")\n};

   if (ref $v eq 'HASH')
   {
      my $u;
      %$u = %$v;
      $v = {};
      tie %$v, 'Foo', $u;
   }

   return $self->{DATA}{$k} = $v;
}

sub STORE2
{
   my ($self, $k, $v) = @_;
   print qq{Foo::STORE("$self", "$k", "$v")\n};

   if (ref $v eq 'HASH')
   {
      my $u = {};
      foreach (keys %$v) { $u->{$_} = delete $v->{$_}; }
      tie %$v, 'Foo', $u;
   }

   return $self->{DATA}{$k} = $v;
}



package main;
my $foo = new Foo;
$foo->{a}{b} = 7;
print $foo->{a}{b}, "\n";


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

Date: Mon, 29 Jun 1998 01:42:00 GMT
From: Todd Lehman <lehman@javanet.com>
Subject: Re: autovivification and tie questions
Message-Id: <359700A8.8CF30A48@javanet.com>

Todd Lehman wrote:
> sub STORE1
> [...]
>       my $u;
>       %$u = %$v;
>       $v = {};
>       tie %$v, 'Foo', $u;

Shame on me for writing %$u when $u isn't defined.

Those 4 lines should be these 3:

      my %u = %$v;
      $v = {};
      tie %$v, 'Foo', \%u;

Unfortunately, 5.004_02 still gacks the same way.

--Todd


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

Date: Mon, 29 Jun 1998 03:30:17 GMT
From: Todd Lehman <lehman@javanet.com>
Subject: Re: autovivification and tie questions
Message-Id: <35971A08.415F59E4@javanet.com>

Here is a better rework of the little nested-tied-hash class posted earlier.
Now STORE1 fails silently under 5.004_02 (no warning, which certainly isn't
better) but both STORE1 and STORE2 are smarter about taking non-empty hashes,
which is better.  And STORE2 still works, but still destroys the rvalue.

$foo->Dump() produces this with STORE1 swapped in:

   {A=a,B=b,C=c,D={},F={},J={K={L={M=jklm},N={O=no}}}}

and this with STORE2:

   {A=a,B=b,C=c,D={E=de},F={G={H={I=fghi}}},J={K={L={M=jklm},N={O=no}}}}

The second one is the correct output.

$foo->{J}{K}->Dump() produces the same (correct) output with both STORE1 and
STORE2 because $foo->{J} = {K=>{L=>{M=>'jklm'},N=>{O=>'no'}}} doesn't invoke
autovivification.

Unsolved problem:  STORE2 should not be destroying its rvalue unless it is
being called during autovivification.  How can this be detected?  If the
rvalue is an empty hash, it might not be coming from autovivification, so
testing that won't work.  It would be nice if a 5.004_02-compatible
workaround were possible.

--Todd


______________________________________________________________________________

#!/usr/local/bin/perl5

use strict;
$^W = 1;



package main;
my $foo = new Foo;

$foo->{A} = 'a';
$foo->{B} = 'b';
$foo->{C} = 'c';
$foo->{D}{E} = 'de';
$foo->{F}{G}{H}{I} = 'fghi';
$foo->{J} = {K=>{L=>{M=>'jklm'},N=>{O=>'no'}}};

$foo->Dump();
$foo->{J}{K}->Dump();



package Foo;

sub new
{
   my ($class) = @_;
   print qq{Foo::new("$class")\n};
   my $self = {};
   tie %$self, $class, {};
   return bless $self, $class;
}

sub TIEHASH
{
   BEGIN { $Foo::ID_Counter = 0; }
   my ($class, $v) = @_;
   my $self = bless { DATA => $v, ID => $Foo::ID_Counter++ }, $class;
   print qq{Foo::TIEHASH("$class", "$v") -> ID=$self->{ID}\n};
   return $self;
}

sub DESTROY
{
   my ($self) = @_;
   $self = tied %$self if tied %$self;
   foreach (values %{$self->{DATA}})
      { my $tied = !!tied %$_; untie %$_ if $tied; }
}

sub Flatten
{
   my ($self) = @_;
   $self = tied %$self if tied %$self;
   return '{' .
          join(',',
               map { sprintf("%s=%s", $_, ref($self->{DATA}{$_})
                                            ? $self->{DATA}{$_}->Flatten()
                                            : $self->{DATA}{$_}) }
               sort keys %{$self->{DATA}}) .
          '}';
}

sub Dump
{
   my ($self) = @_;
   print $self->Flatten(), "\n";
}

sub EXISTS
{
   my ($self, $k) = @_;
   return exists $self->{DATA}{$k};
}

sub FETCH
{
   my ($self, $k) = @_;
   print qq{Foo::FETCH("$self", "$k")\n};
   return $self->{DATA}{$k};
}

sub STORE1
{
   my ($self, $k, $v) = @_;
   print qq{Foo::STORE("$self", "$k", "$v")\n};

   if (ref $v eq 'HASH')
   {
      my $u = $v;
      $v = {};
      tie %$v, 'Foo', {};
      bless $v, 'Foo';
      foreach (keys %$u) { $v->{$_} = $u->{$_}; }
   }

   return $self->{DATA}{$k} = $v;
}

sub STORE2
{
   my ($self, $k, $v) = @_;
   print qq{Foo::STORE("$self", "$k", "$v")\n};

   if (ref $v eq 'HASH')
   {
      my $u = {};
      foreach (keys %$v) { $u->{$_} = delete $v->{$_}; }
      tie %$v, 'Foo', {};
      bless $v, 'Foo';
      foreach (keys %$u) { $v->{$_} = delete $u->{$_}; }
   }

   return $self->{DATA}{$k} = $v;
}


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

Date: Mon, 29 Jun 1998 04:17:43 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: autovivification and tie questions
Message-Id: <Pine.GSO.3.96.980628211627.21917D-100000@user2.teleport.com>

On Mon, 29 Jun 1998, Todd Lehman wrote:

> Good guess -- I was using 5.004_02.  Am downloading 5.004_68 now.

Now, you know that _68 is an experimental version, known to have bugs,
right? If you're looking to replace 5.004_02, I recommend 5.004_04 or the
soon-to-be-released 5.004_05. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3007
**************************************

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