use H1::ZTEDSLAM;
use H1::ZTEMSAN;
-use Data::Dumper;
-
sub prefix { 'DSLAM_' }
sub process_name {
eval { $hash = $module->hash( $crm->{IP_UREDAJA}, $crm->{SHELF_SLOT_PORT} ) };
return { error => $@ } if $@;
- warn "# hash ",dump $hash;
- local $Data::Dumper::Useqq = 1; # double quote for PostgreSQL
- my $h = Dumper($hash);
- $h =~ s/\s+/ /gs;
- $h =~ s/^\$\w+\s*=\s*{\s*//s;
- $h =~ s/\s*}\s*;\s*$//s;
-
$self->do_background_json( 'Store_insert', {
_table => 'dslam_h',
ip => $crm->{IP_MANAGEMENT}, # FIXME IP_UREDAJA ?
username => $crm->{USERNAME},
timestamp => $time,
- h => $h,
+ h => $self->to_hstore($hash),
});
return $hash;
use DateTime;
use DateTime::Format::Pg;
+use Data::Dumper;
+
sub e_json {
my ( $self, $result ) = @_;
warn "# e_json ", dump $result;
return DateTime::Format::Pg->format_datetime( DateTime->now );
}
+sub to_hstore {
+ my ($self,$hash) = @_;
+
+ warn "# hash ",dump $hash;
+ local $Data::Dumper::Useqq = 1; # double quote for PostgreSQL
+ my $h = Dumper($hash);
+ $h =~ s/\s+/ /gs;
+ $h =~ s/^\$\w+\s*=\s*{\s*//s;
+ $h =~ s/\s*}\s*;\s*$//s;
+
+ return $h;
+}
+
1;