Browse files

example matrix is done

  • Loading branch information...
1 parent 8940820 commit f8f30f45efa0560b7a5d6754a48309b71fb977bc Devin Austin committed Mar 24, 2010
Showing with 90 additions and 10 deletions.
  1. +14 −10 Survey-Perl/script/survey_csv_matrix.pl
  2. +76 −0 Survey-Perl/test.csv
View
24 Survey-Perl/script/survey_csv_matrix.pl
@@ -1,19 +1,23 @@
#!/usr/bin/perl
use strict;
use warnings;
-use Text::CSV_XS;
use Survey::Perl::Answers::Schema;
use Config::JFDI;
use Data::Dumper;
-my $conf = Config::JFDI->new( name => "Survey::Perl" );
-my $config = $conf->get;
-my $schema =
- Survey::Perl::Answers::Schema->connect( @{ $config->{'Model::Answers'}->{connect_info} }, );
-my $csv = Text::CSV_XS->new({binary => 1});
-my $answer_rs = $schema->resultset('Survey')->all;
-
+my $conf = Config::JFDI->new( name => "Survey::Perl" );
+my $config = $conf->get;
+my $schema = Survey::Perl::Answers::Schema->connect(
+ @{ $config->{'Model::Answers'}->{connect_info} },
+);
+my $answer_rs = $schema->resultset('Survey');
+my $ans;
open my $fh, ">", $ARGV[0] or die "can't open file for writing: $!\n";
+
while ( my $answer = $answer_rs->next ) {
- $csv->print($fh, { $_ => $answer->$_ } ) for $answer->columns or die "couldn't write row: " . $csv->error_diag;
+ print Dumper $answer->columns;
+ for ( $answer->columns ) {
+ print $fh $_ . "," . $answer->$_ . "\n"
+ or die "couldn't write row: $!";
+ }
}
-close $fh;
+close $fh;
View
76 Survey-Perl/test.csv
@@ -0,0 +1,76 @@
+surveyid,1
+gender,1
+age,2
+country_birth,
+country_residence,
+highest_qual,3
+field,ARRAY(0x103804b20)
+perl_formal,2
+other_dynamic_formal,3
+other_dynamic_taught,ruby
+income,1
+industries,Computers - Services>
+prog_length,3
+perl_length,3
+percent_programming,4
+percent_management,4
+percent_perl,4
+spare_time,4
+perl_versions,ARRAY(0x103804c00)
+os_dev,ARRAY(0x100d15700)
+os_deployment,
+lang,
+lang1,
+lang2,
+lang3,
+lang4,
+perl_freq,4
+pm_list,3
+tech_list,3
+tech_list_non_perl,3
+local_pm,3
+pm_meetings,2
+conference,
+cpan_modules,
+handover_modules,
+bug_report_interpreter,
+fix_bug_interpreter,
+feature_interpreter,
+cpan_bug,
+cpan_fix_bug,
+cpan_feature,
+legacy,4
+eliminate,4
+startup,4
+unmaintainable,4
+scale,4
+management_encourages,4
+management_outdated,4
+management_unmaintainable,4
+management_scale,4
+first,4
+beginner,4
+early_career,4
+experienced,4
+sysadmins,4
+netengs,4
+embedded,4
+apps,4
+best,asdf
+frustrates,
+words,
+cert_me,3
+cert_other,3
+cert_comments,asdf
+cpan_important,
+cpan1,
+cpan2,
+cpan3,
+cpan4,
+run_tests,
+force,
+understand,
+report,
+x_platform,3
+x_comments,324tgegrasg
+email,

0 comments on commit f8f30f4

Please sign in to comment.