From 7a9e68a1089e2d7a015b1a856018520facbe7c30 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Tue, 31 Oct 2023 16:29:48 -0400 Subject: [PATCH 1/2] hush the warning --- t/registry.t | 1 + 1 file changed, 1 insertion(+) diff --git a/t/registry.t b/t/registry.t index dd14fb3..e5277c9 100644 --- a/t/registry.t +++ b/t/registry.t @@ -11,6 +11,7 @@ $registry->add_type( id => 'id', links => { self => sub ( $data, @ ) { + no warnings qw/ uninitialized /; return "/peoples/$data->{id}"; } } } ); From 6debdda4121acbb7ba2765a163ba96d45f17dd35 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Tue, 31 Oct 2023 16:30:01 -0400 Subject: [PATCH 2/2] add example for top links --- t/example.t | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/t/example.t b/t/example.t index 890c4da..6ea4b4b 100644 --- a/t/example.t +++ b/t/example.t @@ -58,6 +58,14 @@ $registry->add_type( count => $xtra->{count}, total => 0+ @$data, } + }, + top_level_links => { + self => '/articles', + }, + links => { + self => sub($data,@) { + return "/articles/" . $data->{id}; + }, } } ); @@ -72,6 +80,9 @@ like $output => { "count"=> 2, "total"=> 1 }, + "links"=> { + "self"=> "/articles" + }, }; done_testing();