#!/usr/local/bin/perl -w
###########################################
# repo-search - Search code within a repo
# Mike Schilli, 2015 (m@perlmeister.com)
###########################################
use strict;
use Net::GitHub;
use YAML qw( LoadFile );

my $gh_conf = (glob "~")[0] . "/.githubrc";

my $gh = Net::GitHub->new( access_token => 
  LoadFile( $gh_conf )->{ token }
);

my %data = $gh->search->code( 
  { q => 'snickers in:file language:perl' .
         ' repo:mschilli/log4perl' 
  } );

for my $item ( @{ $data{ items } } ) {
  print $item->{ path }, "\n";
}
