Skip to content

Instantly share code, notes, and snippets.

@EvanCarroll
EvanCarroll / coreopen_and_iofile.t
Created May 12, 2009 18:48
CORE::Open vs IO::File
#!/usr/bin/env perl
##
## These tests to help illustrate some of the difference between IO::File and CORE::open()
##
use feature ':5.10';
use Test::More tests => 18;
use_ok ( 'IO::File' );
my $oofh = IO::File->new('foobar', 'w');
CORE::open( my $fh, '>', 'foobar' );
foreach my $method ( $poe_kernel->meta->get_method_list ) {
next unless $method =~ /^[a-z]/; #skip constants
next if $method eq 'run' or $method eq 'meta' or $method eq 'singleton';
around ( $method => sub {
my ( $sub, $self, @args ) = @_;
if ( Scalar::Util::reftype( $self ) eq 'ARRAY' ) {
$self = __PACKAGE__->instance;
}
$sub->( $self, @args );
} );
package Class;
use Moose;
use Moose::Util::TypeConstraints;
## Whatever, you get the idea.
sub trim_whitespace { my $str = shift; $str =~ s/^\s+|\s+$//; $str };
sub boolify { my $str = shift; $str =~ /^y/i ? 1 : $str };
## Guess i need to say an OLBool is just a regular bool that coerces, stringifies, and removes padding... JOYZER. Shouldn't the where be at the very least, inherited it is a subtype.
Delivery to the following recipient failed permanently:
130376-subscribe@bugs.debian.org
Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 550 550 unknown user (state 14).
Original message
Delivered-To: me@evancarroll.com
I'm looking to solve a long standing bug, here is a brief overview.
DESCRIPTION:
* BUG ID: 130376
* LINK: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=130376
* PROBLEM: Prevents using cpanp and cpan to update system
The real issue here is this was done **totally** wrong. Someone forked over a module from cpan by polluting the namespace with save_parsers_debian {} and breaking upstreams save_parsers {}. This results in an update of XML::SAX (which will install to /usr/local) holding higher precedence than /usr in the perl load sequence and totally breaking dpkg.
My fix for this problem is fairly simple:
package XML::SAX::Debian;
use strict;
use warnings;
use base 'XML::SAX';
use File::Spec;
our $VERSION = '0.01';
sub save_parsers {
package nolocal;
use warnings;
use strict;
use File::Spec ();
our $VERSION = '0.01';
sub import {
my @newinc;
ecarroll@x60s:~$ php -a
Interactive shell
php > $comp_me = gzcompress('Compress me', 9);
php >
php > parse_str( 'var='. urlencode( $comp_me ) );
php >
php > var_dump( urlencode($var) );
string(42) "x%DAs%CE%CF-%28J-.V%C8M%05%5C0%19%BD%04%3F"
php > var_dump( urlencode( $comp_me ) );
package DM::Model::Types::Overload;
use mro 'c3';
use overload;
use feature ':5.10';
sub unoverload {
die "$_[0] Not an object that is overloaded"
if !overload::Method( $_[0], '""' )
;