Mojo::Snoo v0.10 - "Snoo" Explained

Hi everyone,

I recently attended Miniconf in New York at which I decided to host a hackathon for my current hobby project, Mojo::Snoo - a Mojo wrapper for the reddit API.

Some hackathon attendees were nice enough to contribute code and give me some great ideas for future development. So, I’d like to briefly mention some changes introduced in the v0.10 release.

Firstly, let’s get one thing out of the way:

What the #$%! is Snoo?

Snoo is the name of reddit’s alien mascot. You know, the white alien at the top of


Not to be confused with “snu-snu” from Futurama.

death by Snu Snu.jpg

According to reddit’s most recent license changes, reddit API wrappers cannot contain the word “reddit”.

Thus, Mojo::Snoo was born.

New features and changes

Moving on - I’d like to summarize some changes made recently and share some quick examples:

  • ojo::Snoo

Firstly, I’d like to go ahead and mention the one-liner package, ojo::Snoo. ojo::Snoo was inspired by ojo, the Mojolicious one-liner module. This lets the user create quick one-liners via shortcut functions. Technically, these shortcut functions could accept OAuth details, but ojo::Snoo is intended to be used for non-auth reddit endpoints.

Quick example (see docs for more):

# print title of the first 5 “hot” submissions from /r/perl subreddit perl -Mojo::Snoo -E ‘sr(“perl”)->links(5)->each(sub { $_->title })’

In the example shown above, the function sr() is a shortcut to creating a Mojo::Snoo::Subreddit object.

Other shortcut functions include:
mr() -> Mojo::Snoo::Multireddit->new()
c() -> Mojo::Snoo::Comment->new()
l() -> Mojo::Snoo::Link->new()
u() -> Mojo::Snoo::User->new()

  • Redesign the Mojo::Snoo::Thing class

Before I explain this change, one must understand that reddit officially refers to certain entities within its site as “things”. For example, subreddits and comments are both classified as “things”. Subreddits have a type prefix of “t5”, while comments have “t1”. You can see all reddit “things” and more details here:

One mistake I made originally was assuming subreddit link submissions were the *only* "thing" type.

So, in short, I’ve renamed Mojo::Snoo::Thing as Mojo::Snoo::Link, and Hunter McMillen contributed some initial work to revive Mojo::Snoo::Thing as a generic interface to creating “thing” objects.


# create new Mojo::Snoo::Link object from specific link ID Mojo::Snoo::Link->new(‘391jsz’);

# do the same with the thing’s fullname via Mojo::Snoo::Thing

  • Mojo::Snoo now requires Mojolicious v5.73

After a few releases, I quickly learned there have been some major changes to the monkey_patch function in Mojo::Util. Also, this function did not even exist at one point, which I think was the major point of failure. This change should help assure that more tests are passing.

What now?

write more tests
support more endpoints
improve documentation and examples

What’s the point?

Besides being a reddit API wrapper, I want Mojo::Snoo to be an attractive alternative to the Python reddit wrapper, PRAW. There are a *lot* of people on reddit wanting to learn how to write their own bots (see /r/redditdev), and most are guided towards PRAW. Furthermore, the Mojolicious suite is fast and its syntax is sexy.

Leave a comment

About curtis