Data::Image - Data object for image.
use Data::Image; my $obj = Data::Image->new(%params); my $author = $obj->author; my $comment = $obj->comment; my $dt_created = $obj->dt_created; my $height = $obj->height; my $id = $obj->id; my $size = $obj->size; my $url = $obj->url; my $url_cb = $obj->url_cb; my $width = $obj->width;
new
my $obj = Data::Image->new(%params);
Constructor.
Returns instance of object.
author
Image author. It's optional. Default value is undef.
comment
Image comment. It's optional. Default value is undef.
dt_created
Date and time the image was created. Value must be DateTime object. It's optional.
height
Image height. It's optional. Default value is undef.
id
Image id. It's optional. Default value is undef.
size
Image size. It's optional. Default value is undef.
url
URL of image. It's optional. Default value is undef.
url_cb
URL callback. To get URL from code. It's optional. Default value is undef.
width
Image width. It's optional. Default value is undef.
my $author = $obj->author;
Get image author.
Returns string.
my $comment = $obj->comment;
Get image comment.
my $dt_created = $obj->dt_created;
Get date and time the image was created.
Returns DateTime object.
my $height = $obj->height;
Get image height.
Returns number.
my $id = $obj->id;
Get image id.
my $size = $obj->size;
Get image size.
my $url = $obj->url;
Get URL of image.
my $url_cb = $obj->url_cb;
Get URL callback.
Returns code.
my $width = $obj->width;
Get image width.
new(): From Mo::utils: Parameter 'author' has length greater than '255'. Value: %s Parameter 'comment' has length greater than '1000'. Value: %s Parameter 'dt_created' must be a 'DateTime' object. Value: %s Reference: %s Parameter 'height' must a number. Value: %s Parameter 'id' must a number. Value: %s Parameter 'size' must a number. Value: %s Parameter 'url' has length greater than '255'. Value: %s Parameter 'url_cb' must be a code. Value: %s Parameter 'width' must a number. Value: %s
use strict; use warnings; use Data::Image; use DateTime; my $obj = Data::Image->new( 'author' => 'Zuzana Zonova', 'comment' => 'Michal from Czechia', 'dt_created' => DateTime->new( 'day' => 1, 'month' => 1, 'year' => 2022, ), 'height' => 2730, 'size' => 1040304, 'url' => 'https://upload.wikimedia.org/wikipedia/commons/a/a4/Michal_from_Czechia.jpg', 'width' => 4096, ); # Print out. print 'Author: '.$obj->author."\n"; print 'Comment: '.$obj->comment."\n"; print 'Height: '.$obj->height."\n"; print 'Size: '.$obj->size."\n"; print 'URL: '.$obj->url."\n"; print 'Width: '.$obj->width."\n"; print 'Date and time the image was created: '.$obj->dt_created."\n"; # Output: # Author: Zuzana Zonova # Comment: Michal from Czechia # Height: 2730 # Size: 1040304 # URL: https://upload.wikimedia.org/wikipedia/commons/a/a4/Michal_from_Czechia.jpg # Width: 4096 # Date and time the photo was created: 2022-01-01T00:00:00
Mo, Mo::utils.
Data object for Wikimedia Commons image.
https://github.com/michal-josef-spacek/Data-Image
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2022-2023 Michal Josef Špaček
BSD 2-Clause License
0.03
To install Data::Image, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Image
CPAN shell
perl -MCPAN -e shell install Data::Image
For more information on module installation, please visit the detailed CPAN module installation guide.