NAME
Data::InfoBox::Item - Data object for info box item.
SYNOPSIS
use Data::InfoBox;
my $obj = Data::InfoBox::Item->new(%params);
my $icon_url = $obj->icon_url;
my $icon_char = $obj->icon_char;
my $text = $obj->text;
my $uri = $obj->uri;
METHODS
new
my $obj = Data::InfoBox->new(%params);
Constructor.
icon_url
Icon URL.
It's optional.
icon_char
Icon character. Could be UTF-8 character. Only one character.
It's optional.
text
Item text. Must me a Data::Text::Simple object.
It's required.
uri
URI of item.
It's optional.
Returns instance of object.
icon_url
my $icon_url = $obj->icon_url;
Get icon URL.
Returns string.
icon_char
my $icon_char = $obj->icon_char;
Get icon character.
Returns string.
text
my $text = $obj->text;
Get text of item.
Returns Data::Text::Simple object.
uri
my $uri = $obj->uri;
Get URI of item.
Returns string.
ERRORS
new():
From Mo::utils:
Parameter 'icon_char' has length greater than '1'.
Value: %s
Parameter 'text' is required.
Parameter 'text' must be a 'Data::Text::Simple' object.
Value: %s
Reference: %s
From Mo::utils::URI::check_location():
Parameter 'icon_url' doesn't contain valid location.
Value: %s
From Mo::utils::URI::check_uri():
Parameter 'uri' doesn't contain valid URI.
Value: %s
EXAMPLE
use strict;
use warnings;
use Data::InfoBox::Item;
use Data::Text::Simple;
my $obj = Data::InfoBox::Item->new(
'icon_url' => 'https://example.com/foo.png',
'text' => Data::Text::Simple->new(
'text' => 'Funny item'
),
'uri' => 'https://skim.cz',
);
# Print out.
print "Icon URL: ".$obj->icon_url."\n";
print "Text: ".$obj->text->text."\n";
print "URI: ".$obj->uri."\n";
# Output:
# Icon URL: https://example.com/foo.png
# Text: Funny item
# URI: https://skim.cz
DEPENDENCIES
Mo, Mo::utils, Mo::utils::URI.
SEE ALSO
- Data::InfoBox
-
Data object for info box.
-
Street info box fixture.
REPOSITORY
https://github.com/michal-josef-spacek/Data-InfoBox
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2024 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.02