view release on metacpan or search on metacpan
Amethyst/Brain.pm view on Meta::CPAN
package Amethyst::Brain;
use strict;
use Data::Dumper;
use POE;
sub new {
my $class = shift;
my $self = ($#_ == 0) ? { %{ (shift) } } : { @_ };
return bless $self, $class;
}
sub init {
my ($self) = @_;
# Not overriding this is not fatal.
}
sub think {
my ($self, $messages, @args) = @_;
die "Think not implemented by brain";
Amethyst/Brain/Infobot/Module.pm view on Meta::CPAN
# Custom process sub;
}
elsif ($class->can('action') ne __PACKAGE__) {
die "No Regex or process subroutine in $class"
unless $self->{Regex};
}
else {
die "No action subroutine in $class";
}
return bless $self, $class;
}
sub init {
my $self = shift;
}
sub reply_to {
my ($self, $message, $text) = @_;
my $reply = $message->reply($text);
# Unless it's a tell
Amethyst/Brain/Infobot/Module/BabyTime.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'BabyTime',
# Regex => qr/^(what is the? )?babytime/i,
Usage => '(what is the )? babytime in <language>',
Description => "Print the time for babies.",
@_
);
return bless $self, $class;
}
sub process {
my ($self, $message) = @_;
my $content = lc $message->content;
$content =~ s/\s+/ /g;
$content =~ s/^what is the //;
return undef unless $content =~ /^babytime/;
Amethyst/Brain/Infobot/Module/Cool.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Cool',
Regex => qr/^(?:neat|cool)(?:[!.])?$/i,
Usage => 'cool',
Description => "Be Cool",
@_
);
return bless $self, $class;
}
sub action {
my ($self, $message) = @_;
my $reply = $self->reply_to($message, 'cool ' x (2 + rand(5)));
$reply->send;
return 1;
}
Amethyst/Brain/Infobot/Module/Exchange.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Exchange',
Regex => qr/^(?:ex)?change\s+(\d+)\s+(\w+)\s+(?:into|to|for)\s+(\w+)/x,
Usage => '(ex)?change 100 USD for DEM',
Description => "Convert currencies",
@_
);
return bless $self, $class;
}
sub init {
my $self = shift;
eval { spawn POE::Component::Client::UserAgent; };
if ($@) {
die $@ unless $@ =~ /^alias is in use by another session/;
}
Amethyst/Brain/Infobot/Module/Excuse.pm view on Meta::CPAN
my $self = $class->SUPER::new(
Name => 'Excuse',
Regex => qr/^(give me an? )?excuse$/i,
Usage => '((?:give me an)? excuse)',
Description => "Get an excuse from the excuse " .
"server.",
@_
);
return bless $self, $class;
}
sub action {
my ($self, $message) = @_;
my $reply = $self->reply_to($message, $self->excuse());
$reply->send;
return 1;
}
Amethyst/Brain/Infobot/Module/Fortune.pm view on Meta::CPAN
my $self = $class->SUPER::new(
Name => 'Fortune',
Regex => qr/^(give me a? )?fortune$/i,
Usage => '((?:give me a)? fortune)',
Description => "Get a fortune from the fortune " .
"server.",
@_
);
return bless $self, $class;
}
sub action {
my ($self, $message) = @_;
my $reply = $self->reply_to($message, $self->fortune());
$reply->send;
return 1;
}
Amethyst/Brain/Infobot/Module/Google.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Google',
Regex => qr/^(?:google|search)\s+for\s+(.*)$/i,
Usage => '(google|search) for .*',
Description => "Search Google",
@_
);
return bless $self, $class;
}
sub init {
my $self = shift;
eval {
spawn POE::Component::Client::UserAgent(
agent => 'Lynx/2.8rel.1 libwww-FM/2.14',
);
};
Amethyst/Brain/Infobot/Module/Help.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Help',
Regex => qr/^\s*help\b/i,
Usage => 'help [<module>]',
Description => "Help handler",
@_
);
return bless $self, $class;
}
sub action {
my ($self, $message) = @_;
my $content = $message->content;
$content =~ s/\s+/ /g;
my $re = qr/(\(.*?\)|[^(++)(--)\s]+)(\+\+|--)/;
Amethyst/Brain/Infobot/Module/Insult.pm view on Meta::CPAN
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Insult',
Regex => qr/^insult (.*)$/i,
Usage => 'insult (.*)',
Description => "Insult someone.",
@_
);
return bless $self, $class;
}
sub action {
my ($self, $message) = @_;
my %states = map { $_ => "handler_$_" } qw(
_start connect failure read
);
print STDERR "Creating child session for insult\n";
Amethyst/Brain/Infobot/Module/Karma.pm view on Meta::CPAN
Regex => qr/(?:karma|\+\+|--)/i,
Usage => '<foo>++|<foo>--|karma <foo>',
Description => "Karma handler",
@_
);
$self->{Store} = new Amethyst::Store(
Source => 'karma',
);
return bless $self, $class;
}
sub karma_get { return $_[0]->{Store}->get($_[1]); }
# These two can warn about undef
sub karma_inc {
my ($self, $term) = @_;
my $store = $self->{Store};
my $val = $store->get($term);
$store->set($term, $val ? ($val + 1) : 1); # Avoid warning
Amethyst/Brain/Infobot/Module/Math.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Math',
Usage => 'Evaluates mathematical expressions',
Description => "Math handler",
@_
);
return bless $self, $class;
}
sub process {
my ($self, $message) = @_;
my $content = $message->content;
my $base = 10;
$content =~ s/^what\s+is\s+//i;
$content =~ s/[.?!]$//g;
Amethyst/Brain/Infobot/Module/Nslookup.pm view on Meta::CPAN
sub new {
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Nslookup',
Regex => qr/^(?:resolve|nslookup)\s+(.*)$/i,
Usage => 'resolve|nslookup .*',
Description => "Resolve names/IPs",
@_
);
return bless $self, $class;
}
sub init {
my $self = shift;
spawn POE::Component::Client::DNS;
}
sub action {
my ($self, $message, $addr) = @_;
Amethyst/Brain/Infobot/Module/Purldoc.pm view on Meta::CPAN
return undef if $any_bad;
my $self = $class->SUPER::new(
Name => 'Purldoc',
Regex => qr/^p[ue]rldoc (.*)$/i,
Usage => 'purldoc (.*)',
Description => "Get related FAQ questions",
@_
);
return bless $self, $class;
}
sub action {
my ($self, $message, $what) = @_;
my @results;
my $output = $self->purldoc_lookup($what, \@results);
if (@results) {
Amethyst/Brain/Infobot/Module/Statement.pm view on Meta::CPAN
my @stores = ($self->{WriteStore});
foreach (@{ $self->{Infobot}->{FactoidRead} }) {
my $store = new Amethyst::Store(
Source => $_,
);
push(@stores, $store);
}
$self->{Stores} = \@stores;
return bless $self, $class;
}
sub forget {
my ($self, $message, $key) = @_;
my $filter = qr/./;
my $msg = undef;
my $data = undef;
print STDERR "Forget: $key\n";
Amethyst/Brain/Infobot/Module/Time.pm view on Meta::CPAN
$zones{$x} = $_;
$x =~ s,.*/,,;
$zones{$x} = $_ unless exists $zones{$x};
}
# Special cases... *cough*
$zones{bath} = $zones{london};
$self->{Zonemap} = \%zones;
return bless $self, $class;
}
sub process {
my ($self, $message) = @_;
my $content = lc $message->content;
$content =~ s/\s+/ /g;
unless (($content =~ /^what is the time/) ||
($content =~ /^what time is it/) ||
Amethyst/Brain/Infobot/Module/Zappa.pm view on Meta::CPAN
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Zappa',
Regex => qr/^(be zappa)$/i,
Usage => 'be zappa',
Description => "gives you a random quote from " .
"Frank Zappa",
@_
);
return bless $self, $class;
}
sub action {
my ($self, $message) = @_;
my $reply = $self->reply_to($message, $self->quote());
$reply->send;
return 1;
}
Amethyst/Brain/Infobot/Module/Zappa.pm view on Meta::CPAN
The real question is: Is it possible to laugh while fucking?
The single-child yuppo-family that uses the child as a status object: `A perfect child? Of course! We have one here -- he's under the coffee table. Ralph, stand up! Play the violin!'
Americans like to talk about (or be told about) Democracy but, when put to the test, usually find it to be an 'inconvenience.' We have opted instead for an authoritarian system disguised as a Democracy. We pay through the nose for an enormous joke-...
In every language, the first word after 'Mama!' that every kid learns to say is 'Mine!' A system that doesn't allow ownership, that doesn't allow you to say 'Mine!' when you grow up, has -- to put it mildly -- a fatal design flaw.
From the time Mr. Developing Nation was forced to read _The Little Red Book_ in exchange for a blob of rice, till the time he figured out that waiting in line for a loaf of pumpernickel was boring as fuck, took about three generations. ...
Decades of indoctrination, manipulation, censorship and KGB excursions haven't altered this fact: People want a piece of their own little Something-or-Other, and, if they don't get it, have a tendency to initiate counterrevolution.
If it sounds GOOD to YOU, it's bitchen; and if it sounds BAD to YOU, it's shitty.
The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows.
In the fight between you and the world, back the world.
Let's not be too tough on our own ignorance. It's the thing that makes America great. If America weren't incomparably ignorant, how could we have tolerated the last eight years?
Lord have mercy on the people in England for the terrible food these people must eat. And Lord have mercy on the fate of this movie and God bless the mind of the man in the street.
Interviewer: So Frank, you have long hair. Does that make you a woman? FZ: You have a wooden leg. Does that make you a table?
If your children ever find out how lame you really are, they'll gonna murder you in your sleep....-- Whole Grains
I'm not a man for all seasons but I'm doing something right. -- Frank Zappa during the Senate PMRC hearings.
Ugly as I mights be, I is your futum!
There is no hell. There is only France.
`Conducting' is when you draw `designs' in the nowhere -- with your stick, or with your hands -- which are interpreted as `instructional messages' by guys wearing bow ties who wish they were fishing.
Without music to decorate it, time is just a bunch of boring production deadlines or dates by which bills must be paid.
The bassoon is one of my favorite instruments. It has the medieval aroma -- like the days when everything used to sound like that.
Some people crave baseball -- I find this unfathomable -- but I can easily understand why a person could get excited about playing a bassoon.
Whatever you have to do to have a good time, let's get on with it, so long as it doesn't cause a murder.
Amethyst/Brain/Infobot/Module/Zippy.pm view on Meta::CPAN
my $class = shift;
my $self = $class->SUPER::new(
Name => 'Zippy',
Regex => qr/^(be zippy|yow)$/i,
Usage => 'be zippy|yow',
Description => "gives you a random quote from " .
"Zippy the Pinhead",
@_
);
return bless $self, $class;
}
sub action {
my ($self, $message) = @_;
my $reply = $self->reply_to($message, $self->yow());
$reply->send;
return 1;
}
Amethyst/Message.pm view on Meta::CPAN
sub ACT_EMOTE () { 1; }
sub CHAN_PRIVATE () { '_tell' }
sub DESTROY { } # Don't autoload
sub new {
my $class = shift;
my $self = ($#_ == 0) ? { %{ (shift) } } : { @_ };
$self->{Hints} = { } unless exists $self->{Hints};
return bless $self, $class;
}
sub AUTOLOAD {
my $func = $AUTOLOAD;
$func =~ s/.*:://;
if ($VALID{$func}) {
my $key = ucfirst $func;
eval qq {
sub $func {
my \$self = shift;
Amethyst/Store.pm view on Meta::CPAN
@EXPORT = qw();
sub new {
my $class = shift;
my $self = ($#_ == 0) ? { %{ (shift) } } : { @_ };
die "No source for store" unless $self->{Source};
my %data;
my $dbm = tie %data, 'MLDBM', $self->{Source}, O_CREAT|O_RDWR, 0640
or die "tie: $self->{Source}: $!";
$self->{Data} = \%data;
return bless $self, $class;
}
sub get { return $_[0]->{Data}->{$_[1]}; }
sub set { $_[0]->{Data}->{$_[1]} = $_[2]; }
sub unset { delete $_[0]->{Data}->{$_[1]}; }
sub keys { return keys %{ $_[0]->{Data} }; }
1;
factpacks/old_test_meanings.fact view on Meta::CPAN
Barabbas => son of shame, confusion
Barachel => that bows before God
Barachias => same as Barachel
Barak => thunder, or in vain
Barjesus => son of Jesus or Joshua
Barjona => son of a Jona; of a dove
Barnabas => son of the prophet, or of consolation
Barsabas => son of return; son of rest
Bartholomew => a son that suspends the waters
Bartimeus => son of the honorable
Baruch => who is blessed
Barzillai => son of contempt; made of iron
Bashan => in the tooth, in ivory
Bashemath => perfumed; confusion of death; in desolation
Bathsheba => the seventh daughter; the daughter of satiety
Bathsuha => same as Bathsheba
Bealiah => the god of an idol; in an assembly
Bealoth => cast under
Bebai => void, empty
Becher => first begotten; first fruits
Bechorath => first fruits
factpacks/old_test_meanings.fact view on Meta::CPAN
Benhail => son of strength
Benhanan => son of grace
Benjamin => son of the right hand
Benimi => our sons
Beno => his son
Benoni => son of my sorrow, or pain
Benzoheth => son of separation
Beon => in affliction
Beor => burning; foolish; mad
Bera => a well; declaring
Berachah => blessing; bending the knee
Berachiah => speaking well of the Lord
Beraiah => the choosing of the Lord
Berea => heavy; weighty
Bered => hail
Beri => my son; my corn
Beriah => in fellowship; in envy
Berith => covenant
Bernice => one that brings victory
Berodach-baladan => the son of death
Berothai => wells; a cypress
factpacks/techdict.fact view on Meta::CPAN
Enhanced Small Device Interface => (ESDI) This was a popular form of hard drive and controller before IDE took over the PC market.
Environment => Normally, this is your surroundings. In your computer, the environment is what a group of variables are set to. Think of it as your computer's surroundings.
EPIC => see Explicitly Parallel Instruction Computing.
ESCD => (Extended System Configuration Data) This is setup data that is stored in a Plug-and-Play-compatible system BIOS. It consists of the system resource requirements of legacy (non PNP) devices, and the last working configuration of Plug-and-Play...
ESDI => see Enhanced Small Device Interface.
Expansion Slot => Refers to any type of slot in a computer that you can plug an expansion card into. Generally, it's limited to ISA, EISA, PCI, and PCMCIA, but there are other types and there will be more in the future.
Explicitly Parallel Instruction Computing => (EPIC) This is Intel and Hewlett-Packard's invention, designed to be used on Intel's forthcoming Merced processor. It is a method for arranging instructions so that they are ordered to be explicitly parall...
Extended Binary Coded Decimal Interchange Code => (EBCDIC) This is a way of encoding 256 characters in binary, much like ASCII, but used mainly on mainframes. Most of the time, EBCDIC is only mentioned in translations between EBCDIC and ASCII.
Extended partition => This is a type of partition that is an extension of a primary partition. It's possible to have many extended partitions on a hard drive.
Extranet => An Extranet is an intranet that extends onto the Internet. Confusing? Yes. Extranets are external extensions of a company's intranet that allow certain people to interact from the Internet. Not all intranets are Extranets.
Fabless => This term refers to a company that produces chips but doesn't own a fabrication plant, or fab. These companies are starting to become more and more successful at creating chips and renting out other companies' excess fabs to produce their ...
Fabrication Plant => A fab is a factory that takes raw silicon wafers and creates chips with them. Often, fabs are categorized by what micron process they use. For example, the Intel Pentium chip with MMX is produced in a fab with a 0.35 micron proce...
FAQ => (Frequently Asked Questions) This is a document that lists the most common questions about something (with the answers, of course).
Fast SCSI 2 => This version of SCSI transfers data at 10 Mbps. The connections all contain 50 pins. See also Fast-Wide SCSI 2.
Fast-SCSI => Plain vanilla fast-SCSI never really existed. See Fast-SCSI 2
Fast-Wide SCSI 2 => This version of SCSI upped the pin count to 68, effectively doubling the signal speed of Fast-SCSI 2 to 20 Mbps.
Fat Client => Today's fast PCs are fat clients. They've got lots of memory and big hard drives. They store information and run programs locally off of their hard drives. Fat clients usually work in client/server environments, where they leave the ser...
FCC => (Federal Communications Commission) These are the people in the government who decide what's legal and illegal to broadcast, including what frequencies are allowed to be used by whom.
FDDI => (Fiber Distributed Data Interface) This is a fiber optic interface that allows data to travel extreme distances (many miles/kilometers) without signal loss. It is far superior to copper wire for data integrity as well. FDDI is often used to c...
Feature => A feature is something that a piece of hardware or software is designed to do. Many things that appear to be bugs are actually features. Often, a hardware or software developer will have to make a tradeoff in functionality that causes some...
Fiber Optic => A method of transmission alternative to copper. The way it works is by pulsing light down a strand of glass. These pulses represent binary code. So far, that's no better than copper. The advantage is that a single strand of fiber optic...