API-Eulerian

 view release on metacpan or  search on metacpan

lib/API/Eulerian/EDW/Parser/CSV.pm  view on Meta::CPAN

#
# @return API::Eulerian::EDW::Json Parser.
#
sub new
{
  my ( $class, $path, $uuid ) = @_;
  my $self;
  my $file;
  my $fd;

  if( open( $file, '<:encoding(utf8)', $path ) ) {
    $self = $class->SUPER::new( $path, $uuid );
    $self->{ _FILE } = $file;
    $self->{ _PARSER } = Text::CSV->new( {
      binary => 1,
      auto_diag => 1,
      sep_char => ',',
    } );
  }

  return $self;

lib/API/Eulerian/EDW/Peer/Thin.pm  view on Meta::CPAN

#
# @brief Dispatch Eulerian Data Warehouse Analytics Analysis result messages to
#        their matching callback hook.
#
# @param $ws - Eulerian WebSocket.
# @param $buf - Received buffer.
#
sub dispatcher
{
  my ( $ws, $buf ) = @_;
  $buf = encode( 'utf-8', $buf );
  my $json = decode_json( $buf );
  my $type = $json->{ message };
  my $uuid = $json->{ uuid };
  my $self = $ws->{ _THIN };
  my $hook = $self->hook();
  my $rows = $json->{ rows };

  switch( $type ) {
    case 'add' {
      $hook->on_add( $json->{ uuid }, $json->{ rows } );

lib/API/Eulerian/EDW/Request.pm  view on Meta::CPAN

sub json
{
  my ( $class, $response ) = @_;
  my $data = undef;

  if( $class->is_json( $response ) ) {
    $data = $response->decoded_content;
    if( defined( $data ) ) {
      chomp( $data );
      if( length( $data ) > 0 ) {
        $data = encode( 'utf-8', $data );
        $data = decode_json( $data );
       } else {
        $data = undef;
       }
    }
  }

  return $data;
}
#



( run in 0.258 second using v1.01-cache-2.11-cpan-4d50c553e7e )