This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl -w | |
=head1 NAME | |
pl2js.pl | |
=head1 DESCRIPTION | |
Attempts to convert perl scripts to javascript with the awesome power of regular expressions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ack Module::Load --output='@{[`git blame $_[1] -L $.,$. | perl -e "chomp and print while <STDIN>"`]}' | |
alias ack-blame="ack --output='@{[\`git blame \$_[1] -L \$.,\$. | perl -e \"chomp and print while <STDIN>\"\`]}'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub element { | |
my $name = shift; | |
my $element = XML::LibXML::Element->new($name); | |
my $next = shift; | |
if (ref $next eq ref {}){ | |
foreach my $attrName (keys %$next){ | |
$element->setAttribute ($attrName, $next->{$attrName}); | |
} | |
$next = shift; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use threads; | |
use Thread::Queue; | |
my $q = Thread::Queue->new(); # A new empty queue | |
my $q2 = Thread::Queue->new(); # A new empty queue | |
use XML::LibXML qw(:threads_shared); | |
my $parser = XML::LibXML->new; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl | |
use strict; | |
use warnings; | |
use Test::More; | |
sub first_or_all { | |
return @_ if wantarray; | |
return shift; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
no less; use strict; use warnings; | |
open (my $fhIN, '<', $0) or die; my @lines = <$fhIN>; | |
open (my $fhOUT, '>', $0) or die; | |
print $fhOUT sort {$a cmp $b} @lines; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use 5.010; | |
{ | |
package A; | |
our $hash={1=>'i',2=>'j'}; | |
} | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Acme::Object::Overloaded; | |
use overload '""' => sub{ 'String' }, '0+' => sub{ 123 }, 'fallback' => '0+'; | |
sub new{ | |
bless {}, shift; | |
} | |
1; | |
package main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl -w | |
=head1 NAME | |
pl2py.pl | |
=head1 DESCRIPTION | |
Attempts to convert perl scripts to python with the awesome power of regular expressions. |
NewerOlder