Sir, Please check my latest code and i am not getting any warning while compiling but i am getting below error. in my $datver. I used to pass numeric values as hours like 168 hours in $datver through config.properties file.Please check my existing code. Its looks like argument is not passing values through Web Form. How can i confirm the complete URL string for API call?

#!/usr/bin/env perl package Op; use strict; use warnings; use Win32::Process; ##use Net::LDAP; use REST::Client; use JSON::Parse ':all'; use MIME::Base64; use Term::ReadKey; use Data::Dumper; use MIME::Lite; use Net::SMTP; use Spreadsheet::XLSX; use Spreadsheet::ParseXLSX; use Excel::Writer::XLSX; use Config::Properties; use Data::Dumper; use List::Compare; use Array::Compare; use Storable qw/freeze/; use Data::Validate::IP; use Data::Table::Excel; use Excel::Writer::XLSX::Chart; use Win32::OLE::Const; use Spreadsheet::WriteExcel::Utility qw( xl_range_formula ); use Win32::OLE; use POSIX 'strftime'; use POSIX qw(strftime); use DateTime; use DateTime::Format::Strptime; use Try::Tiny; use feature qw{ say }; open my $fh, '<', "C:/PERL/" . "config.properties" or die "unable to o +pen configuration file"; my $properties = Config::Properties->new(); $properties->load($fh); my $value = $properties->getProperty('oktapreview.token'); my $baseurl = $properties->getProperty('oktaQA.baseURL'); my $from_address = 'chandan@aol.com'; my $to_address = 'chandan@bol.com'; my $subject = 'A message with 2 parts ...'; my $my_file_zip = 'C://PERL//'; my $mail_host = 'mail.aol.com'; my $pass = '1234567'; my $client = REST::Client->new(); my %header1 = ( -size => 10, ); #sub api_call { # $client->addHeader('Authorization',"SSWS $value"); # $client->addHeader('Accept','application/json'); # $client->addHeader('Content-type','application/json'); # $client->GET($_[0]); #} sub api_call { my ($client, $value, $url) = @_; $client->addHeader('Authorization',"SSWS $value"); $client->addHeader('Accept','application/json'); $client->addHeader('Content-type','application/json'); $client->GET($url); } sub result { my ($args) = @_; my $appID = $args->{APPID}; my $datver = $args->{date}; my $email = $args->{Email}; my $date = strftime '%Y-%m-%d-%H-%M-%S', localtime; my $date3 = strftime '%Y-%m-%d' , localtime(time() - $datver*60*60 +); my $date4 = strftime '%Y-%m-%d' , localtime(time() - 24*60*60); my $apiurllog = $baseurl ."/users/sys/logs?"; my @responsetext; my @responsetextall; my $sortor = "filter=eventType+eq+%22"; my $filter = "user.authentication.sso"; my @responsalter; my $target = "%22+and+target.id+eq+%22"; my $strExcelFilename; my $date2 = "%22&since=" . $date3 . "T00%3A00%3A00.000-04%3A00&until=" + . $date4 . "T23%3A59%3A59.000-04%3A00"; my $urlstringlog = $apiurllog . $sortor . $filter . $target . $appID . + $date2; print "My URL: $urlstringlog"; $strExcelFilename = "C:/PERL/" . "My-File" . $date . ".xlsx"; my $your_file_zip = "My-File . $date . '.xlsx'"; api_call($client,$value,$urlstringlog); @responsetext = parse_json ($client->responseContent()); push @responsetextall, @responsetext; for my $i (0..$#responsetextall) { for my $j (0..$#{$responsetextall[$i]}) { my $responseid = $responsetextall[$i][$j]{act}{UID}; my $responsdisp = $responsetextall[$i][$j]{act}{Name}; push @responsalter, $responseid ; } } my $workbook = Excel::Writer::XLSX->new( $strExcelFilename ); my $format_bold = $workbook->add_format( bold => 1, size => 10, top=> +1, bottom=> 1 ); my $format2 = $workbook->add_format(%header1); my $worksheet = $workbook->add_worksheet('UserSSO-Data'); my $r = 1; my $r2 = 1; my $r3 = 1; foreach my $j (0..$#responsalter ) { $worksheet->write(0, 0, 'UserSSO-Total +-Users' ); $worksheet->write($r2, 0, $responsalter[$j]); $r2 += 1; } $workbook->close; print "Spreadsheet saved.\n"; ## Mail Functionality my $msg = MIME::Lite->new ( From => $from_address, To => $to_address, Subject => $subject, Type =>'multipart/mixed' ) or die "Error creating multipart container: $!\n"; $msg->attach ( Type => 'text/csv', Encoding => 'base64', Path => $my_file_zip, Filename => $your_file_zip, Disposition => 'attachment' ) or die "Error adding $your_file_zip: $!\n"; MIME::Lite->send('smtp', $mail_host, Timeout=>60,Auth=>'LOGIN',AuthUs +er=>$from_address,AuthPass=>$pass,Port => 25, Debug => 1); } #__PACKAGE__

My current error

TTP::Server::PSGI: Accepting connections at http://0:5000/ [webapp:22424] core @2021-04-22 20:56:53> looking for get / in C:/Stra +wberry/perl/site/lib/Dancer2/Core/App.pm l. 35 [webapp:22424] core @2021-04-22 20:56:53> Entering hook core.app.befor +e_request in (eval 239) l. 1 [webapp:22424] core @2021-04-22 20:56:53> Entering hook core.app.after +_request in (eval 239) l. 1 127.0.0.1 - - [22/Apr/2021:20:56:53 -0400] "GET / HTTP/1.1" 200 1129 " +-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHT +ML, like Gecko) Chrome/88.0.4324.104 Safari/537.36" [webapp:22424] core @2021-04-22 20:57:12> looking for post / in C:/Str +awberry/perl/site/lib/Dancer2/Core/App.pm l. 35 [webapp:22424] core @2021-04-22 20:57:12> Entering hook core.app.befor +e_request in (eval 239) l. 1 Use of uninitialized value $datver in multiplication (*) at C:/Users/u +ser1/Documents/Perl/webapp/bin/../lib/Op.pm line 76. [webapp:22424] core @2021-04-22 20:57:13> Entering hook core.app.route +_exception in (eval 239) l. 1 [webapp:22424] error @2021-04-22 20:57:13> Route exception: JSON error + at line 1, byte 1/1259: Unexpected character '<' parsing initial sta +te: expecting whitespace: 'n', '\r', '\t', ' ' or start of string: '" +' or digit: '0-9' or minus: '-' or start of an array or object: '{', +'[' or start of literal: 't', 'f', 'n' at C:/Users/user1/Documents/Pe +rl/webapp/bin/../lib/Op.pm line 98. in C:/Strawberry/perl/site/lib/Da +ncer2/Core/App.pm l. 1501 [webapp:22424] core @2021-04-22 20:57:13> Entering hook core.error.ini +t in (eval 239) l. 1 [webapp:22424] core @2021-04-22 20:57:13> Entering hook core.error.bef +ore in (eval 239) l. 1 [webapp:22424] core @2021-04-22 20:57:13> Entering hook core.error.aft +er in (eval 239) l. 1 127.0.0.1 - - [22/Apr/2021:20:57:13 -0400] "POST / HTTP/1.1" 500 9972 +"http://localhost:5000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) A +ppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537 +.36"

In reply to Re^12: Need to know the process to implement perl script into web application server. by chandantul
in thread Need to know the process to implement perl script into web application server. by chandantul

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.