Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

okay, *now* populate works properly

  • Loading branch information...
commit 12cd478cdf0db3f62b00eaa7fbd5850a2dd99274 1 parent a633dea
Devin Austin authored
View
BIN  Survey-Perl/db/answers.db
Binary file not shown
View
11 Survey-Perl/lib/Survey/Perl/Controller/Survey.pm
@@ -33,15 +33,16 @@ sub finish_survey : Chained("survey_base") PathPart("finish") Args(0) {
$c->log->debug( "Params: " . Dumper $answers);
delete $answers->{'submit'};
my @multis;
- my ( $fields, $industries, $versions, $os );
$c->log->debug( "Answers: " . Dumper @{ $answers->{'field'} } );
- push @multis, { industries => $_ } for @{ $answers->{'industries'} };
- push @multis, { versions => $_ } for @{ $answers->{'perl_versions'} };
- push @multis, { os_dev => $_ } for @{ $answers->{'os_dev'} };
+ push @multis, { industries => $_ } for @{ $answers->{'industries'} };
+ push @multis, { perl_versions => $_ } for @{ $answers->{'perl_versions'} };
+ push @multis, { os_dev => $_ } for @{ $answers->{'os_dev'} };
+ delete $answers->{$_} for qw/ industries perl_versions os_dev field /;
$c->log->debug( "multis: " . Dumper @multis );
my $rs = $c->model('Answers')->txn_do(
sub {
- $c->model('Answers::Survey')->populate( \@multis );
+ $c->model('Answers::Survey')->populate( \@multis )
+ or die "Could not submit survey answers: $!";
$c->model('Answers::Survey')->create($answers)
or die "Could not submit survey answers: $!";
View
13 Survey-Perl/script/survey_csv_matrix.pl
@@ -16,15 +16,10 @@
while ( my $answer = $answer_rs->next ) {
print Dumper $answer->columns;
for my $column ( $answer->columns ) {
- if ( ref eval $answer->$column eq "ARRAY" ) {
- print "Arrayref found\n";
- print $fh $column . "," . @{$answer->$column} . "\n"
- or die "couldn't write row: $!";
- }
- else {
- print $fh $column . "," . $answer->$column . "\n"
- or die "couldn't write row: $!";
- }
+
+ print $fh $column . "," . $answer->$column . "\n"
+ or die "couldn't write row: $!";
+
}
}
close $fh;
View
76 Survey-Perl/test.csv
@@ -1,76 +0,0 @@
-surveyid,1
-gender,1
-age,1
-country_birth,
-country_residence,adfasdf
-highest_qual,2
-field,ARRAY(0x100d15700)
-perl_formal,3
-other_dynamic_formal,
-other_dynamic_taught,
-income,
-industries,
-prog_length,
-perl_length,
-percent_programming,
-percent_management,
-percent_perl,
-spare_time,
-perl_versions,
-os_dev,
-os_deployment,
-lang,
-lang1,
-lang2,
-lang3,
-lang4,
-perl_freq,
-pm_list,
-tech_list,
-tech_list_non_perl,
-local_pm,
-pm_meetings,
-conference,
-cpan_modules,
-handover_modules,
-bug_report_interpreter,
-fix_bug_interpreter,
-feature_interpreter,
-cpan_bug,
-cpan_fix_bug,
-cpan_feature,
-legacy,
-eliminate,
-startup,
-unmaintainable,
-scale,
-management_encourages,
-management_outdated,
-management_unmaintainable,
-management_scale,
-first,
-beginner,
-early_career,
-experienced,
-sysadmins,
-netengs,
-embedded,
-apps,
-best,
-frustrates,
-words,
-cert_me,
-cert_other,
-cert_comments,
-cpan_important,
-cpan1,
-cpan2,
-cpan3,
-cpan4,
-run_tests,
-force,
-understand,
-report,
-x_platform,
-x_comments,
-email,
Please sign in to comment.
Something went wrong with that request. Please try again.