Skip Menu |

This queue is for tickets about the Acme-Crap CPAN distribution.

Report information
The Basics
Id: 84030
Status: open
Priority: 0/
Queue: Acme-Crap

People
Owner: Nobody in particular
Requestors: victor.adam [...] derpymail.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: crap!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11111111111111111!!!!!!!!!!!1111!!!111!!!!!
Date: Mon, 18 Mar 2013 23:18:07 +0100
To: bug-acme-crap [...] rt.cpan.org
From: Victor ADAM <victor.adam [...] derpymail.org>
Howdy, Sometimes, trailing exclamation marks just aren't enough to express one's degree of frustration. The traditional way to vent that much anger is to interleave them with '1' digits. However, Acme::Crap currently doesn't support this, which puts an unnecessary upper bound on the amount of emphasis it can express—exclamation marks getting asymptotically bland. I may get myself to write a working patch, if you like the idea. Your faithful student, Victor Adam
Subject: Re: [rt.cpan.org #84030] crap!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11111111111111111!!!!!!!!!!!1111!!!111!!!!!
Date: Thu, 21 Mar 2013 17:54:03 +0100
To: bug-Acme-Crap [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Hi Victor, I'd be delighted to receive a patch for Acme::Crap!!!!11111!!!!11111 Feel free to send it along any time. Show quoted text
> Your faithful student,
Hmmmm. More like: <Palpatine>My young...apprentice!</Palpatine> Show quoted text
>;-)
Damian
Subject: Re: [rt.cpan.org #84030] crap!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11111111111111111!!!!!!!!!!!1111!!!111!!!!!
Date: Fri, 22 Mar 2013 16:30:34 +0100
To: bug-Acme-Crap [...] rt.cpan.org
From: Victor ADAM <victor.adam [...] derpymail.org>
Howdy, I toyed around with symbol table manipulation and `use overload::constant', but it seems that neither of those is appropriate here. I finally implemented crap!1 using a source filter, which is nowhere near as elegant as your original solution. Do with it as you please, I had fun writing it anyway. The contextual diff follows, the full source is attached. Your young apprentice, Victor Adam --- old/Crap.pm 2013-03-22 15:39:28.461728689 +0100 +++ /home/grimy/perl/lib/site_perl/5.16.2/Acme/Crap.pm 2013-03-22 16:11:50.153755536 +0100 @@ -7,57 +7,32 @@ use strict; use Carp; -sub deref { my ($self) = @_; return ${$self}; } +use Perl6::Export::Attrs; +use Filter::Simple; -use overload ( - q{!} => sub { Acme::Crap::Negated->new(&deref) }, - q{""} => \&deref, - q{0+} => \&deref, - q{bool} => \&deref, - - fallback => 1, -); - -sub import { - overload::constant q => sub { my $val = $_[1]; bless \$val, 'Acme::Crap' }; - - no strict qw( refs ); - *{caller().'::crap'} = sub { - local $Acme::Crap::no_negation = 1; - @_ = map {"$_"} @_; - goto &Carp::carp; - } -} - -package Acme::Crap::Negated; - -sub new { - my ($class, $val) = @_; - bless { val => $val, degree => 1 }, $class; +FILTER_ONLY code_no_comments => sub { + # Pass trailing '!'s and '1's as the first argument to crap + # '§'s are supported for compatibility with azerty keyboards + s/ \b crap \b ( [!1§]* ) /crap q{$1},/gxms; +}; + +sub crap : Export(:DEFAULT) { + my ($suffix, @args) = @_; + $args[0] //= q{I just don't know what went wrong}; + @_ = map { _emphasize(length $suffix, $_) } @args, $suffix; + goto &Carp::carp; } -sub value { - my ($self) = @_; - if ($Acme::Crap::no_negation) { - given ($self->{degree}) { - when (1) { return ucfirst "$self->{val}!" } - when (2) { return join q{}, map { ucfirst $_ } split /(\s+)/, "$self->{val}!!" } - default { return uc $self->{val} . '!' x $_ } - } +sub _emphasize { + my ($degree, $msg) = @_; + given ($degree) { + when (0) { $msg } + when (1) { ucfirst $msg } + when (2) { join q{}, map { ucfirst $_ } split /(\s+)/, $msg } + default { uc $msg } } - return !$self->{val} if $self->{degree} % 2; - return !!$self->{val}; } -use overload ( - q{!} => sub { my ($self) = @_; $self->{degree}++; return $self; }, - q{""} => \&value, - q{0+} => \&value, - q{bool} => \&value, - - fallback => 1, -); - 1; # Magic true value required at end of module __END__ @@ -111,8 +86,19 @@ =head1 DEPENDENCIES -None. +Acme::Crap depends on the following modules: + +=over + +=item * + +Perl6::Export::Attrs; + +=item * + +Filter::Simple; +=back =head1 INCOMPATIBILITIES ===END DIFF=== 2013/3/21 damian@conway.org via RT <bug-Acme-Crap@rt.cpan.org>: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=84030 > > > Hi Victor, > > I'd be delighted to receive a patch for Acme::Crap!!!!11111!!!!11111 > Feel free to send it along any time. > >
>> Your faithful student,
> > Hmmmm. More like: <Palpatine>My young...apprentice!</Palpatine> >
>>;-)
> > Damian >

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #84030] crap!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11111111111111111!!!!!!!!!!!1111!!!111!!!!!
Date: Fri, 22 Mar 2013 20:29:23 +0100
To: bug-Acme-Crap [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Thanks, Victor. Cool mod, but I don't think I'll incorporate it into the module. I've sworn off source filters! ;-) But please fell free to fork the module (maybe as Acme::Crap::11111111) if you feel so inclined. All the very best, Damian