perl

Perl: why separate "perl" compiler and "perlcc" frontend?

I am trying to make an executable out of my perl code and then I realized that there is no such option available with the perl compiler. After a bit of searching, I found perlcc, which is a frontend for the perl compiler and does the job (produce a binary). Why does perl have separate compiler and frontend? Like for example, gcc for C/C...

What dynamic programming features of Perl should I be using?

I am pretty new to scipting languages (Perl in particular), and most of the code I write is an unconscious effort to convert C code to Perl. Reading about Perl, one of the things that is often mentioned as the biggest difference is that Perl is a dynamic language. So, it can do stuff at runtime that the other languages (static ones) ...

how do I manually add cookies to WWW::Mechanize's already existing cookiejar

I have a perl script where after fetching a page I need to add a cookie to an already existing cookiejar with cookies in it already. how do I go about doing this? I'm hoping for a python mechanize style .set_cookie() function ...

Website Security Questions

I am creating a website that is using a perl script, PHP, a MySQL database, and HTML. My main concern is making sure there is not anyway someone can gain access to anything that give them access to my information. I mean is there anyway for someone to get my perl script and see my database information. I know about sql injection but I ha...

Regex: Lookaround && some syntax

Hi Experts, I am studying about regular expression and struck with the lookaround concept and with few syntax. After doing googling, I thought it is a right forum to ask for help. Please help with this concept. As I am not good with understanding the explanation. It will be great if I get plenty of different examples to underst...

Why are variables declared with "our" visible across files?

From the "our" perldoc: our has the same scoping rules as my, but does not necessarily create a variable. This means that variables declared with our should not be visible across files, because file is the largest lexical scope. But this is not true. Why? ...

How to run same tests on different servers using prove?

I am using the Perl prove testing utility (TAP::Harness) to test my program. I need to run the same tests first on a local computer, then on a remote computer. (Test programs should connect to localhost or to remote host, respectively) How can I pass parameters (test_server) to tests using prove? I should use environment or there is bet...

Should I use the function-oriented or object-oriented CGI interfaces?

I've been learning about the CGI module lately, and the book I'm using shows there are two ways you can use CGI, function-oriented or object-oriented. They say the benefit of having object-oriented is only to be able to create two CGI objects. First of all is this true, and are there any other benefits, and secondly what example is there...

WMI Query for list of hotfixes installed in a system?

I am writing a perl script that will list the hotfixes installed in my system and check if any pre-requisite hotfixes are not available before beginning my program; So I need to be able to enumerate the list of hotfixes in the system; Here there is a mention of using wmic to generate a html file. Is it possible to do this via a WMI quer...

Perl DBI with mysql: how to get return value from a stored procedure?

Does DBD::mysql implement the bind_param_inout method? I am getting the following error messages when trying it out: DBD::mysql::st bind_param_inout failed: Output parameters not implemented [for Statement "call spCreateTransactionRecord(?, ?)" with ParamValues: 0=Null!, 1=Null!] at ./db.pl line 23 My code: #!/usr/bin/pe...

How can Perl's XSUB die?

I have written a Perl XS wrapper for a C library consisting of about ~80 functions. Right now my general strategy is to substitute the error from a C function with PL_sv_undef and the calling Perl code has to check explicitly whether the return is not undef. (For some C functions it is more complicated as I convert their output into a HV...

Making Strings Safe for Regular Expressions in Perl

I have a string which I want to use in a regular expression it a way like m/$mystring_03/ however $mystring contains +s and slashes that cause problems. Is there a simple way in Perl to modify $mystring to ensure all regular expression wildcards or other special characters are properly escaped? (like all + turned into \+) ...

How do I use Perl and Excel OLE to copy a worksheet to a new or existing workbook?

I have tried using the following Perl code, but the worksheet does not copy (nor move) and no error message is returned. Thanks in advance for your ideas. #!/usr/bin/perl -w use strict; use warnings; use OLE; use Win32::OLE::Const 'Microsoft Excel'; my $Excel = CreateObject OLE "Excel.Application"; my $Book2 = $Excel->Workbooks->Add()...

What is setting $VERSION good for?

Lot's of ways to set your modules $VERSION in perl, some even have advantages. What I don't know is why we do it? I mean the META.yml has a version... which is what cpan uses? so why do we set it in the module? what's the point? ...

Convert Perl MD5 Digest and Create to PowerShell

I am trying to convert the following in Perl to PowerShell, I am stuck on the MD5 Digest and Create. timestamp=1283473470 key='this-is-my-key' secret='secret' perl -e "use Digest::MD5 qw(md5 md5_hex); print md5_hex('$key' . '$secret' . $timestamp);" For testing purposes I am setting the time stamp to a static number. That way I can c...

Removing HTML from user input in Perl and Catalyst

I'm using Catalyst for my Perl web app. What is the accepted way of removing HTML from user input? Currently I'm leaning towards using HTML::FormatText. But it seems strange to me that I can't find a utility built into Catalyst to do this common task. Have I just not found it? Also, it seems these modules for removing input take l...

Multi-Line Regular Expression

I'm trying to match out of this text: <a href="http://english317.ning.com/profiles/blogs/bad-business-writing-487"&gt;Continue&lt;/a&gt; </div> <p class="small"> Added by <a href="/profile/KemberleyRamirez">Kemberley Ramirez</a> on...

Using C# to call perl script on a Unix box

I need to execute Perl script (basically job submission) sitting on a Unix box. This needs to happen from a C# application sitting on a Windows box. Is this entirely possible? If so, where do I start? Any reading material would be helpful! ...

Perl Arrays and grep

I think its more a charachters, anyway, I have a text file, consisted of something like that: COMPANY NAME City Addresss, Address number Email phone number and so on... (it repeats itself, but with different data...), lets assume thing text is now in $strting variable. I want to have an array (@row), for exa...

Perl: Programatically set POST param using REST::Client module

I've built a REST Server and now I want to rapidly test it from a Perl Client, using REST::Client module. It works fine if I perform GET Request (explicitly setting parameters in the URL) but I can't figure out how to set those params in POST Requests. This is how my code looks like: #!/usr/bin/perl use strict; use warnings; use REST...