Skip to content

Instantly share code, notes, and snippets.

@SpiceMan
SpiceMan / 20.pod
Created December 23, 2010 19:24
Catalyst Advent

Checking for leaks in MyApp.

Wait a minute. Catalyst leaks? No, but our application might be leaking.

The single most common leak cause in Catalyst, which we'll cover later, is stashing a closure which needs to use the Catalyst context (usually $ctx or $c). But that's hardly the only cause.

The Real Culprit(TM): circular references

11:32 spiceman@spiceman ~ % git clone https://github.com/SpiceMan/MoopsTestCase.git
Initialized empty Git repository in /home/spiceman/MoopsTestCase/.git/
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 18 (delta 3), reused 18 (delta 3)
Unpacking objects: 100% (18/18), done.
11:32 spiceman@spiceman ~ % perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux
@SpiceMan
SpiceMan / a.pl
Last active August 29, 2015 14:08
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw/:5.10/;
use Moops;
use Carp::Always;
role SubClassVariableAttributes {
has "_var_attrs" => qw/is rw isa HashRef required 1/;
Summary of my perl5 (revision 5 version 18 subversion 2) configuration:
Platform:
osname=linux, osvers=2.6.32-431.el6.x86_64, archname=x86_64-linux
uname='linux asyst 2.6.32-431.el6.x86_64 #1 smp fri nov 22 03:15:09 utc 2013 x86_64 x86_64 x86_64 gnulinux '
config_args='-de -Dprefix=/opt/perl5/perls/perl-5.18.2 -Aeval:scriptdir=/opt/perl5/perls/perl-5.18.2/bin'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw/:5.10/;
use TryCatch;
use Moops;
use Carp::Always;
package MyApp::Controler::Root;
# blah blah blah
sub bar :Local Args(0) POST Consumes(JSON) {
my( $self, $c ) = @_;
# do nothing, just calling it to make sure _build_body_data runs
my $foo = $c->req->body_data;
@MappedSuperclass
@Data
public abstract class AbstractBaseEntity implements Serializable {
private static final long serialVersionUID = -2700410403541761609L;
@Id
@GeneratedValue
private Long id;
@SpiceMan
SpiceMan / php_functions.httpd2.4.patch
Created November 7, 2019 04:12
PHP 5.2.17 patch to use with httpd 2.4 (unixd_config variable name change)
--- sapi/apache2handler/php_functions.c 2010-01-03 18:23:27.000000000 +0900
+++ sapi/apache2handler/php_functions2.4.c 2019-11-07 13:08:30.966214824 +0900
@@ -383,7 +383,7 @@
char *p;
server_rec *serv = ((php_struct *) SG(server_context))->r->server;
#if !defined(WIN32) && !defined(WINNT) && !defined(NETWARE)
- AP_DECLARE_DATA extern unixd_config_rec unixd_config;
+ AP_DECLARE_DATA extern unixd_config_rec ap_unixd_config;
#endif
diff --git a/lib/MBPY/DB/Result/Option.pm b/lib/MBPY/DB/Result/Option.pm
index b3bb2d3..a766e0a 100644
--- a/lib/MBPY/DB/Result/Option.pm
+++ b/lib/MBPY/DB/Result/Option.pm
@@ -157,7 +157,11 @@ sub short_name {
my $name = decode( "sjis", $self->name );
$name =~ s/を選んで.+$//;
- return to_sjis($name);
+# 波ダッシュと全角マイナスのUTF-8=>シフトジス変換問題対策
diff --git a/IRC/plugins/URL/URL.rb b/IRC/plugins/URL/URL.rb
index 7511bb8..be5b2f3 100644
--- a/IRC/plugins/URL/URL.rb
+++ b/IRC/plugins/URL/URL.rb
@@ -120,6 +120,8 @@ accept either index (1 is the most recent one) or substring of the desired URL",
text = nil
fetch_by_uri(uri) do |result|
+ # ZZZ. Net::HTTPResponse.uri only has the uri if the request used an URI instance. (why not ducktype, ffs?)
+ result['uri'] = uri