Skip to content

Instantly share code, notes, and snippets.

$ perl -wle 'sub foo (&$*) { print "@_"; } foo(sub {*STDOUT},"a", "b");'
CODE(0x2561da8) a b
$ perl -wle 'sub foo (&$*) { print "@_"; } foo {*STDOUT} "a", "b";'
CODE(0x184ed68) a b
# How do I from inside foo distinguish the calls, to treat the first param magically?
# print example:
$ perl -wle 'print sub{*STDOUT},"a", "b";'
#!/usr/bin/perl
use Data::Dumper;
my @interesting_keys = qw/a/;
my $hash_list = [ { a => 1, b => 1 }, { a => 2 } ];
my $new_hash_list = [
map {
my $dest = $_;
package Around;
use Mojo::Util qw/trim/;
use Moose;
has "trimmed" => (is => 'rw', isa => 'Str');
around "trimmed" => sub {
my ($orig, $self, $str) = @_;
#!/usr/bin/perl -l
use strict;
use warnings;
use Mojo::Util;
use Mojo::Collection;
Mojo::Util::monkey_patch('Mojo::Collection', sort_by_order => sub {
my ($self, $order, $cb) = @_;
#!/usr/bin/perl -l
use strict;
use warnings;
use Mojo::Util;
use Mojo::Collection;
Mojo::Util::monkey_patch('Mojo::Collection', sort_by_attr_order => sub {
my ($self, $attr, $order) = @_;
+++ b/lib/Startsiden/Build/Database/Schema/Ci.pm
@@ -31,7 +31,6 @@ __PACKAGE__->belongs_to('svnrepo','Startsiden::Build::Database::Schema::Svnrepo'
__PACKAGE__->belongs_to('packageinfo','Startsiden::Build::Database::Schema::Packageinfo', 'packageinfo_id',
{join_type => 'left', }
);
-__PACKAGE__->has_many('citeststatus','Startsiden::Build::Database::Schema::CiTeststatus','ci_id');
__PACKAGE__->has_many('history', 'Startsiden::Build::Database::Schema::CiHistory', 'ci_id', {
order_by => 'ts DESC',
rows => 40
@nicomen
nicomen / simple_trace.pl
Last active May 28, 2016 01:25
Some weird with that }; ?
$ cat test.pl
#!/usr/bin/perl -dl
{
use DB;
*DB::DB = sub {
my ($p, $f, $l) = caller;
print "> " . @{"::_<$f"}[$l] unless caller(1);
};
};
2016/04/12 14:24:07 [TRACE] Build.Debian.Base.bootsh.STDOUT Perl.pm:build_make 531> [12:24:07] t/aggregate/unit_core_script_run_options.t ............................ ok 871 ms
2016/04/12 14:24:07 [TRACE] Build.Debian.Base.bootsh.STDOUT Perl.pm:build_make 531> [12:24:07] t/aggregate/unit_core_script_server-without_modules.t ................. skipped: Need Test::Without::Module for this test
2016/04/12 14:24:08 [TRACE] Build.Debian.Base.bootsh.STDOUT Perl.pm:build_make 531> [12:24:08] t/aggregate/unit_core_script_server.t ................................. ok 625 ms
2016/04/12 14:24:08 [TRACE] Build.Debian.Base.bootsh.STDOUT Perl.pm:build_make 531> [12:24:08] t/aggregate/unit_core_scriptrunner.t .................................. ok 514 ms
2016/04/12 14:24:09 [DEBUG] Build.Debian.Base.bootsh.STDERR Perl.pm:build_make 531> Term::Size::Any is not installed, can't autodetect terminal column width
2016/04/12 14:24:09 [TRACE] Build.Debian.Base.bootsh.STDOUT Perl.pm:build_make 531> [12:24:09] t/aggrega
libraries $ cover -test
---------------------------- ------ ------ ------ ------ ------ ------ ------
File stmt bran cond sub pod time total
---------------------------- ------ ------ ------ ------ ------ ------ ------
RG/BasePackage.pm 83.1 70.4 67.4 94.7 91.6 4.8 78.8
RG/CDN.pm 92.0 59.7 37.5 100.0 70.0 21.9 78.2
RG/Charter/Index.pm 13.6 0.0 0.0 35.7 85.7 0.0 12.8
RG/Charter/Search.pm 75.6 52.3 56.7 88.5 100.0 0.4 67.7
RG/Config.pm 35.7 17.7 28.5 52.9 100.0 0.0 34.2
RG/Content/Wordpress.pm 78.9 n/a 22.2 73.3 100.0 0.0 72.8
nicolasm@tipsy:/projects/Reisegiganten $ cloc libraries backend --by-file
523 text files.
476 unique files.
7534 files ignored.
http://cloc.sourceforge.net v 1.60 T=1.30 s (267.0 files/s, 58196.2 lines/s)
------------------------------------------------------------------------------------------------------------------------------
File blank comment code
------------------------------------------------------------------------------------------------------------------------------
libraries/t/Supplier/API/apollo_hotel_test_data_hotel-id_328870.xml 6 0 1847