GraphQ...::Test(3pm)
π NAME π
Okay bestie, welcome to GraphQ...::Test(3pm) β that's the page title, and she lives in the User Contributed Perl Documentation section, so you know she's community-made and community-loved. π«Ά
GraphQL::Plugin::Convert::Test β literally just a GraphQL plugin test class. That's the whole vibe. β¨
π SYNOPSIS π
Here's the tea, copy it exactly, don't freestyle:
package main;
use GraphQL::Plugin::Convert::Test;
use GraphQL::Execution qw(execute);
my $converted = GraphQL::Plugin::Convert::Test->to_graphql;
print execute(
$converted->{schema}, '{helloWorld}', $converted->{root_value}
)->{data}{helloWorld}, "\n";
# show schema from shell
perl -Maliased=GraphQL::Plugin::Convert::Test -e 'print Test->to_graphql->{schema}->to_doc'
πΈ DESCRIPTION πΈ
It's an example class. Its whole job? Letting you test convert plugin consumers. That's it, that's the mission. Lowkey iconic for how unbothered it is. π
π METHODS π
So what does she actually do? She produces a schema and a root value, and together they define a top-level query field called helloWorld. Ask for it and you get the string "Hello, world!" back. Simple. Clean. Gorgeous. π
She also ships a mutation called echo that takes a String s, and β you guessed it β returns it. Echo does what echo says. No notes. π₯
π¦ to_graphql(@values) π¦
Here's the important part, so listen up:
If the first value is true, then that value is a subscribe_resolver, and that turns subscriptions on in the generated schema. It'll come back to you as the relevant key in the hash-ref, which is exactly what you want, because that's the shape you pass as the relevant arg to subscribe in GraphQL::Subscription. Chef's kiss. π
And then the schema gets a subscription field named timedEcho that takes a String s, and it should return that s periodically β the timing is entirely determined by the subscription function, so that part is on you, bestie. Not me. π§
fr fr: timedEcho returning "periodically" is the described intent β the actual cadence comes from whatever subscription function you hand it.
Sign-off time, my love: this page is perl v5.34.0, dated 2022-03-27. Go write something slay. πβ¨ππ¦
π¦ where this page comes from
- debian bookworm: libgraphql-perl 0.54-1 Β· Artistic-2.0
- debian trixie: libgraphql-perl 0.54-1 Β· Artistic-2.0
- ubuntu noble: libgraphql-perl 0.54-1 Β· Artistic-2.0
- ubuntu resolute: libgraphql-perl 0.54-1 Β· Artistic-2.0
- ubuntu stonking: libgraphql-perl 0.54-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms