This file contains hidden or 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
#/usr/bin/env perl | |
use warnings; | |
use strict; | |
use List::Util 'all'; | |
sub foo { | |
print "before: @_\n"; | |
all { print "in all block: @_\n" } qw( bar ); | |
print "after: @_\n"; |
This file contains hidden or 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
#!/usr/bin/perl | |
# Author: Todd Larason <[email protected]> | |
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $ | |
# use the resources for colors 0-15 - usually more-or-less a | |
# reproduction of the standard ANSI colors, but possibly more | |
# pleasing shades | |
# should look like https://forums.freebsd.org/threads/urxvt-tmux-256-colors.38399/ |
This file contains hidden or 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
package Foo; | |
sub new { | |
my( $class, $hash ) = @_; | |
return bless $hash, $class; |
This file contains hidden or 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
#!/bin/sh | |
perl -pe 's/(\[.*?\] ){3}(.*?), referer.*/$2/' |
This file contains hidden or 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
for ( 1 .. 2 ) { | |
my $var = 0 if 0; | |
$var++; # no warning/error? | |
print "$var\n"; | |
} |
This file contains hidden or 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
SELECT A.*, B.*, C.* | |
FROM A | |
LEFT JOIN B | |
ON B.aid = A.id | |
LEFT JOIN C | |
ON C.bid = B.id | |
LEFT JOIN D | |
ON D.cid = C.id AND D.aid = A.id |
This file contains hidden or 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
$dbh = DBI->connect( $DSN, $DB_USER, $DB_PASS ) || die "cannot connect to database"; | |
$dbh->{HandleError} = sub { confess( shift ) }; | |
$dbh->{Profile} = 31; | |
$DBI::Profile::ON_DESTROY_DUMP = $DBI::Profile::ON_DESTROY_DUMP = sub { | |
my ( $result ) = @_; | |
my $time = $1 if ( $result =~ m/DBI::Profile: ([\d\.]+?)s/ ); | |
return if $time and $time < 0.3; | |
open my $fh, '>>', '/home/writers/sitedata/logs/db_profile.log'; |
This file contains hidden or 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
(defun remove* (symbol tree) | |
"Removes SYMB0L from TREE." | |
(cond ((null tree) tree) | |
((atom (car tree)) | |
(if (equalp symbol (car tree)) | |
(remove* symbol (cdr tree)) | |
(cons (car tree) (remove* symbol (cdr tree))))) | |
(t (cons (remove* symbol (car tree)) | |
(remove* symbol (cdr tree)))))) |
This file contains hidden or 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; | |
package Minimum; | |
use Validation::Class; | |
directive 'my_directive' => sub { die }; | |
mixin 'my_mixin' => { |
This file contains hidden or 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
{1 => undef}; # works, but | |
sub foo { return }; | |
{1 => foo() } # Odd number of elements in anonymous hash | |
sub bar { return undef } | |
{1 => bar() } # works! |
NewerOlder