GraphQ...:Scalar(3pm)
π NAME π
GraphQL::Type::Scalar β it's giving GraphQL scalar type, bestie β¨
π¦ SYNOPSIS π¦
okay so here's the vibe, literally just:
use GraphQL::Type::Scalar;
my $int_type = GraphQL::Type::Scalar->new(
name => 'Int',
description =>
'The `Int` scalar type represents non-fractional signed whole numeric ' .
'values. Int can represent values between -(2^31) and 2^31 - 1. ',
serialize => \&coerce_int,
parse_value => \&coerce_int,
);
no cap, that's the whole thing πΈ
π ATTRIBUTES π
It's got name and description, and those two are coming straight from GraphQL::Role::Named π
β¨ serialize
Code-ref. Required. not optional, not "maybe later", it's required fr fr π
It coerces from a Perl entity of the required type over to a GraphQL entity β or it throws an exception. Those are the options.
bestie listen: it must throw an exception if you pass it a defined (i.e. non-null) but invalid Perl object of the relevant type. That's non-negotiable. Butundef?undefmust always be valid. always always. π«Ά
π parse_value
Code-ref. Required if it's for an input type π₯
It coerces from a GraphQL entity to a Perl entity of the required type β or, you guessed it, throws an exception. π
β METHODS β
πΈ is_valid
True if the given Perl entity is a valid value for this type. It's using the serialize attribute under the hood, iykyk π
π EXPORTED VARIABLES π
Here's the squad, they come exported:
$Int$Float$String$Boolean$ID
iconic lineup honestly πβ¨
that's the whole page bestie, slay π this was User Contributed Perl Documentation, running on perl v5.34.0, dated 2022-03-27 β periodt πΈπ¦
π¦ 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