StatusCafe.pm/README.md

1.2 KiB

StatusCafe.pm

Perl module to fetch content directly from status.cafe

I wanted to create a custom widget on my Mojolicious site listing off my status from status.cafe, so I wrote this module to fetch the info by directly scraping the given user's page. There's not really any reason I did that over Atom feed parsing, however!

This isn't a proper Perl module yet that can be put on the CPAN; for now what I've personally been doing is using it under the Model namespace in the Mojolicious project I mentioned above. I plan on turning it into a proper CPAN module at a later date.

How to use

use utf8;
use StatusCafe;

my ($emoji, $timeAgo, $content) = statuscafe('m15o');

NOTE: You might want to set up some form of caching so it doesn't need refetched every time the script is triggered

Dependencies

  • HTTP::Tiny (for page fetching)
  • Mojo::DOM (for parsing the fetched page for necessary info)
  • Mojo::Util (so Mojo::DOM doesn't throw a fit over emoji usage)

To-do

  • Add an optional flag to output emoji information as text instead of an actual emoji, since that's easier to handle
  • As mentioned above, modify into a proper module to be uploaded to CPAN