GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Venus::Role::Accessible(3) User Contributed Perl Documentation Venus::Role::Accessible(3)

Venus::Role::Accessible - Accessible Role

Accessible Role for Perl 5

  package Example;
  use Venus::Class;
  with 'Venus::Role::Accessible';
  attr 'value';
  sub downcase {
    lc $_[0]->value
  }
  sub upcase {
    uc $_[0]->value
  }
  package main;
  my $example = Example->new(value => 'hello, there');
  # $example->value;

This package modifies the consuming package and provides the "access" method for getting and setting attributes.

This package provides the following methods:

  access(string $name, any $value) (any)

The access method gets or sets the class attribute specified.

Since 1.23

access example 1
  # given: synopsis
  package main;
  my $access = $example->access;
  # undef
    
access example 2
  # given: synopsis
  package main;
  my $access = $example->access('value');
  # "hello, there"
    
access example 3
  # given: synopsis
  package main;
  my $access = $example->access('value', 'something');
  # "something"
    
access example 4
  # given: synopsis
  package main;
  my $instance = $example;
  # bless({}, "Example")
  $example->access('value', 'something');
  # "something"
  $instance = $example;
  # bless({value => "something"}, "Example")
    

  assign(string $name, string | coderef $code, any @args) (any)

The assign method dispatches the method call or executes the callback, sets the class attribute specified to the result, and returns the result.

Since 1.23

assign example 1
  # given: synopsis
  package main;
  my $assign = $example->assign('value', 'downcase');
  # "hello, there"
    
assign example 2
  # given: synopsis
  package main;
  my $assign = $example->assign('value', 'upcase');
  # "HELLO, THERE"
    
assign example 3
  # given: synopsis
  package main;
  my $instance = $example;
  # bless({value => "hello, there"}, "Example")
  my $assign = $example->assign('value', 'downcase');
  # "hello, there"
  $instance = $example;
  # bless({value => "hello, there"}, "Example")
    

Awncorp, "awncorp@cpan.org"

Copyright (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.

2023-11-27 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.