perl

How can I use XML::Simple to configure HTML::FormFu?

I assume you can use XML::Simple with HTML::FormFu because FromFu uses Config::Any to load it's config data. However, I can't seem to find any sample xml configs being used with HTML::FormFu. Not only am I getting an error. I'm not sure my xml is structured correctly to create the desired form. For example, on options, formfu wants an a...

Which CPAN module would you recommend for turning HTML into plain text?

Which CPAN module would you recommend for turning HTML into formatted plain text? One strict requirement is that the module must handle Unicode characters. ...

How can I use ActivePerl's PPM 4 from the command line?

Hi Guys, The version of PPM (4.06, and I run it under Windows) directly puts me into a GUI which is a nice but since I'm quite comfortable with the command-line prompt so I still want to find a way to get a command-line prompt instead of a GUI . thanks in advance. ...

Is it possible to get the index of a exchange using Finance::Quote?

I need to get the index of a exchange like NASDAQ rather than the price of a specific stock in that exchange. I suppose that Finance::Quote will come to the rescue , but after a quick go-through of the document, I find it the way one can use the module for query is like: %info = $q->fetch("australia","CML") which means both the ex...

How can I add a progress bar to WWW::Mechanize?

I have the following code: $mech->get($someurl, ":content_file" => "$i.flv"); So I'm getting the contents of a url and saving it as an flv file. I'd like to print out every second or so how much of the download is remaining. Is there any way to accomplish this in WWW::Mechanize? ...

How can I extract HTML table data using Perl?

Hi Guys, I need to retrieve some data from a web page. After analysing the HTML code of the page, I found the data I need is embeded in a table with a unique table id. I don't know whether it is an HTML rule or not, anyway it's very good for parsing I think. The data in the table is arranged as below (various attributes and tags hav...

How can I count number of logical conditions used in if,elseif or while in Perl?

hi all... i have a while,if,elseif statements in a file with multipe conditions inside it... it is a C language...the format is mentioned below is standard for all the multiple conditions.So no worries about the indendation.The only problem is to check how many conditions are there and list as per output format that i have descr...

What does 1; mean in Perl?

I have come across a few Perl Modules that for example look similar to the following code: package MyPackage; use strict; use warnings; use constant PERL510 => ( $] >= 5.0100 ); require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( ); { #what is the significance of this curly brace? my $somevar; sub Somesub { ...

Perl Array Question

Never done much programming -- been charged at work with manipulating the data from comment cards. Using perl so far I've got the database to correctly put its daily comments into an array. Comments are each one LINE of text within the database, so I just split the array on the line-break. my @comments = split("\n", $c_data); And yes,...

How can I parse CSV data with internal commas in data using Perl?

The data I need to parse looks like: [fild1, filed2, .... filedn] , [filed1, filed2, .... filedn] ..... I call it a special form of CSV data because there are two kinds of comma: those commas outside the [] pair are served as the separator between different records. those commas inside the [] pair are served as the separator betwee...

Does SELECT DISTINCT work with Perl's DBD::CSV?

Hello, I found a SELECT-example on the web. When I try it in my script I get this error-message: Specifying DISTINCT when using aggregate functions isn't reasonable - ignored. at /usr/lib/perl5/site_perl/5.10.0/SQL/Parser.pm line 496. #!/usr/bin/perl use warnings; use strict; use DBI; my $dbh = DBI->connect( "DBI:CSV:", undef, undef,...

How can I extract and format HTML found in a div tag, using Perl?

Note: Using HTML::TreeBuilder or other suitable method Question: Using Perl with LWP, for the following HTML, how to search for the literal string whatever between the start tag and end tag div and then get all text between the aforementioned start and end tag, while adhering to formatting text tags <div id="foo" class="blah"> <tt...

String class internals - caching character offset to byte relationship if using UTF-8

When writing a custom string class that stores UTF-8 internally (to save memory) rather than UTF-16 from scratch is it feasible to some extent cache the relationship between byte offset and character offset to increase performance when applications use the class with random access? Does Perl do this kind of caching of character offset t...

MySql: transactions don't detect deadlocks?

Consider the following perl code: $schema->txn_begin(); my $r = $schema->resultset('test1')->find({id=>20}); my $n = $r->num; $r->num($n+1); print("updating for $$\n"); $r->update(); print("$$ val: ".$r->num."\n"); sleep(4); $schema->txn_commit(); I'm expecting that since the update is protected by a transaction, then if two proc...

How can I prevent perl from reading past the end of a tied array that shrinks when accessed?

Is there any way to force Perl to call FETCHSIZE on a tied array before each call to FETCH? My tied array knows its maximum size, but could shrink from this size depending on the results of earlier FETCH calls. here is a contrived example that filters a list to only the even elements with lazy evaluation: use warnings; use strict; pa...

Error on syntax for generating coverage data from multiple files using lcov in Windows

Hi all: I would like some help... I'm having trouble coming up with the syntax to generate coverage data from multiple files using lcov in Windows. I have gcov, lcov and genhtml installed on cygwin (I'm running this under Windows). All of those files are inside cygwin/bin directory. The coverage data I flush through I believe are per...

How do I undefined the value for a hash key in Perl?

#!/usr/bin/perl use strict; use warnings; my %hash; undef($hash{"a"}); undef($hash{"b"}); print scalar values %hash; # i need here 0 print scalar keys %hash; # and here 2 thank you, guys! ...

How can I encrypt with AES in C# then decrypt it on Perl?

Here is my C# code. How could I decrypt this in Perl? Or I cannot decypt it in Perl due to OpenSSL? RijndaelManaged RijndaelAlg = new RijndaelManaged(); FileStream fStream = File.Open(FileName, FileMode.OpenOrCreate); byte[] initVectorBytes = Encoding.ASCII.GetBytes("11B2c3D4e5F6g7H8"); RijndaelAlg.IV = initVectorBytes; string password ...

How can I search a large sorted file in Perl?

Hi all, Can you suggest me any CPAN modules to search on a large sorted file? The file is a structured data about 15 million to 20 million lines, but I just need to find about 25,000 matching entries so I don't want to load the whole file into a hash. Thanks. ...

How can I compare mtimes returned by Perl's stat?

Hello. I found some sample scripts "stat" usage below. $source_mtime = (stat($source_file))[9]; $dest_file_mtime = (stat($dest_file))[9]; $script_mtime = (stat($this_file))[9]; if (-e $dest_xml_file) { if ($dest_file_mtime gt $source_mtime) // gt used { printf "No $this_file Scan Needed\n"; exit(0); } ...