Venus::Name - Name Class
Name Class for Perl 5
package main; use Venus::Name; my $name = Venus::Name->new('Foo/Bar'); # $name->package;
This package provides methods for parsing and formatting package namespace strings.
This package inherits behaviors from:
Venus::Kind::Utility
This package integrates behaviors from:
Venus::Role::Accessible
Venus::Role::Buildable
Venus::Role::Explainable
Venus::Role::Valuable
This package provides the following methods:
default() (Str)
The default method returns the default value, i.e. 'Venus'.
'Venus'
Since 0.01
0.01
# given: synopsis; my $default = $name->default; # "Venus"
dist() (Str)
The dist method returns a package distribution representation of the name.
# given: synopsis; my $dist = $name->dist; # "Foo-Bar"
explain() (Str)
The explain method returns the package name and is used in stringification operations.
# given: synopsis; my $explain = $name->explain; # "Foo/Bar"
file() (Str)
The file method returns a file representation of the name.
# given: synopsis; my $file = $name->file; # "foo__bar"
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.
# given: synopsis; my $format = $name->format('file', '%s.t'); # "foo__bar.t"
label() (Str)
The label method returns a label (or constant) representation of the name.
# given: synopsis; my $label = $name->label; # "Foo_Bar"
lookslike_a_file() (Str)
The lookslike_a_file method returns truthy if its state resembles a filename.
# given: synopsis; my $lookslike_a_file = $name->lookslike_a_file; # ""
lookslike_a_label() (Str)
The lookslike_a_label method returns truthy if its state resembles a label (or constant).
# given: synopsis; my $lookslike_a_label = $name->lookslike_a_label; # ""
lookslike_a_package() (Str)
The lookslike_a_package method returns truthy if its state resembles a package name.
# given: synopsis; my $lookslike_a_package = $name->lookslike_a_package; # ""
lookslike_a_path() (Str)
The lookslike_a_path method returns truthy if its state resembles a file path.
# given: synopsis; my $lookslike_a_path = $name->lookslike_a_path; # 1
lookslike_a_pragma() (Str)
The lookslike_a_pragma method returns truthy if its state resembles a pragma.
# given: synopsis; my $lookslike_a_pragma = $name->lookslike_a_pragma; # ""
package() (Str)
The package method returns a package name representation of the name given.
# given: synopsis; my $package = $name->package; # "Foo::Bar"
path() (Str)
The path method returns a path representation of the name.
# given: synopsis; my $path = $name->path; # "Foo/Bar"
This package overloads the following operators:
(.)
This package overloads the . operator.
.
example 1
# given: synopsis; my $package = $name . 'Baz'; # "Foo::BarBaz"
(eq)
This package overloads the eq operator.
eq
# 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
(ne)
This package overloads the ne operator.
ne
# given: synopsis; $name ne 'Foo\Bar'; # 1
package main; use Venus::Name; my $name1 = Venus::Name->new('FooBar'); my $name2 = Venus::Name->new('Foo_Bar'); $name1 ne $name2; # 1
(qr)
This package overloads the qr operator.
qr
# given: synopsis; "Foo/Bar" =~ qr/$name/; # 1
("")
This package overloads the "" operator.
""
# given: synopsis; my $result = "$name"; # "Foo/Bar"
# given: synopsis; my $result = "$name, $name"; # "Foo/Bar, Foo/Bar"
(~~)
This package overloads the ~~ operator.
~~
# given: synopsis; my $result = $name ~~ 'Foo/Bar'; # 1
To install Venus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Venus
CPAN shell
perl -MCPAN -e shell install Venus
For more information on module installation, please visit the detailed CPAN module installation guide.