App-Slackeria

 view release on metacpan or  search on metacpan

lib/App/Slackeria/Plugin/Debian.pm  view on Meta::CPAN

	my $dist  = $self->{conf}->{distribution} // 'sid';
	my $reply = $self->{ua}->get("http://packages.debian.org/${dist}/${name}");

	if ( not $reply->is_success ) {
		die( $reply->status_line );
	}

	$self->{conf}->{href} //= 'http://packages.debian.org/sid/%s';
	my $href = sprintf( $self->{conf}->{href}, $self->{conf}->{name} );

	my $html = $reply->decoded_content();
	my $tree = XML::LibXML->load_html(
		string            => $html,
		recover           => 2,
		suppress_errors   => 1,
		suppress_warnings => 1,
	);

	my $xp_title = XML::LibXML::XPathExpression->new('//div[@id="content"]/h1');
	my $re_package = qr{
		^ Package: \s ${name} \s

lib/App/Slackeria/Plugin/OpenPorts.pm  view on Meta::CPAN

	my ($self) = @_;

	my $name  = $self->{conf}->{name};
	my $reply = $self->{ua}
	  ->get("http://openports.se/search.php?stype=folder&so=${name}");

	if ( not $reply->is_success() ) {
		die( $reply->status_line() );
	}

	my $html = $reply->decoded_content();
	my $tree = XML::LibXML->load_html( string => $html );

	my $xp_main = XML::LibXML::XPathExpression->new('//div[@id="main"]/b');
	my $xp_url  = XML::LibXML::XPathExpression->new('following::a[1]');
	my $xp_ver  = XML::LibXML::XPathExpression->new('following::em/b[1]');

	for my $node ( @{ $tree->findnodes($xp_main) } ) {
		if ( $node->textContent() eq '*** Exact match ***' ) {
			my $category = $node->findnodes($xp_url)->[0]->textContent();
			my $version  = $node->findnodes($xp_ver)->[0]->textContent();



( run in 0.431 second using v1.01-cache-2.11-cpan-26ccb49234f )