[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Parsing package names/versions/flavors

I'm currently working on a portupgrade tool in Perl for OpenBSD ports.
Currently, parsing package name/version/flavor strings is extremely
icky, to wit:

( $pkg, $versionflavor ) = /([^[:space:]]*)-([[:digit:]][^[:space:]]*)[[:space:]]/ ;
( $version, $flavor) = ( $versionflavor =~ /([^-]*)(.*)/ );

Correctly seperates the data (currently), but it makes the eyes bleed
and relies on some potentially nasty assumptions.

Would it be possible to change the field seperator for this data (':',
as an example) such that it is unique?


Jeff Bachtel  (root@ISC,TAMU)    http://www.cepheid.org/~jeff
				 [finger jeff@cepheid.org for PGP key]