ACME-QuoteDB

 view release on metacpan or  search on metacpan

lib/ACME/QuoteDB.pm  view on Meta::CPAN

our @EXPORT = qw/quote/; # support one liner

use Carp qw/croak/;
use Data::Dumper qw/Dumper/;
use ACME::QuoteDB::LoadDB;
use aliased 'ACME::QuoteDB::DB::Attribution' => 'Attr';
use aliased 'ACME::QuoteDB::DB::QuoteCatg'  => 'QuoteCatg';
use aliased 'ACME::QuoteDB::DB::Category'  => 'Catg';
use aliased 'ACME::QuoteDB::DB::Quote'    => 'Quote';

binmode STDOUT, ':encoding(utf8)';
binmode STDERR, ':encoding(utf8)';

sub new {
    my $class = shift;
    my $self = bless {}, $class;
    return $self;
}

# provide 1 non OO method for one liners
sub quote {
    my ($arg_ref) = @_;

lib/ACME/QuoteDB/LoadDB.pm  view on Meta::CPAN

    $self->{record}->{quote}  = q{};
    $self->{record}->{rating} = q{};
    $self->{record}->{name}   = q{};
    $self->{record}->{source} = q{};
    $self->{record}->{catg}   = q{};

    $self->{file}        = $args->{file};
    $self->{dir}         = $args->{dir};
    $self->{data}        = $args->{data};
    $self->{file_format} = $args->{file_format};
    $FILE_ENCODING       = $args->{file_encoding} || $FILE_ENCODING;
    $self->{delim}       = $args->{delimiter};
    $self->{verbose}     = $args->{verbose};
    $self->{category}    = $args->{category};
    $self->{rating}      = $args->{rating};
    $self->{attr_source} = $args->{attr_source};
    $self->{orig_args}   = $args;
    $self->{success}     = undef;

    # start with if set
    $self->{record}->{rating} = $self->{rating};

t/01-load_quotes.t  view on Meta::CPAN

  # this is an example of importing a file in the 'fortune' format
  # subclass ACME::QuoteDB::LoadDB and override dbload, to do our parsing
  package Fortune2QuoteDB;
  use base 'ACME::QuoteDB::LoadDB';
  use Carp qw/croak/;
  use Data::Dumper qw/Dumper/;

  sub dbload {
    my ($self, $file) = @_;

    open my $source, '<:encoding(utf8)', $file || croak $!;

    local $/ = $self->{delim};

    my $q = q{};

    while (my $line = <$source>){

      #$self->debug_record;

      $q .= $line;

t/04-load_get_quote_utf8.t  view on Meta::CPAN

#!perl -T
# /* vim:et: set ts=4 sw=4 sts=4 tw=78 encoding=utf-8: */

use 5.008005;        # require perl 5.8.5
                     # DBD::SQLite Unicode is not supported before 5.8.5
use strict;
use warnings;
use utf8; # yes this source code does contain utf8 characters

use ACME::QuoteDB;
use ACME::QuoteDB::LoadDB;

t/data/python_quotes.txt  view on Meta::CPAN

      -- Barry Warsaw, 23 Mar 2000

    >Have you ever looked at the output of a bib | tbl | eqn pipeline?
    Are you kids still using that as a pick-up line?
      -- Roy Smith and Cameron Laird, 4 Apr 2000

This is like getting lost in a dictionary. What does quincuncial mean anyhow?
      -- Dennis Hamilton, 4 Apr 2000

UTF-8 has a certain purity in that it equally annoys every nation, and is
nobody's default encoding.
      -- Andy Robinson, 10 Apr 2000

    "Now if we could figure out where python programmers are from, someone
could write a book and get rich."
    "Yorkshire."
      -- Quinn Dunkan and Warren Postma, 11 Apr 2000

If I didn't have my part-time performance art income to help pay the bills, I
could never afford to support my programming lifestyle.
      -- Jeff Bauer, 21 Apr 2000

t/data/www.amk.ca/quotations/python-quotes/index.html  view on Meta::CPAN

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head profile="http://www.amk.ca/foaf/author">
<meta name="generator" content=
"HTML Tidy for Mac OS X (vers 1 September 2005), see www.w3.org" />
<link rel="stylesheet" href="/base.css" type="text/css" />
<meta name="ICBM" content="38.87510,-77.28705" />
<meta name="geo.position" content="38.87510; -77.28705" />
<meta name="DC.title" content="Python Quotes, page 1 of 10" />

t/data/www.amk.ca/quotations/python-quotes/page-10.html  view on Meta::CPAN

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head profile="http://www.amk.ca/foaf/author">
<meta name="generator" content=
"HTML Tidy for Mac OS X (vers 1 September 2005), see www.w3.org" />
<link rel="stylesheet" href="/base.css" type="text/css" />
<meta name="ICBM" content="38.87510,-77.28705" />
<meta name="geo.position" content="38.87510; -77.28705" />
<meta name="DC.title" content="Python Quotes, page 10 of 10" />

t/data/www.amk.ca/quotations/python-quotes/page-2.html  view on Meta::CPAN

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head profile="http://www.amk.ca/foaf/author">
<meta name="generator" content=
"HTML Tidy for Mac OS X (vers 1 September 2005), see www.w3.org" />
<link rel="stylesheet" href="/base.css" type="text/css" />
<meta name="ICBM" content="38.87510,-77.28705" />
<meta name="geo.position" content="38.87510; -77.28705" />
<meta name="DC.title" content="Python Quotes, page 2 of 10" />

t/data/www.amk.ca/quotations/python-quotes/page-3.html  view on Meta::CPAN

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head profile="http://www.amk.ca/foaf/author">
<meta name="generator" content=
"HTML Tidy for Mac OS X (vers 1 September 2005), see www.w3.org" />
<link rel="stylesheet" href="/base.css" type="text/css" />
<meta name="ICBM" content="38.87510,-77.28705" />
<meta name="geo.position" content="38.87510; -77.28705" />
<meta name="DC.title" content="Python Quotes, page 3 of 10" />

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.664 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )