Skip to content

Instantly share code, notes, and snippets.

@chansen
chansen / NoticeableChanges.md
Created May 7, 2018
Noticeable changes in Property Aliases and Property Value Aliases
View NoticeableChanges.md

Noticeable changes in Property Aliases and Property Value Aliases

PropertyAliases.txt

3.2:
 + NBrk;Non_Break
 + WSpace;White_Space
 + scc;Special_Case_Condition
 + sfc;Simple_Case_Folding

4.0:

@chansen
chansen / results.txt
Created Nov 16, 2015
Faster UTF-X validation (~ 50% - 300% faster)
View results.txt
perl: 5.022000 (darwin 14.5.0)
ar.txt: code points: 14308 (U+0000..U+007F: 2698 U+0080..U+07FF: 11610)
Rate core this
core 26873/s -- -33%
this 39928/s 49% --
el.txt: code points: 58748 (U+0000..U+007F: 13560 U+0080..U+07FF: 45150 U+0800..U+FFFF: 38)
Rate core this
View id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvkbSjboxgPOsq6rbKxww8taPipuM17Fj9xURQjIkEiunb+6mBumR+ct1d//O5Va6/t/srAg14KeQWEY6Ody+EC8DVI02TtX4buBc1rAL7BCRarLrTJCNYpJ9VLhu+h/u2x/3SgdMfHsBKbs65jqDIsSooXjyuJz3GDWrMDculQqwCiGGhkNPkzjdB1cXIOt8PEMRYV8/A/yqZtfIgd9lumT069m3xc1uKSScSpTSI4BeLMRTfydh5JlLATrBEPqHT/Iudb8xy37YdO0v0Et03eL5j8BID7RAZlnNq6ECV22doqBZ2UrfYnaqY/HeiekqaY52vNnATZ0pXlRItKvkuw== chansen@cpan.org
@chansen
chansen / result.txt
Last active Aug 29, 2015
Benchmark of slurping UTF-8 encoded file in Perl
View result.txt
$ perl benchmarks/slurp.pl
perl: 5.023001 (darwin 14.4.0)
Encode: 2.75
Unicode::UTF8: 0.60
PerlIO::encoding: 0.21
PerlIO::utf8_strict: 0.006
ar.txt: Size: 25918 Code points: 14308 (U+0000..U+007F: 2698 U+0080..U+07FF: 11610)
Rate :encoding(UTF-8) Encode :utf8_strict Unicode::UTF8
@chansen
chansen / ago.pl
Created Jul 10, 2015
Simple and efficient formatting of relative date/time using Time::Moment
View ago.pl
#!/usr/bin/perl
use strict;
use warnings;
use Carp qw[];
use Time::Moment 0.19 qw[];
sub YEAR () { 365.2425 }
sub MONTH () { YEAR / 12 }
sub DAY () { 1 }
@chansen
chansen / benchmark.txt
Created Oct 13, 2014
Unicode::UTF8 vs Encode
View benchmark.txt
$ perl benchmarks/bench.pl
perl: 5.020001 (darwin 13.3.0)
Encode: 2.60
Unicode::UTF8: 0.60
ar.txt: code points: 14308 (U+0000..U+007F: 2698 U+0080..U+07FF: 11610)
Rate Encode Unicode::UTF8
Encode 4121/s -- -83%
Unicode::UTF8 24613/s 497% --
@chansen
chansen / extract.pl
Created Oct 26, 2013
Extracts name and filename values from Content-Disposition header in multipart/form-data
View extract.pl
#!/usr/bin/perl
use strict;
use warnings;
# <https://bugzilla.mozilla.org/show_bug.cgi?id=136676>
# <https://bugs.webkit.org/show_bug.cgi?id=62107>
# <https://www.w3.org/Bugs/Public/show_bug.cgi?id=16909>
# extracts name and filename values from Content-Disposition header.
# returns the escaped value, due to different behaviour across browsers. (see below)
@chansen
chansen / eigen.pl
Created Sep 6, 2013
Transparent singleton methods in Perl
View eigen.pl
#!/usr/bin/perl
use strict;
use warnings;
# Transparent singleton methods in Perl
# First a new anonymous class is created to hold the object's singleton
# methods, this anonymous class assumes the role of the object's class
# and the original class is designated as the super class of that anonymous
# class. This is completely transparent and the anonymous class can't be
# referenced by name.
View unicode.pm
package unicode;
use strict;
use warnings;
use warnings::register;
use Carp qw[croak cluck];
use Encode qw[];
# from perl.h verified in 5.6.2, 5.8.9, 5.10.1 and blead (2010-02-27)
sub HINT_BLOCK_SCOPE () { 0x00000100 }
View perlio-scalar-eof.patch
diff --git a/ext/PerlIO-scalar/scalar.xs b/ext/PerlIO-scalar/scalar.xs
index eac682b..d324bdd 100644
--- a/ext/PerlIO-scalar/scalar.xs
+++ b/ext/PerlIO-scalar/scalar.xs
@@ -125,6 +125,18 @@ PerlIOScalar_tell(pTHX_ PerlIO * f)
return s->posn;
}
+IV
+PerlIOScalar_eof(pTHX_ PerlIO * f)