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
| #Newbie programmer | |
| def factorial(x): | |
| if x == 0: | |
| return 1 | |
| else: | |
| return x * factorial(x - 1) | |
| print factorial(6) | |
| #First year programmer, studied Pascal |
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
| svn co http://svn.perlide.org/padre/trunk/ padre_trunk | |
| svn co http://svn.perlide.org/padre/trunk/Padre padre_trunk |
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 common::sense; | |
| use AnyEvent; | |
| use AnyEvent::Util qw/fork_call/; | |
| my $cond = AnyEvent->condvar; | |
| my $timer = AnyEvent->timer( | |
| interval => 3, |
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
| perl -E 'open my $x, "<", "test.tmp" or die; seek $x, 10, 0; if (my $child = fork) { waitpid $child, 0; say "Parent: child exited, pos: " . tell($x) } else { ; say "Child: after read from file, pos: " . tell($x) }' |
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 Mojolicious::Lite; | |
| use utf8; | |
| use Encode qw/encode_utf8 decode_utf8/; | |
| post '/' => sub { | |
| my $self = shift; | |
| my $param = $self->req->body; |
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 common::sense; | |
| use AnyEvent::Filesys::Notify; | |
| use AnyEvent; | |
| my $src = "/my/proj/path/htdocs"; | |
| my $dst = "/var/www/html"; | |
| my $cv = AnyEvent->condvar; |
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 5.12.3; | |
| use FindBin qw($Bin); | |
| use lib "$Bin/../lib"; | |
| use DB::Connect; | |
| use HTML::Template; | |
| use Plack::Request; |
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 DB::Local; | |
| use AnyEvent::HTTP::Socks; | |
| use constant CHECK_TIME => 15 * 60; | |
| use constant TIMEOUT => 10; | |
| use constant MAX_GETS => 60; |
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 common::sense; | |
| use AnyEvent::HTTP; | |
| my $app = sub { | |
| my $env = shift; | |
| return sub { | |
| my $respond = shift; | |
| fetch_content(sub { |
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 common::sense; | |
| my $module = $ARGV[0]; | |
| $| = 1; | |
| die "wrong module name: $module" if $module !~ /^[A-Za-z0-9:]+$/; | |
| my @parts = split "::", $module; | |
| $parts[$#parts] .= ".pm"; |