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::Atom(3) User Contributed Perl Documentation Venus::Atom(3)

Venus::Atom - Atom Class

Atom Class for Perl 5

  package main;
  use Venus::Atom;
  my $atom = Venus::Atom->new;
  # $atom->get;
  # undef

This package provides a write-once object representing a constant value.

This package inherits behaviors from:

Venus::Sealed

This package provides the following methods:

  get() (any)

The get method can be used to get the underlying constant value set during instantiation.

Since 3.55

get example 1
  # given: synopsis
  package main;
  my $get = $atom->get;
  # undef
    
get example 2
  # given: synopsis
  package main;
  $atom->set("hello");
  my $get = $atom->get;
  # "hello"
    

  set(any $data) (any)

The set method can be used to set the underlying constant value set during instantiation or via this method. An atom can only be set once, either at instantiation of via this method. Any attempt to re-set the atom will result in an error.

Since 3.55

set example 1
  # given: synopsis
  package main;
  my $set = $atom->set("hello");
  # "hello"
    
set example 2
  # given: synopsis
  package main;
  my $set = $atom->set("hello");
  $atom->set("hello");
  # Exception! (isa Venus::Atom::Error) (see error_on_set)
    

This package may raise the following errors:

This package may raise an error_on_set exception.

example 1

  # given: synopsis;
  my $input = {
    throw => 'error_on_set',
    value => 'test',
  };
  my $error = $atom->catch('error', $input);
  # my $name = $error->name;
  # "on_set"
  # my $message = $error->render;
  # "Can't re-set atom value to \"test\""
  # my $value = $error->stash('value');
  # "test"
    

This package overloads the following operators:

This package overloads the "" operator.

example 1

  # given: synopsis;
  my $result = "$atom";
  # ""
    

example 2

  # given: synopsis;
  $atom->set("hello");
  my $result = "$atom";
  # "hello"
    
This package overloads the "eq" operator.

example 1

  # given: synopsis;
  my $result = $atom eq "";
  # 1
    

example 2

  # given: synopsis;
  $atom->set("hello");
  my $result = $atom eq "hello";
  # 1
    
This package overloads the "ne" operator.

example 1

  # given: synopsis;
  my $result = $atom ne "";
  # 0
    

example 2

  # given: synopsis;
  $atom->set("hello");
  my $result = $atom ne "";
  # 1
    
This package overloads the "qr" operator.

example 1

  # given: synopsis;
  my $test = 'hello' =~ qr/$atom/;
  # 1
    

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.