|
NAMEVenus::Prototype - Prototype Class ABSTRACTPrototype Class for Perl 5 SYNOPSIS package main;
use Venus::Prototype;
my $prototype = Venus::Prototype->new(
'$counter' => 0,
'&decrement' => sub { $_[0]->counter($_[0]->counter - 1) },
'&increment' => sub { $_[0]->counter($_[0]->counter + 1) },
);
# bless({value => {...}}, 'Venus::Prototype')
# $prototype->counter # 0
# $prototype->increment # 1
# $prototype->counter # 1
# $prototype->decrement # 0
# $prototype->counter # 0
DESCRIPTIONThis package provides a simple construct for enabling prototype-base programming. Properties can be called as methods when prefixed with a dollar or ampersand symbol. See "call" for more details. INHERITSThis package inherits behaviors from: Venus::Kind::Utility INTEGRATESThis package integrates behaviors from: Venus::Role::Buildable Venus::Role::Proxyable Venus::Role::Valuable METHODSThis package provides the following methods: applyapply(hashref $data) (Venus::Prototype) The apply method extends the underlying data structure by merging the data provided, and then returns the invocant. Since 1.50
callcall(string $method, any @args) (any) The call method dispatches method calls based on the method name provided and the state of the object, and returns the results. If the method name provided matches an object property of the same name with an ampersand prefix, denoting a method, then the dispatched method call acts as a method call providing the invocant as the first argument. If the method name provided matches an object property of the same name with a dollar sign prefix, denoting an attribute, then the dispatched method call acts as an attribute accessor call. This method is also useful for calling virtual methods when those virtual methods conflict with the Venus::Prototype methods. Since 1.50
extendextend(hashref $data) (Venus::Prototype) The extend method copies the underlying data structure, merging the data provided if any, and then returns a new prototype object. Since 1.50
AUTHORSAwncorp, "awncorp@cpan.org" LICENSECopyright (C) 2022, Awncorp, "awncorp@cpan.org". This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.
|