use HTTP::Daemon::SSL; use HTTP::Status; use SOAP::Lite; use SOAP::Transport::HTTP; use auth; # Make sure you have a certs/ directory with "server-cert.pem" # and "server-key.pem" in it before running this! my $daemon = HTTP::Daemon::SSL->new(LocalPort => 8001) || die "Can't start SSH Daemon. $!\n"; my $soap = SOAP::Transport::HTTP::Server -> new ( ) -> dispatch_to(qw(auth)); print "Please contact me at: url, ">\n"; while (my $conn = $daemon->accept) { while (my $request = $conn->get_request) { my $req = $request->{_headers}{soapaction}; $soap->request($request); $soap->handle(); my $response = $soap->response(); $conn->send_response($response); } $conn->close; undef($conn); } #### package auth; use strict; use Win32::TaskScheduler; sub new { my $pkg = shift; my $self = {}; bless ($self, $pkg); return $self; } sub getTaskInfo { my $self = shift; my $scheduler = Win32::TaskScheduler->New(); die "not defined" if ( !defined( $scheduler )); my %tasks; foreach my $tsk ($scheduler->Enum()) { $scheduler->Activate($tsk); substr($tsk,-4,4) = ''; $tasks{$tsk}{'status'} = -1; $scheduler->GetStatus($tasks{$tsk}{status}); $tasks{$tsk}{'code'} = -1; $scheduler->GetExitCode($tasks{$tsk}{code}); $tasks{$tsk}{'owner'} = $scheduler->GetAccountInformation(); my ($ms, $sec, $min, $hour, $day, $dayofweek, $month, $year) = $scheduler->GetMostRecentRunTime(); $tasks{$tsk}{'last_ran'} = sprintf "%04d%02d%02d%02d%02d%02d", $year, $month, $day, $hour, $min, $sec; ($ms, $sec, $min, $hour, $day, $dayofweek, $month, $year) = $scheduler->GetNextRunTime(); $tasks{$tsk}{'next_run'} = sprintf "%04d%02d%02d%02d%02d%02d", $year, $month, $day, $hour, $min, $sec; } return %tasks; }