Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Short quines

by jdalbec (Deacon)
on Jan 12, 2008 at 15:36 UTC ( #662072=note: print w/ replies, xml ) Need Help??


in reply to Re: Short quines
in thread Short quines

If you use <code> tags your quine becomes much simpler:

use strict; use LWP; use HTTP::Request; my $ua = LWP::UserAgent::new ('LWP::UserAgent'); LWP::UserAgent::agent ($ua, 'Mozilla/5.0'); my $url = "http://www.perlmonks.org/?displaytype=displaycode;node_id=6 +62072"; my $request = HTTP::Request::new ('HTTP::Request', GET => $url); my $response = LWP::UserAgent::request ($ua, $request); print $response->content;
Also, you don't break formatting for replies to your node.

Edit: I think you want a question mark after dot-star. Otherwise it's q-positively trivial for me to break your code.

Edit2: I just realized that, if you put a question mark after dot-star, the end of your regex matches itself. But there are ways around that.


Comment on Re^2: Short quines
Download Code
Re^3: Short quines
by ambrus (Abbot) on Jan 12, 2008 at 18:26 UTC

    As the title of this thread is "short quines", let me shorten that code a bit.

    use LWP::Simple;getprint"http://tinyurl.com/ynp5kp"

    Update: fixed code. It should now work.

    Update 2012-05-24:</c> see also Usually J.A.P.H..

Re^3: Short quines
by Snarius (Sexton) on Jan 12, 2008 at 19:21 UTC
    I tried using <code. It renders > as & gt; or something. I actually tried to eliminate the >'s from my code, which is why there are lines like LWP::UserAgent::request ($ua, $request); instead of $ua->request ($request);.

      I'm quite sure that the displaytype=displaycode cgi argument makes perlmonks return the code as plain text, not HTML, so the angle brackets shouldn't be a problem.

      Let me try.

      use warnings; use strict; my $u = "http://perlmonks.com/?node_id=662172;displaytype=displaycode" +; use LWP; print LWP::UserAgent->new->get($u)->content;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://662072]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-08-20 13:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (113 votes), past polls