From owner-freebsd-doc Tue Dec 8 03:23:44 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA13698 for freebsd-doc-outgoing; Tue, 8 Dec 1998 03:23:44 -0800 (PST) (envelope-from owner-freebsd-doc@FreeBSD.ORG) Received: from firewall1.lehman.com (firewall1.Lehman.COM [192.147.65.82]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id DAA13483; Tue, 8 Dec 1998 03:23:33 -0800 (PST) (envelope-from nclayton@lehman.com) From: nclayton@lehman.com Received: from relay.lehman.com by firewall1.lehman.com (8.8.6/8.8.6) id GAA22003; Tue, 8 Dec 1998 06:23:07 -0500 (EST) Received: from cmgrelay1.messaging-svcs.lehman.com by relay.lehman.com (4.1/LB-0.6) id AA10612; Tue, 8 Dec 98 06:22:35 EST Received: from lonmailhost.lehman.com by cmgrelay1.messaging-svcs.lehman.com (8.8.5/8.8.5) id GAA23321; Tue, 8 Dec 1998 06:22:32 -0500 (EST) Received: from lonadminvnm.lehman.com by lonmailhost.lehman.com (SMI-8.6/Lehman Bros. V1.5) id LAA21074; Tue, 8 Dec 1998 11:22:31 GMT Received: from lonadmin80.lehman.com by lonadminvnm.lehman.com (4.1/Lehman Bros. V1.6) id AA06573; Tue, 8 Dec 98 11:22:31 GMT Received: by lonadmin80.lehman.com (SMI-8.6/Lehman Bros. V1.5) id LAA07161; Tue, 8 Dec 1998 11:22:30 GMT Message-Id: <19981208112229.T543@lehman.com> Date: Tue, 8 Dec 1998 11:22:29 +0000 To: Steve Price , Gary Howland Cc: doc@FreeBSD.ORG, wosch@FreeBSD.ORG, asami@FreeBSD.ORG Subject: Re: ports INDEX perl Module References: <19981207154741.28355.qmail@abc.aaa-mainstreet.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91.1i In-Reply-To: ; from Steve Price on Mon, Dec 07, 1998 at 12:32:49PM -0600 Organization: Lehman Brothers Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Mon, Dec 07, 1998 at 12:32:49PM -0600, Steve Price wrote: > I have some related stuff that might help if you're interested. > You can also find the list of wants/needs that Wolfram Schneider > put out here: > > http://www.freebsd.org/cgi/getmsg.cgi?fetch=76128+79859+/usr/local/www/db/text/1998/freebsd-ports/19981018.freebsd-ports > > -steve > > On 7 Dec 1998, Gary Howland wrote: > > # If no one has volunteered yet, then I'll volunteer for this project. > # Let me know if someone is working on it or not, and if available, > # give me as much details as poss, and I'll start ASAP. I started working on this, and wrote some code which I mailed to Wolfram and Satoshi -- I appear to have lost it, so I've cc'd them on this message in the hope that's they hung on to it. Basically, it implemented two objects. FreeBSD::Port was an individual port. You created it calling the new() method, passing it one line from the ports INDEX file. The object read this in and set its internal state. It then provided methods to get this info back. There were also two methods that returned a multi-line string of information, one as text, the other as HTML. The second object was tied hash. You passed it the filename to the INDEX file and it went and created all the ::Port objects as necessary. The hash key was the name of the port. So you'd write code like use FreeBSD::PortsIndex; my(%i, $i); tie %i, FreeBSD::PortsIndex, "/usr/ports/INDEX"; $i = tied(%i); # Get information about a port print $i{"foo-1.1"}->maintainer(), "\n"; # Set information about a port $i{"foo-1.1"}->maintainer("foo@bar.org"); # Dump all information about a port print $i{"foo-1.1"}->as_text(); # Turn the port's information back into an INDEX line print $i{"foo-1.1"}->as_index(); # Create a new INDEX file that contains the changed information open(F, "/tmp/INDEX") or die "Can't open /tmp/INDEX"; print F $i->as_index(); close(F); Because FreeBSD::PortsIndex was a tied hash, you could use the normal Perl operators (sort(), keys(), each(), etc) to iterate over it. That's as far as I got. I didn't re-write any existing programs to use these new objects. N -- --+==[ Systems Administrator, Year 2000 Test Lab, Lehman Brothers, Inc. ]==+-- --+==[ 1 Broadgate, London, EC2M 7HA 0171-601-0011 x5514 ]==+-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message