[11910] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5510 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 28 19:07:19 1999

Date: Wed, 28 Apr 99 16:00:15 -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           Wed, 28 Apr 1999     Volume: 8 Number: 5510

Today's topics:
        ANNOUNCE: Data::Locations 5.0 <sb@sdm.de>
        associative array problem bing-du@tamu.edu
    Re: associative array problem (Andrew Johnson)
        FYI Compiling perl 5.005_03 Under Irix 6.2: Use cc -O1 <jepeway@manfred.blasted-heath.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 28 Apr 1999 22:30:53 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: ANNOUNCE: Data::Locations 5.0
Message-Id: <7g826t$kr6$1@solti3.sdm.de>

I am glad to announce version 5.0 of my module "Data::Locations":

                  =========================================
                    Package "Data::Locations" Version 5.0
                  =========================================

This package is available for download either from my web site at

                  http://www.engelschall.com/u/sb/download/

or from any CPAN (= "Comprehensive Perl Archive Network") mirror server:

                  http://www.perl.com/CPAN/authors/id/STBEY/

Prerequisites:
--------------

Perl version 5.004 (subversion 0) or higher.

What's new in version 5.0:
--------------------------

 +  All global or "class" methods (except "Data::Locations->new()",
    of course) are gone. This allows several modules to use this
    module simultaneously without interfering with each other.
 +  All locations are local ("my" or "lexically scoped") variables
    now in the sense that they are automatically destroyed (and
    automatically dumped, if desired) whenever your last reference
    of a location goes out of scope. It's the Perl way now :-).
 +  All locations are dumped automatically now at shutdown time of
    this module (and also when the last reference of a location goes
    out of scope) if and only if a filename has been provided previously.
 +  The method "toplevel()" cannot be used to artificially set or reset
    the "toplevel" status of a location anymore. A location is a "toplevel"
    location (by definition) whenever it is not embedded in any other
    location. The method "toplevel()" now only allows to test this
    condition.
 +  The code in general, the regression test suite and the documentation
    have been overhauled a great deal.

What does it do:
----------------

Data::Locations - magic insertion points in your data

Did you already encounter the problem that you had to produce some
data in a particular order, but that some piece of the data was still
unavailable at the point in the sequence where it belonged and where
it should have been produced?

Did you also have to resort to cumbersome and tedious measures such
as storing the first and the last part of your data separately, then
producing the missing middle part, and finally putting it all together?

In this simple case, involving only one deferred insertion, you might
still put up with this solution.

But if there is more than one deferred insertion, requiring the handling
of many fragments of data, you will probably get annoyed and frustrated.

You might even have to struggle with limitations of the file system of
your operating system, or handling so many files might considerably slow
down your application due to excessive file input/output.

And if you don't know exactly beforehand how many deferred insertions
there will be (if this depends dynamically on the data being processed),
and/or if the pieces of data you need to insert need additional (nested)
insertions themselves, things will get really tricky, messy and troublesome.

In such a case you might wonder if there wasn't an elegant solution to
this problem.

This is where the "Data::Locations" module comes in: It handles such
insertion points automatically for you, no matter how many and how deeply
nested, purely in memory, requiring no (inherently slower) file input/output
operations.

(The underlying operating system will automatically take care if the amount
of data becomes too large to be handled fully in memory, though, by swapping
out unneeded parts.)

Moreover, it also allows you to insert the same fragment of data into
SEVERAL different places.

This increases space efficiency because the same data is stored in
memory only once, but used multiple times.

Potential infinite recursion loops are detected automatically and
refused.

In order to better understand the underlying concept, think of
"Data::Locations" as virtual files with almost random access:
You can write data to them, you can say "reserve some space here
which I will fill in later", and continue writing data.

And you can of course also read from these virtual files, at any time,
in order to see the data that a given virtual file currently contains.

When you are finished filling in all the different parts of your virtual
file, you can write out its contents in flattened form to a physical, real
file this time, or process it otherwise (purely in memory, if you wish).

You can also think of "Data::Locations" as bubbles and bubbles inside
of other bubbles. You can inflate these bubbles in any arbitrary order
you like through a straw (i.e., the bubble's object reference).

Note that this module handles your data completely transparently, which
means that you can use it equally well for text AND binary data.

You might also be interested in knowing that this module and its concept
have already been heavily used in the automatic code generation of large
software projects.

Legal issues:
-------------

This package with all its parts is

Copyright (c) 1997, 1998, 1999 by Steffen Beyer.
All rights reserved.

This package is free software; you can redistribute it and/or
modify it under the same terms as Perl itself, i.e., under the
terms of the "Artistic License" or the "GNU General Public License".

Please refer to the files "Artistic.txt" and "GNU_GPL.txt" in
this distribution for details!

Author's note:
--------------

I would be very pleased over *ANY* kind of feedback, questions,
suggestions, donations ;-) and so on, since unfortunately none of
you lazy bums ;-) (for exceptions to this see the "CREDITS.txt"
file in this distribution!) hardly ever writes me.

This feedback is essential for me in order to know wether this
module is useful, to estimate how many people use it and for
what (essential to assess the potential impact an incompatible
change may have, for instance), where its problems and weak-
nesses lie, what should be improved, what additional features
would be useful, etc.

Even e-mail with an empty body and just a subject line such as
"I'm using Data::Locations" would help!

Thank you very much in advance!

In any case, I hope you will find this module beneficial,
share and enjoy!

Yours sincerely,
--
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/
    http://www.engelschall.com/u/sb/download/
    http://www.perl.com/CPAN/authors/id/STBEY/
    http://www.oreilly.de/catalog/perlmodger/bnp/


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

Date: Wed, 28 Apr 1999 22:23:15 GMT
From: bing-du@tamu.edu
Subject: associative array problem
Message-Id: <7g81of$d8$1@nnrp1.dejanews.com>

Hello there,

Look at the following code snippet.  I want the subroutin 'change' to return
an associative array (%test2) and assign it to another associative array
(%test1) in the main program.  Unfortunately this code did not give me what I
want.  The output is:  new test1 is:  test2:

I have no trouble with general arrays (@).  Reference problem?	Can anybody
shed some light on this?  Thanks in advance.

Bing

--------------------------------
#!/usr/local/bin/perl

my %test1 = (one,1,two,2);

%test1 = &change;

print "new test1 is:\n";

foreach $key (keys %test1)
{
  print "$key: $test1{$key}\n";
}

exit;

sub change {
my %test2 = (three,3);

return(test2);
}
-----------------------------

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 28 Apr 1999 22:35:07 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: associative array problem
Message-Id: <v2MV2.571$HO3.113287@news1.rdc1.on.wave.home.com>

In article <7g81of$d8$1@nnrp1.dejanews.com>,
 bing-du@tamu.edu <bing-du@tamu.edu> wrote:
!  Hello there,
!  
!  Look at the following code snippet.  I want the subroutin 'change'
!  to return an associative array (%test2) and assign it to another
[snip] 
!  
!  return(test2);
          ^

return %test2;

regards
andrew

-- 
Andrew L. Johnson   http://members.home.com/andrew-johnson/
      I drink to make other people interesting.
          -- George Jean Nathan


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

Date: 28 Apr 1999 18:35:05 -0400
From: Chris Jepeway <jepeway@manfred.blasted-heath.com>
Subject: FYI Compiling perl 5.005_03 Under Irix 6.2: Use cc -O1
Message-Id: <55yajc4bmu.fsf@manfred.blasted-heath.com>

Geez, I've no idea where this note should be posted.

I've seen some questions fly by re: the following error
when building 5.005_03 on a Irix system using SGI's cc:

  Modification of a read-only value attempted at lib/File/Path.pm line 123

That line's an assignment to a my()d variable, so I
doubt that's the real problem.  My guess is that
the C compiler blows something when building that
part of the perl parser which detects constants.
Using "cc -O1" instead of "cc -O2" builds a perl
that passes all the relevant tests in the "t" subdir.

Chris <jepeway@cs.utk.edu>.


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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