Finishing off CSV import functionality
This commit is contained in:
parent
423c68aca2
commit
91677034ca
6 changed files with 149 additions and 31 deletions
17
lib/Pear/LocalLoop/Plugin/Currency.pm
Normal file
17
lib/Pear/LocalLoop/Plugin/Currency.pm
Normal file
|
@ -0,0 +1,17 @@
|
|||
package Pear::LocalLoop::Plugin::Currency;
|
||||
use Mojo::Base 'Mojolicious::Plugin';
|
||||
|
||||
sub register {
|
||||
my ( $plugin, $app, $cong ) = @_;
|
||||
|
||||
$app->helper( parse_currency => sub {
|
||||
my ( $c, $currency_string ) = @_;
|
||||
my $value;
|
||||
if ( $currency_string =~ /^£([\d.]+)/ ) {
|
||||
$value = $1 * 1;
|
||||
}
|
||||
return $value;
|
||||
});
|
||||
}
|
||||
|
||||
1;
|
Reference in a new issue