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; | |
| use AnyEvent::HTTP::LWP::UserAgent; | |
| use Data::Dump; | |
| use Time::HiRes; | |
| STDOUT->autoflush; |
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 Modern::Perl; | |
| my @natural = separator(10_000_000); | |
| say scalar @natural; | |
| sub separator { | |
| my $number = shift; | |
| my %hash = map { $_ => 1 } 1..$number; |
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; | |
| use utf8; | |
| use DBI; | |
| use Digest::SHA qw/sha1/; | |
| use Data::Dump; |
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
| Tracking memory leaks: | |
| Devel::Arena - sv_stats() returns arena structures used for SV allocation | |
| * Devel::Cycle - find_cycle($ref) returns all cycles found in $ref and the perl variables they point to | |
| Devel::Gladiator - walk Perl variable arena | |
| Devel::Leak - deprecated by Devel::LeakTrace::Fast | |
| Devel::LeakTrace - deprecated by Devel::LeakTrace::Fast | |
| * Devel::LeakTrace::Fast - prints leaked SV's and line numbers at END. | |
| Data::Structure::Util - has_circular_ref($ref) returns ref to link in $ref that is circular or false. | |
| Test::LeakTrace - no_leaks_ok(), etc. |
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
| # PBP .perltidyrc file | |
| -l=78 # Max line width is 78 cols | |
| -i=4 # Indent level is 4 cols | |
| -ci=4 # Continuation indent is 4 cols | |
| -st # Output to STDOUT | |
| -se # Errors to STDERR | |
| -vt=2 # Maximal vertical tightness | |
| -cti=0 # No extra indentation for closing brackets | |
| -pt=1 # Medium parenthesis tightness |
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
| sub binsearch { | |
| my ( $number, $array ) = @_; | |
| my $last = scalar @$array; | |
| if ( $last == 0 ) { | |
| return undef; | |
| } | |
| elsif ( $array->[0] > $number ) { | |
| return 0; |
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 Modern::Perl '2015'; | |
| use utf8; | |
| use Benchmark qw(:all); | |
| my @array = sort { $a <=> $b } ( 1 .. 10_000 ); | |
| my @numbers = ( -1, 0, 1, 5, 500, 5000, 10_000, 11_000 ); |
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
| package MyApp::Accessor; | |
| sub new { | |
| my $class = shift; | |
| my $self = {}; | |
| bless $self, $class; | |
| $self->_init(@_) if @_; |
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 Modern::Perl '2015'; | |
| use utf8; | |
| use Carp qw/confess/; | |
| use IO::Socket::IP; | |
| use URI; | |
| my $host = 'www.perlmonks.org'; |
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 Modern::Perl '2015'; | |
| use utf8; | |
| use Carp qw/confess/; | |
| use URI; | |
| use IO::Socket::IP; | |
| use IO::Poll qw/POLLIN POLLOUT POLLERR POLLHUP/; | |
| use Errno qw/EWOULDBLOCK/; |
OlderNewer