diff options
author | Edmund von der Burg <evdb@mysociety.org> | 2011-03-31 17:54:14 +0100 |
---|---|---|
committer | Edmund von der Burg <evdb@mysociety.org> | 2011-03-31 17:54:14 +0100 |
commit | 53fbccab8e7471fa9e06496a56f136b1edb43351 (patch) | |
tree | d55e62c6729093f4532876010b91cf04705cd535 /perllib/FixMyStreet/TestMech.pm | |
parent | aee7bf19d25be738df0ca94e12452de33dcf42f9 (diff) |
Ported import.cgi to catalyst
Diffstat (limited to 'perllib/FixMyStreet/TestMech.pm')
-rw-r--r-- | perllib/FixMyStreet/TestMech.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 750a78305..04d825da7 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -182,6 +182,24 @@ sub form_errors { return $result->{errors} || []; } +=head2 import_errors + + my $arrayref = $mech->import_errors; + +Takes the text output from the import post result and returns all the errors as +an arrayref. + +=cut + +sub import_errors { + my $mech = shift; + my @errors = # + grep { $_ } # + map { s{^ERROR:\s*(.*)$}{$1}g ? $_ : undef; } # + split m/\n+/, $mech->response->content; + return \@errors; +} + =head2 pc_alternatives my $arrayref = $mech->pc_alternatives; |