NAME

Venus::Name - Name Class

ABSTRACT

Name Class for Perl 5

SYNOPSIS

package main;

use Venus::Name;

my $name = Venus::Name->new('Foo/Bar');

# $name->package;

DESCRIPTION

This package provides methods for parsing and formatting package namespace strings.

INHERITS

This package inherits behaviors from:

Venus::Kind::Utility

INTEGRATES

This package integrates behaviors from:

Venus::Role::Accessible

Venus::Role::Explainable

METHODS

This package provides the following methods:

default

default() (Str)

The default method returns the default value, i.e. 'Venus'.

Since 0.01

default example 1
# given: synopsis;

my $default = $name->default;

# "Venus"

dist

dist() (Str)

The dist method returns a package distribution representation of the name.

Since 0.01

dist example 1
# given: synopsis;

my $dist = $name->dist;

# "Foo-Bar"

explain

explain() (Str)

The explain method returns the package name and is used in stringification operations.

Since 0.01

explain example 1
# given: synopsis;

my $explain = $name->explain;

# "Foo/Bar"

file

file() (Str)

The file method returns a file representation of the name.

Since 0.01

file example 1
# given: synopsis;

my $file = $name->file;

# "foo__bar"

format

format(Str $method, Str $format) (Str)

The format method calls the specified method passing the result to the core "sprintf" function with itself as an argument. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method.

Since 0.01

format example 1
# given: synopsis;

my $format = $name->format('file', '%s.t');

# "foo__bar.t"

label

label() (Str)

The label method returns a label (or constant) representation of the name.

Since 0.01

label example 1
# given: synopsis;

my $label = $name->label;

# "Foo_Bar"

lookslike_a_file

lookslike_a_file() (Str)

The lookslike_a_file method returns truthy if its state resembles a filename.

Since 0.01

lookslike_a_file example 1
# given: synopsis;

my $lookslike_a_file = $name->lookslike_a_file;

# ""

lookslike_a_label

lookslike_a_label() (Str)

The lookslike_a_label method returns truthy if its state resembles a label (or constant).

Since 0.01

lookslike_a_label example 1
# given: synopsis;

my $lookslike_a_label = $name->lookslike_a_label;

# ""

lookslike_a_package

lookslike_a_package() (Str)

The lookslike_a_package method returns truthy if its state resembles a package name.

Since 0.01

lookslike_a_package example 1
# given: synopsis;

my $lookslike_a_package = $name->lookslike_a_package;

# ""

lookslike_a_path

lookslike_a_path() (Str)

The lookslike_a_path method returns truthy if its state resembles a file path.

Since 0.01

lookslike_a_path example 1
# given: synopsis;

my $lookslike_a_path = $name->lookslike_a_path;

# 1

lookslike_a_pragma

lookslike_a_pragma() (Str)

The lookslike_a_pragma method returns truthy if its state resembles a pragma.

Since 0.01

lookslike_a_pragma example 1
# given: synopsis;

my $lookslike_a_pragma = $name->lookslike_a_pragma;

# ""

package

package() (Str)

The package method returns a package name representation of the name given.

Since 0.01

package example 1
# given: synopsis;

my $package = $name->package;

# "Foo::Bar"

path

path() (Str)

The path method returns a path representation of the name.

Since 0.01

path example 1
# given: synopsis;

my $path = $name->path;

# "Foo/Bar"

OPERATORS

This package overloads the following operators:

operation: (.)

This package overloads the . operator.

example 1

# given: synopsis;

my $package = $name . 'Baz';

# "Foo::BarBaz"
operation: (eq)

This package overloads the eq operator.

example 1

# given: synopsis;

$name eq 'Foo/Bar';

# 1

example 2

package main;

use Venus::Name;

my $name1 = Venus::Name->new('Foo\Bar');
my $name2 = Venus::Name->new('Foo\Bar');

$name1 eq $name2;

# 1
operation: (ne)

This package overloads the ne operator.

example 1

# given: synopsis;

$name ne 'Foo\Bar';

# 1

example 2

package main;

use Venus::Name;

my $name1 = Venus::Name->new('FooBar');
my $name2 = Venus::Name->new('Foo_Bar');

$name1 ne $name2;

# 1
operation: (qr)

This package overloads the qr operator.

example 1

# given: synopsis;

"Foo/Bar" =~ qr/$name/;

# 1

AUTHORS

Cpanery, cpanery@cpan.org

LICENSE

Copyright (C) 2021, Cpanery

Read the "license" file.