perl-module

How to make a HTTP PUT request using LWP?

烈酒焚心 提交于 2019-12-07 03:58:50
问题 I'm trying to change this request to a HTTP PUT request, any idea how ? my $request = LWP::UserAgent->new; my $response = $request->get($url, "apikey", $apiKey, "requestDate", $requestDate); 回答1: You should use HTTP::Request: use LWP::UserAgent; use HTTP::Request; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new("PUT", $url); my $res = $ua->request($req); 回答2: As of 6.04, LWP::UserAgent has a put helper, so you can now do: $ua->put( $url ) 回答3: PUT is HTTP::Request::Common. You can

How to use perl for SMTP connection with user and SSL Auth and send emails with attachment

我只是一个虾纸丫 提交于 2019-12-06 11:38:00
问题 I am using a SMTP mail server which require user + ssl authentication for connection. I am looking for the perl modules to connect to the mail server and send emails but doesn't found anything helpful. Any suggestion for perl module or any perl code would be really appreciated. EDIT I have tried to use Mail::Sendmail and Net::SMTP::SSL to connect to the sendmail server and send mail. Below is the sample code but getting the error user unknown. Error: mail: Net::SMTP::SSL=GLOB(0x9599850) not

Insert column to a CSV file in Perl using Text::CSV_XS module

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 11:32:13
问题 How can I add column to a CSV file using the Text::CSV_XS module? The print routine in the module only writes the array as a row. If I have an array, how can I write it to the file as a column? I already wrote the code below open my $outFH, ">", $outFile or die "$outFile: $!"; $outFilecsv = Text::CSV_XS->new ({ binary => 1, eol => $/ }); @column = read_column($inFile, $i); $outFilecsv->print($outFH, \@column)or $outFilecsv->error_diag; where read_column method reads returns a specified column

How to Install ROUGE In Ubuntu

▼魔方 西西 提交于 2019-12-06 08:20:41
问题 Although there is good description of how to Set Up ROUGE evaluation , i could not get any place where the installation was described completely. 回答1: Basically, the trick is in the successful installation of the perl modules. I am providing the download and installing links as well. First Download ROUGE. Install perl. Install Synaptic Package manager for installing XML::DOM libxml-dom-perl The good thing is that synaptic package manager will install extra Perl modules that are required by

Perl: How can I call object methods inside END {} without warning?

懵懂的女人 提交于 2019-12-06 07:04:08
问题 package JustTesting; use strict; use warnings; sub new { my $self = {}; bless($self, shift); END { $self->goodbye() }; return $self; } sub goodbye { print "Goodbye.\n"; } package main; my $this = JustTesting->new(); Output: Variable "$self" will not stay shared at ./test line 10. Goodbye. Apparently it works and I can suppress the warning with no warnings inside the END block. But I wonder if there is a better way how to do this. I tried using an anonymous sub like this: my $cleanup = sub {

Is there a way to avoid putting the Perl version number into the “use lib” line for Perl modules in non-standard locations?

我们两清 提交于 2019-12-06 06:35:46
问题 I am trying to install some Perl modules into a non-standard location, let's call it /non/standard/location . I used perl Makefile.PL PREFIX=/non/standard/location make;make install to install them. In the script which uses the module, it seems to be necessary to specify a long directory path including the version of Perl, like so: #!/usr/local/bin/perl use lib '/non/standard/location/lib/perl5/site_perl/5.8.9/'; use A::B; Is there any use lib or other statement which I can use which is not

Can't load 'C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll' for module XML::LibXML

China☆狼群 提交于 2019-12-06 05:13:32
问题 I have downloaded strawberry PERL and writing one application with CGI Perl Apache on Winxp sp3). One of the libraries (written by someone else) which I using uses XML::LibXML. When i load the page it gives Internal Server Error. From Apache error log i can see this error: Can't load 'C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll' for module XML::LibXML: load_file:The specified module could not be found at C:/strawberry/perl/lib/DynaLoader.pm line 190. C:/strawberry/perl/site/lib

How do you specify a package version in Perl?

孤街醉人 提交于 2019-12-06 02:55:43
问题 I'm a bit confused by conflicting advice between pre-5.10.0 documents and the more recent version module. Perl Best Practices makes it pretty clear that version strings ('v1.0.3') are bad and one is supposed to specify a version as follows: use version; our $VERSION = qv('1.0.3'); but the version module says that we're back to using version strings: use version 0.77; our $VERSION = qv("v1.2.3"); Have we regressed, or is there a reason behind this? 回答1: Your quote from Perl Best Practices is

How do we convert UUID to date in perl

随声附和 提交于 2019-12-06 02:08:49
I am very new to Perl language. How to convert the UUID to date format 2011-04-22 ? For example, I have UUID like this 118ffe80-466b-11e1-b5a5-5732cf729524 . How to convert this to date format? The module UUID::Tiny has a method called time_of_UUID() that might help: time_of_UUID() This function accepts UUIDs and UUID strings. Returns the time as a floating point value, so use int() to get a time() compatible value. Returns undef if the UUID is not version 1. my $uuid_time = time_of_UUID($uuid); The Timestamp section of RFC4122 can also complement the Wikipedia article about UUID. maybe this

How do you use a variable in lib Path?

蓝咒 提交于 2019-12-05 16:25:46
问题 I would like to use the $var variable in lib path. my $var = "/home/usr/bibfile;" use lib "$var/lib/"; However when I do this it throws an error. I'd like to use use lib "$var/lib/"; instead of use lib "/home/usr/bibfile/lib/"; . How can I assign a variable, so that it can be used in the setting of lib modules? 回答1: Variables work fine in use lib , well, just like they do in any string. However, since all use directives are executed in BEGIN block, your variable will be not yet initialized at