This small program, quinify, produces a quining wrapper around any suitably simple perl program. The quined version writes its source to STDERR so that STDOUT remains available to the wrapped code. The program to wrap can be provided by a list of files on the command line,
$ quinify file1 file2 file3
through a pipe,
$ cat file.pl | quinify - | perl -w - 2>filequine.pl
or from the keyboard,
$ quinify >Quinequote
my $string = 'yields falsehood when preceded by its quotation';
print "'$string' $string.$/";
^D
Some of the usage is *nicentric.
'Suitably simple' means
Here's the code:
I use reverse to mung the source in data, mostly for visual effect. Any encryption-decryption scheme may be used, or none at all.#!/usr/bin/perl -w use strict; { my @lines = map { chomp; $_ } <DATA>; # magical input permits interactive, piped, or # batch operation. push @lines, map { chomp; $_ } <>; { local $, = $/; print @lines,'__DATA__', reverse @lines; } } __DATA__ #!/usr/bin/perl -w use strict; { # This block prints the source to this program on stderr. # It quines there so that scripts which write to stdout # can operate unimpeded. Generated by quinify. my @ary= map { chomp; $_ } <DATA>; { local $,=$/; print STDERR reverse( @ary ), '__DATA__', @ary; } }
This may look familiar. I used a previous version, with a mildly obfuscated __DATA__ section, to quine There can be only one! in But There Are Two! .
After Compline,
Zaxo
In reply to Quine code with quinify by Zaxo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |