Skip to content

Instantly share code, notes, and snippets.

View mpeters's full-sized avatar

Michael Peters mpeters

  • Red Hat
  • Raleigh, NC
View GitHub Profile
Index: Build.PL
===================================================================
--- Build.PL (revision 908)
+++ Build.PL (working copy)
@@ -22,6 +22,7 @@
'CGI::Application::Plugin::TT' => 1.04,
'CGI::Application::Plugin::ValidateRM' => 2.3,
'Class::DBI' => 3.0,
+ 'Class::DBI::SQLite' => 0,
'Class::DBI::Plugin::RetrieveAll' => 1.04,
Index: Build.pm
===================================================================
--- Build.pm (revision 910)
+++ Build.pm (working copy)
@@ -66,6 +66,10 @@
$ENV{SMOLDER_CONF} = $tmp_conf->filename;
$ENV{SMOLDER_TEST_HARNESS_ARCHIVE} = 1;
+ # make sure we create a DB first. Smolder will do this when it starts,
+ # but we still want to run some tests even if we fail to start smolder
Index: Build.PL
===================================================================
--- Build.PL (revision 909)
+++ Build.PL (working copy)
@@ -52,6 +52,7 @@
'Pod::Usage' => 0,
'TAP::Harness::Archive' => 0.12,
'Template::Plugin::Cycle' => 0,
+ 'Template::Plugin::Number::Format' => 0,
'URI::Escape' => 0,
#!/usr/bin/perl
print (undef() > 10 ? "TRUE\n" : "FALSE\n");
print (undef() < 10 ? "TRUE\n" : "FALSE\n");
print (undef() == 10 ? "TRUE\n" : "FALSE\n");
print (undef() == undef() ? "TRUE\n" : "FALSE\n");
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my $add = ($0 =~ /\/uncomment$/ ? 0 : 1);
my $lang = lc(shift) || 'perl';
my %comment_chars = (
perl => '#',
bash => '#',
#!/usr/bin/perl
use Benchmark qw(:all);
my @strings = (123456, 1234567890, 1234567890123456);
foreach my $str (@strings) {
print "\nString of " . length($str) . " characters\n";
cmpthese(
1000000,
{
'length and substr' => sub {
#!/usr/bin/perl
use Benchmark qw(:all);
my @strings = (123456, 1234567890, 1234567890123456);
foreach my $str (@strings) {
print "\nString of " . length($str) . " characters\n";
cmpthese(
1000000,
{
'length and substr' => sub {
use strict;
use warnings;
my $foo = 3;
my $ref1 = \$foo;
my $foo = 10;
my $ref2 = \$foo;
print "$$ref1";
print "$$ref2";
String of three characters
--------------------------------------------------------------------------------
using a quotemeta regex 277778/s -- -6% -56%
using a regex 294118/s 6% -- -53%
using eq 625000/s 125% 112% --
String of five characters
--------------------------------------------------------------------------------
using a quotemeta regex 250000/s -- -17% -60%
using a regex 303030/s 21% -- -52%
#!/usr/bin/perl
use strict;
use warnings;
use Benchmark qw(:all);
my %strings = (
three => [[qw(foo bar baz fut)], 'bar'],
five => [[qw(foodi barsi bazie foots)], 'foodi'],
seven => [[qw(fooding barsing bazieys footsys)], 'bazieys'],
nine => [[qw(foodinges barsinges bazieyses footsysin)], 'footsysin'],