App-DuckPAN

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    to always print instead of returning a string in non-void contexts.

    Setting 'return_value' to 'dump' ensures that p() behaves the same as
    the code expects it to by printing in a void context and returning a
    string otherwise. 

  Change: d2d6bcd2ec563f810823162347a4610efef35c3b
  Author: Zaahir Moolla <moollaza@fastmail.fm>
  Date : 2015-10-16 20:14:06 +0000

    Merge pull request #277 from duckduckgo/zt/bad-promptwq

    Fix IA name prompt 

  Change: 5c7e0b5f22afb064ef9a11affa2741146dae49b6
  Author: Zach Thompson <zach@duckduckgo.com>
  Date : 2015-10-16 16:36:08 +0000

    space after prompt about IA name 

  Change: 12aeb9973883a294192cb9e6f28153db9fd22d31
  Author: Zaahir Moolla <moollaza@fastmail.fm>
  Date : 2015-10-07 13:16:13 +0000

    Merge pull request #276 from duckduckgo/zach/metadata

    Fix metadata on serp 

  Change: 952c138e4aadde3cd596740c51917800de7e38ea

Changes  view on Meta::CPAN

  Date : 2015-05-18 23:29:22 +0000

    resolve merge conflicts 

  Change: 5f22c4cd1bcab58d482b30cb15079c6d2f86bbe3
  Author: Zaahir Moolla <moollaza@fastmail.fm>
  Date : 2015-05-18 19:25:22 +0000

    Merge pull request #259 from duckduckgo/zaahir/check-ia-bundles

    Add check and prompt for missing IA Bundles 

  Change: d4f8026575c0654c225d76eadb1d5ac6cf04ab9f
  Author: Zaahir Moolla <moollaza@duckduckgo.com>
  Date : 2015-05-18 23:17:01 +0000

    Fix indentation 

  Change: 481c24f8654c5750efb7e2ce1c8670272c33d27e
  Author: Zaahir Moolla <moollaza@duckduckgo.com>
  Date : 2015-05-18 23:13:24 +0000

Changes  view on Meta::CPAN

  Change: 3ca46b1c57a145c8dd4773b109169c0c4ecc1894
  Author: Zaahir Moolla <moollaza@duckduckgo.com>
  Date : 2015-05-18 22:43:10 +0000

    fix indentation 

  Change: df3c00cb0ed5ff4c2dbb8df3f2b55a2264297a10
  Author: Zaahir Moolla <moollaza@duckduckgo.com>
  Date : 2015-05-18 22:32:25 +0000

    Add check and prompt for missing IA Bundles 

  Change: 076de8e235e6edf965104acb2394fca3b6d4db5a
  Author: Zaahir Moolla <moollaza@duckduckgo.com>
  Date : 2015-05-16 03:58:10 +0000

    Fixed naming collision in duckpan assets, use https 

  Change: a7f80d133314fca6522a65941fd53e2011e010c3
  Author: Zaahir Moolla <moollaza@duckduckgo.com>
  Date : 2015-05-14 04:46:28 +0000

README.md  view on Meta::CPAN


Shows you the DuckPAN help page which briefly describes DuckPAN and its features.


### For Instant Answer Developers

```
duckpan new [instant_answer_name]
```

Generates all necessary files for a new Spice or Goodie Instant Answer (depending on the current repo). DuckPAN will prompt you for a package name and generate the required files. If the name is already in use, DuckPAN will let you know and no files ...

Example:

```
duckpan new
```

```
duckpan new MyFirst::Spice
```

bin/duckpan  view on Meta::CPAN


[package_name ...]:
Loads only the specified Spice or Goodie Instant Answers.

Examples:
duckpan server Movie
duckpan server IDN Sort Morse

=item C<duckpan new> [package name]

Generates all necessary files for a new Spice or Goodie Instant Answer (depending on the current repo). DuckPAN will prompt you for a package name and generate the required files. If the name is already in use, DuckPAN will let you know and no files ...

=item C<duckpan test>

Tests your release, by running the tests in the B<t/> directory using Dzil (if a dist.ini exists) or prove. This will run automatically during a B<duckpan release>.

=item C<duckpan installdeps>

Attempt to install dependencies for the distribution in your current directory using cpanm.

=item C<duckpan roadrunner>

lib/App/DuckPAN.pm  view on Meta::CPAN

		{
			name          => 'Longtail',
			dir           => $ddg_path->child('Longtail'),
			supported     => 0,
			path_basename => 'zeroclickinfo-longtail',
		},
	];
}

sub get_reply {
	my ( $self, $prompt, %params ) = @_;
	my $return = $self->term->get_reply( prompt => $prompt, %params );
	Encode::_utf8_on($return);
	return $return;
}

sub ask_yn {
	my ( $self, $prompt, %params ) = @_;

	return $self->term->ask_yn( prompt => $prompt, %params );
}

has http => (
	is => 'ro',
	builder => 1,
	lazy => 1,
);

sub _build_http {
	my ( $self ) = @_;

lib/App/DuckPAN/Query.pm  view on Meta::CPAN

		$console->addhistory($input);
		$console->write_history($history_path);
		$k->yield(_run_query => $input); # this yield keeps the loop going
	}
	else{
		$h->{console}->put('\\_o< Thanks for testing!');
	}
	# falling through here without queuing an event ends the app.
}

# Event that prints the prompt and waits for input.
sub _get_user_input {
	$_[HEAP]{console}->get('Query: ');
}

# Event that processes the query
sub _run_query {
	my ($k, $h, $query) = @_[KERNEL, HEAP, ARG0];

	my ($app, $blocks) = @$h{qw{app blocks}};
	Encode::_utf8_on($query);

lib/App/DuckPAN/Query.pm  view on Meta::CPAN

			unless ($hit) {
				$app->emit_info('Sorry, no Instant Answers returned a result')
			}
		}
	}
	catch {
		my $error = $_;
		if ($error =~ m/Malformed UTF-8 character/) {
			$app->emit_info('You got a malformed utf8 error message. Normally' .
				' it means that you tried to enter a special character at the query' .
				' prompt but your interface is not properly configured for utf8.' .
				' Please check the documentation for your terminal, ssh client' .
				' or other client used to execute duckpan.'
			);
		}
		$app->emit_info("Caught error: $error");
	};

	# Enqueue input event
	$k->yield('_get_user_input');
}



( run in 2.070 seconds using v1.01-cache-2.11-cpan-6aa56a78535 )