[freeside-commits] freeside/FS/FS/part_export http_status.pm, NONE, 1.1.2.2

Ivan,,, ivan at wavetail.420.am
Wed Nov 9 19:30:09 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv4787/FS/FS/part_export

Added Files:
      Tag: FREESIDE_2_3_BRANCH
	http_status.pm 
Log Message:
DSL status pulling, RT#13656

--- NEW FILE: http_status.pm ---
packages FS::part_export::http_status;
use base qw( FS::part_export );

use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common;

tie my %options, 'Tie::IxHash',
  'url' => { label => 'URL', },
  #'user'     => { label => 'Username', default=>'' },
  #'password' => { label => 'Password', default => '' },
;

%info = (
  'svc'     => 'svc_dsl',
  'desc'    => 'Retrieve status information via HTTP or HTTPS',
  'options' => \%options,
  'notes'   => <<'END'
Fields from the service can be substituted in the URL as $field.
END
);

sub rebless { shift; }

sub export_getstatus {
  my( $self, $svc_x, $htmlref, $hashref ) = @_;

  my $url = $self->option('url');
  {
    no strict 'refs';
    ${$_} = $svc_x->getfield($x) foreach $svc_x->fields;

    $url = eval(qq($url));
  }

  my $req = HTTP::Request::Common::GET( $url );
  my $ua = LWP::UserAgent->new;
  my $response = $ua->request($req);

  $$htmlref = $response->is_error ? $response->error_as_HTML
                                  : $response->content;


  #hash data note yet implemented for this status export

}

1;



More information about the freeside-commits mailing list