Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
* Convert slurp/Load to LoadFile
Browse files Browse the repository at this point in the history
  • Loading branch information
zachthompson committed May 29, 2015
1 parent 5674628 commit b8aed43
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions lib/DDG/Goodie/CalendarConversion.pm
Expand Up @@ -8,7 +8,7 @@ with 'DDG::GoodieRole::Dates';
use Date::Hijri;
use Date::Jalali2;

use YAML qw(Load);
use YAML::XS 'LoadFile';

zci answer_type => "calendar_conversion";
zci is_cached => 0;
Expand All @@ -25,7 +25,7 @@ attribution github => ['http://github.com/mattlehning', 'mattlehning'],

triggers any => 'hijri', 'gregorian', 'jalali';

my $calendars = Load(scalar share('calendars.yml')->slurp);
my $calendars = LoadFile(share('calendars.yml'));

my $datestring_regex = datestring_regex();

Expand Down
4 changes: 2 additions & 2 deletions lib/DDG/Goodie/DuckDuckGo.pm
Expand Up @@ -4,7 +4,7 @@ package DDG::Goodie::DuckDuckGo;
use strict;
use DDG::Goodie;

use YAML qw( Load );
use YAML::XS 'LoadFile';

primary_example_queries 'duckduckgo help';
secondary_example_queries 'ddg tor', 'short URL for duck duck go';
Expand All @@ -22,7 +22,7 @@ triggers any => @ddg_aliases, "zeroclickinfo", "private search";

zci is_cached => 1;

my $responses = Load(scalar share("responses.yml")->slurp);
my $responses = LoadFile(share('responses.yml'));

# The YAML is intended to be human-friendly.
# Now we make something computer-friendly.
Expand Down
6 changes: 3 additions & 3 deletions lib/DDG/Goodie/HelpLine.pm
Expand Up @@ -4,9 +4,9 @@ package DDG::Goodie::HelpLine;
use strict;
use DDG::Goodie;

use YAML::XS qw( Load );
use YAML::XS 'LoadFile';

my $triggers = Load(scalar share('triggers.yml')->slurp);
my $triggers = LoadFile(share('triggers.yml'));

triggers any => @$triggers;

Expand All @@ -21,7 +21,7 @@ topics 'everyday';
category 'special';
source 'https://en.wikipedia.org/wiki/List_of_suicide_crisis_lines';

my $helplines = Load(scalar share('helplines.yml')->slurp);
my $helplines = LoadFile(share('helplines.yml'));
my %suicide_phrases = map { $_ => 1 } @$triggers;

handle query_lc => sub {
Expand Down
4 changes: 2 additions & 2 deletions lib/DDG/Goodie/Jira.pm
Expand Up @@ -8,7 +8,7 @@ use utf8;
zci is_cached => 1;
zci answer_type => 'jira';

use YAML qw( Load );
use YAML::XS 'LoadFile';

primary_example_queries 'SOLR-4530';
secondary_example_queries 'IdentityHtmlMapper solr-4530';
Expand All @@ -21,7 +21,7 @@ attribution
github => ['https://github.com/arroway', 'Stéphanie Ouillon'],
twitter => ['http://twitter.com/steph_ouillon', 'Stéphanie Ouillon'];

my $projects = Load(scalar share('projects.yml')->slurp);
my $projects = LoadFile(share('projects.yml'));

my @all_project_keys = sort keys %$projects;

Expand Down
4 changes: 2 additions & 2 deletions lib/DDG/Goodie/POTUS.pm
Expand Up @@ -5,7 +5,7 @@ use strict;
use DDG::Goodie;
use Lingua::EN::Numbers::Ordinate qw(ordsuf ordinate);
use Lingua::EN::Words2Nums;
use YAML::XS qw( Load );
use YAML::XS 'LoadFile';

triggers startend => 'potus';
triggers any => 'president of the united states', 'president of the us';
Expand All @@ -22,7 +22,7 @@ code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DD
attribution github => ['numbertheory', 'John-Peter Etcheber'],
twitter => ['jpscribbles', 'John-Peter Etcheber'];

my @presidents = @{Load(scalar share('presidents.yml')->slurp)};
my @presidents = @{LoadFile(share('presidents.yml'))};
my $prez_count = scalar @presidents;

handle remainder => sub {
Expand Down
4 changes: 2 additions & 2 deletions lib/DDG/Goodie/Paper.pm
Expand Up @@ -3,7 +3,7 @@ package DDG::Goodie::Paper;

use strict;
use DDG::Goodie;
use YAML;
use YAML::XS 'LoadFile';

zci answer_type => "paper";
zci is_cached => 1;
Expand All @@ -22,7 +22,7 @@ attribution github => ['loganom', 'Logan McCamon'],
twitter => ['loganmccamon', 'Logan McCamon'],
github => ['mattlehnig', 'Matt Lehnig'];

my $sizes = Load(scalar share('sizes.yml')->slurp);
my $sizes = LoadFile(share('sizes.yml'));

handle query_lc => sub {
return unless my ($s, $l, $n) = $_ =~ /^((?:(a|b|c)(\d{0,2}))|legal|letter|junior\s*legal|ledger|tabloid|hagaki)\s+paper\s+(?:size|dimm?ensions?)$/i;
Expand Down
4 changes: 2 additions & 2 deletions lib/DDG/Goodie/PeriodicTable.pm
Expand Up @@ -3,7 +3,7 @@ package DDG::Goodie::PeriodicTable;

use strict;
use DDG::Goodie;
use YAML::XS qw(Load);
use YAML::XS 'LoadFile';
use List::Util qw(first);
use Text::Trim;

Expand All @@ -20,7 +20,7 @@ code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DD
attribution github => [ 'zblair', 'Zachary D Blair' ],
github => ['skywickenden', 'Sky Wickenden'];

my @elements = @{ Load( scalar share('elements.yml')->slurp ) };
my @elements = @{ LoadFile(share('elements.yml')) };

# Triggers
my @element_triggers = [map { lc($_->[2]) } @elements];
Expand Down
4 changes: 2 additions & 2 deletions lib/DDG/Goodie/PublicDNS.pm
Expand Up @@ -5,7 +5,7 @@ use strict;
use DDG::Goodie;

use List::Util qw(max);
use YAML qw( Load );
use YAML::XS 'LoadFile';

primary_example_queries 'public dns';
description 'list common public DNS servers and their IP addresses';
Expand All @@ -21,7 +21,7 @@ triggers end => "public dns", "dns server", "dns servers";
zci is_cached => 1;
zci answer_type => "public_dns";

my $providers = Load(scalar share('providers.yml')->slurp);
my $providers = LoadFile(share('providers.yml'));

my @ordered_servers;
# Alphabetize the output while making the structure
Expand Down
4 changes: 2 additions & 2 deletions lib/DDG/Goodie/SolarSystem.pm
Expand Up @@ -2,7 +2,7 @@ package DDG::Goodie::SolarSystem;
# ABSTRACT: Return various attributes of a object

use DDG::Goodie;
use YAML::XS qw( Load );
use YAML::XS 'LoadFile';
use POSIX;
use Text::Trim;
use strict;
Expand Down Expand Up @@ -32,7 +32,7 @@ my $unitsString = join('|', @unitTriggers);
triggers any => 'earth', 'jupiter', 'mars', 'mercury', 'neptune', 'saturn', 'uranus', 'venus', 'pluto', 'sun', 'moon';

# Load object data
my $objects = Load(scalar share('objects.yml')->slurp);
my $objects = LoadFile(share('objects.yml'));

# Handle statement
handle query_lc => sub {
Expand Down
4 changes: 2 additions & 2 deletions lib/DDG/Goodie/ZappBrannigan.pm
Expand Up @@ -4,7 +4,7 @@ package DDG::Goodie::ZappBrannigan;
use strict;
use DDG::Goodie;

use YAML::XS qw(Load);
use YAML::XS 'LoadFile';

triggers any => "zapp", "brannigan";

Expand All @@ -21,7 +21,7 @@ code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DD
category 'entertainment';
topics 'entertainment';

my $quotes = Load(scalar share('quotes.yml')->slurp);
my $quotes = LoadFile(share('quotes.yml'));

handle query => sub {
return unless $_ =~ m/quotes?/;
Expand Down

0 comments on commit b8aed43

Please sign in to comment.