[freeside-commits] freeside/FS/FS cdr.pm,1.5.2.8,1.5.2.9
Ivan,,,
ivan at wavetail.420.am
Sat Aug 2 16:52:08 PDT 2008
- Previous message: [freeside-commits] freeside/FS/FS/cdr asterisk.pm, 1.1, 1.2 genband_meetme.pm, 1.1, 1.2 genband.pm, 1.1, 1.2 nextone.pm, 1.1, 1.2 openser.pm, 1.1, 1.2 simple.pm, 1.1, 1.2 taqua.pm, 1.1, 1.2 unitel.pm, 1.1, 1.2
- Next message: [freeside-commits] freeside/FS/FS/cdr asterisk.pm, 1.1.2.2, 1.1.2.3 genband_meetme.pm, 1.1.2.2, 1.1.2.3 genband.pm, 1.1.2.2, 1.1.2.3 openser.pm, 1.1.2.2, 1.1.2.3 simple.pm, 1.1.2.2, 1.1.2.3 taqua.pm, 1.1.2.2, 1.1.2.3 unitel.pm, 1.1.2.2, 1.1.2.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv14440
Modified Files:
Tag: FREESIDE_1_7_BRANCH
cdr.pm
Log Message:
fix 'Can't call method "parse" on an undefined value' error from CDR format refactor
Index: cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr.pm,v
retrieving revision 1.5.2.8
retrieving revision 1.5.2.9
diff -u -d -r1.5.2.8 -r1.5.2.9
--- cdr.pm 17 Jul 2008 23:55:39 -0000 1.5.2.8
+++ cdr.pm 2 Aug 2008 23:52:06 -0000 1.5.2.9
@@ -15,7 +15,7 @@
use FS::cdr_upstream_rate;
@ISA = qw(FS::Record);
- at EXPORT_OK = qw( _cdr_date_parser_maker );
+ at EXPORT_OK = qw( _cdr_date_parser_maker _cdr_min_parser_maker );
$DEBUG = 0;
@@ -547,8 +547,24 @@
%import_formats;
}
-sub _cdr_date_parser_maker {
+sub _cdr_min_parser_maker {
my $field = shift;
+ my @fields = ref($field) ? @$field : ($field);
+ return sub {
+ my( $cdr, $min ) = @_;
+ my $sec = eval { _cdr_min_parse($min) };
+ die "error parsing seconds for @fields from $min minutes: $@\n" if $@;
+ $cdr->$_($sec) foreach @fields;
+ };
+}
+
+sub _cdr_min_parse {
+ my $min = shift;
+ sprintf('%.0f', $min * 60 );
+}
+
+sub _cdr_date_parser_maker {
+ my $field = shift || [qw( billsec duration )];
return sub {
my( $cdr, $date ) = @_;
#$cdr->$field( _cdr_date_parse($date) );
@@ -613,11 +629,11 @@
if ( $type eq 'csv' ) {
eval "use Text::CSV_XS;";
die $@ if $@;
- my $parser = new Text::CSV_XS;
+ $parser = new Text::CSV_XS;
} elsif ( $type eq 'fixedlength' ) {
eval "use Parse::FixedLength;";
die $@ if $@;
- my $parser = new Parse::FixedLength $info->{'fixedlength_format'};
+ $parser = new Parse::FixedLength $info->{'fixedlength_format'};
} else {
die "Unknown CDR format type $type for format $format\n";
}
- Previous message: [freeside-commits] freeside/FS/FS/cdr asterisk.pm, 1.1, 1.2 genband_meetme.pm, 1.1, 1.2 genband.pm, 1.1, 1.2 nextone.pm, 1.1, 1.2 openser.pm, 1.1, 1.2 simple.pm, 1.1, 1.2 taqua.pm, 1.1, 1.2 unitel.pm, 1.1, 1.2
- Next message: [freeside-commits] freeside/FS/FS/cdr asterisk.pm, 1.1.2.2, 1.1.2.3 genband_meetme.pm, 1.1.2.2, 1.1.2.3 genband.pm, 1.1.2.2, 1.1.2.3 openser.pm, 1.1.2.2, 1.1.2.3 simple.pm, 1.1.2.2, 1.1.2.3 taqua.pm, 1.1.2.2, 1.1.2.3 unitel.pm, 1.1.2.2, 1.1.2.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list