Skip to content

Instantly share code, notes, and snippets.

@vonglasow
Last active August 29, 2015 14:03
Show Gist options
  • Save vonglasow/c4d9ac08568f50a44740 to your computer and use it in GitHub Desktop.
Save vonglasow/c4d9ac08568f50a44740 to your computer and use it in GitHub Desktop.
Get redmine issues title for pomojs
#!/usr/bin/perl
use strict;
use warnings;
use Carp;
use WWW::Mechanize;
use Mojo::DOM;
use String::ShellQuote;
my $site = 'https://redmine-url/issues/' . $ARGV[0];
my $mech = WWW::Mechanize->new();
$mech->get($site);
my $form = $mech->form_with_fields(qw(username password));
$mech->field('username', 'username');
$mech->field('password', '********************');
$mech->submit();
# Parse
my $dom = Mojo::DOM->new($mech->content);
my $title = $dom->find('div.subject h3')->text;
my $string = "[TECH] refs #" . $ARGV[0] . ' - ' . $title;
# Find
print $string . "\n";
exec 'pomojs --log ~/.pomo.log --tmux -w 25 ' . shell_quote $string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment