Skip to content

Instantly share code, notes, and snippets.

@jeff

jeff/output.txt Secret

Created Apr 7, 2021
Embed
What would you like to do?
$ perlbrew exec ./test-with-nonempty-array.pl
perl-5.32.1
==========
SV = PVAV(0x55d60e94bec0) at 0x55d60eac5b50
REFCNT = 1
FLAGS = ()
ARRAY = 0x55d60e95f2d0
FILL = 1
MAX = 3
FLAGS = (REAL)
Elt No. 0
SV = IV(0x55d60e94a4f8) at 0x55d60e94a508
REFCNT = 1
FLAGS = (ROK)
RV = 0x55d60e94a358
SV = PVHV(0x55d60e94fb70) at 0x55d60e94a358
REFCNT = 2
FLAGS = (SHAREKEYS)
ARRAY = 0x55d60ea01110 (0:6, 1:1, 2:1)
hash quality = 90.0%
KEYS = 3
FILL = 2
MAX = 7
Elt "pickup_lib" HASH = 0xfad1ceb8
SV = PVIV(0x55d60e96ca00) at 0x55d60e94a6b8
REFCNT = 1
FLAGS = (IOK,POK,pIOK,pPOK)
IV = 23
PV = 0x55d60e95f030 "23"\0
CUR = 2
LEN = 10
Elt "current_shelf_lib" HASH = 0x28439165
SV = PVIV(0x55d60e96ca18) at 0x55d60e94a610
REFCNT = 1
FLAGS = (IOK,POK,pIOK,pPOK)
IV = 23
PV = 0x55d60eaca260 "23"\0
CUR = 2
LEN = 10
Elt No. 1
SV = IV(0x55d60e963ad8) at 0x55d60e963ae8
REFCNT = 1
FLAGS = (ROK)
RV = 0x55d60e963ab8
SV = PVHV(0x55d60e94fbf0) at 0x55d60e963ab8
REFCNT = 2
FLAGS = (SHAREKEYS)
ARRAY = 0x55d60e978630 (0:6, 1:1, 2:1)
hash quality = 90.0%
KEYS = 3
FILL = 2
MAX = 7
Elt "pickup_lib" HASH = 0xfad1ceb8
SV = PVIV(0x55d60e96ca30) at 0x55d60e963b78
REFCNT = 1
FLAGS = (IOK,POK,pIOK,pPOK)
IV = 23
PV = 0x55d60e974870 "23"\0
CUR = 2
LEN = 10
Elt "behind_desk" HASH = 0x2eb266d5
SV = PV(0x55d60e94ad90) at 0x55d60e963b90
REFCNT = 1
FLAGS = (POK,IsCOW,pPOK)
PV = 0x55d60ea31180 "false"\0
CUR = 5
LEN = 10
COW_REFCNT = 1
SV = IV(0x55d60ead4fd0) at 0x55d60ead4fe0
REFCNT = 1
FLAGS = (ROK)
RV = 0x55d60ea9c3a0
SV = PVHV(0x55d60e950790) at 0x55d60ea9c3a0
REFCNT = 1
FLAGS = (SHAREKEYS)
ARRAY = 0x55d60e9cbef0 (0:7, 3:1)
hash quality = 50.0%
KEYS = 3
FILL = 1
MAX = 7
Elt "ready" HASH = 0x568ee0f7
SV = IV(0x55d60ea3f220) at 0x55d60ea3f230
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 2
Elt "foo" HASH = 0x4951a25f
SV = PVNV(0x55d60e949110) at 0x55d60ea935e8
REFCNT = 1
FLAGS = (IOK,NOK,POK,pIOK,pNOK,pPOK)
IV = 0
NV = 0
PV = 0x55d60eacb350 "0"\0
CUR = 1
LEN = 10
Elt "total" HASH = 0x3d2ca387
SV = IV(0x55d60e9eaa90) at 0x55d60e9eaaa0
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 2
{"ready":2,"foo":"0","total":2}
perl-5.28.3
==========
SV = PVAV(0x559884793e98) at 0x55988485b100
REFCNT = 1
FLAGS = ()
ARRAY = 0x5598847a72e0
FILL = 1
MAX = 3
FLAGS = (REAL)
Elt No. 0
SV = IV(0x5598847924b0) at 0x5598847924c0
REFCNT = 1
FLAGS = (ROK)
RV = 0x559884792328
SV = PVHV(0x559884798770) at 0x559884792328
REFCNT = 2
FLAGS = (SHAREKEYS)
ARRAY = 0x55988484bbd0 (0:6, 1:1, 2:1)
hash quality = 90.0%
KEYS = 3
FILL = 2
MAX = 7
Elt "current_shelf_lib" HASH = 0x222cd5f8
SV = PVIV(0x5598847b2ac8) at 0x5598847ac070
REFCNT = 1
FLAGS = (IOK,POK,pIOK,pPOK)
IV = 23
PV = 0x55988493d180 "23"\0
CUR = 2
LEN = 10
Elt "pickup_lib" HASH = 0x9f7def68
SV = PVIV(0x5598847b2ab0) at 0x5598847ac088
REFCNT = 1
FLAGS = (IOK,POK,pIOK,pPOK)
IV = 23
PV = 0x5598847c0040 "23"\0
CUR = 2
LEN = 10
Elt No. 1
SV = IV(0x5598847ac138) at 0x5598847ac148
REFCNT = 1
FLAGS = (ROK)
RV = 0x5598847ac0a0
SV = PVHV(0x5598847987f0) at 0x5598847ac0a0
REFCNT = 2
FLAGS = (SHAREKEYS)
ARRAY = 0x559884867960 (0:6, 1:1, 2:1)
hash quality = 90.0%
KEYS = 3
FILL = 2
MAX = 7
Elt "current_shelf_lib" HASH = 0x222cd5f8
SV = PVIV(0x5598847b2af8) at 0x5598847ac160
REFCNT = 1
FLAGS = (IOK,POK,pIOK,pPOK)
IV = 23
PV = 0x5598849540d0 "23"\0
CUR = 2
LEN = 10
Elt "pickup_lib" HASH = 0x9f7def68
SV = PVIV(0x5598847b2ae0) at 0x5598847ac1f0
REFCNT = 1
FLAGS = (IOK,POK,pIOK,pPOK)
IV = 23
PV = 0x5598848e4db0 "23"\0
CUR = 2
LEN = 10
SV = IV(0x5598848d5d20) at 0x5598848d5d30
REFCNT = 1
FLAGS = (ROK)
RV = 0x5598847cb710
SV = PVHV(0x559884799390) at 0x5598847cb710
REFCNT = 1
FLAGS = (SHAREKEYS)
ARRAY = 0x5598847b9380 (0:6, 1:1, 2:1)
hash quality = 90.0%
KEYS = 3
FILL = 2
MAX = 7
Elt "ready" HASH = 0xec6a2b98
SV = IV(0x559884935f50) at 0x559884935f60
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 2
Elt "foo" HASH = 0x158a96d0
SV = PVNV(0x559884791110) at 0x559884936458
REFCNT = 1
FLAGS = (IOK,NOK,POK,pIOK,pNOK,pPOK)
IV = 0
NV = 0
PV = 0x559884933700 "0"\0
CUR = 1
LEN = 10
Elt "total" HASH = 0xb6f00083
SV = IV(0x55988493c5e8) at 0x55988493c5f8
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 2
{"ready":2,"foo":"0","total":2}
perl-5.26.3
==========
SV = PVAV(0x563d70b71e98) at 0x563d70c283d0
REFCNT = 1
FLAGS = ()
ARRAY = 0x563d70b7e180
FILL = 1
MAX = 3
FLAGS = (REAL)
Elt No. 0
SV = IV(0x563d70b70318) at 0x563d70b70328
REFCNT = 1
FLAGS = (ROK)
RV = 0x563d70b70190
SV = PVHV(0x563d70b76d60) at 0x563d70b70190
REFCNT = 2
FLAGS = (SHAREKEYS)
ARRAY = 0x563d70cecf90 (0:5, 1:3)
hash quality = 150.0%
KEYS = 3
FILL = 3
MAX = 7
Elt "pickup_lib" HASH = 0x8dec4a72
SV = PVIV(0x563d70b89750) at 0x563d70b84530
REFCNT = 1
FLAGS = (IOK,POK,pIOK,pPOK)
IV = 23
PV = 0x563d70cd2f00 "23"\0
CUR = 2
LEN = 10
Elt "behind_desk" HASH = 0x7ad97bdc
SV = PV(0x563d70b70d70) at 0x563d70b84560
REFCNT = 1
FLAGS = (POK,IsCOW,pPOK)
PV = 0x563d70ba98d0 "false"\0
CUR = 5
LEN = 10
COW_REFCNT = 1
Elt No. 1
SV = IV(0x563d70b845e0) at 0x563d70b845f0
REFCNT = 1
FLAGS = (ROK)
RV = 0x563d70b84548
SV = PVHV(0x563d70b76de0) at 0x563d70b84548
REFCNT = 2
FLAGS = (SHAREKEYS)
ARRAY = 0x563d70cf3000 (0:5, 1:3)
hash quality = 150.0%
KEYS = 3
FILL = 3
MAX = 7
Elt "pickup_lib" HASH = 0x8dec4a72
SV = PVIV(0x563d70b89780) at 0x563d70b84698
REFCNT = 1
FLAGS = (IOK,POK,pIOK,pPOK)
IV = 23
PV = 0x563d70b77e30 "23"\0
CUR = 2
LEN = 10
Elt "behind_desk" HASH = 0x7ad97bdc
SV = PV(0x563d70b70df0) at 0x563d70b846b0
REFCNT = 1
FLAGS = (POK,IsCOW,pPOK)
PV = 0x563d70c223c0 "false"\0
CUR = 5
LEN = 10
COW_REFCNT = 1
SV = IV(0x563d70cedfa8) at 0x563d70cedfb8
REFCNT = 1
FLAGS = (ROK)
RV = 0x563d70cc0ea0
SV = PVHV(0x563d70b77980) at 0x563d70cc0ea0
REFCNT = 1
FLAGS = (SHAREKEYS)
ARRAY = 0x563d70ba98f0 (0:6, 1:1, 2:1)
hash quality = 90.0%
KEYS = 3
FILL = 2
MAX = 7
Elt "total" HASH = 0xc4e30101
SV = IV(0x563d70c81c58) at 0x563d70c81c68
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 2
Elt "ready" HASH = 0x7587f6d5
SV = IV(0x563d70ca22c8) at 0x563d70ca22d8
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 2
Elt "foo" HASH = 0x24022fd5
SV = IV(0x563d70c8bf38) at 0x563d70c8bf48
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 0
{"total":2,"ready":2,"foo":0}
#!/usr/bin/env perl
use strict;
use warnings;
use Devel::Peek;
use Data::Dumper;
use JSON::XS;
my $holds = [
{'current_shelf_lib' => 23, 'pickup_lib' => 23, 'behind_desk' => 'false'},
{'current_shelf_lib' => 23, 'pickup_lib' => 23, 'behind_desk' => 'false'}
];
my @ready = grep {
$_->{current_shelf_lib} and $_->{pickup_lib} eq $_->{current_shelf_lib}
} @$holds;
Dump(@ready);
my @bar = ();
my $resp = {
total => scalar(@$holds),
ready => scalar(@ready),
foo => scalar(@bar)
};
Dump($resp);
print encode_json($resp), "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment