Questions tagged [perl]

32882 questions
1

votes
2

answer
68

Views

Perl which line belongs to which category

I have following output: dis vlan 100 VLAN ID: 100 VLAN Type: static Route Interface: configured IP Address: x.x.x. Subnet Mask: y.y.y.y Description: Text Name: SomeMoreText Tagged Ports: Bridge-Aggregation1 Bridge-Aggregation2 Bridge-Aggregation3 Bridge-Aggregation6 Ten-GigabitEthernet1...
Noosrep
1

votes
0

answer
17

Views

SSL connection fails when often stalled by ~5s

I have a Perl streaming application that GET some file through HTTPS. The TCP flow is often paused for a few seconds because the player has buffered a lot. As a result, the connection very often breaks/ends early. I've taken various TCP logs and wireshark seems to be all confused and whines about C...
philippe_44
1

votes
1

answer
328

Views

how to extract 7z zip file using perl in linux

I have an example.7z zip file in the following location /aaa/bbb/ccc. i need to extract that zip file in the same location itself. i tried many methods but can't able to get the correct output. please help me out. Thanks in advance! use strict ; use warnings ; use IO::Uncompress::Unzip qw(unzip $Unz...
keeru
1

votes
1

answer
76

Views

Testing file i/o with Perl - frameworks

I have the following command in pl script: mkpath($my_dir,0,0777); I want to test instances when it encounters errors when executing this command. Currently, I change permissions of the parent directory, or some other such change to the file system, to force an error. How would I set up a unit test,...
paulj
1

votes
0

answer
71

Views

How to mock system call with argument in whole directory?

I have a directory in my app which has several test cases. Those test cases use some third party software using either `` or system calls. And I need to mock those calls. What I can't figure out is how do I mock those calls for that particular directory? I had been trying Test::Mock::Cmd But I can...
Ishan Bhatt
1

votes
3

answer
263

Views

Partial match of strings [closed]

I would like to find a way to do a partial match of strings. I have two 50-bit binary inputs. If any input is matched with data at least 5-bit in database (array), I would print the input. Let's say my input is like this. X is a 'don't care' bit; it would be changed to ., 11XX110010001011011111011...
Jaeyoung Park
1

votes
0

answer
95

Views

Perl Modification of a read-only value attempted for hash

I have a server that also counts the number of distinct IPs connected in a minute. I get a 'Modification of a read-only value attempted' in the marked line in the code below: $lsock=new IO::Socket::INET(LocalPort=>$port,Proto=>'tcp',Listen=>1,Reuse=>1); $clients={}; while (1) { $sock=$lsock->accep...
soger
1

votes
3

answer
45

Views

perl: capturing the replaced-with string

I have code in a loop similar to for( my $i=0; $a =~ s/(.*?)/sprintf('&CITE%03d;',$i)/e ; $i++ ){ %cite{ $i } = $1; } but instead of just the integer index, I want to make the keys of the hash the actual replaced-with text (placeholder '&CITE001;', etc.) without having to redo the sprintf(). I w...
user5754171
1

votes
0

answer
30

Views

How to use XSUBs from another module?

I am writing XS module. And want to reuse functions from another XS in Sub::Indentify. In case of usual perl module I can do: use Sub::Identify; Sub::Identify::get_code_info( $code ); How do same thing from XS? UPD I want to call get_code_info as C function not as perl subroutine
Eugen Konkov
1

votes
0

answer
44

Views

How to create a library module to expand Dancer2 main script

I would like to create a relatively complex web application. For that I find very convenient the Dancer2 way of programming using the provided DSL (Domain-Specific Language). I also find the set of provided libraries excelent. According to the documentation, if you wanted to split your main script i...
Javier Elices
1

votes
1

answer
101

Views

Not able to ssh to another machine using Perl CGI Scripts issue with Keys

I am trying to ssh to another machine using Perl CGI script and I am executing the script on a remote machine. I am facing the issue. Note: I am calling below command in Perl CGI Script: Below is just code snippet which is not working as expected i.e it is not executing the script in remote system....
Prateek
1

votes
0

answer
55

Views

Why array variable names have magic? What is this for?

Fetching the name of variable from PAD_COMPNAME shows that the name is magical: SV *sv = PadnameSV( PAD_COMPNAME( cPADOP->targ +ix ) ); do_sv_dump( 0, Perl_debug_log, sv, 0, 10, 0, 0 ); SV = PV(0x1c1ed40) at 0x1c1bb30 REFCNT = 1 FLAGS = (POK,pPOK,UTF8) PV = 0x19eb480 '@y'\0 [UTF8 '@y'] CUR = 2 LEN...
Eugen Konkov
1

votes
1

answer
110

Views

How to select an option in a dropdown list using WWW::Mechanize::PhantomJS

I am trying to select an option that has no value using WWW::Mechanize::PhantomJS I have tried both methods below: $mech->set_fields($name, $value); $mech->field($name, $value); This is the select element I am trying to select from: 1 2 3 ... I have not been able to select any of the options. Appare...
jdubu423
0

votes
0

answer
2

Views

Store Radio Button selection as variable perl cgi script

I have a perl script utilizing cgi where I have 2 radio buttons 'uptime' and 'localtime'. When the submit button is selected I am looking to display the unix command uptime if the uptime radio button is selected and the perl function localtime if the 'localtime' radio button is selected. Below is wh...
hanktank45
1

votes
2

answer
471

Views

Logging to browser console from within perl script

I have an Angular2 application that has Perl running the back end scripts. The Perl is sending back an error, and I finally nailed it down to the fact that a 'read_ini()' function is failing, so it sends back a simple 'Failed to read ini' and it's done. The read_ini() function, as you can probably d...
Reverend Bubbles
1

votes
1

answer
197

Views

How do i install openLink virtuoso on windows? [closed]

I am trying to install OpenLink Virtuoso (Open Source Edition) on Windows but didn't make to install it correctly. What I have tried: First I follow all the step at Installation steps for OpenLink Virtuoso on Windows, which are as below -- Cygwin bash with developer tools (gawk, flex, bison) install...
1

votes
1

answer
57

Views

Removing identifier with “unavailable sequence” from FASTA file

I'm new to perl and regex, but have used the guidance from this article to try to remove gene sequences in a FASTA file that have either 'Sequence unavailable' or 'No UTR is annotated...' for a given identifier: https://www.biostars.org/p/127842/ Unfortunately, my perl script is not producing the de...
James Sheppard
1

votes
0

answer
79

Views

php perl script can not run using shell_exec

i am trying to execute perl script using php shell_excel function. but instead of printing output it ask to open perl file when i execute php script. i tried below $result = shell_exec('app.pl'); app.pl contains below script #!/usr/local/bin/perl $count = 0; while () { @w = split; $count++; for (...
amit nindroda
1

votes
1

answer
93

Views

Perl socket (IO::Socket::INET6) is not autoflushing

I have a very strange scenario. I have a Perl application that receives input from several connections (sockets and pipes). Than I am forwarding the message to a pre-defined destinations (sockets are already opened). see code example: our %openSockets; sub forward_message{ my ($message,$ip,$port,$...
yanger
1

votes
0

answer
274

Views

Running a perl script with root, changing to another user and then back to root?

I've tried to search a lot around the web for this question, to no avail. Currently I'm building a perl script that needs to do a specific job for each line in some database. The database contains several arguements including a 'user' field. The script runs as root, and in each line iteration in th...
Mor Elmaliach
1

votes
1

answer
144

Views

how to pass a variable to a subroutine to send email in perl

I want to be able to send an email if the contents of a variable are not empty this is my code: my $output = $ssh->capture({stdin_data => name('*.0') ->mtime('>$oneday') ->mtime('
danidar
1

votes
0

answer
146

Views

Can't install AnyEvent::DBI with Cpan on macOS High Sierra

there was a problem installing the AnyEvent::DBI for perl v5.18.2 on macOS High Sierra 10.13.3 As I understood, the AnyEvent::Fork dependency module is not installed, here's the information from CPAN cpan[1]> install AnyEvent::Fork Reading '/Users/dmitry/.cpan/Metadata' Database was generated on Tue...
Dmitriy
1

votes
1

answer
62

Views

Perl generating hash of complex records

The big problem that I can't seem to figure out. I need to input into this complex hash (array?): my $raterequest = { Shipment => { Shipper => { (static data here) }, ShipTo => { (static data here too) }, Package => [ { PackagingType => { Code => '02', Description => 'Package' }, PackageWeight =>...
Alith7
1

votes
0

answer
261

Views

How I do to emulate a bluetooth HID keyboard in linux?

How I do in Linux, to emulate a Bluetooth HID keyboard in Linux, with perl? I have tried with the Net::Bluetooth ( http://search.cpan.org/~addutko/Net-Bluetooth-0.41/Bluetooth.pm ) module, but can't find anywhere I put in the HID descriptor, and I can't find anywhere if I should use RFCOMM or L2CAP....
sebastian nielsen
1

votes
0

answer
38

Views

Spring Cloud Eureka library for perl

Are there any library for adding perl service(s) to eureka server similar to how we have eureka-js-client module for nodejs?
anil.mavila
1

votes
1

answer
124

Views

Obtain the last command executed by bash, inside a perl script [duplicate]

This question already has an answer here: What's the difference between Perl's backticks, system, and exec? 5 answers How can I store Perl's system function output to a variable? 8 answers I would like to write a perl script that do something similar to what fc do. Indeed I want to edit programmat...
mox
1

votes
0

answer
99

Views

Perl threads: auto restart in case of error or out

There is an infinite loop, about as below. And the function 'new_task' can give an error because of which the thread will die or pause (I do not know). Is it possible to automatically restart the stream in this case? I did not find an answer on the Internet, or I did not understand. Thank you. use s...
Firsim
1

votes
2

answer
78

Views

How to delete pattern which matches with the next new pattern which is calling in the next line by using /bin/sed command in dc_shell

Below is the example of my file, signal { { ab cd } 'm_1_clk' { P { '0ns' D; '25ns' U; '65ns' D; } } 'm_0_clk' { P { '0ns' D; '25ns' U; '65ns' D; } } 'o_[9]' { Data S Mk { Active Up; } } 'm_0_clk' { Data S Mk { Active Up; } } 'm_1_clk' { Data S Mk { Active Up; } } } I am expecting the output fro...
Bhargavi Bk
1

votes
1

answer
115

Views

How to decode HEX code to regular text in Apple Script

I'm using the todo list app Things from Cultured Code on my Mac and when I copy a link to a task to clipboard it ends up encoded as HEX code in the clipboard. No problem when I paste it into a text file – it then shows as decoded text. But, I need to use the clipboard content in an AppleScript and...
iLoveCode
1

votes
0

answer
79

Views

Perl - How to validate Chinese character input from web form?

My web page uses Charset UTF-8 to allow Chinese character input in a textarea form field. I want to test if the input contains a certain character. I've writtena test script to see how Perl is going to handle the Chinese input. It's not finding the match when there is a known match. Here is my...
Jim_1234
1

votes
0

answer
66

Views

PERL - Net::Websocket::Server with external periodic event

In my server program I need to have ability to iterate every 5 minutes through all opened connections and see which is really 'active' or not. I know that the best approach is to use 'heart beat', but then, the server need to have somehow ability to check weather the connection is 'off' in order to...
Xerix
1

votes
1

answer
69

Views

Perl send STDIN and filter STDOUT from external program

I'm writing a Perl wrapper for another application. I need to pipe STDIN and some STDOUT. Perl code #!/usr/bin/perl -w use strict; use IPC::Run3 qw(run3); my $stdout; local $| = 1; run3 ['node','gekko','-b','-c','BNB-XLM-Doktor_v1-5-144-config.js'], undef, $stdout; Output 2018-03-18 13:50:10 (DEBUG...
J. Doe
1

votes
3

answer
135

Views

How to parse xml file with perl based on attribute using grep

I'm new to perl and have been struggling. I have an xml file with the following structure, but with thousands of entries: test.xml I need to parse/delete the 'spectrum_query' nodes that do not contain in the attribute 'spectrum' the string in this example 'TPP08' i.e. in reality what it is between t...
Sasha
1

votes
0

answer
122

Views

Parallel processing using AnyEvent (Any) module with custom function

I am trying to use the AnyEvent module to fetch some information of several web pages in parallel. In Example: Fetching several web pages in parallel using AnyEvent #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use AnyEvent; use AnyEvent::HTTP; my @urls = qw( https://perlmaven.com/ ht...
AbhiNickz
1

votes
1

answer
99

Views

How to validate an RSA cert in perl

How do you validate an cert given a root cert that signed it? I've got this far: $root_x509 = Crypt::OpenSSL::X509->new_from_string($root_key_data, FORMAT_ASN1); $root_key = Crypt::OpenSSL::RSA->new_public_key($x509->pubkey()); $other_x509 = Crypt::OpenSSL::X509->new_from_string($other_key_data,...
Kevin G.
1

votes
0

answer
740

Views

Perl: how to install the DateTime module for timestamp parsing

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 stil...
user3573403
1

votes
0

answer
46

Views

Perl Printing arbitrary number of hash values of 2 arrays of hashes

I am trying to find a way to print the subhash values of a pair of arrays of hashes in the same loop. This is how my hash looks like: $VAR1 = { 'countrya' => [ [ { 'area' => 'statea', 'population' => '10' }, { 'area' => 'stateb', 'population' => '20' } ], # previous [ { 'area' => 'statea', 'populat...
Jon J
1

votes
1

answer
40

Views

MinGW and Perl conflict regarding IncludePath

I have installed MinGW and StrawberryPerl and now whenever I type gcc -v the version installed with StrawberryPerl is executed. But I want to execute the MinGW version, because otherwise my VS Code setup gives me the error: cannot open source file 'vcruntime.h' (dependency of 'iostream') But besides...
frankenapps
1

votes
0

answer
34

Views

Filling unnamed text fields in Mechanize::Firefox

I'm trying to fill some unnamed fields using $mech->fields but I ran out of hair on my head to pull off, please help. have tried using xpath, no use, adding a dot or a hash in front of the id to let $mech know this is an id not a name, no use. $mech->field( '.af-city', 'Monsey'); $mech->field( {xpat...
David Copperfield
1

votes
0

answer
51

Views

Adding a periodic timeout to select from a sub-class of Net::Server::HTTP

I'm trying to write a small service that responds to a couple commands (to check/report on status), but every 15 seconds or so breaks out of its polling status to check a database for messages and fork off a child to do some processing. I'm sub-classing Net::Server::HTTP, for example: my $service =...
srh

View additional questions