Skip to content

Instantly share code, notes, and snippets.

View monken's full-sized avatar

Moritz Onken monken

View GitHub Profile
@monken
monken / gist:1106698
Created July 26, 2011 13:01
Use ElasticSearch.pm to query MetaCPAN
use ElasticSearch;
my $es = ElasticSearch->new( servers => 'api.metacpan.org', no_refresh => 1 );
my $scroller = $es->scrolled_search(
query => { match_all => {} },
search_type => 'scan',
scroll => '5m',
index => 'v0',
type => 'release',
use IO::Async::Timer::Periodic;
use strict;
use warnings;
use IO::Async::Loop;
use LWP::UserAgent;
use HTTP::Request::Common qw(HEAD);
my $ua = LWP::UserAgent->new;
my $loop = IO::Async::Loop->new();
my $code = 0;
{"error":"IOException[EOF in 477 byte (compressed) block: could only read 453 bytes]","status":500}
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test
curl -XPUT localhost:9200/test/type1/_mapping -d '
{
"author" : {
"dynamic" : "false",
"_source" : {
"compress" : true
},
"properties" : {
curl -XGET http://localhost:9200/esindex/job/_search -d '{"filtered":{"query":{"match_all":{}},"filter":{"geo_distance":{"distance":"200km","job.geo_loc":{"lat":45.16667,"lon":10.8}}}}}'
@monken
monken / gist:1047411
Created June 26, 2011 08:36
Transition to Catalyst from Mo-AE-Plack

This document describes how to move metacpan-web from the currently asynchronous, home grown framework to Catalyst.

MetaCPAN::Web::View

The view is a Template::Alloy subclass, that defines a number of virtual methods and sets up the configuration for the Template::Alloy object. Since there is Catalyst::View::TT::Alloy already, the move towards it should be straightforward. Though, you would have to rename it to something like MetaCPAN::Web::View::HTML

MetaCPAN::Web::Model

The model class is a tiny wrapper around AnyEvent::HTTP and provides convenience methods for accessing the individual model classes. $controller->model('Author') will return an instance of MetaCPAN::Web::Model::Author. This is pretty similar to what Catalyst does.

use strict;
use warnings;
use Test::More;
use MetaCPAN::Test;
test_psgi app, sub {
my $cb = shift;
ok( my $res = $cb->( GET "/author/DOESNTEXIST" ),
'GET /author/DOESNTEXIST' );
is( $res->code, 404, 'code 404' );

Search for "moose role":

Moose::Role - The Moose Role

The concept of roles is documented in Moose::Manual::Roles. This document serves as API documentation.

  • Moose::Meta::Role::Application::ToRole - Compose a role into another role
  • Moose::Spec::Role - Formal spec for Role behavior
  • Moose::Meta::Role - The Moose Role metaclass
MapperParsingException[object_mapper [testreport] tried to parse as object, but got EOF, has a concrete value been provided to it?]
With vars:{
'request' => {
'qs' => {},
'cmd' => '/cpan/testreport/00000001-b19f-3f77-b713-d32bba55d77f',
'as_json' => undef,
'data' => {
'date' => '1999-08-28T07:08:00',
'release' => 'Bundle-ABH-1.01',

Introducing beta.metacpan.org - A better search for the CPAN

By mo on May 27, 2011 3:26 PM

I'm very excited to announce the front end for MetaCPAN: beta.metacpan.org. This is what you can expect from the new interface to the CPAN:

New uploads instantly available

New uploads to the CPAN are indexed within seconds. No more waiting for the new upload to appear on the search site. Check out /recent