perl-module

Provision of switching Devel::Cover on/off

落爺英雄遲暮 提交于 2019-12-12 21:08:51
问题 While using Devel::Cover in a test code which tests CodeA, does Devel::Cover have an option of switching the coverage off. Is there a way to switch the coverage module on or off as per user? Test code tests CodeA. Devel::Cover commands are embedded in Test code whenever CodeA commands get tested. Does Devel::Cover include any provision where this coverage collection can be switched on or off? 回答1: There is a way to turn coverage on and off at runtime, but it seems that I have forgotten to

Perl REST client, authentication issue

我与影子孤独终老i 提交于 2019-12-12 13:18:36
问题 I am using Perl 5.16 with REST::Client for REST call with GET, but it shows an error 401 authentication issue. I am not clear how to resolve this issue. Code use REST::Client; use JSON; use Data::Dumper; use MIME::Base64; my $username = 'test'; my $password = 'test'; my $client = REST::Client->new(); $client->setHost('http://myurl'); my $headers = { Accept => 'application/json', Authorization => 'Full' . encode_base64($username . ':' . $password) }; $client->GET('folder/file', $headers);

calling perl subroutine in shell script

前提是你 提交于 2019-12-12 08:59:44
问题 i made a Perl Module MyModule.pm it has some subroutines getText which I wanted to call in a shell script. i tried following manner but it gives error; SEC_DIR=`perl -MMyModule -e 'getText'`; # line 1 echo $SEC_DIR exit 0 Returned Error; Can't locate MyModule.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux

what is the best practice for Perl getting parent folder permissions while running on windows

蓝咒 提交于 2019-12-12 06:32:23
问题 I'm not much of a Perl developer but I need it to make triggers for perforce. So this is the background: I have a windows service that runs as admin that calls the Perl script on windows. The script needs to create a file on a network storage which is both configured to work with windows and UNIX permissions\security types. Since the user that is running the script is an admin user all folders and files that it creates under all directories are no inheriting the directories permissions but

DBI connect() fails to establish the connection and doesnt return an error message

我们两清 提交于 2019-12-12 05:19:57
问题 When i am trying to establish a connection to database, it fails. But It doesnt return any error message either. Code for it is as below my $dbh; $dbh = DBI->connect('DBI:SQLAnywhere:', $connString, undef, {PrintError => 0, PrintWarn => 0})or die "died",$DBI::errstr,"\n"; #dbh = DBI->connect('DBI:SQLAnywhere:', $connString); # setting up the authentication signature for the connection print "$dbh"; if($dbh) { if(DbAuth::AuthenticateConnection($dbh)) { return($dbh,$DbAuth::errstr) if

For How to make an XML Request in Perl -help required? [closed]

我与影子孤独终老i 提交于 2019-12-12 03:47:44
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Being new to Perl and XML..Can any one guide me in order to do the following: I have to write a Perl Code which should do : Make a

Auto login web form

丶灬走出姿态 提交于 2019-12-12 03:20:39
问题 I have the next problem: I have a device that it has an xml page (http://IP_device/counters.xml), I want to monitor this file for extract some information. The problem comes because for access to this file, previously I must login into a form (http://IP_device/frameCmd_Login.htm) like this: <form method="get" action="/Action_Login" onsubmit="return MD5HASH()"> <font color="#000000" align="center">Please Enter Password</font> <input size="21" type="password" value="" name="LOGINPASSWORD" id=

What is the third parameter to Text::JaroWinkler::strcmp95 for?

随声附和 提交于 2019-12-12 02:25:45
问题 I am interested in the Jaro-Winkler module written in Perl to compute the distance (or similarity) between two strings: http://search.cpan.org/~scw/Text-JaroWinkler-0.1/JaroWinkler.pm The syntax of the function is not clear to me; I could not find any clear documentation of it. Here is the sample code: #!/usr/bin/perl use 5.10.0; use Text::JaroWinkler qw( strcmp95 ); print strcmp95("it is a dog","i am a dog.",11); What exactly does the 11 represent? I gather it is a length. Which length? The

Perl: how to install the DateTime module for timestamp parsing

给你一囗甜甜゛ 提交于 2019-12-11 12:07:51
问题 I am using Perl for the first time, and I need to use the DateTime class to parse timestamps, compare timestamps, etc. However, I found that it is not included with Perl (I am using Strawberry 5.26.1.1) and needs to be separately downloaded and installed. After spending some time googling, I am still not sure where to download and how to install. I tried the following but it does not work. I have already set the http_proxy, http_proxy_user and http_proxy_pass variables. PPM interactive shell

perl script for user interaction

大憨熊 提交于 2019-12-11 11:35:42
问题 I'm new to programming. I have written a perl script which does the following. 1) ssh into a remote machine 2) execute a sequence of commands. The script requires user interaction in between.It needs user name and password. I'm not sure how to proceed with that. use Net::SSH::Expect; use strict; use warnings; #login to a remote host my $ssh = Net::SSH::Expect->new (host => "ipaddr", password=> 'pwd', user => 'username', raw_pty => 1); my $login_output = $ssh->login(); The login is successful.