Skip to content

Instantly share code, notes, and snippets.

ok 1 - Single line check
not ok 2 - Multiple line check # TODO Multiline parsing
# Failed (TODO) test 'Multiple line check'
# at t/03_lines.t line 29.
# got: 'Just 1'
# expected: 'Just 3'
not ok 3 - Error syntax error at (eval 26) line 3, at EOF
# syntax error at (eval 26) line 4, at EOF
# syntax error at (eval 26) line 6, near "}) "
# syntax error at (eval 26) line 6, near "shift) "
eval q[
$ret = mdo {
mbind $x = Just 1 + 2;
munit $x;
};];
if ($@) {
fail "Error $@";
} else {
is_deeply( $ret, $expected, "Sanity check for next (partial line) test" );
}
use strict;
use warnings;
use Test::More tests => 3; # last test to print
use MooseX::Method::Signatures;
my $evalcode = do {
local $/ = undef;
<DATA>;
use strict; use warnings;
use Test::More tests=>1;
use Devel::Peek;
my $peek;
close STDERR;
open STDERR, '>', \$peek;
#!/usr/bin/perl
use strict; use warnings;
package Parent;
use Moose;
use MooseX::ClassAttribute;
class_has attr => (
isa => 'Str',
is => 'rw',
uniq = join . snd . mapAccumL f S.empty
where f s e | e `S.member` s = (s, [])
| otherwise = (e `S.insert` s, [e])
#!/usr/bin/perl
use strict; use warnings;
use Benchmark qw/timethese cmpthese/;
sub recur {
my $n = shift;
if ($n) {
return $n + recur($n-1);
} else {
return 0;
import Control.Monad
import Data.Maybe
joinMaybe [] = Nothing
joinMaybe xs = Just $ join xs
fizzbuzz b = fromMaybe (show b)
. joinMaybe
. concatMap (\f -> f b)
$ [aux "fizz" 3, aux "buzz" 5]
#!/usr/bin/perl
use strict; use warnings;
use Data::Dumper;
use Sub::Curried;
use Carp qw(croak cluck);
my @stream = split /\n/, <<'EOF';
method foo { say $x }
EOF
use strict;
use warnings;
use Data::Dumper;
use DBI;
my $dbh = DBI->connect( 'dbi:CSV:', '', '',
{f_dir => '.',
f_ext => ".asc/r",
csv_sep_char => "\t",
})