Last active
December 30, 2015 16:09
-
-
Save hexfusion/7852970 to your computer and use it in GitHub Desktop.
populate countries table with Locale::Country and DBIC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env perl | |
use strict; | |
use warnings; | |
use Locale::Country; | |
use Interchange6::Schema; | |
my $dsn = shift; | |
my $schema = Interchange6::Schema->connect($dsn); | |
my @countries = (); | |
@countries = map {[$_, code2country($_)]} (all_country_codes(LOCALE_CODE_ALPHA_2)); | |
#populate countries table | |
$schema->populate('Country', [ | |
[ 'iso_code', 'name' ], | |
@countries, | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment