perl

How to make perl Makefile.PL use a given C compiler when compiling an XS module?

旧时模样 提交于 2021-01-28 04:15:38
问题 I am trying to build Acme::Damn using a pre-compiled perl downloaded with conda, see this question for details. The cc that was used to build perl with is given by: $ perl -V | grep cc=./ cc='/tmp/build/80754af9/perl_1527832170752/_build_env/bin/x86_64-conda_cos6-linux-gnu-gcc' which does not exist on my machine, and make thus fails: $ perl Makefile.PL Checking if your kit is complete... Looks good Warning: prerequisite Test::Exception 0 not found. Generating a Unix-style Makefile Writing

can't ssh:unable to establish master SSH connection: bad password or master process exited unexpectedly

南笙酒味 提交于 2021-01-28 04:13:18
问题 I have problem with perl modules, i 'm trying to connect to the remote server using the OpenSSH module from CPAN and i have given the username and password correctly but when i run my CGI from browser i see the following error message " can't ssh:unable to establish master SSH connection: bad password or master process exited unexpectedly in need of immediate reply's and awaiting, Thanks in Advance. Here is my code #!/usr/bin/perl -w use CGI; use Data::Dumper; use strict; use CGI::Carp qw

Comparing two arrays, removing items that match

会有一股神秘感。 提交于 2021-01-28 03:06:19
问题 I have two arrays, @names and @employees , that are filled with strings that represent names. @names is 2 dimentional, holding references to anonymous arrays, but the location of the data we care about is at @names[i][0] . I want to loop through @names and find which names are not in @employees . At first I thought that looping through @names backwards, comparing it to @employees and deleting any matches from @names would work, but I run into some errors. Here's what I have: for my $i

Read SFTP directories and Sub directories using perl Net::SFTP or Net::SFTP::Foriegn

青春壹個敷衍的年華 提交于 2021-01-28 03:02:46
问题 I am using Net::SFTP::Foriegn module to connect the SFTP server and I could make the connection successfully. I would like to read each and every directories and sub directories in the SFTP server to get some files. Is it possible? And, is there any way to differentiate file and directory using this module? 回答1: use find method to find the entries and then use get method $sftp->find(\@paths, %opts) Does a recursive search over the given directory $path (or directories @path) and returns a

Regex pulling IP and port from string

此生再无相见时 提交于 2021-01-28 02:01:22
问题 I'm using Perl to try and pull the IP address and port from a string. The regex I'm trying to use is: s/(sip:)(;.*)// The strings are: sip:255.255.255.255:8080;transport=TCP sip:255.255.255.255:8080 Obviously my regex replace is not working. Can anyone point me to how I would need to write the regex? From those two strings I want to pull this: 255.255.255.255:8080 Meaning the regex needs to match anything that's not that string and replace it with nothing. Note: IP address and port will be

Set breakpoint from .perldb init file

梦想的初衷 提交于 2021-01-27 23:21:33
问题 I am experimenting with the .perldb rc file and trying to set a breakpoint. Here is a small sample script that I use for testing ( p.pl ): use feature qw(say); use strict; use warnings; say "Line 5"; say "Line 6"; say "Line 7"; Then, I created the following .perldb file in the current directory: parse_options("NonStop=1"); sub afterinit { push @DB::typeahead, "b 7" } (Note that this file should not have write permission by other than yourself (i.e. : chmod 644 .perldb ) or else the debugger

Perl and Selenium::Remote::Driver

China☆狼群 提交于 2021-01-27 21:30:21
问题 EDITED AGAIN I have a server on AWS somewhere in Northern Virginia and this is my monitoring server. I ssh into this Ubuntu server from another State to do system administration. I want to do web automation tests on this server which will test a web application on the Internet hitting a URL and verify that I can selenium test a login and authenticate successfully. This server is on an AWS cloud I'm not quite sure which Perl module to use since I'm accessing it remotely. There are two CPAN

Subprocess command encoding

跟風遠走 提交于 2021-01-27 20:55:22
问题 I'm currently migration a script from Perl to Python3 (3.6.5). Is is running on Windows Server 2016. The Script builds a command line with arguments and executes the created string with subprocess.check_output . One of the argument option is called -location:"my street" . The location can contain special chars like umlaut (äöß) or (áŠ). When I run the Perl script the special chars are passed correctly to the application. When I run the Python script the special chars are replaced by question

How to catch timeout exception with IPC::Run on Windows 10?

核能气质少年 提交于 2021-01-27 19:55:56
问题 I am trying to catch a timeout exception with IPC::Run on Windows 10 (using Strawberry Perl version 5.30.1): use strict; use warnings; use feature qw(say); use Data::Dumper; use IPC::Run qw(run timeout); my $timeout = 3; my $cmd = ['perl', '-E', "sleep 5; say 'stdout_text'; say STDERR 'stderr_text'"]; my $in; my $out; my $err; my $result; eval { $result = run $cmd, \$in, \$out, \$err, timeout($timeout ); }; if ( $@ ) { say "Timed out: $@"; } else { print Dumper({ out => $out, err => $err}); }

Line Input operator with glob returning old values

不想你离开。 提交于 2021-01-27 19:15:52
问题 The following excerpt code, when running on perl 5.16.3 and older versions, has a strange behavior, where subsequent calls to a glob in the line input operator causes the glob to continue returning previous values, rather than running the glob anew. #!/usr/bin/env perl use strict; use warnings; my @dirs = ("/tmp/foo", "/tmp/bar"); foreach my $dir (@dirs) { my $count = 0; my $glob = "*"; print "Processing $glob in $dir\n"; while (<$dir/$glob>) { print "Processing file $_\n"; $count++; last if