Perl::WSDL. Generated methods in different directory than script - perl-module

I am trying to write a script for using with op5/nagios.
What it tries to do is to connect to database an get a value there, and then send a request to a webservice and match the response from the webservice with the value from the database.
Now writing the script wasn't the problem. The problem arrises when trying to run it from OP5.
When including the interface to script I use the following syntax
use MyInterfaces::PortalServicesImplService::PortalServicesImplPort;
This works just fine when I execute the script located on the same level as "MyInterfaces".
The problem is that the script itself is located in the folder /opt/plugins/custom/SOAP where both the script and the folders generated by wsdl2perl.pl is located. However when OP5 executes the script is does so from the folder /opt/monitor.
So I tried to include the "PortalServicesImplPort" using this syntax
use lib "/opt/plugins/custom/SOAP/MyInterfaces/PortalservicesImplServices/PortalServicesImplPort
The code compiles but when trying to run it I get an error message saying
Can't locate object method "new" via package "MyInterfaces::PortalServicesImplService::PortalServicesImplPort" (perhaps you forgot to load "MyInterfaces::PortalServicesImplService::PortalServicesImplPort"?)
Am I doing something wrong when importing methods from another location or doesn't SOAP::WSDL support placing the auto generated files in a different directory from where you are executing the script?

Seems I managed to solve this myself by adding use lib "/opt/plugins/custom/SOAP

Related

I can't export a custom report name from html-reporter-extra

This really should be straightforward but I can't get it to work.
It's a simple setup: I have a locally run Jenkins, exported Postman collections that I'm running using newman. I got html-report-extra installed and it's generating a report but I can't get it to export the html file under a different name!
I have a locally installed Jenkins, I'm using a freestyle project and under Build - Execute Windows batch command I have this:
newman run IDMS4.postman_collection.json -e IDMS4.postman_environment.json --reporters cli,htmlextra --reporter-html-export newman/index.html --disable-unicode
This is how my Jenkins job is setup:
Jenkins job setup
Build completes but there is no index.html anywhere. This is the the part that's puzzling me.
In
.jenkins\jobs\Newman runner\htmlreports\HTMLReport
i get the default file format name (project name + timestamp).
In
.jenkins\workspace\Newman runner\newman
I also get project name + timestamp html files.
Why is this outputed to both folders and how can I get this to export just one index.html?
Please try with dot slash. eg: ./newman/index.html.
and also
if you need collection name to be in the report, please use following node module
https://www.npmjs.com/package/jaiman

Can I run stanza NER without downloading the language modules?

I need to run stanza ner in a platform without any access to external network. The code stanza.download('en') fails. Running without the download function, gives me an exception
Exception: Resources file not found at: \home\stanza_resources\resources.json. Try to download the model again
Is there a way to download and cache all the required modules in a resource directory and point this directory to stanza pipeline?
Thanks
It looks like both download and the Pipeline class take an argument for directory dir
So the below code works
stanza.download('en', dir='resources/', processors={ner_processor: package})
nlp_pipeline = stanza.Pipeline('en', dir='resources/', processors={ner_processor: package})

Writing .cargo/config.toml to allow rust code to be imported by python

I'm using rust-cpython to make a python module in rust. I've run my code on a linux os and it runs just fine but I get the familiar "linking with cc failed:exit code 1 error". I've gathered from this that I need to add the .cargo/config file to my project as suggested at the bottom of this:
https://github.com/dgrunwald/rust-cpython
I've copied and pasted their code into a file, config.toml, and place there in a directory, .cargo. I've tried nesting this in my src directory and my project directory with no success, what am I missing?
Solution found: Thought I'd post it as this gave me grief.
Everything with this setup is fine except the config file can't have the extension .toml despite being written in a toml format

How could I do a massive install of a PrestaShop module?

I have a problem, I have to do a massive install of a custom PrestaShop module on 1500 e-commerce, but I don't know if this is possible, I was thinking to include a file called install.php and run through a.sh, this file may contain the next.
For example:
<?php
include "meli.php";
$meli = new Meli();
$meli->install();
?>
I called this file and initially, nothing happened so I check the possible reason and was:
if (!defined('_PS_VERSION_'))
exit;
So I commented this and run it again but this show me this error:
Fatal error: Class 'Module' not found in /home/dev2al5/public_html/modules/meli/meli.php on line 7
Does someone know how I can do this process?
Indeed I would do 3 things in the SH script:
Copy of the modules files in each site in the modules folder
Copy of a sql file containing the instructions to be executed
Calling a URL present in each module that would execute the SQL and then delete the SQL file in question
Regards

Path Error running CakePHP's "cake" console utility in Windows

A while ago when I started with Cake, I managed to get the console running in my Windows environment, and I have no idea how. I'm now having problems to make it work again in another computer.
This is what I've done in the new machine:
Downloaded my Cake code from source control (so all the files are exactly the same as the computer where it worked, including the configuration files)
Added PHP and "c:\my_cake_path\cake\console" to the path
If I run "cake OneOfMyShells", either standing on the /app, or in /cake/console directories, I get the following error:
Warning: get_object_vars() expects parameter 1 to be object, null given in C:\my_cake_path\cake\libs\model\connection_manager.php on line 199
Error: Missing Database Connection. Try 'cake bake'
"cake Bake", if run normally, when I try to get it to do the DB config ends up throwing another error (which is not that relevant to this)
However, if I run: cake bake -app "c:\my_cake_path\app"
Then bake works, I can do the database config, and it writes the DB config file (which is useless at this point, since I already had one)
Then, of course: cake OneOfMyShells -app "c:\my_cake_path\app"
does work perfectly well.
So, everything's working fine, I just need to manually specify the path to "app" every single time, which is very annoying.
How can I get around this? Where is Cake looking for to find the path to app?
Thanks!
Daniel
Not much of a difference in the sense you still need to type but you can run cake from the app dir like this: C:\XXX\project\app> ..\cake\console\cake.bat
To make it smaller you can put that line on a .bat or just add the \cake\console dir the windows path

Resources