Skip to content

Instantly share code, notes, and snippets.

mmcleric@mmbook:~$ perl -E 'sub f { (5,6) }; say 6 ~~ f()'
1
mmcleric@mmbook:~$ perl -E 'my @x = (5,6); sub f { @x }; say 6 ~~ f()'
mmcleric@mmbook:~$ perl -E 'my @x = (5,6); sub f { @x }; say 2 ~~ f()'
1
mmcleric@mmbook:~$ perl -E 'my @x = (1,2); sub f { @x }; say @x ~~ f();'
mmcleric@mmbook:~$ perl -E 'my @x = (1,2); sub f { @x }; say @x ~~ @{ [ f() ] };'
1
$ perl -e 'use autodie; sub read {}'
Prototype mismatch: sub main::read (*\$$;$) vs none at -e line 1.
$ perl -e 'use autodie; BEGIN { undef *read }; sub read {}'
# this one works...
# but it breaks if I use it in module:
$ cat >X.pm
use autodie;
BEGIN { undef *read }
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAy50l7a/1OpeVTiVALsWwRDvbczw/GBBwO5kSXHQGNQeZEp+fy+9Jh6jrno9ojU+IGWGewDpDl3mvgfeOMpjnQrWO0e0QJ1ZkxgRwUG6PGVsNVZ182eFrUl3BU/epke/LHtK17e+282zFOAPf7S+XbTyOWNU7k1N4WkexJUIFtDH0zhvcKaU8rzeP3YDK3+jQCF+BZpvtrijJF1cydguSaEohuhH3MBU67IUgPwtqXIGzOr/1op/iwxIRGFsPd9BaXQ/AC9dTw/DoiiZ5Xh0efOdPvtCdupxmB1GXIBO4MtJaSYnDSDCHxMWJdyw8wjAn5i/WsNZ9AnxKFtNWqeTGiQ== mmcleric@mmcleric-macbook
$ perl -E 'use Moo; has "foo" => ();'
Must have an is at /Users/mmcleric/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/Method/Generate/Accessor.pm line 20.
$ perl -e 'use Moo; sub BUILDARGS { return { x => 5 } }; main->new("foo")'
Odd number of elements in anonymous hash at /Users/mmcleric/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/Moo/Object.pm line 25.
@berekuk
berekuk / test.t
Created May 31, 2012 17:47
Test::Deep::This
use strict;
use Test::More;
use Test::Deep::This;
use Test::Deep;
cmp_deeply(
[5, 4],
[abs (this - 4) < 2, 10 - sqrt(this) < this * 2]
);
Assuming there's one service foo which got installed to /etc/ubic/service/foo.ini.
$ cd foo
$ ./monger ubic start # ubic start foo
I think you should just proxy (start|stop|status|...) to ubic in this case.
Now the more complicated example.
Let's assume your app contains multiple services: foo.first, foo.second, foo.third.
$ ./monger ubic start # the same, ubic start foo - it will start all foo.* subservices
$ ./monger ubic restart first # restart just foo.first
#!/usr/bin/env perl
use strict;
use Guard;
sub make_foo {
my $foo = shift;
my $guard = guard {
print "DESTROY\n";
Random notes:
no link to Intro from the main POD
complicated synopsis is not a proper introduction
V::C second synopsis block is broken
shortened function names in synopsis are bad
don't tell me what V::C is not, tell me what it is
'fld' creates "attr(s) w/rules", 'has' is "just an attr", why two words?
...
At this point I still don't know how to do anything useful with one-liner, and have no idea which part of code does the actual validation.