Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
2
Task/Quine/Perl/quine-1.pl
Normal file
2
Task/Quine/Perl/quine-1.pl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$s = q($s = q(%s); printf($s, $s);
|
||||
); printf($s, $s);
|
||||
3
Task/Quine/Perl/quine-2.pl
Normal file
3
Task/Quine/Perl/quine-2.pl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
seek(DATA, 0, 0);
|
||||
print <DATA>
|
||||
__DATA__
|
||||
1
Task/Quine/Perl/quine-3.pl
Normal file
1
Task/Quine/Perl/quine-3.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
open ME, $0 and print <ME>;
|
||||
1
Task/Quine/Perl/quine-4.pl
Normal file
1
Task/Quine/Perl/quine-4.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
open 0; print <0>;
|
||||
1
Task/Quine/Perl/quine-5.pl
Normal file
1
Task/Quine/Perl/quine-5.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
$_=q{print"\$_=q{$_};eval"};eval
|
||||
47
Task/Quine/Perl/quine-6.pl
Normal file
47
Task/Quine/Perl/quine-6.pl
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{local$_=q{
|
||||
{
|
||||
package Quine;
|
||||
use strict;
|
||||
use warnings;
|
||||
our $VERSION = sprintf "%d.%02d", q$Revision: 0.2 $ =~ /(\d+)/g;
|
||||
my $head = '{local$_=q' . "\x7B\n";
|
||||
my $tail = 'print"{local\$_=q{$_};eval}\n"' . "\x7D;eval}\n";
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $quine = $head . shift;
|
||||
my $ret = shift || 1;
|
||||
my $ln = ( $quine =~ tr/\n/\n/ );
|
||||
$ln++;
|
||||
$quine .= "return $ret if caller(1)or(caller)[2]!=$ln;$tail";
|
||||
bless \$quine, $class;
|
||||
}
|
||||
|
||||
sub from_file {
|
||||
my ( $class, $fn, $ret ) = @_;
|
||||
local $/;
|
||||
open my $fh, '<', $fn or die "$fn : $!";
|
||||
my $src = <$fh>;
|
||||
close $fh;
|
||||
$class->new( $src, $ret );
|
||||
}
|
||||
|
||||
sub quine { ${ $_[0] } }
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Quine - turn your perl modules/apps into a true quine!
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
$Id: Quine.pm,v 0.2 2010/09/15 20:23:53 dankogai Exp dankogai $
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Quine;
|
||||
print Quine->from_file("woot.pl")->quine;
|
||||
print Quine->from_file("moot.psgi", '$app')->quine;
|
||||
|
||||
=cut
|
||||
}
|
||||
return 1 if caller(1);print"{local\$_=q{$_};eval}\n"};eval}
|
||||
Loading…
Add table
Add a link
Reference in a new issue