Re: Error when using the executable perl in client machine

2020-04-24 Thread Mike


Hi Manikandan,

I just received this response on the PAR list:


 Forwarded Message 
Subject:Re: Par with strawberry-Perl
Date:   Sat, 25 Apr 2020 09:44:13 +1000
From:   Shawn Laffan 
To: Mike Flannigan 
CC: p...@perl.org 



Hello Mike,

There are likely missing DLLs that need to be added to the pp call using 
the --link option.


Finding these manually can be a pain, so have a look at pp_autolink or 
pp_simple (the former is mine, but adapted from the latter).


https://github.com/shawnlaffan/perl-pp-autolink
https://www.perlmonks.org/?node_id=1148802

Shawn.





On 4/17/20 12:00 PM, Manikandan Narayan wrote:

Hi We are using strawberry-perl

Error when using the executable perl in client machine that does not 
have strawberry-perl in it


Can't load 
'C:\Users\Nuser\AppData\Local\Temp\par-30303030313137\cache-3610486
8c73148db1c60163c6ec837fe6a3b7c0d\9c557319.xs.dll' for module 
Net::SSH2: load_file:The specified module could not be found at 
/DynaLoader.pm line 193.

  at /PAR/Heavy.pm line 140.
Compilation failed in require at C:\Users\ 
Nuser\AppData\Local\Temp\par-3030303

0313137\cache-36104868c73148db1c60163c6ec837fe6a3b7c0d\inc\lib/Net/SFTP/Foreign/
Backend/Net_SSH2.pm line 15.
BEGIN failed--compilation aborted at C:\Users\ Nuser 
\AppData\Local\Temp\par-30303030313137\cache-36104868c73148db1c60163c6ec837fe6a3b7c0d\inc\lib/Net/SFTP/Foreign/Backend/Net_SSH2.pm 
line 15.

Compilation failed in require at script/SFTPdownload.pl line 13.
BEGIN failed--compilation aborted at script/SFTPdownload.pl line 13.

Any Help will be highly appreciated.

Regards,
Narayan




Re: Help with REST API interaction.

2020-04-24 Thread Gil Magno
Hi Francisco,

2020-04-22 11:21:31 -0300 Francisco Acuña:
> Good day, I've been getting familiarized with Perl for the last couple of
> days due to a RT integration project I've been handed. I've also been doing
> a lot of research and a lot of asking around in forums for pointers on how
> to properly achieve this.
> 
> I'm glad to say that I managed to get all my basic scrips up and running,
> retrieving all the values I needed and updating all the fields I wanted to
> update. I now need to get to the part of actually interacting with the
> external RESTful API.
> 
> If what I understood from my research is correct, I will be working with
> the REST::Client and JSON modules. And what I need to do is:
> 
>1. Encode the values I want to pass over to the API into a JSON object.
>2. Do some coding on the other side in order to achieve my desired
>funcionalities and pass some values back to RT (for this I won't need your
>help since the coding won't be done in Perl, sadly)
>3. Decode the response I get back to Perl and use those values in RT to
>do some more updating.
> 
> I would greatly appreciate if you could provide me with some pointers and
> code examples of this being done. Choosing the values I need to pass,
> encoding them, passing them over to the API, and then decoding the response.
> 
> Needless to say, I am documenting all my work and will gladly share my
> experience in this project and all the coding work in any forum.

One way to do it is like this:

use strict;
use warnings;
use feature 'say';
use LWP::UserAgent;
use JSON;

my $ua = LWP::UserAgent->new;
my $uri = 'https://example.com/path/to/something';
my %headers = ('Content-Type' => 'application/json');

# here are the values to pass to the API
my %values = (number => 1, name => 'etc');

my $res = $ua->post(
$uri,
%headers,
Content => JSON::encode_json(\%values)
);

if ($ua->is_success) {
# if you're receiving a JSON
my $data = JSON::decode_json $res->content;
# now $data is a Perl data structure; it's the decoded JSON

# but if you're receiving (say) HTML
say $res->decoded_content;
}
else {
# handle errors here
}

See these docs for the modules' details:
https://metacpan.org/pod/LWP::UserAgent
https://metacpan.org/pod/JSON


signature.asc
Description: PGP signature


Re: Help with REST API interaction.

2020-04-24 Thread Gil Magno
Correction: we should use $res->is_success in the 'if' below, not
$ua->is_success.

2020-04-24 19:42:32 -0300 Gil Magno:
> if ($ua->is_success) {


signature.asc
Description: PGP signature


Help with REST API interaction.

2020-04-24 Thread Francisco Acuña
Good day, I've been getting familiarized with Perl for the last couple of
days due to a RT integration project I've been handed. I've also been doing
a lot of research and a lot of asking around in forums for pointers on how
to properly achieve this.

I'm glad to say that I managed to get all my basic scrips up and running,
retrieving all the values I needed and updating all the fields I wanted to
update. I now need to get to the part of actually interacting with the
external RESTful API.

If what I understood from my research is correct, I will be working with
the REST::Client and JSON modules. And what I need to do is:

   1. Encode the values I want to pass over to the API into a JSON object.
   2. Do some coding on the other side in order to achieve my desired
   funcionalities and pass some values back to RT (for this I won't need your
   help since the coding won't be done in Perl, sadly)
   3. Decode the response I get back to Perl and use those values in RT to
   do some more updating.

I would greatly appreciate if you could provide me with some pointers and
code examples of this being done. Choosing the values I need to pass,
encoding them, passing them over to the API, and then decoding the response.

Needless to say, I am documenting all my work and will gladly share my
experience in this project and all the coding work in any forum.