<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>TODO</filename>
    </added>
    <added>
      <filename>t/test_regression/no_entries.gz</filename>
    </added>
    <added>
      <filename>t/test_regression/three_entries.gz</filename>
    </added>
    <added>
      <filename>t/write_file.t</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -6,3 +6,4 @@ blib
 pm_to_blib
 CPAN-*
 cover_db
+t/test_output</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,23 +1,25 @@
 # $Id: Makefile.PL,v 1.4 2004/07/04 17:04:17 comdog Exp $
 use ExtUtils::MakeMaker;
 
-require 5.006;
+require 5.008;
 
-eval &quot;use Test::Manifest 1.14&quot;;
+eval &quot;use Test::Manifest 1.21&quot;;
 
 WriteMakefile(
 	'NAME'	       =&gt; 'CPAN::PackageDetails',
-	'ABSTRACT'     =&gt; 'This is what the module does',
+	'ABSTRACT'     =&gt; 'Create or read 02.packages.details.txt.gz',
 	'VERSION_FROM' =&gt; 'lib/PackageDetails.pm',
 	'LICENSE'      =&gt; 'perl',
 	'AUTHOR'       =&gt; 'brian d foy &lt;bdfoy@cpan.org&gt;',
 	
 	'PREREQ_PM'    =&gt; { 
-		'Test::More' =&gt; '0',
+		'Test::More'   =&gt; '0',
+		'Test::Output' =&gt; '0.10',
+		'PerlIO::gzip' =&gt; '0',
 		},
 
 	'PM'           =&gt; {
-		'lib/PackageDetails.pm'         =&gt; '$(INST_LIBDIR)/PackageDetails.pm',
+		'lib/PackageDetails.pm' =&gt; '$(INST_LIBDIR)/PackageDetails.pm',
 		},
 
 	'MAN3PODS'     =&gt; {</diff>
      <filename>Makefile.PL</filename>
    </modified>
    <modified>
      <diff>@@ -38,7 +38,7 @@ CPAN::PackageDetails - Create or read 02.packages.details.txt.gz
 		logic   =&gt; 'OR',  # but that could be AND, which is the default
 		package =&gt; qr/^Test::/, # or a string
 		author  =&gt; 'OVID',      # case insenstive
-		path    =&gt; 
+		path    =&gt;  qr/foo/,
 		)
 	
 	# create a new file #####################
@@ -49,7 +49,7 @@ CPAN::PackageDetails - Create or read 02.packages.details.txt.gz
 		columns      =&gt; &quot;package name, version, path&quot;,
 		intended_for =&gt; &quot;My private CPAN&quot;,
 		written_by   =&gt; &quot;$0 using CPAN::PackageDetails $CPAN::PackageDetails::VERSION&quot;,
-		last-updated =&gt; $epoch_time,
+		last_updated =&gt; $epoch_time,
 		);
 
 	$package_details-&gt;add_entry(
@@ -151,7 +151,7 @@ sub CPAN::PackageDetails::Header::AUTOLOAD
 # so I need to intercept them at the top-level and redirect
 # them to the right delegate
 my %Dispatch = (
-		header  =&gt; { map { $_, 1 } qw(set_header header_exists) },
+		header  =&gt; { map { $_, 1 } qw(set_header header_exists columns_as_list) },
 		entries =&gt; { map { $_, 1 } qw(add_entry count) },
 		entry   =&gt; { map { $_, 1 } qw() },
 		);
@@ -292,7 +292,7 @@ sub _parse
 		last if /^\s*$/;
 		}
 	
-	my @columns = $package_details-&gt;columns;
+	my @columns = $package_details-&gt;columns_as_list;
 	while( &lt;$fh&gt; ) # entry processing
 		{
 		chomp;
@@ -305,6 +305,44 @@ sub _parse
 	$package_details;	
 	}
 
+=item write_file( OUTPUT_FILE )
+
+=cut
+
+sub write_file
+	{
+	my( $self, $output_file ) = @_;
+
+	my( $class, $output_file ) = @_;
+
+	unless( defined $output_file )
+		{
+		carp &quot;Missing argument!&quot;;
+		return;
+		}
+
+	use PerlIO::gzip;
+		
+	open my($fh), &quot;&gt;:gzip&quot;, $output_file
+		or croak &quot;Could not open $output_file for writing: $!&quot;;
+	
+	$self-&gt;write_fh( $fh );
+	}
+
+=item write_fh( FILEHANDLE )
+
+=cut
+
+sub write_fh
+	{
+	my( $self, $fh ) = @_;
+	
+	print $fh $self-&gt;header-&gt;as_string( $self-&gt;entries-&gt;count );
+	print $fh $self-&gt;entries-&gt;as_string( $self-&gt;header-&gt;columns_as_list );
+	
+	return 1;
+	}
+	
 sub DESTROY {}
 
 =back
@@ -390,6 +428,44 @@ sub CPAN::PackageDetails::Header::get_header
 	else { carp &quot;No such header as $field!&quot;; return }
 	}
 
+=item columns_as_list
+
+=cut
+
+sub CPAN::PackageDetails::Header::columns_as_list
+	{
+	my( $self ) = @_;
+	
+	split /,\s+/, $self-&gt;{columns};	
+	}
+
+=item as_string
+
+=cut
+
+sub CPAN::PackageDetails::Header::as_string
+	{
+	my( $self, $line_count ) = @_;
+	
+	# XXX: need entry count
+	my @lines;
+	foreach my $field ( keys %$self )
+		{
+		my $value = $self-&gt;get_header( $field );
+		(my $out_field = $field ) =~ s/_/-/g;
+		$out_field =~ s/^(.)/ uc $1 /eg;
+		$out_field =~ s/-(.)/ &quot;-&quot; . uc $1 /eg;
+		
+		$out_field = 'URL' if $field =~ /URL/i;
+		
+		push @lines, &quot;$out_field: $value&quot;;
+		}
+		
+	push @lines, &quot;Line-Count: $line_count&quot;;
+	
+	join &quot;\n&quot;, sort( @lines ), &quot;\n&quot;;
+	}
+	
 =back
 	
 =head2 Entries
@@ -462,6 +538,32 @@ Returns the entries object.
 
 sub entries { $_[0]-&gt;{entries} }
 
+=item as_string
+
+=cut
+
+sub CPAN::PackageDetails::Entries::as_string
+	{
+	my( $self, @columns ) = @_;
+	
+	my $entries;
+	
+	foreach my $entry ( @{ $self } )
+		{
+		$entries .= $entry-&gt;as_string( @columns );
+		}
+	
+	$entries;
+	}
+	
+sub CPAN::PackageDetails::Entry::as_string
+	{
+	my( $self, @columns ) = @_;
+	
+	print STDERR &quot;Columns are @columns\n&quot;;
+	return join( &quot;\t&quot;, map { $self-&gt;{$_} } @columns ) . &quot;\n&quot;;
+	}	
+	
 =item add_entry
 
 Add an entry to the collection. Call this on the C&lt;CPAN::PackageDetails&gt;
@@ -488,8 +590,10 @@ sub add_entry
 
 =head1 SOURCE AVAILABILITY
 
-This source is in Github
+This source is in Github:
 
+	http://github.com/briandfoy/cpan-packagedetails
+	
 =head1 AUTHOR
 
 brian d foy, C&lt;&lt; &lt;bdfoy@cpan.org&gt; &gt;&gt;</diff>
      <filename>lib/PackageDetails.pm</filename>
    </modified>
    <modified>
      <diff>@@ -4,3 +4,4 @@ pod_coverage.t
 autoload.t
 new.t
 read.t
+write_file.t
\ No newline at end of file</diff>
      <filename>t/test_manifest</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>61fe44a4e281b69a0aa4cc7b00070bc150ad3800</id>
    </parent>
  </parents>
  <author>
    <name>brian d foy</name>
    <email>brian.d.foy@gmail.com</email>
  </author>
  <url>http://github.com/briandfoy/cpan-packagedetails/commit/a4643876c48232c9183131007baff20d46ca0e66</url>
  <id>a4643876c48232c9183131007baff20d46ca0e66</id>
  <committed-date>2008-10-23T15:44:09-07:00</committed-date>
  <authored-date>2008-10-23T15:44:09-07:00</authored-date>
  <message>* I'm almost done with the stuff to write 02packages.

* I'm using the PerlIO::gzip layer, so put that in the prereqs.

* The write_file.t is mostly done, but I have to figure out
another way to compare them since the datestamps mess up the
MD5 of the gzipped files.

* I haven't done any of the work to cleanup the files I make
because I still want to inspect them.</message>
  <tree>ae53661d6c715efce1ba098b2eb07a6b992c7b46</tree>
  <committer>
    <name>brian d foy</name>
    <email>brian.d.foy@gmail.com</email>
  </committer>
</commit>
