perl-module

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

有些话、适合烂在心里 提交于 2019-12-04 19:07:40
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 found RCPT TO: error (550 5.1.1 <user@mail.com>... User unknown). Code: #!/usr/bin/perl use strict; use

Should a Perl constructor return an undef or a “invalid” object?

自闭症网瘾萝莉.ら 提交于 2019-12-04 18:42:16
问题 Question : What is considered to be "Best practice" - and why - of handling errors in a constructor?. "Best Practice" can be a quote from Schwartz, or 50% of CPAN modules use it, etc...; but I'm happy with well reasoned opinion from anyone even if it explains why the common best practice is not really the best approach. As far as my own view of the topic (informed by software development in Perl for many years), I have seen three main approaches to error handling in a perl module (listed from

Where can I find the cpanfile format definition?

扶醉桌前 提交于 2019-12-04 18:07:40
问题 We consider to use Minilla or Dist::Milla for our perl development. Declaring dependencies is done via cpanfile. I expected to find an exact definintion of what and how can be declared. But perldoc cpanfile : Shows only the principal usage. 'SEE ALSO' section does not help. perldoc Module::CPANfile: same as cpanfile. perldoc cpanfile-faq: no explanation of the exact syntax or a link to it, only Familiar DSL syntax This is a new file type, but the format and syntax isn't entirely new. The

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

为君一笑 提交于 2019-12-04 18:06:12
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 from another csv file. To add a column, simply add a single element to each row and print the rows as

calling perl subroutine in shell script

风流意气都作罢 提交于 2019-12-04 15:18:55
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-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .). BEGIN failed--compilation

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

两盒软妹~` 提交于 2019-12-04 14:10:02
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 { $self->goodbye() }; END { $cleanup->() }; and then like this: END { sub { $self->goodbye() }->() }; But

How to Install ROUGE In Ubuntu

别说谁变了你拦得住时间么 提交于 2019-12-04 11:45:57
Although there is good description of how to Set Up ROUGE evaluation , i could not get any place where the installation was described completely. Vivek Aditya 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 XML::DOM. Many times people get stuck at how to install the XML::DOM. Hope this helps. Any

Can't locate DBI.pm

时间秒杀一切 提交于 2019-12-04 10:02:48
问题 I'm trying to launch this script: #!/usr/bin/perl use DBI; my $dbh = DBI->connect( 'dbi:Oracle:host=lonlin2;sid=TIMFX1AD;port=1524','xbsesdbo','xbsesdbo123' ) || die ( $DBI::errstr . "\n" ); my $query= "SELECT * FROM product_elements WHERE element_id = 1001"; my $queryHandler= $dbh->prepare($query); my $result= $queryHandler->execute(); open(fileHandler,"> note.txt"); print fileHandler "Risultato query: $result\n"; my $e= $dbh->disconnect(); close(fileHandler); When I launch this script I

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

霸气de小男生 提交于 2019-12-04 09:53:11
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/auto/XML/LibXML/LibXML.dll exists with all permissions. Also this library works properly on Linux. My

How do I use Perl's Google::Search to look for specific URLs?

偶尔善良 提交于 2019-12-04 09:41:10
The Google::Search module, which is based on the AJAX Search API, doesn't seems to work very well, or it is just me? For example, I use firefox to search google for: http://bloggingheads.tv/forum/member.php?u=12129 It brings results. But when I use the module this way: $google_search = Google::Search->Web ( q => "http://bloggingheads.tv/forum/member.php?u=12129" ); @result = $google_search->all; I get nothing in the array. Any idea? Seems like this API doesn't bring the same results like when searching manually, am I missing something? I had a similar problem with cyrillic queries. Both Google