Hi all:
I'm using genhtml (in Windows under cygwin) to generate a unit test coverage report from 2 coverage data files. They are all coverage data from the same unit test source file.
However, when I entered the following command:
perl genhtml /home/administrator/coverage1.dat /home/administrator/coverage2.dat
I got the following o...
Lets say I have "http://www.ritzcarlton.com" and that redirects me to "http://www.ritzcarlton.com/en/Default.htm". Is there a way in Perl to find the end url after all the redirects?
...
Hi, activePerl 5.8 based
#!C:\Perl\bin\perl.exe
use strict;
use warnings;
# declare a new hash
my %some_hash;
%some_hash = ("foo", 35, "bar", 12.4, 2.5, "hello",
"wilma", 1.72e30, "betty", "bye\n");
my @any_array;
@any_array = %some_hash;
print %some_hash;
print "\n";
print @any_array;
print "\n";
print $any_array[0];
print "\...
I need to export a table in the database to a tab separated values file. I am using DBI on Perl and SQL*Plus. Does it support (DBI or SQL*Plus) exporting and importing to or from TSV files?
I can write a code to do my need, But I would like to use a ready made solution if it is available.
...
i am using this site as a resource
http://www.perlmonks.org/?node_id=573138
I am trying to understand about O notation and it gives two examples of searching two arrays for the same element. First example has O(n^2) as does the second, however the second has an enhancement to it so it runs quicker but still maintains the same O notation...
I am doing a lot of file searching based on a criteria in multiple iterations from my Perl script and it seems to take up 100% of the CPU time. Is there a way to control my script CPU utilization? I read somewhere about putting empty sleep cycles in my script. But I am not sure how to do this.
...
I have an array of various things including scalars and arrays. I want to make a copy of it, and tried the following:
@b = dclone(\@a)
but then when I try to read one of the scalar values from b, I get nothing back.
Everything appears to work when I copy it this way, though:
@b = @{dclone(\@a)}
What is the reason?
...
Have a perl brain-teaser:
my @l = ('a', 'b', 'c');
for (@l) {
my $n = 1;
print shift @l while (@l and $n --> 0);
print "\n";
}
What's it print? Should be a, b, and c, right? But oh wait actually there's a bug somewhere, it only prints a and b. Probably just some stupid off-by-one, should be easy to solve, right?
Ok so mak...
What is the best way to parse INI file in Perl and convert it to hash?
...
Hello!
How do I find a literal % with the LIKE-operator?
#!/usr/bin/perl
use warnings;
use strict;
use DBI;
my $table = 'formula';
my $dbh = DBI->connect ( "DBI:CSV:", undef, undef, { RaiseError => 1 } );
my $AoA = [ [ qw( id formula ) ],
[ 1, 'a + b' ],
[ 2, 'c - d' ],
[ 3, 'e * f' ],
[ 4, 'g / h...
I have a TT plugin that does the trivial unique ids:
sub get_unique_uid_tt {
my ( $classname, $o ) = @_;
my %h;
foreach my $item ( @{$o} ) {
unless ( exists $h{ $item->id } ) {
$h{ $item->id } = 1;
}
}
return keys %h;
}
where the template call is simply:
[% Namespace.get_unique_uid_tt( data.users ) %]
and...
I am making a simple time sheet for which people can register times
worked on a bug real quickly.
But the hours added to the bugs_activity table are not noticed
anywhere.
here is a simple made up line
Bugzilla::Bug::LogActivityEntry(1, 'work_time', 0, 66, 1, '2010-01-12 14:44:44');
Pretty much, add 66 hours to bug 1, work time...
I want to test one of my Perl scripts. I want to modify the "$0" value during compile time. Is that possible?
...
I'm trying to thaw a database BLOB that was frozen using Storable on a 64-bit Solaris (production) machine. When I try to thaw on a 32-bit Windows (development) PC I receive "Byte order is not compatible error".
perl -v (on solaris)
This is perl, v5.8.8 built for i86pc-solaris-64
perl -v (on Windows)
This is perl, v5.10.1 built for MSW...
Hi! Why do I get my string two times in the output?
#!/usr/bin/perl
use warnings;
use strict;
use XML::Twig;
my $string = '<cd_catalogue><title>Hello, World!</title></cd_catalogue>';
my $t= XML::Twig->new( twig_handlers => { cd_catalogue => \&cd_catalogue, },
pretty_print => 'indented',
);
$t->parse( $string );
s...
Is there any function like int() which can convert a string to float value?
I'm currently using the following code:
$input=int(substr($line,1,index($line,",")-1));
I need to convert the string returned by substr to float.
...
In a web application written in Perl and using PostgreSQL the users have username and password. What would be the recommended way to store the passwords?
Encrypting them using the crypt() function of Perl and a random salt? That would limit the useful length of passswords to 8 characters and will require fetching the stored password in ...
Hi,
I'm searching for improving my algorithm for an allocate massive data riddle.
If anyone can think of some good idea that makes it run faster, I'll appreciate it.
I have 8 files contains 2 parameters:
1) start point
2) end point
These type of data repeat itself with different numbers along the file.
means I could have a file with ...
I have been using an Object-Oriented MVC architecture for a web project, and all the models are OO Perl. But I have noticed a couple on the team are reverting to procedural techniques and are essentially using "objects" as dumping grounds for related functions. Their functions basically read/write directly to/from the database.
What's t...
I inherited a project which is supposed to be able to be deployed to other servers. This project has a number of simple module dependencies which however might not be present on all target machines.
As such I'd like to be able to run a single command line script that checks which Perl modules are installed and tries to automatically ins...