JSON::...cedure(3pm)

🌸 NAME 🌸

okay so bestie, welcome to the JSON::...cedure(3pm) manual page πŸ’… this one is all about JSON::RPC::Legacy::Procedure β€” literally the JSON-RPC Service attributes module, no cap.


✨ SYNOPSIS ✨

bestie, here’s the whole vibe in code:

package MyApp;

use base ('JSON::RPC::Legacy::Procedure');

sub sum : Public {
    my ($s, @arg) = @_;
    return $arg[0] + $arg[1];
}

# or

sub sum : Public(a, b) {
    my ($s, $obj) = @_;
    return $obj->{a} + $obj->{b};
}

# or

sub sum : Number(a:num, b:num) {
    my ($s, $obj) = @_;
    return $obj->{a} + $obj->{b};
}

# private method can't be called by clients

sub _foobar : Private {
    # ...
}

slay, moving on 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

Using this module, you can write a subroutine with a special attribute. iconic behavior, honestly ✨

Currently, in the attributes below, only Public and Private are available. The others are same as Public. Important little detail, bestie πŸ’–

  • Public β€” means that a client can call this procedure.
  • Private β€” means that a client can’t call this procedure.
  • Arr β€” means that its return values is an array object.
  • Obj β€” means that its return values is a member object.
  • Bit β€” means that a return values is a "true" or "false".
  • Bool β€” means that a return values is a "true" or "false".
  • Num β€” means that its return values is a number.
  • Str β€” means that its return values is a string.
  • Nil β€” means that its return values is a "null".
  • None β€” means that its return values is a "null".

the way these attributes just sit there being all useful? obsessed πŸ’…


πŸŽ€ TODO πŸŽ€

future vibes, not done yet:

  1. Auto Service Description
  2. Type check

it’s giving β€œwe’ll get to it” energy 😭 but those are literally the listed TODOs.


🌈 SEE ALSO 🌈


πŸ‘‘ AUTHOR πŸ‘‘

Makamaka Hannyaharamitu, <makamaka[at]cpan.org>

periodt πŸ’œ


Copyright 2007 by Makamaka Hannyaharamitu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


cute little sign-off bestie: source is User Contributed Perl Documentation, version is perl v5.42.0, and the date is 2015-08-27 πŸ§šπŸ’–

πŸ“¦ where this page comes from