Image::Randim::Source - Pull a random image from a source


  use Image::Randim::Source;
  $source = Image::Randim::Source->new;
  $image = $source->get_image;

  say $image->url;


This is the main class to instantiate when wanting to pull random image information from the defined sources.

You can specifically state which source to use to pull a random image from by using the set_provider() method, or you can also let the provider be a random choice too by calling the method set_random_provider() instead.

Nothing much will work until you call one of those two methods, except for list(), which returns a list of defined sources (providers of images).



Return a list of supported providers (ones with "plugins").


Sets the provider name to use, to grab a random image. Valid ones can be found with the list() method.

"Plugins" can be created to support more providers by implementing the Image::Randim::Source::Role

set_random_provider(['name1', 'name2'])

Without any parameters, chooses a random provider from the list() of possible providers and set_provider()'s to it.

An array ref - a list of source providers names - can be provided if you want to limit the random choice to just those providers.


Returns the URL from which the provider information is gathered. You probably don't need to care about this.


Returns the provider name (as it was set by set_provider())


Returns an Image::Randim::Image object, populated with the necessary information to download the image, and image credits for the owner of the image, as well as reported dimensions of the image.



Gets or sets the timeout in seconds we will wait for a response from the provider's server for the information. If you want something different than the default (25 seconds) you must set this attribute before calling the set_* methods.


Gives access to the provider "plugin" object directly. Not typically needed.


Mark Rushing <>


This software is copyright (c) 2017 by Home Grown Systems, SPC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.