Skip to content

Instantly share code, notes, and snippets.

@scottwalters
scottwalters / gist:8220a1e60469ad3ef990
Created August 21, 2014 12:59
when perl code stops working on a newer version of perl
( perl5.12.3 -d:Trace t/013_complexType.t 2>&1) | grep -v '/home/scott/lib/' | sed -e 's!lib//SOAP!lib/SOAP!' > trace512.txt
( perl -d:Trace t/013_complexType.t 2>&1) | grep -v '/usr/local/lib/perl5/' > trace519.txt
# For example... the library paths to grep out vary (5.12.3 was installed in my home dir whereas 5.19.9 is in /usr/local).
kompare trace*.txt
That creates full execution traces, showing every line that Perl runs, while running the same unit test under two different versions of Perl. grep -v removes all lines traced from running installed modules so that only tracing from the unit test and non-installed module are left. kompare does a visual comparison on that. The point in the code where execution diverges for whatever reason will be clear in the visual diff.
#!/bin/perl
use 5.010;
use strict;
use warnings;
use B::Generate;
use Opcode;
#Asking to enter a number.
#!/usr/bin/perl
use strict;
use warnings;
# change these
my $pdf = '/path/to/pdf/file/filename_of_pdf_file.pdf';
my $to_email = 'walt0132@gmail.com';
my $email_subject = 'form completed';
mysql> select assetIndex.assetId, assetIndex.title, assetIndex.url,
-> assetIndex.synopsis, assetIndex.ownerUserId, assetIndex.groupIdView,
-> assetIndex.groupIdEdit, assetIndex.creationDate, assetIndex.revisionDate,
-> assetIndex.className, match (keywords) against ('+following-following*') as
-> score from assetIndex
-> where
-> -- isPublic = 1 and
-> ((match (keywords) against ('+following-following*' in boolean mode))
-> -- and (lineage like '000001000002%')
-> and (className='WebGUI::Asset' or className='WebGUI::Asset::Event' or
# uses https://github.com/mtve/bitcoin-pl for base58.pm, ecdsa.pm
# doesn't work. ecdsa.pm is flakey and usually doesn't create the same signature as the reference implementation.
use strict;
use warnings;
use Carp;
use Data::Dumper;
use Socket;
Hello,
Per discussion between Cliff and I, I've put all of the raw bike count
data into github:
https://github.com/biketempe/DataAnalysis
Some of the code I've written for this project is in there, such as
the crash rate plot I did for this year, the SQL query used to fetch
the data, and the raw ADOT from that.
@scottwalters
scottwalters / gist:9e7eb0242d2c1734283b
Created April 5, 2015 08:40
TBAG filtering Facebook's RSS feed on tags so that Mailchimp only sends out emails on tagged posts
#!/home/biketempe/bin/perl
#!/usr/local/bin/perl
use 5.019;
use strict;
use warnings;
use experimental 'postderef', 'signatures';
use CGI;
sub _autofield_processor {
my $self = shift;
my $cnf = shift || {};
return sub {
my $name = shift;
my $display = shift;
$display = $name unless ($display);
my $Column = $self->AppDV->get_column($name) or return '';
# no strict 'refs';
# use Data::Dumper; warn 'ISA: ' . join ', ', @{ ref($self->AppDV) . '::ISA' }; # ->_virtual_columns();
in a method in a Content Handler:
my $cart = WebGUI::Shop->Cart->newBySession($session);
my $asset_id = $session->db->quickScalar("select assetId from sku where sku = ?", [ $session->request->param('sku')) ]);
my $product;
if( $asset_id ) {
$product = WebGUI::Asset::Sku::Product->newById($session, $asset_id);
} else {
$product = WebGUI::Asset::Sku::Product->new($session);
#!/usr/bin/perl
# creates reports on WebGUI (tm) helpdesks from the command line using $EDITOR
# supposed to automatically close them but doesn't do that yet
# todo:
# o. change ticket status to 'resolved' automatically, optionally
# o. do a git log to find the last hash and commit comment?
# o. <perlDreamer> start with /data/WebGUI/sbin/_utility.skeleton