Earlier today I saw a recent blog post from Gabor Szabo. In it, he shows a very concise way to handle Basic Authentication using LWP::UserAgent. Now, what if you had a problem running the script? How might you go about debugging it? You could add a bunch of print statements. Maybe dump the request and the response objects. That's entirely valid, but I want to show you a slightly simpler way of going about it, using LWP::ConsoleLogger::Easy.

Gabor's original script looks like this:

use strict; use warnings; use v5.10; use LWP::UserAgent; use HTTP::Request::Common; my $ua = LWP::UserAgent->new(); my $request = GET 'https://pause.perl.org/pause/authenquery'; $request->authorization_basic('szabgab', '*******'); my $response = $ua->request($request); say $response->as_string(); 1 2 3 4 5 6 7 8 9 10 11 12 13 use strict ; use warnings ; use v5 . 10 ; use LWP:: UserAgent ; use HTTP:: Request:: Common ; my $ua = LWP:: UserAgent-> new ( ) ; my $request = GET 'https://pause.perl.org/pause/authenquery' ; $request -> authorization_basic ( 'szabgab' , '*******' ) ; my $response = $ua -> request ( $request ) ; say $response -> as_string ( ) ;

Let's run it to see what the output looks like.

olaf$ perl gabor.pl HTTP/1.0 401 Unauthorized Connection: close Date: Thu, 29 Sep 2016 02:07:34 GMT WWW-Authenticate: Basic realm="PAUSE" Content-Length: 22 Content-Type: text/plain Client-Date: Thu, 29 Sep 2016 02:07:34 GMT Client-Peer: 207.171.7.119:443 Client-Response-Num: 1 Client-SSL-Cert-Issuer: /C=US/O=GeoTrust, Inc./CN=RapidSSL CA Client-SSL-Cert-Subject: /serialNumber=K6R2GP4nh37grllJm9PZlQm0SS-oSNZ4/C=DE/O=pause.perl.org/OU=GT38611495/OU=See www.rapidssl.com/resources/cps (c)11/OU=Domain Control Validated - RapidSSL(R)/CN=pause.perl.org Client-SSL-Cipher: AES128-GCM-SHA256 Client-SSL-Socket-Class: IO::Socket::SSL Authorization required 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 olaf $ perl gabor . pl HTTP / 1 . 0 401 Unauthorized Connection : close Date : Thu , 29 Sep 2016 02 : 07 : 34 GMT WWW - Authenticate : Basic realm = "PAUSE" Content - Length : 22 Content - Type : text / plain Client - Date : Thu , 29 Sep 2016 02 : 07 : 34 GMT Client - Peer : 207 . 171 . 7 . 119 : 443 Client - Response - Num : 1 Client - SSL - Cert - Issuer : / C = US/O=GeoTrust, Inc./CN = RapidSSL CA Client - SSL - Cert - Subject : / serialNumber = K6R2GP4nh37grllJm9PZlQm0SS - oSNZ4/C=DE/O=pause.perl.org/OU=GT38611495/OU=See www.rapidssl.com/resources/cps (c)11/OU=Domain Control Validated - RapidSSL(R)/CN = pause . perl . org Client - SSL - Cipher : AES128 - GCM - SHA256 Client - SSL - Socket - Class : IO:: Socket :: SSL Authorization required

Here's the debugging version. Note the important changes are on lines 4 and 9.

use strict; use warnings; use v5.10; use LWP::ConsoleLogger::Easy qw( debug_ua ); use LWP::UserAgent; use HTTP::Request::Common; my $ua = LWP::UserAgent->new(); debug_ua( $ua ); my $request = GET 'https://pause.perl.org/pause/authenquery'; $request->authorization_basic( 'szabgab', '*******' ); my $response = $ua->request($request); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 use strict ; use warnings ; use v5 . 10 ; use LWP:: ConsoleLogger:: Easy qw ( debug_ua ) ; use LWP:: UserAgent ; use HTTP:: Request:: Common ; my $ua = LWP:: UserAgent-> new ( ) ; debug_ua ( $ua ) ; my $request = GET 'https://pause.perl.org/pause/authenquery' ; $request -> authorization_basic ( 'szabgab' , '*******' ) ; my $response = $ua -> request ( $request ) ;

The output we get is:

olaf$ perl basic-authentication.pl GET https://pause.perl.org/pause/authenquery .----------------+----------------------------. | Request Header | Value | +----------------+----------------------------+ | Authorization | Basic c3phYmdhYjoqKioqKioq | | User-Agent | libwww-perl/6.15 | '----------------+----------------------------' ==> 401 Unauthorized .-------------------------+-----------------------------------------------------------------------------------------. | Response Header | Value | +-------------------------+-----------------------------------------------------------------------------------------+ | Client-Date | Thu, 29 Sep 2016 01:54:23 GMT | | Client-Peer | 207.171.7.119:443 | | Client-Response-Num | 1 | | Client-SSL-Cert-Issuer | /C=US/O=GeoTrust, Inc./CN=RapidSSL CA | | Client-SSL-Cert-Subject | /serialNumber=K6R2GP4nh37grllJm9PZlQm0SS-oSNZ4/C=DE/O=pause.perl.org/OU=GT38611495/OU=- | | | See www.rapidssl.com/resources/cps (c)11/OU=Domain Control Validated - RapidSSL(R)/CN=- | | | pause.perl.org | | Client-SSL-Cipher | AES128-GCM-SHA256 | | Client-SSL-Socket-Class | IO::Socket::SSL | | Connection | close | | Content-Length | 22 | | Content-Type | text/plain | | Date | Thu, 29 Sep 2016 01:54:23 GMT | | WWW-Authenticate | Basic realm="PAUSE" | '-------------------------+-----------------------------------------------------------------------------------------' .------------------------. | Content | +------------------------+ | Authorization required | '------------------------' .------------------------. | Text | +------------------------+ | Authorization required | '------------------------' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 olaf $ perl basic - authentication . pl GET https : //pause.perl.org/pause/authenquery . -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- -- -- -- -- -- . | Request Header | Value | + -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- -- -- -- -- -- + | Authorization | Basic c3phYmdhYjoqKioqKioq | | User - Agent | libwww - perl / 6 . 15 | '----------------+----------------------------' == > 401 Unauthorized . -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - . | Response Header | Value | + -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + | Client - Date | Thu , 29 Sep 2016 01 : 54 : 23 GMT | | Client - Peer | 207 . 171 . 7 . 119 : 443 | | Client - Response - Num | 1 | | Client - SSL - Cert - Issuer | / C = US/O=GeoTrust, Inc./CN = RapidSSL CA | | Client - SSL - Cert - Subject | / serialNumber = K6R2GP4nh37grllJm9PZlQm0SS - oSNZ4/C=DE/O=pause.perl.org/OU=GT38611495/OU = - | | | See www . rapidssl . com/resources/cps (c)11/OU=Domain Control Validated - RapidSSL(R)/CN = - | | | pause . perl . org | | Client - SSL - Cipher | AES128 - GCM - SHA256 | | Client - SSL - Socket - Class | IO:: Socket :: SSL | | Connection | close | | Content - Length | 22 | | Content - Type | text / plain | | Date | Thu , 29 Sep 2016 01 : 54 : 23 GMT | | WWW - Authenticate | Basic realm = "PAUSE" | '-------------------------+-----------------------------------------------------------------------------------------' . -- -- -- -- -- -- -- -- -- -- -- -- . | Content | + -- -- -- -- -- -- -- -- -- -- -- -- + | Authorization required | '------------------------' . -- -- -- -- -- -- -- -- -- -- -- -- . | Text | + -- -- -- -- -- -- -- -- -- -- -- -- + | Authorization required | '------------------------'

You can see that the debugging version is just one line longer. I added 2 lines and removed a print statement. It prints out a whole pile of (nicely?) formatted information. Let's try running it with valid credentials. (Brace yourself, there's going to be a lot of output.)

olaf$ LWPCL_REDACT_HEADERS='Authorization' perl basic-authentication.pl GET https://pause.perl.org/pause/authenquery .----------------+------------------. | Request Header | Value | +----------------+------------------+ | Authorization | [REDACTED] | | User-Agent | libwww-perl/6.15 | '----------------+------------------' ==> 200 OK .-------------------------+-----------------------------------------------------------------------------------------. | Response Header | Value | +-------------------------+-----------------------------------------------------------------------------------------+ | Cache-Control | no-cache | | Client-Date | Thu, 29 Sep 2016 02:06:02 GMT | | Client-Peer | 207.171.7.119:443 | | Client-Response-Num | 1 | | Client-SSL-Cert-Issuer | /C=US/O=GeoTrust, Inc./CN=RapidSSL CA | | Client-SSL-Cert-Subject | /serialNumber=K6R2GP4nh37grllJm9PZlQm0SS-oSNZ4/C=DE/O=pause.perl.org/OU=GT38611495/OU=- | | | See www.rapidssl.com/resources/cps (c)11/OU=Domain Control Validated - RapidSSL(R)/CN=- | | | pause.perl.org | | Client-SSL-Cipher | AES128-GCM-SHA256 | | Client-SSL-Socket-Class | IO::Socket::SSL | | Connection | close | | Content-Length | 11251 | | Content-Type | text/html; charset=utf-8 | | Date | Thu, 29 Sep 2016 02:06:02 GMT | | Last-Modified | Thu, 29 Sep 2016 02:06:02 GMT | | Link | </pause/pause_favicon.jpg>; rel="shortcut icon"; type="image/jpeg", </pause/pause.css>- | | | ; rel="stylesheet"; title="pause"; type="text/css" | | Pragma | no-cache | | Title | PAUSE: menu | | Vary | accept-encoding | '-------------------------+-----------------------------------------------------------------------------------------' .-------------------------------------------------------------------------------------------------------------------. | Content | +-------------------------------------------------------------------------------------------------------------------+ | <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html | | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/x- | | html"><head><title>PAUSE: menu</title> | | <link rel="shortcut icon" href="/pause/pause_favicon.jpg" type="image/jpeg" /> | | <link rel="stylesheet" type="text/css" href="/pause/pause.css" title="pause"/> | | </head><body bgcolor="white" link="#0000CC" vlink="#0000BB" | | alink="#FF0000" text="#000000"><table width="100%" border="0" | | cellpadding="0" cellspacing="0"><tr><td valign="middle"><a href="authenquery"><img src="/pause/pause2.jpg" | | border="0" alt="PAUSE Logo" | | width="177" height="43" align="left" /></a></td><td nowrap="nowrap"><h4 | | style="margin: 0 0 0 0; padding: 0 1em;">The [Perl programming] Authors Upload | | Server</h4></td><td align="right" style="width: 100%;"><table cellpadding="3" cellspacing="0"><tr><td class="- | | statusencr" nowrap="nowrap">OALDERS <olaf@wundersolutions.com><br />encrypted session</td></tr></table> | | </td></tr></table><br /><form | | action="/pause/authenquery" | | enctype="application/x-www-form-urlencoded" | | method="post"><table border="0" cellpadding="1"><tr><td valign="top"><table width="155" cellspacing="1" cellpad- | | ding="0"><tr><td class="menuheading" colspan="2"><b>Public menu</b></td></tr><tr><td class="menuitem"><a class="- | | menuitem" href="authenquery?ACTION=request_id">Request PAUSE account</a></td><td class="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=pause_04about">About PAUSE</a></td><td cla- | | ss="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=pause_namingmodules">On The Naming of Modu- | | les</a></td><td class="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=pause_05news">PAUSE News</a></td><td class- | | ="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=pause_06history">PAUSE History</a></td><td- | | class="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=pause_04imprint">Imprint/Impressum</a></td- | | ><td class="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=who_pumpkin">List of pumpkins</a></td><td - | | class="menupointer"></td></tr> | | <tr><td class="menuheading" colspan="2"><b>User menu</b></td></tr><tr><td class="menuheading">Files</td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=add_uri">Upload a file to CPAN</a></td><td- | | class="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=show_files">Show my files</a></td><td clas- | | s="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=edit_uris">Repair a Pending Upload</a></td- | | ><td class="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=delete_files">Delete Files</a></td><td cla- | | ss="menupointer"></td></tr> | | <tr><td class="menuheading">Permissions</td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=peek_perms">View Permissions</a></td><td c- | | lass="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=share_perms">Change Permissions</a></td><t- | | d class="menupointer"></td></tr> | | <tr><td class="menuheading">Utils</td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=reindex">Force Reindexing</a></td><td clas- | | s="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=reset_version">Reset Version</a></td><td c- | | lass="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=tail_logfile">Tail Daemon Logfile</a></td>- | | <td class="menupointer"></td></tr> | | <tr><td class="menuheading">Account</td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=edit_cred">Edit Account Info</a></td><td c- | | lass="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=change_passwd">Change Password</a></td><td- | | class="menupointer"></td></tr> | | <tr><td class="menuitem"><a class="menuitem" href="authenquery?ACTION=pause_logout">About Logging Out</a></td><t- | | d class="menupointer"></td></tr> | | </table> | | </td><td valign="top" bgcolor="red" | | > </td><td valign="top"> | | <h2 class="firstheader">Hi Olaf Alders,<br />please choose an action from the menu.</h2> | | <p>The usermenu to the left shows all menus available to | | you, the table below shows descriptions for all menues available | | to anybody on PAUSE.</p> | | <table | | border="0" | | bgcolor="black" | | cellspacing="0" cellpadding="0"><tr><td><table | | bgcolor="white" | | border="0" cellspacing="1" cellpadding="2"><tr | | class="alternate2"><th>Action</th><th>Group</th><th>Description</th></tr> | | <tr class="alternate1"> | | <td><b>Request PAUSE account</b><!-- (request_id) --></td><td>public</td><td>Apply for a PAUSE account.</td></tr> | | <tr class="alternate2"> | | <td><b>Forgot Password?</b><!-- (mailpw) --></td><td>public</td><td>A passwordmailer that sends you a | | password that enables you to set a new | | password.</td></tr> | | <tr class="alternate1"> | | <td><b>About PAUSE</b><!-- (pause_04about) --></td><td>public</td><td>Same as modules/04pause.html on any CPAN s- | | erver</td></tr> | | <tr class="alternate2"> | | <td><b>On The Naming of Modules</b><!-- (pause_namingmodules) --></td><td>public</td><td>A couple of suggestions- | | that hopefully get you on track</td></tr> | | <tr class="alternate1"> | | <td><b>PAUSE News</b><!-- (pause_05news) --></td><td>public</td><td>What's going on on PAUSE</td></tr> | | <tr class="alternate2"> | | <td><b>PAUSE History</b><!-- (pause_06history) --></td><td>public</td><td>Old News</td></tr> | | <tr class="alternate1"> | | <td><b>Imprint/Impressum</b><!-- (pause_04imprint) --></td><td>public</td><td>N/A</td></tr> | | <tr class="alternate2"> | | <td><b>List of pumpkins</b><!-- (who_pumpkin) --></td><td>public</td><td>A list, also available as YAML</td></tr> | | <tr class="alternate1"> | | <td><b>Upload a file to CPAN</b><!-- (add_uri) --></td><td>user</td><td>This is the heart of the <b>Upload | | Server</b>, the page most heavily used on | | PAUSE.</td></tr> | | <tr class="alternate2"> | | <td><b>Show my files</b><!-- (show_files) --></td><td>user</td><td>find . -ls resemblance</td></tr> | | <tr class="alternate1"> | | <td><b>Repair a Pending Upload</b><!-- (edit_uris) --></td><td>user</td><td>When an upload you requested hangs | | for some reason, you can go here and edit | | the file to be uploaded.</td></tr> | | <tr class="alternate2"> | | <td><b>Delete Files</b><!-- (delete_files) --></td><td>user</td><td>Schedule files for deletion. | | There is a delay until the deletion | | really happens. Until then you can also | | undelete files here.</td></tr> | | <tr class="alternate1"> | | <td><b>View Permissions</b><!-- (peek_perms) --></td><td>user</td><td>Whose uploads of what are being indexed on- | | PAUSE</td></tr> | | <tr class="alternate2"> | | <td><b>Change Permissions</b><!-- (share_perms) --></td><td>user</td><td>Enable other users to upload a | | module for any of your namespaces, manage | | your own permissions.</td></tr> | | <tr class="alternate1"> | | <td><b>Force Reindexing</b><!-- (reindex) --></td><td>user</td><td>Tell the indexer to index a file again | | (e.g. after a change in the perms table)</td></tr> | | <tr class="alternate2"> | | <td><b>Reset Version</b><!-- (reset_version) --></td><td>user</td><td>Overrule the record of the current | | version number of a module that the indexer | | uses and set it to 'undef'</td></tr> | | <tr class="alternate1"> | | <td><b>Tail Daemon Logfile</b><!-- (tail_logfile) --></td><td>user</td><td>N/A</td></tr> | | <tr class="alternate2"> | | <td><b>Edit Account Info</b><!-- (edit_cred) --></td><td>user</td><td>Edit your user name, your email | | addresses (both public and secret one), | | change the URL of your homepage.</td></tr> | | <tr class="alternate1"> | | <td><b>Change Password</b><!-- (change_passwd) --></td><td>user</td><td>Change your password any time | | you want.</td></tr> | | <tr class="alternate2"> | | <td><b>About Logging Out</b><!-- (pause_logout) --></td><td>user</td><td>N/A</td></tr> | | <tr class="alternate1"> | | <td><b>Select Mailinglist/Action</b><!-- (select_ml_action) --></td><td>mlrepr</td><td>Representatives of mailing | | lists have their special | | menu here.</td></tr> | | <tr class="alternate2"> | | <td><b>Show Mailinglist Reps</b><!-- (show_ml_repr) --></td><td>mlrepr</td><td>Admins and the representatives th- | | emselves | | can lookup who is | | elected to be representative of | | a mailing list.</td></tr> | | <tr class="alternate1"> | | <td><b>Add a User or Mailinglist</b><!-- (add_user) --></td><td>admin</td><td>Admins can add users or | | mailinglists.</td></tr> | | <tr class="alternate2"> | | <td><b>Look up the forward email address</b><!-- (email_for_admin) --></td><td>admin</td><td>Admins can look whe- | | re email should go</td></tr> | | <tr class="alternate1"> | | <td><b>Manage a registration request (alpha)</b><!-- (manage_id_requests) --></td><td>admin</td><td>show/reject - | | open registration requests</td></tr> | | <tr class="alternate2"> | | <td><b>Edit a Mailinglist</b><!-- (edit_ml) --></td><td>admin</td><td>Admins and mailing list | | representatives can change the name, | | address and description of a mailing | | list.</td></tr> | | <tr class="alternate1"> | | <td><b>Select User/Action</b><!-- (select_user) --></td><td>admin</td><td>Admins can access PAUSE as-if | | they were somebody else. Here | | they select a user/action pair.</td></tr> | | <tr class="alternate2"> | | <td><b>Post a message</b><!-- (post_message) --></td><td>admin</td><td>Post a message to a specific user.</td></- | | tr> | | <tr class="alternate1"> | | <td><b>Show/Delete Msgs</b><!-- (dele_message) --></td><td>admin</td><td>Delete your messages from the message b- | | oard.</td></tr> | | <tr class="alternate2"> | | <td><b>Index users with digrams (BROKEN)</b><!-- (index_users) --></td><td>admin</td><td>Batch-index all users.<- | | /td></tr> | | <tr class="alternate1"> | | <td><b>Show bad xhtml output</b><!-- (check_xhtml) --></td><td>admin</td><td>Monitor bad xhtml output stored fro- | | m previous sessions</td></tr> | | <tr class="alternate2"> | | <td><b>coredump</b><!-- (coredump) --></td><td>admin</td><td>N/A</td></tr> | | </table> | | </td></tr></table> | | </td></tr></table> | | </form><hr noshade="noshade" /><table width="100%"> | | <tr> | | <td> </td> | | <td width="100%" valign="top" align="center"><div class="xexplain">Rev: 1071.02</div></td> | | <td valign="top"><div class="xexplain" align="right">To validate, download page first.</div><br /></td> | | </tr> | | <tr> | | <td width="100%"></td> | | <td> | | <a href="http://jigsaw.w3.org/css-validator/"><img | | src="/pause/vcss.gif" | | alt="Valid CSS!" height="31" width="88" /></a> | | </td> | | <td> | | <a href="http://validator.w3.org/file-upload.html"> | | <img src="/pause/valid-xhtml10.gif" | | alt="Valid XHTML 1.0!" height="31" width="88" /> | | </a> | | </td> | | </tr> | | </table> | | </body></html> | '-------------------------------------------------------------------------------------------------------------------' .-------------------------------------------------------------------------------------------------------------------. | Text | +-------------------------------------------------------------------------------------------------------------------+ | PAUSE: menu The [Perl programming] Authors Upload ServerOALDERS <olaf@wundersolutions.com>encrypted sessio- | | n Public menuRequest PAUSE account About PAUSE On The Naming of Modules PAUSE News PAUSE History Imprint/Impress- | | um List of pumpkins User menuFiles Upload a file to CPAN Show my files Repair a Pending Upload Delete Files Perm- | | issions View Permissions Change Permissions Utils Force Reindexing Reset Version Tail Daemon Logfile Account Edi- | | t Account Info Change Password About Logging Out Hi Olaf Alders,please choose an action from the menu. Th- | | e usermenu to the left shows all menus available to you, the table below shows descriptions for all menues avail- | | able to anybody on PAUSE. ActionGroupDescription Request PAUSE accountpublicApply for a PAUSE account. Forgot Pa- | | ssword?publicA passwordmailer that sends you a password that enables you to set a new password. About PAUSEpubli- | | cSame as modules/04pause.html on any CPAN server On The Naming of ModulespublicA couple of suggestions that hope- | | fully get you on track PAUSE NewspublicWhat's going on on PAUSE PAUSE HistorypublicOld News Imprint/Impressumpub- | | licN/A List of pumpkinspublicA list, also available as YAML Upload a file to CPANuserThis is the heart of the Up- | | load Server, the page most heavily used on PAUSE. Show my filesuserfind . -ls resemblance Repair a Pending Uploa- | | duserWhen an upload you requested hangs for some reason, you can go here and edit the file to be uploaded. Delet- | | e FilesuserSchedule files for deletion. There is a delay until the deletion really happens. Until then you can a- | | lso undelete files here. View PermissionsuserWhose uploads of what are being indexed on PAUSE Change Permissions- | | userEnable other users to upload a module for any of your namespaces, manage your own permissions. Force Reindex- | | inguserTell the indexer to index a file again (e.g. after a change in the perms table) Reset VersionuserOverrule- | | the record of the current version number of a module that the indexer uses and set it to 'undef' Tail Daemon Lo- | | gfileuserN/A Edit Account InfouserEdit your user name, your email addresses (both public and secret one), change- | | the URL of your homepage. Change PassworduserChange your password any time you want. About Logging OutuserN/A S- | | elect Mailinglist/ActionmlreprRepresentatives of mailing lists have their special menu here. Show Mailinglist Re- | | psmlreprAdmins and the representatives themselves can lookup who is elected to be representative of a mailing li- | | st. Add a User or MailinglistadminAdmins can add users or mailinglists. Look up the forward email addressadminAd- | | mins can look where email should go Manage a registration request (alpha)adminshow/reject open registration requ- | | ests Edit a MailinglistadminAdmins and mailing list representatives can change the name, address and description- | | of a mailing list. Select User/ActionadminAdmins can access PAUSE as-if they were somebody else. Here they sele- | | ct a user/action pair. Post a messageadminPost a message to a specific user. Show/Delete MsgsadminDelete your me- | | ssages from the message board. Index users with digrams (BROKEN)adminBatch-index all users. Show bad xhtml outpu- | | tadminMonitor bad xhtml output stored from previous sessions coredumpadminN/A Rev: 1071.02 To validate, d- | | ownload page first. | '-------------------------------------------------------------------------------------------------------------------' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 olaf $ LWPCL_REDACT_HEADERS = 'Authorization' perl basic - authentication . pl GET https : //pause.perl.org/pause/authenquery . -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- . | Request Header | Value | + -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- + | Authorization | [ REDACTED ] | | User - Agent | libwww - perl / 6 . 15 | '----------------+------------------' == > 200 OK . -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - . | Response Header | Value | + -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + | Cache - Control | no - cache | | Client - Date | Thu , 29 Sep 2016 02 : 06 : 02 GMT | | Client - Peer | 207 . 171 . 7 . 119 : 443 | | Client - Response - Num | 1 | | Client - SSL - Cert - Issuer | / C = US/O=GeoTrust, Inc./CN = RapidSSL CA | | Client - SSL - Cert - Subject | / serialNumber = K6R2GP4nh37grllJm9PZlQm0SS - oSNZ4/C=DE/O=pause.perl.org/OU=GT38611495/OU = - | | | See www . rapidssl . com/resources/cps (c)11/OU=Domain Control Validated - RapidSSL(R)/CN = - | | | pause . perl . org | | Client - SSL - Cipher | AES128 - GCM - SHA256 | | Client - SSL - Socket - Class | IO:: Socket :: SSL | | Connection | close | | Content - Length | 11251 | | Content - Type | text / html ; charset = utf - 8 | | Date | Thu , 29 Sep 2016 02 : 06 : 02 GMT | | Last - Modified | Thu , 29 Sep 2016 02 : 06 : 02 GMT | | Link | < / pause/pause_favicon.jpg>; rel="shortcut icon"; type="image/jpeg", </pause/pause . css > - | | | ; rel = "stylesheet" ; title = "pause" ; type = "text/css" | | Pragma | no - cache | | Title | PAUSE : menu | | Vary | accept - encoding | '-------------------------+-----------------------------------------------------------------------------------------' . -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - . | Content | + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + | <? xml version = "1.0" encoding = "UTF-8" ?> < ! DOCTYPE html | | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > < html xmlns = "http://www.w3.org/1999/x- | | html" > < head > < title > PAUSE : menu < / title > | | < link rel = "shortcut icon" href = "/pause/pause_favicon.jpg" type = "image/jpeg" / > | | < link rel = "stylesheet" type = "text/css" href = "/pause/pause.css" title = "pause" / > | | < / head > < body bgcolor = "white" link = "#0000CC" vlink = "#0000BB" | | alink = "#FF0000" text = "#000000" > < table width = "100%" border = "0" | | cellpadding = "0" cellspacing = "0" > < tr > < td valign = "middle" > < a href = "authenquery" > < img src = "/pause/pause2.jpg" | | border = "0" alt = "PAUSE Logo" | | width = "177" height = "43" align = "left" / > < / a > < / td > < td nowrap = "nowrap" > < h4 | | style = "margin: 0 0 0 0; padding: 0 1em;" > The [ Perl programming ] Authors Upload | | Server < / h4 > < / td > < td align = "right" style = "width: 100%;" > < table cellpadding = "3" cellspacing = "0" > < tr > < td class = "- | | statusencr" nowrap = "nowrap" > OALDERS < olaf @ wundersolutions . com > < br / > encrypted session < / td > < / tr > < / table > | | < / td > < / tr > < / table > < br / > < form | | action = "/pause/authenquery" | | enctype = "application/x-www-form-urlencoded" | | method = "post" > < table border = "0" cellpadding = "1" > < tr > < td valign = "top" > < table width = "155" cellspacing = "1" cellpad - | | ding = "0" > < tr > < td class = "menuheading" colspan = "2" > < b > Public menu < / b > < / td > < / tr > < tr > < td class = "menuitem" > < a class = "- | | menuitem" href = "authenquery?ACTION=request_id" > Request PAUSE account < / a > < / td > < td class = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=pause_04about" > About PAUSE < / a > < / td > < td cla - | | ss = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=pause_namingmodules" > On The Naming of Modu - | | les < / a > < / td > < td class = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=pause_05news" > PAUSE News < / a > < / td > < td class - | | = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=pause_06history" > PAUSE History < / a > < / td > < td - | | class = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=pause_04imprint" > Imprint/Impressum</a></td - | | > < td class = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=who_pumpkin" > List of pumpkins < / a > < / td > < td - | | class = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuheading" colspan = "2" > < b > User menu < / b > < / td > < / tr > < tr > < td class = "menuheading" > Files < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=add_uri" > Upload a file to CPAN < / a > < / td > < td - | | class = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=show_files" > Show my files < / a > < / td > < td clas - | | s = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=edit_uris" > Repair a Pending Upload < / a > < / td - | | > < td class = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=delete_files" > Delete Files < / a > < / td > < td cla - | | ss = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuheading" > Permissions < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=peek_perms" > View Permissions < / a > < / td > < td c - | | lass = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=share_perms" > Change Permissions < / a > < / td > < t - | | d class = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuheading" > Utils < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=reindex" > Force Reindexing < / a > < / td > < td clas - | | s = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=reset_version" > Reset Version < / a > < / td > < td c - | | lass = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=tail_logfile" > Tail Daemon Logfile < / a > < / td > - | | < td class = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuheading" > Account < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=edit_cred" > Edit Account Info < / a > < / td > < td c - | | lass = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=change_passwd" > Change Password < / a > < / td > < td - | | class = "menupointer" > < / td > < / tr > | | < tr > < td class = "menuitem" > < a class = "menuitem" href = "authenquery?ACTION=pause_logout" > About Logging Out < / a > < / td > < t - | | d class = "menupointer" > < / td > < / tr > | | < / table > | | < / td > < td valign = "top" bgcolor = "red" | | > < / td > < td valign = "top" > | | < h2 class = "firstheader" > Hi Olaf Alders , < br / > please choose an action from the menu . < / h2 > | | < p > The usermenu to the left shows all menus available to | | you , the table below shows descriptions for all menues available | | to anybody on PAUSE . < / p > | | < table | | border = "0" | | bgcolor = "black" | | cellspacing = "0" cellpadding = "0" > < tr > < td > < table | | bgcolor = "white" | | border = "0" cellspacing = "1" cellpadding = "2" > < tr | | class = "alternate2" > < th > Action < / th > < th > Group < / th > < th > Description < / th > < / tr > | | < tr class = "alternate1" > | | < td > < b > Request PAUSE account < / b > < ! -- ( request_id ) -- > < / td > < td > public < / td > < td > Apply for a PAUSE account . < / td > < / tr > | | < tr class = "alternate2" > | | < td > < b > Forgot Password ? < / b > < ! -- ( mailpw ) -- > < / td > < td > public < / td > < td > A passwordmailer that sends you a | | password that enables you to set a new | | password . < / td > < / tr > | | < tr class = "alternate1" > | | < td > < b > About PAUSE < / b > < ! -- ( pause_04about ) -- > < / td > < td > public < / td > < td > Same as modules / 04pause . html on any CPAN s - | | erver < / td > < / tr > | | < tr class = "alternate2" > | | < td > < b > On The Naming of Modules < / b > < ! -- ( pause_namingmodules ) -- > < / td > < td > public < / td > < td > A couple of suggestions - | | that hopefully get you on track < / td > < / tr > | | < tr class = "alternate1" > | | < td > < b > PAUSE News < / b > < ! -- ( pause_05news ) -- > < / td > < td > public < / td > < td > What 's going on on PAUSE</td></tr> | | <tr class="alternate2"> | | <td><b>PAUSE History</b><!-- (pause_06history) --></td><td>public</td><td>Old News</td></tr> | | <tr class="alternate1"> | | <td><b>Imprint/Impressum</b><!-- (pause_04imprint) --></td><td>public</td><td>N/A</td></tr> | | <tr class="alternate2"> | | <td><b>List of pumpkins</b><!-- (who_pumpkin) --></td><td>public</td><td>A list, also available as YAML</td></tr> | | <tr class="alternate1"> | | <td><b>Upload a file to CPAN</b><!-- (add_uri) --></td><td>user</td><td>This is the heart of the <b>Upload | | Server</b>, the page most heavily used on | | PAUSE.</td></tr> | | <tr class="alternate2"> | | <td><b>Show my files</b><!-- (show_files) --></td><td>user</td><td>find . -ls resemblance</td></tr> | | <tr class="alternate1"> | | <td><b>Repair a Pending Upload</b><!-- (edit_uris) --></td><td>user</td><td>When an upload you requested hangs | | for some reason, you can go here and edit | | the file to be uploaded.</td></tr> | | <tr class="alternate2"> | | <td><b>Delete Files</b><!-- (delete_files) --></td><td>user</td><td>Schedule files for deletion. | | There is a delay until the deletion | | really happens. Until then you can also | | undelete files here.</td></tr> | | <tr class="alternate1"> | | <td><b>View Permissions</b><!-- (peek_perms) --></td><td>user</td><td>Whose uploads of what are being indexed on- | | PAUSE</td></tr> | | <tr class="alternate2"> | | <td><b>Change Permissions</b><!-- (share_perms) --></td><td>user</td><td>Enable other users to upload a | | module for any of your namespaces, manage | | your own permissions.</td></tr> | | <tr class="alternate1"> | | <td><b>Force Reindexing</b><!-- (reindex) --></td><td>user</td><td>Tell the indexer to index a file again | | (e.g. after a change in the perms table)</td></tr> | | <tr class="alternate2"> | | <td><b>Reset Version</b><!-- (reset_version) --></td><td>user</td><td>Overrule the record of the current | | version number of a module that the indexer | | uses and set it to ' undef '</td></tr> | | <tr class="alternate1"> | | <td><b>Tail Daemon Logfile</b><!-- (tail_logfile) --></td><td>user</td><td>N/A</td></tr> | | <tr class="alternate2"> | | <td><b>Edit Account Info</b><!-- (edit_cred) --></td><td>user</td><td>Edit your user name, your email | | addresses (both public and secret one), | | change the URL of your homepage.</td></tr> | | <tr class="alternate1"> | | <td><b>Change Password</b><!-- (change_passwd) --></td><td>user</td><td>Change your password any time | | you want.</td></tr> | | <tr class="alternate2"> | | <td><b>About Logging Out</b><!-- (pause_logout) --></td><td>user</td><td>N/A</td></tr> | | <tr class="alternate1"> | | <td><b>Select Mailinglist/Action</b><!-- (select_ml_action) --></td><td>mlrepr</td><td>Representatives of mailing | | lists have their special | | menu here.</td></tr> | | <tr class="alternate2"> | | <td><b>Show Mailinglist Reps</b><!-- (show_ml_repr) --></td><td>mlrepr</td><td>Admins and the representatives th- | | emselves | | can lookup who is | | elected to be representative of | | a mailing list.</td></tr> | | <tr class="alternate1"> | | <td><b>Add a User or Mailinglist</b><!-- (add_user) --></td><td>admin</td><td>Admins can add users or | | mailinglists.</td></tr> | | <tr class="alternate2"> | | <td><b>Look up the forward email address</b><!-- (email_for_admin) --></td><td>admin</td><td>Admins can look whe- | | re email should go</td></tr> | | <tr class="alternate1"> | | <td><b>Manage a registration request (alpha)</b><!-- (manage_id_requests) --></td><td>admin</td><td>show/reject - | | open registration requests</td></tr> | | <tr class="alternate2"> | | <td><b>Edit a Mailinglist</b><!-- (edit_ml) --></td><td>admin</td><td>Admins and mailing list | | representatives can change the name, | | address and description of a mailing | | list.</td></tr> | | <tr class="alternate1"> | | <td><b>Select User/Action</b><!-- (select_user) --></td><td>admin</td><td>Admins can access PAUSE as-if | | they were somebody else. Here | | they select a user/action pair.</td></tr> | | <tr class="alternate2"> | | <td><b>Post a message</b><!-- (post_message) --></td><td>admin</td><td>Post a message to a specific user.</td></- | | tr> | | <tr class="alternate1"> | | <td><b>Show/Delete Msgs</b><!-- (dele_message) --></td><td>admin</td><td>Delete your messages from the message b- | | oard.</td></tr> | | <tr class="alternate2"> | | <td><b>Index users with digrams (BROKEN)</b><!-- (index_users) --></td><td>admin</td><td>Batch-index all users.<- | | /td></tr> | | <tr class="alternate1"> | | <td><b>Show bad xhtml output</b><!-- (check_xhtml) --></td><td>admin</td><td>Monitor bad xhtml output stored fro- | | m previous sessions</td></tr> | | <tr class="alternate2"> | | <td><b>coredump</b><!-- (coredump) --></td><td>admin</td><td>N/A</td></tr> | | </table> | | </td></tr></table> | | </td></tr></table> | | </form><hr noshade="noshade" /><table width="100%"> | | <tr> | | <td> </td> | | <td width="100%" valign="top" align="center"><div class="xexplain">Rev: 1071.02</div></td> | | <td valign="top"><div class="xexplain" align="right">To validate, download page first.</div><br /></td> | | </tr> | | <tr> | | <td width="100%"></td> | | <td> | | <a href="http://jigsaw.w3.org/css-validator/"><img | | src="/pause/vcss.gif" | | alt="Valid CSS!" height="31" width="88" /></a> | | </td> | | <td> | | <a href="http://validator.w3.org/file-upload.html"> | | <img src="/pause/valid-xhtml10.gif" | | alt="Valid XHTML 1.0!" height="31" width="88" /> | | </a> | | </td> | | </tr> | | </table> | | </body></html> | ' -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - ' .-------------------------------------------------------------------------------------------------------------------. | Text | +-------------------------------------------------------------------------------------------------------------------+ | PAUSE: menu The [Perl programming] Authors Upload ServerOALDERS < [email protected] >encrypted sessio- | | n Public menuRequest PAUSE account About PAUSE On The Naming of Modules PAUSE News PAUSE History Imprint/Impress- | | um List of pumpkins User menuFiles Upload a file to CPAN Show my files Repair a Pending Upload Delete Files Perm- | | issions View Permissions Change Permissions Utils Force Reindexing Reset Version Tail Daemon Logfile Account Edi- | | t Account Info Change Password About Logging Out Hi Olaf Alders,please choose an action from the menu. Th- | | e usermenu to the left shows all menus available to you, the table below shows descriptions for all menues avail- | | able to anybody on PAUSE. ActionGroupDescription Request PAUSE accountpublicApply for a PAUSE account. Forgot Pa- | | ssword?publicA passwordmailer that sends you a password that enables you to set a new password. About PAUSEpubli- | | cSame as modules/04pause.html on any CPAN server On The Naming of ModulespublicA couple of suggestions that hope- | | fully get you on track PAUSE NewspublicWhat' s going on on PAUSE PAUSE HistorypublicOld News Imprint / Impressumpub - | | licN / A List of pumpkinspublicA list , also available as YAML Upload a file to CPANuserThis is the heart of the Up - | | load Server , the page most heavily used on PAUSE . Show my filesuserfind . - ls resemblance Repair a Pending Uploa - | | duserWhen an upload you requested hangs for some reason , you can go here and edit the file to be uploaded . Delet - | | e FilesuserSchedule files for deletion . There is a delay until the deletion really happens . Until then you can a - | | lso undelete files here . View PermissionsuserWhose uploads of what are being indexed on PAUSE Change Permissions - | | userEnable other users to upload a module for any of your namespaces , manage your own permissions . Force Reindex - | | inguserTell the indexer to index a file again ( e . g . after a change in the perms table ) Reset VersionuserOverrule - | | the record of the current version number of a module that the indexer uses and set it to 'undef' Tail Daemon Lo - | | gfileuserN / A Edit Account InfouserEdit your user name , your email addresses ( both public and secret one ) , change - | | the URL of your homepage . Change PassworduserChange your password any time you want . About Logging OutuserN / A S - | | elect Mailinglist / ActionmlreprRepresentatives of mailing lists have their special menu here . Show Mailinglist Re - | | psmlreprAdmins and the representatives themselves can lookup who is elected to be representative of a mailing li - | | st . Add a User or MailinglistadminAdmins can add users or mailinglists . Look up the forward email addressadminAd - | | mins can look where email should go Manage a registration request ( alpha ) adminshow / reject open registration requ - | | ests Edit a MailinglistadminAdmins and mailing list representatives can change the name , address and description - | | of a mailing list . Select User / ActionadminAdmins can access PAUSE as - if they were somebody else . Here they sele - | | ct a user/action pair. Post a messageadminPost a message to a specific user. Show/Delete MsgsadminDelete your me - | | ssages from the message board . Index users with digrams ( BROKEN ) adminBatch - index all users . Show bad xhtml outpu - | | tadminMonitor bad xhtml output stored from previous sessions coredumpadminN / A Rev : 1071 . 02 To validate , d - | | ownload page first . | '-------------------------------------------------------------------------------------------------------------------'

You can see that I ran the script with LWPCL_REDACT_HEADERS='Authorization' . That's a handy flag to use if you want to copy/paste an example when asking for help publicly. It replaced the Authorization header value with [REDACTED]. That's maybe not a big deal here, but there are cases where it's more important. See also LWP_REDACT_PARAMS .

Let's make it prettier. We'll do this by installing HTML::FormatText::Lynx.

Let's run it again. I'll only show you the changed part. Instead of just displaying the text with the HTML stripped away, we get something nicer to look at.

.------------------------------------------------------------------------------------------------------------------------------------------------------. | Text | +------------------------------------------------------------------------------------------------------------------------------------------------------+ | [1]PAUSE Logo | | | | The [Perl programming] Authors Upload Server | | | | OALDERS <olaf@wundersolutions.com> | | encrypted session | | | | Public menu | | [2]Request PAUSE account | | [3]About PAUSE | | [4]On The Naming of Modules | | [5]PAUSE News | | [6]PAUSE History | | [7]Imprint/Impressum | | [8]List of pumpkins | | User menu | | Files | | [9]Upload a file to CPAN | | [10]Show my files | | [11]Repair a Pending Upload | | [12]Delete Files | | Permissions | | [13]View Permissions | | [14]Change Permissions | | Utils | | [15]Force Reindexing | | [16]Reset Version | | [17]Tail Daemon Logfile | | Account | | [18]Edit Account Info | | [19]Change Password | | [20]About Logging Out | | | | | | Hi Olaf Alders, | | please choose an action from the menu. | | | | The usermenu to the left shows all menus available to you, the table | | below shows descriptions for all menues available to anybody on PAUSE. | | Action Group Description | | Request PAUSE account public Apply for a PAUSE account. | | Forgot Password? public A passwordmailer that sends you a password that | | enables you to set a new password. | | About PAUSE public Same as modules/04pause.html on any CPAN server | | On The Naming of Modules public A couple of suggestions that hopefully | | get you on track | | PAUSE News public What's going on on PAUSE | | PAUSE History public Old News | | Imprint/Impressum public N/A | | List of pumpkins public A list, also available as YAML | | Upload a file to CPAN user This is the heart of the Upload Server, the | | page most heavily used on PAUSE. | | Show my files user find . -ls resemblance | | Repair a Pending Upload user When an upload you requested hangs for | | some reason, you can go here and edit the file to be uploaded. | | Delete Files user Schedule files for deletion. There is a delay until | | the deletion really happens. Until then you can also undelete files | | here. | | View Permissions user Whose uploads of what are being indexed on PAUSE | | Change Permissions user Enable other users to upload a module for any | | of your namespaces, manage your own permissions. | | Force Reindexing user Tell the indexer to index a file again (e.g. | | after a change in the perms table) | | Reset Version user Overrule the record of the current version number of | | a module that the indexer uses and set it to 'undef' | | Tail Daemon Logfile user N/A | | Edit Account Info user Edit your user name, your email addresses (both | | public and secret one), change the URL of your homepage. | | Change Password user Change your password any time you want. | | About Logging Out user N/A | | Select Mailinglist/Action mlrepr Representatives of mailing lists have | | their special menu here. | | Show Mailinglist Reps mlrepr Admins and the representatives themselves | | can lookup who is elected to be representative of a mailing list. | | Add a User or Mailinglist admin Admins can add users or mailinglists. | | Look up the forward email address admin Admins can look where email | | should go | | Manage a registration request (alpha) admin show/reject open | | registration requests | | Edit a Mailinglist admin Admins and mailing list representatives can | | change the name, address and description of a mailing list. | | Select User/Action admin Admins can access PAUSE as-if they were | | somebody else. Here they select a user/action pair. | | Post a message admin Post a message to a specific user. | | Show/Delete Msgs admin Delete your messages from the message board. | | Index users with digrams (BROKEN) admin Batch-index all users. | | Show bad xhtml output admin Monitor bad xhtml output stored from | | previous sessions | | coredump admin N/A | | __________________________________________________________________ | | | | | | Rev: 1071.02 | | | | To validate, download page first. | | | | [21]Valid CSS! [22]Valid XHTML 1.0! | | | | References | | | | 1. https://pause.perl.org/pause/authenquery | | 2. https://pause.perl.org/pause/authenquery?ACTION=request_id | | 3. https://pause.perl.org/pause/authenquery?ACTION=pause_04about | | 4. https://pause.perl.org/pause/authenquery?ACTION=pause_namingmodules | | 5. https://pause.perl.org/pause/authenquery?ACTION=pause_05news | | 6. https://pause.perl.org/pause/authenquery?ACTION=pause_06history | | 7. https://pause.perl.org/pause/authenquery?ACTION=pause_04imprint | | 8. https://pause.perl.org/pause/authenquery?ACTION=who_pumpkin | | 9. https://pause.perl.org/pause/authenquery?ACTION=add_uri | | 10. https://pause.perl.org/pause/authenquery?ACTION=show_files | | 11. https://pause.perl.org/pause/authenquery?ACTION=edit_uris | | 12. https://pause.perl.org/pause/authenquery?ACTION=delete_files | | 13. https://pause.perl.org/pause/authenquery?ACTION=peek_perms | | 14. https://pause.perl.org/pause/authenquery?ACTION=share_perms | | 15. https://pause.perl.org/pause/authenquery?ACTION=reindex | | 16. https://pause.perl.org/pause/authenquery?ACTION=reset_version | | 17. https://pause.perl.org/pause/authenquery?ACTION=tail_logfile | | 18. https://pause.perl.org/pause/authenquery?ACTION=edit_cred | | 19. https://pause.perl.org/pause/authenquery?ACTION=change_passwd | | 20. https://pause.perl.org/pause/authenquery?ACTION=pause_logout | | 21. http://jigsaw.w3.org/css-validator/ | | 22. http://validator.w3.org/file-upload.html | '------------------------------------------------------------------------------------------------------------------------------------------------------' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 . -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- . | Text | + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + | [ 1 ] PAUSE Logo | | | | The [ Perl programming ] Authors Upload Server | | | | OALDERS < olaf @ wundersolutions . com > | | encrypted session | | | | Public menu | | [ 2 ] Request PAUSE account | | [ 3 ] About PAUSE | | [ 4 ] On The Naming of Modules | | [ 5 ] PAUSE News | | [ 6 ] PAUSE History | | [ 7 ] Imprint / Impressum | | [ 8 ] List of pumpkins | | User menu | | Files | | [ 9 ] Upload a file to CPAN | | [ 10 ] Show my files | | [ 11 ] Repair a Pending Upload | | [ 12 ] Delete Files | | Permissions | | [ 13 ] View Permissions | | [ 14 ] Change Permissions | | Utils | | [ 15 ] Force Reindexing | | [ 16 ] Reset Version | | [ 17 ] Tail Daemon Logfile | | Account | | [ 18 ] Edit Account Info | | [ 19 ] Change Password | | [ 20 ] About Logging Out | | | | | | Hi Olaf Alders , | | please choose an action from the menu . | | | | The usermenu to the left shows all menus available to you , the table | | below shows descriptions for all menues available to anybody on PAUSE . | | Action Group Description | | Request PAUSE account public Apply for a PAUSE account . | | Forgot Password ? public A passwordmailer that sends you a password that | | enables you to set a new password . | | About PAUSE public Same as modules / 04pause . html on any CPAN server | | On The Naming of Modules public A couple of suggestions that hopefully | | get you on track | | PAUSE News public What 's going on on PAUSE | | PAUSE History public Old News | | Imprint/Impressum public N/A | | List of pumpkins public A list, also available as YAML | | Upload a file to CPAN user This is the heart of the Upload Server, the | | page most heavily used on PAUSE. | | Show my files user find . -ls resemblance | | Repair a Pending Upload user When an upload you requested hangs for | | some reason, you can go here and edit the file to be uploaded. | | Delete Files user Schedule files for deletion. There is a delay until | | the deletion really happens. Until then you can also undelete files | | here. | | View Permissions user Whose uploads of what are being indexed on PAUSE | | Change Permissions user Enable other users to upload a module for any | | of your namespaces, manage your own permissions. | | Force Reindexing user Tell the indexer to index a file again (e.g. | | after a change in the perms table) | | Reset Version user Overrule the record of the current version number of | | a module that the indexer uses and set it to ' undef ' | | Tail Daemon Logfile user N/A | | Edit Account Info user Edit your user name, your email addresses (both | | public and secret one), change the URL of your homepage. | | Change Password user Change your password any time you want. | | About Logging Out user N/A | | Select Mailinglist/Action mlrepr Representatives of mailing lists have | | their special menu here. | | Show Mailinglist Reps mlrepr Admins and the representatives themselves | | can lookup who is elected to be representative of a mailing list. | | Add a User or Mailinglist admin Admins can add users or mailinglists. | | Look up the forward email address admin Admins can look where email | | should go | | Manage a registration request (alpha) admin show/reject open | | registration requests | | Edit a Mailinglist admin Admins and mailing list representatives can | | change the name, address and description of a mailing list. | | Select User/Action admin Admins can access PAUSE as-if they were | | somebody else. Here they select a user/action pair. | | Post a message admin Post a message to a specific user. | | Show/Delete Msgs admin Delete your messages from the message board. | | Index users with digrams (BROKEN) admin Batch-index all users. | | Show bad xhtml output admin Monitor bad xhtml output stored from | | previous sessions | | coredump admin N/A | | __________________________________________________________________ | | | | | | Rev: 1071.02 | | | | To validate, download page first. | | | | [21]Valid CSS! [22]Valid XHTML 1.0! | | | | References | | | | 1. https://pause.perl.org/pause/authenquery | | 2. https://pause.perl.org/pause/authenquery?ACTION=request_id | | 3. https://pause.perl.org/pause/authenquery?ACTION=pause_04about | | 4. https://pause.perl.org/pause/authenquery?ACTION=pause_namingmodules | | 5. https://pause.perl.org/pause/authenquery?ACTION=pause_05news | | 6. https://pause.perl.org/pause/authenquery?ACTION=pause_06history | | 7. https://pause.perl.org/pause/authenquery?ACTION=pause_04imprint | | 8. https://pause.perl.org/pause/authenquery?ACTION=who_pumpkin | | 9. https://pause.perl.org/pause/authenquery?ACTION=add_uri | | 10. https://pause.perl.org/pause/authenquery?ACTION=show_files | | 11. https://pause.perl.org/pause/authenquery?ACTION=edit_uris | | 12. https://pause.perl.org/pause/authenquery?ACTION=delete_files | | 13. https://pause.perl.org/pause/authenquery?ACTION=peek_perms | | 14. https://pause.perl.org/pause/authenquery?ACTION=share_perms | | 15. https://pause.perl.org/pause/authenquery?ACTION=reindex | | 16. https://pause.perl.org/pause/authenquery?ACTION=reset_version | | 17. https://pause.perl.org/pause/authenquery?ACTION=tail_logfile | | 18. https://pause.perl.org/pause/authenquery?ACTION=edit_cred | | 19. https://pause.perl.org/pause/authenquery?ACTION=change_passwd | | 20. https://pause.perl.org/pause/authenquery?ACTION=pause_logout | | 21. http://jigsaw.w3.org/css-validator/ | | 22. http://validator.w3.org/file-upload.html | ' -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- '

Now, we can also turn down the verbosity of the script by passing a flag to debug_ua() . Any integer from 0-8 will do the trick. Let's try 6.

use strict; use warnings; use v5.10; use LWP::ConsoleLogger::Easy qw( debug_ua ); use LWP::UserAgent; use HTTP::Request::Common; my $ua = LWP::UserAgent->new(); debug_ua( $ua, 6 ); my $request = GET 'https://pause.perl.org/pause/authenquery'; $request->authorization_basic( 'oalders', 'seekrit' ); my $response = $ua->request($request); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 use strict ; use warnings ; use v5 . 10 ; use LWP:: ConsoleLogger:: Easy qw ( debug_ua ) ; use LWP:: UserAgent ; use HTTP:: Request:: Common ; my $ua = LWP:: UserAgent-> new ( ) ; debug_ua ( $ua , 6 ) ; my $request = GET 'https://pause.perl.org/pause/authenquery' ; $request -> authorization_basic ( 'oalders' , 'seekrit' ) ; my $response = $ua -> request ( $request ) ;

Let's see what we get:

olaf$ LWPCL_REDACT_HEADERS='Authorization' perl basic-authentication.pl GET https://pause.perl.org/pause/authenquery .----------------+------------------. | Request Header | Value | +----------------+------------------+ | Authorization | [REDACTED] | | User-Agent | libwww-perl/6.15 | '----------------+------------------' ==> 200 OK .-------------------------+----------------------------------------------------------------------------------------------------------------------------. | Response Header | Value | +-------------------------+----------------------------------------------------------------------------------------------------------------------------+ | Cache-Control | no-cache | | Client-Date | Thu, 29 Sep 2016 02:13:51 GMT | | Client-Peer | 207.171.7.119:443 | | Client-Response-Num | 1 | | Client-SSL-Cert-Issuer | /C=US/O=GeoTrust, Inc./CN=RapidSSL CA | | Client-SSL-Cert-Subject | /serialNumber=K6R2GP4nh37grllJm9PZlQm0SS-oSNZ4/C=DE/O=pause.perl.org/OU=GT38611495/OU=See www.rapidssl.com/resources/cps - | | | (c)11/OU=Domain Control Validated - RapidSSL(R)/CN=pause.perl.org | | Client-SSL-Cipher | AES128-GCM-SHA256 | | Client-SSL-Socket-Class | IO::Socket::SSL | | Connection | close | | Content-Length | 11251 | | Content-Type | text/html; charset=utf-8 | | Date | Thu, 29 Sep 2016 02:13:51 GMT | | Last-Modified | Thu, 29 Sep 2016 02:13:51 GMT | | Link | </pause/pause_favicon.jpg>; rel="shortcut icon"; type="image/jpeg", </pause/pause.css>; rel="stylesheet"; title="pause"; - | | | type="text/css" | | Pragma | no-cache | | Title | PAUSE: menu | | Vary | accept-encoding | '-------------------------+----------------------------------------------------------------------------------------------------------------------------' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 olaf $ LWPCL_REDACT_HEADERS = 'Authorization' perl basic - authentication . pl GET https : //pause.perl.org/pause/authenquery . -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- . | Request Header | Value | + -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- + | Authorization | [ REDACTED ] | | User - Agent | libwww - perl / 6 . 15 | '----------------+------------------' == > 200 OK . -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- . | Response Header | Value | + -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + | Cache - Control | no - cache | | Client - Date | Thu , 29 Sep 2016 02 : 13 : 51 GMT | | Client - Peer | 207 . 171 . 7 . 119 : 443 | | Client - Response - Num | 1 | | Client - SSL - Cert - Issuer | / C = US/O=GeoTrust, Inc./CN = RapidSSL CA | | Client - SSL - Cert - Subject | / serialNumber = K6R2GP4nh37grllJm9PZlQm0SS - oSNZ4/C=DE/O=pause.perl.org/OU=GT38611495/OU=See www.rapidssl.com/resources/cps - | | | ( c ) 11/OU=Domain Control Validated - RapidSSL(R)/CN = pause . perl . org | | Client - SSL - Cipher | AES128 - GCM - SHA256 | | Client - SSL - Socket - Class | IO:: Socket :: SSL | | Connection | close | | Content - Length | 11251 | | Content - Type | text / html ; charset = utf - 8 | | Date | Thu , 29 Sep 2016 02 : 13 : 51 GMT | | Last - Modified | Thu , 29 Sep 2016 02 : 13 : 51 GMT | | Link | < / pause/pause_favicon.jpg>; rel="shortcut icon"; type="image/jpeg", </pause/pause . css > ; rel = "stylesheet" ; title = "pause" ; - | | | type = "text/css" | | Pragma | no - cache | | Title | PAUSE : menu | | Vary | accept - encoding | '-------------------------+----------------------------------------------------------------------------------------------------------------------------'

That's far easier to read now.

This is just a very basic example of what you can do with LWP::ConsoleLogger::Easy. There's a lot more you can do with it and it's all laid out for you in the documentation. It really shines when you have a user agent which is going through multiple links or if you're debugging someone else's API calls. Have fun with it. It beats inserting arbitrary print statements and it could save you from pulling a lot of your own hair out someday.