[10207] in Perl-Users-Digest
Perl-Users Digest, Issue: 3799 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 23 14:07:27 1998
Date: Wed, 23 Sep 98 11:00:27 -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, 23 Sep 1998 Volume: 8 Number: 3799
Today's topics:
Re: 1st Sunday of each Month <stuart@euronova.com>
Re: 1st Sunday of each Month (David A. Black)
Re: any way to encrypt my script? <richgrise@entheosengineering.com>
Re: any way to encrypt my script? <richgrise@entheosengineering.com>
Re: any way to encrypt my script? <richgrise@entheosengineering.com>
Re: Array of hashes: a better way? (Craig Berry)
Re: Array of hashes: a better way? <jdporter@min.net>
Call for Participation: 7th Python Conference <jeremy@cnri.reston.va.us>
Re: Comparing arrays ? <richgrise@entheosengineering.com>
Re: Cookie Help! <richgrise@entheosengineering.com>
Re: Display Client info in users browser? (Amitai Schlair)
Re: Enumerating Properties and Methods droby@copyright.com
Re: EOF command for Mac? (for Perl) (Amitai Schlair)
Re: even/odd numbers (Clinton Pierce)
Re: Hashes springing into existence [Was: more regex/pa (Ilya Zakharevich)
Re: Hidden field??? <cmbaker@fedex.com>
Intro To Perl tutorial - Chicago, 10/5-7/98 <johnd@xor.com>
Re: Is perl millennium compliant ? (Eisen Chao)
Re: MLDBM object methods (Steve Manes)
Re: Need help with a simple program (newbie). <richgrise@entheosengineering.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 23 Sep 1998 18:02:51 +0200
From: "Stuart Thorn" <stuart@euronova.com>
Subject: Re: 1st Sunday of each Month
Message-Id: <6ub62m$ev4$1@buggy.easynet.fr>
I found this code from last year. It'll get you the first saturday. You'll
work out how to get the first sunday but don't ask me right now...
Stuart
________________________________________________
sub firstSaturday {
my( $month, $year ) = @_;
my $firstDay = monthStart( $month, $year );
return ( ( 7 - $firstDay ) % 8);
}
sub monthStart{
$d = 1; $m = $_[0]; $y = $_[1];
@d = (0,3,2,5,0,3,5,1,4,6,2,4);
@days = (Sun, Mon, Tue, Wed, Thu, Fri, Sat);
%day = ("Sun" => 0, "Mon" => 1, "Tue" => 2, "Wed" => 3, "Thu" => 4, "Fri" =>
5, "Sat" => 6 ) ;
$y-- if $m < 3;
$day = $days[($y+int($y/4)-int($y/100)+int($y/400)+$d[$m-1]+$d) % 7];
return $day{ $day } ;
}
Stafford Hyacinth a icrit dans le message
<2s8O1.903$_G3.853152@news2.mia.bellsouth.net>...
>Anyone has sample code for figuring out the 1st sunday of each month or at
>least give an idea where to begin. Have been going at this for two days
and
>still have no code. If I could only do vbscripts on the UNIX platforms.
------------------------------
Date: Wed, 23 Sep 1998 12:59:26 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: 1st Sunday of each Month
Message-Id: <6ub9de$sv4$1@earth.superlink.net>
Hello -
"Stafford Hyacinth" <hyacinth@bellsouth.net> writes:
>Anyone has sample code for figuring out the 1st sunday of each month or at
>least give an idea where to begin. Have been going at this for two days and
>still have no code. If I could only do vbscripts on the UNIX platforms.
use Date::Manip;
print map { UnixDate($_, "%B %d %y\n") }
ParseRecur("first sunday of every month in 1998");
(Leave of "in 1998" to default to cuurent year.)
David Black
dblack@saturn.superlink.net
------------------------------
Date: Wed, 23 Sep 1998 12:18:59 -0500
From: Rich Grise <richgrise@entheosengineering.com>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: any way to encrypt my script?
Message-Id: <36092D83.11F3@entheosengineering.com>
Tom Christiansen wrote:
>
[great wisdom excerpted]
>
> --tom
> --
> Someone who truly understands UNIX not only understands why "rm *"
> screws you, but understands why IT HAS TO BE THAT WAY.
Wouldn't that be
$ rm -R *
?
(or ``rm -r *'' - I can never remember which ones use the upper/lower
case ``r'' for recursion)
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "Delete" button!)
------------------------------
Date: Wed, 23 Sep 1998 12:27:53 -0500
From: Rich Grise <richgrise@entheosengineering.com>
To: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: any way to encrypt my script?
Message-Id: <36092F99.5590@entheosengineering.com>
Ronald J Kimball wrote:
>[bunch stuff]
> Perhaps it's more akin to saying that only astrophysicists should make
> authoritative comments about the composition of stars.
>
Do you mean comments like, "They're big conglomerations of hot gas"?
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "Delete" button!)
------------------------------
Date: Wed, 23 Sep 1998 12:25:41 -0500
From: Rich Grise <richgrise@entheosengineering.com>
To: Ben Sauvin <sauvin@osmic.com>
Subject: Re: any way to encrypt my script?
Message-Id: <36092F15.1DD2@entheosengineering.com>
Ben Sauvin wrote:
>
> Apparently, my imperfect expression could leave some considerable orders
> of magnitude of void for fleets of lost or misconstrued meanings to trespass
> unnoticed. To be clearer, it TAKES someone who has written one or more
> language translator to realise the virtual infinity of field between the
> conceptually pristine "interpreter" and the idealogically unsullied
> "compiler", and how the two are far from mutually exclusive or diametrally
> opposed. In other words, if you've never written a language product of any
> kind, SHUT UP and learn something.
>
OK, then I'm qualified: I wrote an in-line assembler/unassembler for the
NEC V40 to run on a 16-bit ROM simulator.
So, the question was, "any way to encrypt my script?"
Yes.
But then it won't run.
>From whom are you trying to protect your source?
If it's on a server, then the question is moot, unless your attackers
have telnet access, and then you've got much more serious problems than
protecting your source code. A server won't deliver up the source of an
executable script, it will execute it. Unless the server's broken, and
then, the telnet daemon probably wouldn't work either.
If it becomes that big of a deal, then write the damn thing in C or
something, and compile it, and let the server execute the object - and
just rm your source from the server.
Geez!
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "Delete" button!)
------------------------------
Date: 23 Sep 1998 16:48:00 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Array of hashes: a better way?
Message-Id: <6ub8o0$13r$1@marina.cinenet.net>
Andrew W. Robinson (awrobinson@amoco.com) wrote:
: The code I have here works, but I was wondering if there was a
: better way. I have a data file that consists of multiline
: records, each line consisting of key-value pairs. The keys may
: vary between records and some may be missing values. I list an
: example below the code.
:
: My question concerns the section where I split the line, test the
: number of pieces and assign the hash accordingly. This seems
: clumsy. In the spirit of furthering my perl knowledge, is there a
: better, more elegant way of extracting the key-value pair from
: the line?
:
:
: ######### script file #########
: #!/usr/bin/perl -w
Ten karma points for using -w; three deducted for not using strict. :)
: $i = 0;
We're going to get rid of $i below.
: open FIN, "test.dat" ;
Always *always* check the success of open!
: while ( $line = <FIN> ) {
You may wish to make that 'while (defined($line = <FIN>)) {', to guard
against the pathological case of a 0 at EOF with no trailing newline.
: chomp $line;
: if ( $line =~ /^$/ ) {
Probably easier and more efficient to write that test as:
if ($line eq '');
: $i++;
Replace that with:
push @records, {};
That is, put a new (reference to an) empty hash on the end of the list.
: next;
: }
: @items = split /\s*=>\s*/, $line;
: if ( scalar @items == 2 ) {
: ${$records[$i]}{$items[0]} = $items[1];
: } else {
: ${$records[$i]}{$items[0]} = "";
: }
Rewrite that last conditional as:
$items[1] = '' unless @items == 2;
$records[-1]->{$items[0]} = $items[1];
: }
: close FIN ;
Then get rid of the last record if it has no keys, as might be the case if
there were a blank line before EOF:
pop @records unless keys %{$records[-1]};
: foreach $record ( @records ) {
: foreach $key ( keys %{$record} ) {
: print "$key=>${$record}{$key}; ";
: }
: print "\n";
: }
HTH!
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: Wed, 23 Sep 1998 12:50:57 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Array of hashes: a better way?
Message-Id: <360926F1.CC45F25A@min.net>
Andrew W. Robinson wrote:
>
> The code I have here works, but I was wondering if there was a
> better way. I have a data file that consists of multiline
> records, each line consisting of key-value pairs. The keys may
> vary between records and some may be missing values. I list an
> example below the code.
>
> My question concerns the section where I split the line, test the
> number of pieces and assign the hash accordingly. This seems
> clumsy. In the spirit of furthering my perl knowledge, is there a
> better, more elegant way of extracting the key-value pair from
> the line?
Well, what you have isn't too bad, but I would suggest the
following changes.
0. You need to ALWAYS ALWAYS test the result of open().
1. Your split should probably include a third arg of 2:
split /\s*=>\s*/, $line, 2;
That way you won't accidentally split on any occurences of
=> after the first one.
1. You don't need to test the number of pieces from split;
go ahead and assign
${$records[$i]}{$items[0]} = $items[1];
every time. If there weren't 2 pieces, $items[1] will be undef,
and any time you use it like a string it'll look like ''.
2. Since your records are separated by empty lines, you can set
$/ = "", and then <FIN> will return you records instead of lines.
Of course, then you'll have to split each record on newlines...
But your code might still be simpler.
#!/usr/bin/perl -w
$/ = "";
@records = ();
open FIN, "test.dat" or die "open test.dat: $!";
while ( <FIN> ) {
chomp;
my %record;
for my $line ( split /\n/ ) {
if ( $line =~ /\s*=>\s*/ ) {
$record{ $` } = $';
}
}
push @records, \%record;
}
close FIN ;
Hope this helps,
--
John "Many Jars" Porter
------------------------------
Date: 23 Sep 1998 12:09:07 -0400
From: Jeremy Hylton <jeremy@cnri.reston.va.us>
Subject: Call for Participation: 7th Python Conference
Message-Id: <51emt27qvw.fsf@bitdiddle.cnri.reston.va.us>
Call for Participation
7TH INTERNATIONAL PYTHON CONFERENCE
http://www.foretec.com/python/workshops/1998-11/
South Shore Harbour Resort
Houston, Texas
November 10-13, 1998
Sponsored by CNRI and the PSA
The Python Conference brings together a broad range of users, vendors,
researchers, and developers from the Python community. The conference
is the premier opportunity to meet other Python programmers, share
information, and learn about the latest happenings -- including an
update on the future of Python from its creator, Guido van Rossum.
The program also includes a day of tutorials, two days of papers and
invited talks, and Developers' Day. The conference program has been
expanded this year to include a session for demos and posters to
highlight work that is more interesting to see and interact with.
Invited speakers including Eric Raymond, who will present his paper
"Homesteading the Noosphere" about custom, ego, and property in the
open source community, and David Beazley, who will talk about
commodity supercomputing with Python and a Python-driven application
achieved 10 Gflops sustained performance on a Linux cluster.
For registration information, visit:
http://www.foretec.com/python/workshops/1998-11/registration.html
Early registration deadline: Oct. 16, 1998
Program -- two days of invited talks and refereed papers:
http://www.foretec.com/python/workshops/1998-11/program.html
Hotel information:
http://www.foretec.com/python/workshops/1998-11/hotel.html
Jeremy Hylton
program chair
------------------------------
Date: Wed, 23 Sep 1998 11:42:13 -0500
From: Rich Grise <richgrise@entheosengineering.com>
To: Phil Taylor <phil@ackltd.demon.co.uk>
Subject: Re: Comparing arrays ?
Message-Id: <360924E5.2C9C@entheosengineering.com>
Phil Taylor wrote:
>
> I've got an array which contains a series of codes ie
>
> @array1 = ("01", "02");
>
> and I have another array which contains the above codes with a decode
> separated by a colon ie
>
> @array2 = ("01:Element01", "02:Element02", "03:Element03", ........)
>
> I want to end up with @array2 to only contain elements relating to
> codes "01" and "02" ie
>
> @array2 = ("01:Element01", "02:Element02")
>
> Can anyone suggest a neat way to achieve this?
>
> Thanks
>
> Phil
Well, I'm not an expert by any stretch of the imagination, and this
is by no means "neat", and it includes a question I'm about to ask,
but:
for (@array2) {
($key,$item) = split(/:/,$_);
if ($key # [is in @array1 - this is the one I'm looking for a
# quick & dirty answer to])
{
push # whatever the right syntax is to add this particular
# $item to
@array3;
}
}
Or maybe all I did is restate your question. Sigh.
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "Delete" button!)
------------------------------
Date: Wed, 23 Sep 1998 12:10:19 -0500
From: Rich Grise <richgrise@entheosengineering.com>
To: Kresimir.Puskaric@siemens.at
Subject: Re: Cookie Help!
Message-Id: <36092B7B.5D9E@entheosengineering.com>
Kresimir.Puskaric@siemens.at wrote:
>
> Hello Brian,
>
> > Can anyone direct me to (hopefully) an on-line or downloadable file that
> > explains how to use cookies; ie. writing, reading, etc.
> >
> > Brian Enderle
> >
>
> Perhaps the following script could help you:
>
# includes the whole M.W. cookie.lib !?!?!
Geez, ya coulda just said, "go get Matt's Cookie.lib!"
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "Delete" button!)
------------------------------
Date: Wed, 23 Sep 1998 13:40:26 -0400
From: amitai.schlair@usa.net (Amitai Schlair)
Subject: Re: Display Client info in users browser?
Message-Id: <1dft19l.er1gbs16j1nnkN@mac12.ooi.net>
Sam Wang <samwang@freewwweb.com> wrote:
> Oddball wrote:
>
> > I just visited a site that displays this on part of the Index Page:
> > Some System Stuff !!!
> > The local date is :Friday, 18-Sep-98 11:53:04 PDT
> > Your IP address is :24.3.XX.XXX
> > You are currently being served by :http://XXXXXX.com
> > You are using a Mozilla/4.0 (compatible; MSIE 4.0; Windows 95) compatible
> > browser
> >
> > How is this done. I am sure there is some server side cgi/pearl involved.
> > Anyone out there can explain it to me. I can't be Javascript beacuse I am
> > using IE.
>
> thru the use of the magical hash, %ENV
>
> and yes, it's thru perl. and ie can run javascript (but not real good).
Whew! Good thing Larry invented Perl. I can't imagine life without
environment variables.
- Amitai
------------------------------
Date: Wed, 23 Sep 1998 15:52:58 GMT
From: droby@copyright.com
Subject: Re: Enumerating Properties and Methods
Message-Id: <6ub5gq$mbt$1@nnrp1.dejanews.com>
In article <360862D9.57F3@comenius.ms.mff.cuni.cz>,
Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz> wrote:
> Jay Guerette wrote:
> >
> > >>how could I get a list of the methods and properties available to me from
> > >>this class?
> > >
<snip>
> Cause it MATTERS if an object is an ordinary Perl-only object with no
> magic whatsoever
> and if it is a Win32::OLE object.
>
> The methods of Win32::OLE objects are not defined anywhere in any perl
> code.
> They are "AUTOLOADED". So even if you used the MJD's solution you would
> not
> get any helpfull listing. It would list only the "standard" methods
> defined
> within Win32::OLE.pm
>
> I'm not sure, but there may be some method for listing methods and
> properties, but
> it WILL BE Win32::OLE specific. So search the docs of Win32::OLE or
> subscribe to Perl-Win32-Users@lyris.activestate.com and ask there.
> Unless of course Jan Dubois (author of Win32::OLE) comes here and
> answers the question.
>
> Jenda
>
Quite aside from anything specific to Win32::OLE.pm, anything defined by the
proxy method described in perltoot's "Autoloaded Data Methods" section will be
created on-the-fly and will not show up in a symbol-table search.
And there are probably plenty of other fancy tricks with similar effects.
--
Don Roby
<droby@copyright.com>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 23 Sep 1998 13:40:36 -0400
From: amitai.schlair@usa.net (Amitai Schlair)
Subject: Re: EOF command for Mac? (for Perl)
Message-Id: <1dft22h.1lt30r21rc0zs8N@mac12.ooi.net>
brian d foy <comdog@computerdog.com> wrote:
> Mary E Tyler <dejah@DejahsPrivateIce.com> wrote:
>
> > The mac does not have a control key and does not map these characters
> > the same way... she would have to use the ASCII codes (for the control
> > characters), but i do not believe that this is what she is asking.
>
> i don't know what machine you are using, but every Apple keyboard i've
> ever had (and that's several) has had a functioning key labelled
> "Control". and, if you hold that key down along with "D" while MacPerl is
> expecting STDIN, MacPerl gets EOF.
My Mac Plus doesn't have one. I think MacPerl can run on it, so it might
be worth considering alternate methods of sending EOF. Then again, if
you've got a Mac Plus, you've undoubtedly already run into problems due
to the lack of a Control key (and perhaps others).
- Amitai
------------------------------
Date: 23 Sep 1998 15:20:12 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
Subject: Re: even/odd numbers
Message-Id: <6ub3jc$slv7@eccws1.dearborn.ford.com>
In article <6u3sbf$ct6$1@news.iastate.edu>,
kortbein@iastate.edu (Josh Kortbein) writes:
>John Moreno (phenix@interpath.com) wrote:
>: > Well if people keep asking it day in and day out it probably ought to be
>: > in the FAQ, which of course is where I first looked. Just keep in mind not
>: > all of us here are experienced programmers and the logic you express in
>: > your solutions isn't the same as one finds in a high school algebra class.
>
>: As someone else pointed out - this isn't a perl question, it is a basic
>: mathematics question.
>
>As a mathematician-in-training, I'd like to point out that "modulus"
>often isn't introduced for quote some time, depending on when one takes
>which classes. If one takes algebra, geometry, trigonometry, calculus,
>etc., without ever taking a "discrete math" course, it could be that
>division modulo n might not even be introduced until a first course
>in abstract algebra. Yes, the way it works is basic, but the idea
>of something like the modulus operator is largely useless in lots of
>mathematical situations.
(fixed-width font warning)
Let's see...my 5th grader's homework from a while ago:
____3
7) 22
21
----
1
3, Remainder 1
7 does not evenly divide 22.
For 5th grade math, the concept is INFINITELY useful. If ya catch
my drift. As someone else tried to point out: this isn't rocket-science,
this is primary-school stuff.
--
+------------------------------------------------------------------------+
| Clinton A. Pierce | "If you rush a Miracle Man, | http://www. |
| cpierce1@ford.com | you get rotten miracles" | dcicorp.com/ |
| fubar@ameritech.net |--Miracle Max, The Princess Bride| ~clintp |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*
------------------------------
Date: 23 Sep 1998 16:12:40 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Hashes springing into existence [Was: more regex/pattern substitution]
Message-Id: <6ub6lo$5le$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Daniel Grisinger
<dgris@rand.dimensional.com>],
who wrote in article <6ub4l8$a7g$1@rand.dimensional.com>:
> >: would almost certainly slow C<exists> way down).
> >
> > It should speed it up I'd think.
>
> It doesn't seem so to me, but I may be misunderstanding
> something about the perl core (if I am, I'd appreciate
> if someone could enlighten me :-).
> exists $foo{bar}{baz}; # assume $foo{bar} doesn't exist
>
> newHV
> newSV(foo)
> rv2hv
> newSV(bar)
> rv2hv
> pp_exists(baz)
>
> or
>
> exists $foo{bar}{baz} # assume $foo{bar} does exist
>
> rv2hv(foo)
> rv2hv(bar)
> pp_exists(baz)
>
> Now, it's obvious that more steps are called when $foo{bar}{baz}
> doesn't exist, but this is actually irrelevant because even
> if it does exist the calls to newHV and newSV had to take
> place at some point (ie, calling exists on only existing
> values speeds up execution of exists, but has no effect
> on total program execution).
>
> In other words, pp_exists isn't called for each level of
> in the hash, only for the final level.
Well, you confuse PP-code with Perl API. pp_exist() may be not
called, but it is only a wrapper for hv_fetch(...,FALSE) (I did not
look into the code, though). And hv_fetch is called before doing
newHV() anyway.
Ilya
------------------------------
Date: Wed, 23 Sep 1998 12:28:19 -0500
From: Chad Baker <cmbaker@fedex.com>
To: ywang@maingate.net
Subject: Re: Hidden field???
Message-Id: <36092FB3.99D1FD09@fedex.com>
Did you consider
<input type=hidden name=page value=3>
?
name and value are the key-value pairs.
You could check for page and grab its
value. If page not found, then the
(ab)user has entered illegally. If
you are expecting 3 and it has the
value 2, the (ab)user is cheating.
Each time you generate a new page,
you update the page variable to what
the next page expects.
Chad
------------------------------
Date: Wed, 23 Sep 1998 09:18:27 -0700
From: John Donnelly <johnd@xor.com>
Subject: Intro To Perl tutorial - Chicago, 10/5-7/98
Message-Id: <36091F53.2B32@xor.com>
***Introduction To Perl For Programmers***
Only 3 seats left (max 8) in upcoming (10/5-7) Intro To Perl tutorial
in the Chicago area. Contact me ASAP for complete details/
registration info.
--John Donnelly, Training Coordinator
XOR Network Engineering, Inc.
http://www.xor.com/; johnd@xor.com; 303-448-4816
**Register on-line and save 15%**
http://www.xor.com/training
*****
Introduction to Perl for Programmers
(3 day, hands-on, lecture/lab format)
Tuition: $995
Naperville, IL - October 5-7, 1998
Designed to be programmer-friendly and platform-neutral,
Perl is a high-level, general-purpose programming language
that makes easy and medium-hard tasks easy and seriously
non-trivial tasks possible. Now moving into its second
decade, Perl has become the language of choice across all
platforms for programmers engaged in rapid prototyping, sys-
tem utilities, software tools, system management tasks, data
base access, graphical programming, and world wide Web pro-
gramming.
NOTE: While this course is based on the current release of
Perl (version 5.004), it is not intended to be a detailed
discourse on all advanced programming constructs now
afforded by that release. It is a jump-start introduction
to Perl for experienced programmers, not an advanced course
for Perl programmers.
------------------------------
Date: 23 Sep 1998 15:51:32 GMT
From: echao@interaccess.com (Eisen Chao)
Subject: Re: Is perl millennium compliant ?
Message-Id: <6ub5e4$3qj$3@supernews.com>
I R A Aggie (fl_aggie@thepentagon.com) wrote:
: In article <35EEB1F2.34BD@boat.bt.com>, georgelj@boat.bt.com wrote:
:
: + Does snybody knwo if the current releases of perl have been certified
: + for millennium compliance ?
:
: *Which* millenium?
*Which* Calandar System
(e.g. jewish, Babylonian, Chinese, Greek Orthodox)
: James
------------------------------
Date: Wed, 23 Sep 1998 16:57:18 GMT
From: smanes@NOSPAM.HEREmagpie.com (Steve Manes)
Subject: Re: MLDBM object methods
Message-Id: <364025d7.999420153@news.panix.com>
On Wed, 23 Sep 1998 08:26:39 -0400, John Porter <jdporter@min.net>
wrote:
>> Can someone tell me how to access the FIRSTKEY, NEXTKEY, etc. DBM
>> object methods in MLDBM (using GDBM)? I see them in the MLDBM.pm
>> module but I can't fnd any docs to explain how to get at them.
>I hope you're "tie"ing to MLDBM, right?
>If you're doing that, you shouldn't need to call those methods
>directly. However, if you really know what you're doing, you
>can call those methods like so:
>
> $dbm = tie %o, 'MLDBM', ...;
> $key = tied($dbm)->FIRSTKEY;
>
Yup. Actually:
$O = tie %Msg, 'MLDBM', "/tmp/msg.dat", O_RDWR|O_CREAT, 0664;
(tied %Msg)->DumpMeth('portable');
... add some records, check them with Data:Dumper, results OK
my $key = tied($O)->FIRSTKEY;
Results:
Can't call method "FIRSTKEY" without a package or object
or object reference....
That's the problem I've run into.
I need to be able to set a position pointer in the hash in this
application, i.e. if I read Msg{'foo1'}, then move around the file, I
need to be able to return to Msg{'foo1'} and then move to the next
entry in the hash, i.e Msg{'foo2'}, presumably by calling the FETCH
and then NEXTKEY methods.
------------------[ http://www.magpie.com ]-----------=o&>o-------
Steve Manes smanes [at] magpie.com N'Yawk, N'Yawk
------------------------------
Date: Wed, 23 Sep 1998 12:00:22 -0500
From: Rich Grise <richgrise@entheosengineering.com>
Subject: Re: Need help with a simple program (newbie).
Message-Id: <36092926.57F9@entheosengineering.com>
I HATE this netscrape snooze!
"More included text than new text", indeed!
> > ...
> > .> if ($month == 1) {
> > .> $temp_month = $day;
> > .> }
#...
> > .> if ($month == 12) {
> > .> $temp_month = 334 + $day;
> > .> }
> >
> > $temp_month = (0, 31, 59, etc ..., 304, 334)[$day - 1];
> >
>
> $temp_month = (0, 31, 59, etc ..., 304, 334)[$month - 1];
>
>
> Isn't there a better way to do this stuff with localtime and/or the Date
> module anyway?
>
> --
> Don Roby
> <droby@copyright.com>
>
Someone once gave me this ( I'm not sure if this is what you're after,
but it kind of looks like it )
$temp_month = `date -%j`; # gives the julian date
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "Delete" button!)
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3799
**************************************