ACME-QuoteDB

 view release on metacpan or  search on metacpan

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


Readonly my @QUOTE_FIELDS => qw/quote name source catg rating/;

# XXX refactor
sub new {
    my ($class, $args) = @_;

    # TODO encapsulation
    my $self = bless {}, $class;

    # store each record we extract - keys map to database fields
    # TODO proper encapsulation
    $self->{record} = {};
    $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};

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

  $load_db->data_to_db;

  ok $load_db->success;
  is $load_db->success, 1;
   
  my $sq = ACME::QuoteDB->new;
  isa_ok $sq, 'ACME::QuoteDB';
  
  # expected attribution list from our data
  my @expected_attribution_list = (
           'Apu Nahasapemapetilon',
           'Chief Wiggum',
           'Comic Book Guy',
           'Grandpa Simpson',
           'Ralph Wiggum',
          );
  
  is( $sq->list_attr_names, join "\n", sort @expected_attribution_list);
}

{

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

  isa_ok $load_db, 'ACME::QuoteDB::LoadDB';
  $load_db->data_to_db;
  ok $load_db->success;
  is $load_db->success, 1;
   
  my $sq = ACME::QuoteDB->new;
  isa_ok $sq, 'ACME::QuoteDB';
  
  # expected attribution list from our data
  my @expected_attribution_list = (
           'Apu Nahasapemapetilon',
           'Chief Wiggum',
           'Comic Book Guy',
           'Grandpa Simpson',
           'Ralph Wiggum',
          );
  
  is( $sq->list_attr_names, join("\n", sort(@expected_attribution_list)));
}

{ # load from html is not supported because there are too many 

t/02-get_quotes.t  view on Meta::CPAN


    isa_ok $load_db, 'ACME::QuoteDB::LoadDB';
    $load_db->data_to_db;
    is $load_db->success, 1;
}

my $sq = ACME::QuoteDB->new;

# some 'the simpsons' characters
my @expected_attr_name_list = (
         'Apu Nahasapemapetilon',
         'Chief Wiggum',
         'Comic Book Guy',
         'Grandpa Simpson',
         'Ralph Wiggum',
        );
is( $sq->list_attr_names, join "\n", sort @expected_attr_name_list);

#warn $sq->get_quote, "\n";
ok $sq->get_quote; # default get random quote
ok $sq->get_quote =~ m{\w+};

t/03-load_quotes_env.t  view on Meta::CPAN

  $load_db->data_to_db;
  ok $load_db->success;
  is $load_db->success, 1;

   
  my $sq = ACME::QuoteDB->new;
  isa_ok $sq, 'ACME::QuoteDB';
  
  # expected attribution list from our data
  my @expected_attribution_list = (
           'Apu Nahasapemapetilon',
           'Chief Wiggum',
           'Comic Book Guy',
           'Grandpa Simpson',
           'Ralph Wiggum',
          );
  
  is( $sq->list_attr_names, join "\n", sort @expected_attribution_list);

  $load_db = undef;
}

t/05-load_quotes_remote.t  view on Meta::CPAN

  isa_ok $load_db, 'ACME::QuoteDB::LoadDB';
  $load_db->data_to_db;
  ok $load_db->success;
  is $load_db->success, 1;
   
  my $sq = ACME::QuoteDB->new;
  isa_ok $sq, 'ACME::QuoteDB';
  
  # expected attribution list from our data
  my @expected_attribution_list = (
           'Apu Nahasapemapetilon',
           'Chief Wiggum',
           'Comic Book Guy',
           'Grandpa Simpson',
           'Ralph Wiggum',
          );
  
  is( $sq->list_attr_names, join "\n", sort @expected_attribution_list);

  $load_db = undef;
}

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

I claim complete innocence and ignorance! It must have been Tim. I wouldn't
know a Trondheim Hammer if it fell on my foot!
      -- Steve Majewski, 10 Jan 1995

(Aieee! Yet another thing on my TODO pile!)
      -- A.M. Kuchling, 10 Jan 1995

[After someone wrote "...assignment capability, a la djikstra"] Ehh, the poor
old man's name is Dijkstra. I should know, "ij" is a well known digraph in the
Dutch language. And before someone asks the obvious: his famous "P and V" names
for semaphores are derived for the Dutch words "Passeer" and "Verlaat", or
"Pass" and "Leave". And no, I haven't met him (although he did work at CWI back
in the fifties when it was called, as it should still be today, Mathematical
Centre). he currently lives in Austin, Texas I believe. (While we're at it...
does anybody remember the Dijkstra font for Macintoshes? It was a scanned
version of his handwriting. I believe Luca Cardelli scanned it -- the author of
Obliq, a somewhat Python-like distributed language built on Modula-3. I could
go on forever... :-)
      -- Guido van Rossum, 19 Jan 1995

As always, I'll leave it to a volunteer to experiment with this.

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

lawsuits. An added benefit is that John Cleese is teaching Guido how to walk
funny.
    (3) Pre-Release vacations are spent in the Catskills. Post-Release
vacations are spent in the Bahamas. Guido is currently working on a system
which will allow him to make more releases of Python; thus octupling the number
of vacations he takes in a year.
      -- Matthew Lewis Carroll Smith, 4 Apr 1997

I mean, just take a look at Joe Strout's brilliant little "python for
beginners" page. Replace all print-statements with sys.stdout.write(
string.join(map(str, args)) + "\n") and you surely won't get any new beginners.
And That Would Be A Very Bad Thing.
      -- Fredrik Lundh, 27 Aug 1996

Ya, ya, ya, except ... if I were built out of KSR chips, I'd be running at 25
or 50 MHz, and would be wrong about ALMOST EVERYTHING almost ALL THE TIME just
due to being a computer! Think about it -- when's the last time you spent 20
hours straight debugging your son/wife/friend/neighbor/dog/ferret/snake? And
they *still* fell over anyway? Except in a direction you've never seen before
each time you try it? The easiest way to tell you're dealing with a computer is
when the other side keeps making the same moronic misteakes over and misteakes

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


    "Heh -- all it really broke so far was my resistance to installing Tk. I
suppose wizardry is inevitable after one installs something, though <wink>."
    "Spoken like a truly obsessive-compulsive wizard! It-takes-one-to-know
-one..."
      -- Tim Peters and Guido van Rossum, 6 Jan 1999

Note, however, that architectural forms are completely declarative and can be
implemented in a highly optimized fashion. The sorts of extensions that
Microsoft has proposed for XSL (<xsl:eval>...</>) would completely destroy
those features. Architectural mapping would, in general, be as reliable and
high performance as ordinary software -- (not at all).
      -- Paul Prescod, 6 Jan 1999

Darned confusing, unless you have that magic ingredient *coffee*, of which I
can pay you Tuesday for a couple pounds of extra-special grind today.
      -- John Mitchell, 11 Jan 1999

That's so obvious that someone has already got a patent on it.
      -- Guido van Rossum, 12 Jan 1999

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


A comment is in order then. If the code is smarter than it looks, most people
aren't going to think it looks very smart.
      -- Jeremy Hylton, 6 Jul 2000

You and I think too much alike ?!ng. And if that doesn't scare you now, you
should have a talk with Gordon.
      -- Barry Warsaw, 12 Jul 2000

Isn't it somewhat of a political statement to allow marriages of three or more
items? I always presumed that this function was n-ary, like map().
      -- Paul Prescod, on the proposed name marry() for a function to
         combine sequences, 12 Jul 2000

Since my finger was slowest reaching my nose, I got elected Editor. On the
positive side of that, I get to make the early decisions that will be cursed
for generations of Python hackers to come.
      -- Barry Warsaw, 12 Jul 2000

Hey, you know, we can work this in. Sailor Moon + Giant Robots + Tentacle
Demons + Python Conference == Bizarre hilarity ensues!

t/data/simpsons_quotes.csv  view on Meta::CPAN

"My cat's breath smells like cat food.","Ralph Wiggum","The Simpsons","Humor",9.8
"I dropped my popstickle in your toy chest","Ralph Wiggum","The Simpsons","Humor",4
"Milhouse: Why does Bart have a comic book? Comic Book Guy: Your questions have become more redundant and annoying then the last three ""Highlander"" movies.","Comic Book Guy","The Simpsons","Humor",7
"But, Aquaman, you cannot marry a woman without gills. You're from two different worlds... Oh, I've wasted my life.","Comic Book Guy","The Simpsons","Humor",4
"Bart: It's valuable, huh?! Comic Book Guy: Ooh, your powers of deduction are exceptional. I can't allow you to waste them here when there are so many crimes going unsolved at this very moment. Go, go, for the good of the city.","Comic Book Guy","The...
"Last night's 'Itchy and Scratchy Show' was, without a doubt, the worst episode ever. Rest assured, I was on the internet within minutes, registering my disgust throughout the world.","Comic Book Guy","The Simpsons","Humor",5
"Stop right there! I have the only working fazer ever built. It was fired only once to keep William Shatner from making another album.","Comic Book Guy","The Simpsons","Humor",7
"The Internet King? I wonder if he could provide faster nudity... .","Comic Book Guy","The Simpsons","Humor",4.3
"Oh, loneliness and cheeseburgers are a dangerous mix.","Comic Book Guy","The Simpsons","Humor",3
"That is a rare photo of Sean Connery signed by Roger Moore.","Comic Book Guy","The Simpsons","Humor",4.7
"Hello. I am not interested in buying your house, but I would like to use your rest room, flip through your magazines, rearrange your carefully shelved items and handle your food products in an unsanitary manner. Ha! Now you know how it feels!)","Apu...
"Hey, hey, this is not a lending library. If you're not going to buy that thing put it down or I'll blow your heads off","Apu Nahasapemapetilon","The Simpsons","Humor",6
"Shiva H. Vishnu!","Apu Nahasapemapetilon","The Simpsons","Humor",6
"Big deal! When I was a pup, we got spanked by presidents 'til the cows came home! Grover Cleveland spanked me on two non-consecutive occasions!","Grandpa Simpson","The Simpsons","Humor",6
"My Homer is not a communist.  He may be a liar, a pig, an idiot, a communist, but he is not a porn star.","Grandpa Simpson","The Simpsons","Humor",9
"Dear Mr. President, There are too many states nowadays. Please eliminate three. P.S. I am not a crackpot.","Grandpa Simpson","The Simpsons","Humor",9.5

t/data/simpsons_quotes.tsv.csv  view on Meta::CPAN

My cat's breath smells like cat food.	Ralph Wiggum			
I dropped my popstickle in your toy chest	Ralph Wiggum			
Milhouse: Why does Bart have a comic book? Comic Book Guy: Your questions have become more redundant and annoying then the last three 'Highlander' movies.	Comic Book Guy			
But, Aquaman, you cannot marry a woman without gills. You're from two different worlds... Oh, I've wasted my life.	Comic Book Guy			
Bart: It's valuable, huh?! Comic Book Guy: Ooh, your powers of deduction are exceptional. I can't allow you to waste them here when there are so many crimes going unsolved at this very moment. Go, go, for the good of the city.	Comic Book Guy			
Last night's 'Itchy and Scratchy Show' was, without a doubt, the worst episode ever. Rest assured, I was on the internet within minutes, registering my disgust throughout the world.	Comic Book Guy			
Stop right there! I have the only working fazer ever built. It was fired only once to keep William Shatner from making another album.	Comic Book Guy			
The Internet King? I wonder if he could provide faster nudity... .	Comic Book Guy			
Oh, loneliness and cheeseburgers are a dangerous mix.	Comic Book Guy			
That is a rare photo of Sean Connery signed by Roger Moore.	Comic Book Guy			
Hello. I am not interested in buying your house, but I would like to use your rest room, flip through your magazines, rearrange your carefully shelved items and handle your food products in an unsanitary manner. Ha! Now you know how it feels!)	Apu Na...
Hey, hey, this is not a lending library. If you're not going to buy that thing put it down or I'll blow your heads off	Apu Nahasapemapetilon			
Shiva H. Vishnu!	Apu Nahasapemapetilon			
Big deal! When I was a pup, we got spanked by presidents 'til the cows came home! Grover Cleveland spanked me on two non-consecutive occasions!	Grandpa Simpson			
My Homer is not a communist.  He may be a liar, a pig, an idiot, a communist, but he is not a porn star.	Grandpa Simpson			
Dear Mr. President, There are too many states nowadays. Please eliminate three. P.S. I am not a crackpot.	Grandpa Simpson			

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

ignorance! It must have been Tim. I wouldn't know a Trondheim
Hammer if it fell on my foot!</p>
<p class='source'>Steve Majewski, 10 Jan 1995</p>
<p class='quotation' id='q23'>(Aieee! Yet another thing on my TODO
pile!)</p>
<p class='source'>A.M. Kuchling, 10 Jan 1995</p>
<p class='quotation' id='q24'>[After someone wrote "...assignment
capability, a la djikstra"] Ehh, the poor old man's name is
Dijkstra. I should know, "ij" is a well known digraph in the Dutch
language. And before someone asks the obvious: his famous "P and V"
names for semaphores are derived for the Dutch words "Passeer" and
"Verlaat", or "Pass" and "Leave". And no, I haven't met him
(although he did work at CWI back in the fifties when it was
called, as it should still be today, Mathematical Centre). he
currently lives in Austin, Texas I believe. (While we're at it...
does anybody remember the Dijkstra font for Macintoshes? It was a
scanned version of his handwriting. I believe Luca Cardelli scanned
it -- the author of Obliq, a somewhat Python-like distributed
language built on Modula-3. I could go on forever... :-)</p>
<p class='source'>Guido van Rossum, 19 Jan 1995</p>
<p class='quotation' id='q25'>As always, I'll leave it to a

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

added benefit is that John Cleese is teaching Guido how to walk
funny.
(3) Pre-Release vacations are spent in the
Catskills. Post-Release vacations are spent in the Bahamas. Guido
is currently working on a system which will allow him to make more
releases of Python; thus octupling the number of vacations he takes
in a year.</p>
<p class='source'>Matthew Lewis Carroll Smith, 4 Apr 1997</p>
<p class='quotation' id='q42'>I mean, just take a look at Joe
Strout's brilliant little "python for beginners" page. Replace all
print-statements with <code>sys.stdout.write( string.join(map(str,
args)) + "\n")</code> and you surely won't get any new beginners.
And That Would Be A Very Bad Thing.</p>
<p class='source'>Fredrik Lundh, 27 Aug 1996</p>
<p class='quotation' id='q43'>Ya, ya, ya, except ... if I were
built out of KSR chips, I'd be running at 25 or 50 MHz, and would
be wrong about ALMOST EVERYTHING almost ALL THE TIME just due to
being a computer! Think about it -- when's the last time you spent
20 hours straight debugging your
son/wife/friend/neighbor/dog/ferret/snake? And they <em>still</em>
fell over anyway? Except in a direction you've never seen before



( run in 1.625 second using v1.01-cache-2.11-cpan-49f99fa48dc )