[25022] in Perl-Users-Digest
Perl-Users Digest, Issue: 7272 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 19 21:08:18 2004
Date: Tue, 19 Oct 2004 18:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 19 Oct 2004 Volume: 10 Number: 7272
Today's topics:
Re: Calling a perl script from an html doc <jurgenex@hotmail.com>
Re: HTTP Proxy via HTTP Layer by Perl? <spamtrap@dot-app.org>
Re: HTTP Proxy via HTTP Layer by Perl? <nntp@rogers.com>
Re: HTTP Proxy via HTTP Layer by Perl? <usa1@llenroc.ude.invalid>
Re: HTTP Proxy via HTTP Layer by Perl? <nntp@rogers.com>
Re: HTTP Proxy via HTTP Layer by Perl? <spamtrap@dot-app.org>
Re: HTTP Proxy via HTTP Layer by Perl? <nntp@rogers.com>
Re: HTTP Proxy via HTTP Layer by Perl? <tadmc@augustmail.com>
Re: HTTP Proxy via HTTP Layer by Perl? <spamtrap@dot-app.org>
Re: m/(\/\*[.|\n]*\*\/)/ to try and match C-Style multi <abigail@abigail.nl>
Net::FTP and Passive mode problems (Hostile17)
Re: Perl Whirl IV from Dubrovnik (Randal L. Schwartz)
Re: regex to clean path <uguttman@athenahealth.com>
Re: regex to clean path <abigail@abigail.nl>
Re: Special encoded character <see@sig.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 19 Oct 2004 23:33:20 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Calling a perl script from an html doc
Message-Id: <4vhdd.5410$gq2.3950@trnddc01>
lesley_b_linux@yahoo.co.yuk wrote:
> "Jürgen Exner" <jurgenex@hotmail.com> writes:
>> lesley_b_linux@yahoo.co.yuk wrote:
>>> Has there ever been any other
>>> language used with CGI or was CGI specifically designed to work with
>>> Perl and nothing else?
>>
>> OHMYGOD. You are kidding, aren't you?
>
> Now, is that really the best you can offer this newsgroup?
Ok, then how about this:
How on earth could you have missed the myriad of postings _in_this_NG_
pointing out that they don't have a Perl problem but a CGI problem, that
they should head over to the CGI NGs, and that they would have the same
problem no matter which programming language they would have used to
implement their CGI program.
How on earth could you have missed the frequent references _in_this_NG_ to
'perldoc -q 500' with in turn points you to the CGI FAQ which in turn even
has an answer to your question:
1.11: Do I have to use Perl?
No - you can use any programming language you please. Perl is simply
today's most popular choice for CGI applications. Some other widely-
used languages are C, C++, TCL, BASIC and - for simple tasks -
even shell scripts.
So, how on earth could you have missed all that?juejue
------------------------------
Date: Tue, 19 Oct 2004 18:09:37 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: HTTP Proxy via HTTP Layer by Perl?
Message-Id: <OpydnWvVWYk_DejcRVn-jg@adelphia.com>
nntp wrote:
> I need a perl program for doing that.
Why must it be Perl? Seriously - if you're looking for a canned
solution, then you should be looking for the functionality you need,
period, and ignoring the implementation language.
Also - why are you posting this to a Perl group? Unless you're writing
your own proxy in Perl, this is not the place to post your question.
This group is about *writing* Perl, not discussing applications that
happen to have been written in Perl.
> There are windows, binary based
> proxys. However, I have to have broadband to use it, then it will cost $50 a
> month for only fast down, but slow up. If I have a Perl/PHP proxy, and use
> web server port 80, then I only need to pay $10 web hosting fee for super
> fast connections up and down.
I don't follow you here, and to be honest I think you're confused. Using
a proxy that's out on the web won't magically make your dialup line as
fast as broadband. The connection between your proxy server and the
target site will be fast, yes, but the connection between you and the
proxy will be your dialup connection.
> I searched cpan but there is none like that. I went to hotscripts. The only
> proxy is web based. But I need http layer so that I just enter the ip and
> port in browser then I am ready to go.
Some serious advice: Learn how the web works before you try to make it
work better. Really. That's not meant as a slam or an attack, just
honest advice. You appear to be very confused, and you're not making
much sense.
Having said that, one of the most popular cacheing servers in use right
now is Squid:
<http://www.squid-cache.org>
The first link on the Squid site's "recommended reading" list looks to
me like a fairly good introduction to cacheing. You *seriously* need to
read this to get better acquainted with the technology:
<http://www.mnot.net/cache_docs/>
There are also a couple of O'Reilly books available, if you prefer dead
trees:
<http://book.web-cache.com>
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Tue, 19 Oct 2004 18:20:14 -0400
From: "nntp" <nntp@rogers.com>
Subject: Re: HTTP Proxy via HTTP Layer by Perl?
Message-Id: <hqednSn6aYmhDujcRVn-tQ@rogers.com>
> Some serious advice: Learn how the web works before you try to make it
> work better. Really. That's not meant as a slam or an attack, just
> honest advice. You appear to be very confused, and you're not making
> much sense.
>
> Having said that, one of the most popular cacheing servers in use right
> now is Squid:
>
I need proxy, not cache.
for example, let's call the script proxy.pl
i make it sitting on root dir, set .htaccess use proxy.pl as default index
then i use the virtual server in apache to proint to this dir....
i enter the url in proxy and port 80 in my IE
then when i go to citibank.com, it go through than proxy.
i need https as well.
> <http://www.squid-cache.org>
>
> The first link on the Squid site's "recommended reading" list looks to
> me like a fairly good introduction to cacheing. You *seriously* need to
> read this to get better acquainted with the technology:
>
> <http://www.mnot.net/cache_docs/>
>
> There are also a couple of O'Reilly books available, if you prefer dead
> trees:
>
> <http://book.web-cache.com>
>
> sherm--
>
> --
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 19 Oct 2004 22:21:03 GMT
From: "A. Sinan Unur" <usa1@llenroc.ude.invalid>
Subject: Re: HTTP Proxy via HTTP Layer by Perl?
Message-Id: <Xns9587BAACF1E23asu1cornelledu@132.236.56.8>
"nntp" <nntp@rogers.com> wrote in
news:BqydnQLhzKdnEOjcRVn-vA@rogers.com:
>
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> дÈëÓʼþ
> news:Xns9587AE698E474asu1cornelledu@132.236.56.8...
>> "nntp" <nntp@rogers.com> wrote in
>> news:Q_qdnbQqF56oHOjcRVn-vg@rogers.com:
>>
>> >> I am not sure how proxy works. The basic is it got a request then
>> >> forward it.
>> >>
>> >> I need a perl program for doing that. There are windows, binary
>> >> based proxys. However, I have to have broadband to use it, then it
>> >> will cost $50 a month for only fast down, but slow up. If I have a
>> >> Perl/PHP proxy, and use web server port 80, then I only need to
>> >> pay $10 web hosting fee for super fast connections up and down.
>>
>> I am not sure why this is relevant. This is a programming newsgroup.
>> If you are working on a program, and have a question regarding that
>> program which we hope is in Perl, then you post it here and get help.
> I posted two modules from cpan and ask if they are what I need
How do you propose that we should be able to figure out what you _really_
need if you refuse to specify it.
The easiest way to see if HTTP::Proxy does what you want is to write a
program that uses it to see if it does what you want. It probably does but
then you haven't really explained what you want to do.
>> >> I searched cpan but there is none like that. I went to hotscripts.
>> >> The only proxy is web based. But I need http layer so that I just
>> >> enter the ip and port in browser then I am ready to go.
>> >>
>> >> Anyone knows such programs?
>>
>> Yes: http://www.research.att.com/~hpk/wsp/
> I don't understand the program. I don't see any demo either. It looks
> like to me a fake clicking software. I am not asking for that.
It is a proxy application written in pure Perl. Thought it might have
hepled you figure out how proxying works. You could also look at the source
code for HTTP::Proxy obviously.
> I need about 5-10 private proxy servers set up around the world for
> a trading business. I need the lowest cost way.
Again, this is still not relevant.
Sinan.
------------------------------
Date: Tue, 19 Oct 2004 18:27:33 -0400
From: "nntp" <nntp@rogers.com>
Subject: Re: HTTP Proxy via HTTP Layer by Perl?
Message-Id: <K8OdnRrravBpCejcRVn-2g@rogers.com>
> > I need a perl program for doing that. There are windows, binary based
> > proxys. However, I have to have broadband to use it, then it will cost
$50
> a
> > month for only fast down, but slow up. If I have a Perl/PHP proxy, and
use
> > web server port 80, then I only need to pay $10 web hosting fee for
super
> > fast connections up and down.
> >
> > I searched cpan but there is none like that. I went to hotscripts. The
> only
> > proxy is web based. But I need http layer so that I just enter the ip
and
> > port in browser then I am ready to go.
> >
> > Anyone knows such programs?
> >
>
> There are some on cpan. Because I don't know much about the technical
terms,
> so I am not sure which is which
>
> http://search.cpan.org/~rwahby/Net-HTTPTunnel-0.4/HTTPTunnel.pm
> http://search.cpan.org/~book/HTTP-Proxy-0.13/lib/HTTP/Proxy.pm
>
> I could not match what it does to what I am trying to do.
>
This is the code I got online, but it even crash in shell mod in windows, so
I don't know if it will work in CGI enviroment
#####################
#!/usr/usc/bin/perl
#-------------------------------------------------------------------------
#-- proxy.pl - A simple http proxy server. --
#-- --
#-- To run, type proxy.pl [port-number] at the shell prompt. --
#-- Default port number is 5364. --
#-- --
#-------------------------------------------------------------------------
#require "sys/socket.ph";
use Socket;
srand (time||$$);
#--- Define a friendly exit handler
$SIG{'KILL'} = $SIG{QUIT} = $SIG{INT} = 'exit_handler';
sub exit_handler {
print "\n\n --- Proxy server is dying ...\n\n";
close(SOCKET);
exit;
}
#--- Setup socket
$| = 1;
$proxy_port = shift(@ARGV);
$proxy_port = 5364 unless $proxy_port =~ /\d+/;
$socket_format = 'S n a4 x8';
&listen_to_port(SOCKET, $proxy_port);
$local_host = `hostname`;
chop($local_host);
$local_host_ip = (gethostbyname($local_host))[4];
print " --- Proxy server running on $local_host port: $proxy_port \n\n";
#--- Loop forever taking requests as they come
while (1) {
#--- Wait for request
print " --- Waiting to be of service ...\n";
($addr = accept(CHILD,SOCKET)) || die "accept $!";
($port,$inetaddr) = (unpack($socket_format,$addr))[1,2];
@inetaddr = unpack('C4',$inetaddr);
print "Connection from ", join(".", @inetaddr), " port: $port \n";
#--- Fork a subprocess to handle request.
#--- Parent proces continues listening.
if (fork) {
wait; # For now we wait for the child to finish
next; # We wait so that printouts don't mix
}
#--- Read first line of request and analyze it.
#--- Return and edited version of the first line and the request method.
($first,$method) = &analyze_request;
#--- Send request to remote host
print URL $first;
print $first;
while (<CHILD>) {
print $_;
next if (/Proxy-Connection:/);
print URL $_;
last if ($_ =~ /^[\s\x00]*$/);
}
if ($method eq "POST") {
$data = <CHILD>;
print $data;
print URL $data;
}
print URL "\n";
#--- Wait for response and transfer it to requestor.
print " --- Done sending. Response: \n\n";
$header = 1;
$text = 0;
while (<URL>) {
print CHILD $_;
if ($header || $text) { # Only print header & text lines to STDOUT
print $_;
if ($header && $_ =~ /^[\s\x00]*$/) {
$header = 0;
}
# if ($header && $_ =~ /^Content-type: text/) {
# $text = 1;
# }
}
}
close(URL);
close(CHILD);
exit; # Exit from child process
}
#-------------------------------------------------------------------------
#-- analyze_request --
#-- --
#-- Analyze a new request. First read in first line of request. --
#-- Read URL from it, process URL and open connection. --
#-- Return an edited version of the first line and the request --
#-- method. --
#-------------------------------------------------------------------------
sub analyze_request {
#--- Read first line of HTTP request
$first = <CHILD>;
$url = ($first =~ m|(http://\S+)|)[0];
print "Request for URL: $url \n";
#--- Check if first line is of the form GET http://host-name ...
($method, $remote_host, $remote_port) =
($first =~ m!(GET|POST|HEAD) http://([^/:]+):?(\d*)! );
#--- If not, bad request.
if (!$remote_host) {
print $first;
while (<CHILD>) {
print $_;
last if ($_ =~ /^[\s\x00]*$/);
}
print "Invalid HTTP request from ", join(".", @inetaddr), "\n";
# print CHILD "Content-type: text/plain","\n\n";
print CHILD "I don't understand your request.\n";
close(CHILD);
exit;
}
#--- If requested URL is the proxy server then ignore request
$remote_ip = (gethostbyname($remote_host))[4];
if (($remote_ip eq $local_host_ip) && ($remote_port eq $proxy_port)) {
print $first;
while (<CHILD>) {
print $_;
last if ($_ =~ /^[\s\x00]*$/);
}
print " --- Connection to proxy server ignored.\n";
# print CHILD "Content-type: text/plain","\n\n";
print CHILD "It's not nice to make me loop on myself!.\n";
close(CHILD);
exit;
}
#--- Setup connection to target host and send request
$remote_port = "http" unless ($remote_port);
&open_connection(URL, $remote_host, $remote_port);
#--- Remove remote hostname from URL
$first =~ s/http:\/\/[^\/]+//;
($first, $method);
}
#-------------------------------------------------------------------------
#-- listen_to_port(SOCKET, $port) --
#-- --
#-- Create a socket that listens to a specific port --
#-------------------------------------------------------------------------
sub listen_to_port {
local ($port) = $_[1];
local ($socket_format, $proto, $packed_port, $cur, $max_requests);
$max_requests = 3; # Max number of outstanding requests
$socket_format = 'S n a4 x8';
$proto = (getprotobyname('tcp'))[2];
$packed_port = pack($socket_format, &AF_INET, $port, "\0\0\0\0");
socket($_[0], &PF_INET, &SOCK_STREAM, $proto) || die "socket: $!";
bind($_[0], $packed_port) || die "bind: $!";
listen($_[0], $max_requests) || die "listen: $!";
$cur = select($_[0]);
$| = 1; # Disable buffering on socket.
select($cur);
}
#-------------------------------------------------------------------------
#-- open_connection(SOCKET, $remote_hostname, $port) --
#-- --
#-- Create a socket that connects to a certain host --
#-- $local_host_ip is assumed to be local hostname IP address --
#-------------------------------------------------------------------------
sub open_connection {
local ($remote_hostname, $port) = @_[1,2];
local ($socket_format, $proto, $packed_port, $cur);
local ($remote_addr, @remote_ip, $remote_ip);
local ($local_port, $remote_port);
if ($port !~ /^\d+$/) {
$port = (getservbyname($port, "tcp"))[2];
$port = 80 unless ($port);
}
$proto = (getprotobyname('tcp'))[2];
$remote_addr = (gethostbyname($remote_hostname))[4];
if (!$remote_addr) {
die "Unknown host: $remote_hostname";
}
@remote_ip = unpack("C4", $remote_addr);
$remote_ip = join(".", @remote_ip);
print "Connecting to $remote_ip port $port.\n\n";
$socket_format = 'S n a4 x8';
$local_port = pack($socket_format, &AF_INET, 0, $local_host_ip);
$remote_port = pack($socket_format, &AF_INET, $port, $remote_addr);
socket($_[0], &AF_INET, &SOCK_STREAM, $proto) || die "socket: $!";
bind($_[0], $local_port) || die "bind: $!";
connect($_[0], $remote_port) || die "socket: $!";
$cur = select($_[0]);
$| = 1; # Disable buffering on socket.
select($cur);
}
------------------------------
Date: Tue, 19 Oct 2004 18:36:21 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: HTTP Proxy via HTTP Layer by Perl?
Message-Id: <7qidnTWym4t4C-jcRVn-tg@adelphia.com>
nntp wrote:
> I need proxy, not cache.
Please - read the docs I pointed you to. Squid is a caching proxy, but
you can easily - *if* you *read* the *docs* - disable its cache to turn
it into a plain proxy.
And your babble about making your dialup connection faster by putting a
proxy on a $10/month hosting account is still utter nonsense.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Tue, 19 Oct 2004 19:17:56 -0400
From: "nntp" <nntp@rogers.com>
Subject: Re: HTTP Proxy via HTTP Layer by Perl?
Message-Id: <VKudndqycdZcPejcRVn-1A@rogers.com>
> And your babble about making your dialup connection faster by putting a
> proxy on a $10/month hosting account is still utter nonsense.
>
I don't use dialup.
For example, if I buy a high speed internet to use as a windows/linux proxy,
then I need to pay $50 monthly fee, and the speed is 3M down and 300K up.
On a web proxy, the down/up rate is equal. Close to 1M, which is good, as
proxy is two way in and out. So a cable proxy is only good at 300k at most.
Thanks for the doc. I am going to read it Harder!!!.
------------------------------
Date: Tue, 19 Oct 2004 19:11:40 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: HTTP Proxy via HTTP Layer by Perl?
Message-Id: <slrncnbb9s.24g.tadmc@magna.augustmail.com>
nntp <nntp@rogers.com> wrote:
> This is the code I got online,
It is written in an eight year old style.
I wouldn't trust a programmer or program that does it the way it
was done 8 years ago.
It is very likely worth less than what you paid for it...
> $local_host = `hostname`;
> chop($local_host);
The modern way to remove newlines is chomp().
> sub listen_to_port {
> local ($port) = $_[1];
> local ($socket_format, $proto, $packed_port, $cur, $max_requests);
The modern type of variables are lexical, rather than package, variables.
my($port) = $_[1];
my($socket_format, $proto, $packed_port, $cur, $max_requests);
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 19 Oct 2004 20:31:11 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: HTTP Proxy via HTTP Layer by Perl?
Message-Id: <kvydnVgVuuhNLOjcRVn-jg@adelphia.com>
nntp wrote:
> For example, if I buy a high speed internet to use as a windows/linux proxy,
> then I need to pay $50 monthly fee, and the speed is 3M down and 300K up.
> On a web proxy, the down/up rate is equal. Close to 1M, which is good, as
> proxy is two way in and out. So a cable proxy is only good at 300k at most.
Okay, let me see if I can sort this out. I like a challenge. ;-)
You want to set up a web server. If you put it on your home cable
connection, it won't be as quick because that connection limits the
outgoing bandwidth. (Also, although you don't mention it, most cable
providers strictly prohibit servers.)
Now, on this web server of yours, you're looking for a CGI that forwards
the requests it receives to another server, retrieves the results, and
then sends the results to the browser.
You *might* be able to get away with a simple little script that uses
the HTTP::Proxy module. But, you'd need to run that - or most any other
"canned" proxy application I can think of - as a daemon (aka server)
process. That's not likely to be something you'll be allowed to do on a
budget $10/month hosting account. You could do it with a dedicated
server, but the cheapest I've seen that for is $79/month.
If you want a CGI, you'll probably need to write one. You'll need to
send the request to the remote server and retrieve the results - use
LWP::UserAgent for that. Of course, if you want links on the returned
pages to work, you'll need to parse the returned HTML and fix those -
HTML::Parser will help with that.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 19 Oct 2004 22:22:01 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: m/(\/\*[.|\n]*\*\/)/ to try and match C-Style multiline comments. No matches found.
Message-Id: <slrncnb4s9.img.abigail@alexandra.abigail.nl>
Tad McClellan (tadmc@augustmail.com) wrote on MMMMLXVII September
MCMXCIII in <URL:news:slrncnb2no.1s4.tadmc@magna.augustmail.com>:
)) Vijayaraghavan Kalyanapasupathy <vijai.lists@gmail.com> wrote:
))
)) >> Obviously, you didn't get it right. You're using a character class
)) >> which matches an actual period, vertical-bar, or a newline.
))
)) > Oh I see, I figured that meta-characters will work inside a character
)) > class specification as well. My mistake.
))
))
)) Meta-characters *do* work inside of a character class, but since it
)) is its own language distinct from the regular expression language
)) (and from the Perl language), which characters are meta is different.
))
)) There are only 4 meta-characters in a character class:
))
)) ] ends the class if it is not the 1st char in the class
))
)) ^ negates the class if it is the 1st char, else it is not meta
))
)) - forms a range unless it it 1st or last, in which case it
)) is not meta
))
)) \ used to remove the meta-ness of the other three
\ is also used remove the meta-ness of itself, and to introduce special
characters like \w, \S and \b.
Furthermore, [ can be special inside a character class as well:
[[:alpha:]]
POSIX character classes form their own little language as well, giving
us a language inside a language inside a language inside a language.
Abigail
--
split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};
------------------------------
Date: 19 Oct 2004 17:37:50 -0700
From: hosti1e17@yahoo.com (Hostile17)
Subject: Net::FTP and Passive mode problems
Message-Id: <a5522b8e.0410191637.3971835d@posting.google.com>
I'm using Net::FTP to upload a file.
The server to which I'm uploading requires that I do so in Passive
mode.
I start Net::FTP with "Passive => 1", but the upload takes just over
two minutes, for a tiny file.
Except, it probably isn't really taking two minutes, it's trying to
transfer _non_ passively, then switching modes.
The debug info looks like this:
230 User foobar logged in.
CWD /path/to/files/
250 CWD command successful.
ALLO 5
Timeout at ftpscript.pl line 23 ### SEE BELOW
PASV
227 Entering passive mode (123,4,56,78,910,123)
STOR foobar.txt
125 Data connection already open; Transfer starting.
226 Transfer complete.
Line 23 is where the script says to $ftp->put() my file.
So why, when I've told it to use Passive, is it waiting for a timeout
and only _then_ issuing the PASV message?
TIA
------------------------------
Date: 19 Oct 2004 16:24:04 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Perl Whirl IV from Dubrovnik
Message-Id: <1098228807.E5EVE9NPfFwLLI0ZB+uTrA@teranews>
>>>>> "David" == David K Wall <dwall@fastmail.fm> writes:
David> Matija Papec <perl@my-header.org> wrote:
>> http://misc.linux.hr/geekcruises2004/?lang=en
>>
>> it's Larry on most of the pictures for everybody wanted to take
>> picture with him.
David> No names with the pictures? I recognize Larry and Randal, but if there
David> are other names I might know, it would be pleasant (although by no
David> means necessary) to be able to associate a face with them.
#9 is Ted Tso (of Linux fame). Or at least his 20D camera.
#14 is better picture of Ted.
#25 is "Captain" Neil Bauman, the Geekcruise dude.
#41 is Robert Spier in the center.
#18, #19, #44 is me on the left, Larry on the right, local dude in the middle.
(Many pictures like that because we were standing there for quite a few pix.)
#28 is Larry, his wife Gloria, and the back of Ted's head.
#40 is one of the organizers of codejam.org, which Larry and I had just spoken at.
That's all I spotted for now. I'm horrible with names, sorry.
print "Just another Perl hacker,"; # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 19 Oct 2004 18:09:56 -0400
From: Uri Guttman <uguttman@athenahealth.com>
Subject: Re: regex to clean path
Message-Id: <m3ekjul5qj.fsf@linux.local>
>>>>> "A" == Abigail <abigail@abigail.nl> writes:
A> $$
A> $$ echo '/bin:/usr/bin:/usr/local/bin:/bin' |
A> $$ perl -lpe '1 while s/([^:]+)((:?:[^:]*)+):\1/$1$2/g'
A> $$ /bin:/usr/bin:/usr/local/bin
A> Still fails:
A> $ echo /bin:/bin | perl -lpe '1 while s/([^:]+)((:?:[^:]*)+):\1/$1$2/g'
A> /bin:/bin
A> $ echo /bin:/bar:/bin/bar |\
A> perl -lpe '1 while s/([^:]+)((:?:[^:]*)+):\1/$1$2/g'
A> /bin:/bar/bar
A> $ echo 'poof:oof:of' | perl -lpe '1 while s/([^:]+)((:?:[^:]*)+):\1/$1$2/g'
A> poof:oof
bah!
why don't you fix it! :)
this fixes the first 2:
echo '/bin:/bin' | perl -lpe '1 while s/([^:]+)((:?:[^:]*)*):\1(:?=:|$)/$1$2/g'
/bin
echo '/bin:/bar:/bin/bar' | perl -lpe '1 while s/([^:]+)((:?:[^:]*)*):\1(:?=:|$)/$1$2/g'
/bin:/bar:/bin/bar
the poof:oof:of bug is trickier. i need something like perl6's : (a
commit) so it doesn't backtrack past a previous path.
uri
------------------------------
Date: 19 Oct 2004 22:37:23 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: regex to clean path
Message-Id: <slrncnb5p3.img.abigail@alexandra.abigail.nl>
Uri Guttman (uguttman@athenahealth.com) wrote on MMMMLXVII September
MCMXCIII in <URL:news:m3ekjul5qj.fsf@linux.local>:
`' >>>>> "A" == Abigail <abigail@abigail.nl> writes:
`'
`' A> $$
`' A> $$ echo '/bin:/usr/bin:/usr/local/bin:/bin' |
`' A> $$ perl -lpe '1 while s/([^:]+)((:?:[^:]*)+):\1/$1$2/g'
`' A> $$ /bin:/usr/bin:/usr/local/bin
`'
`' A> Still fails:
`'
`' bah!
`'
`' why don't you fix it! :)
I like to see you sweat ;-)
`'
`' the poof:oof:of bug is trickier. i need something like perl6's : (a
`' commit) so it doesn't backtrack past a previous path.
Well, Perl5 has (?> ).
I think the following works:
#!/usr/bin/perl
use strict;
use warnings;
no warnings qw /syntax/;
while (<DATA>) {
chomp;
print "$_ -> ";
1 while s/(^|(?<=:))([^:]*)(?=:)(.*):\2(?=:|$)/$2$3/;
print "$_\n";
}
__DATA__
a:b:c:c:c:s:a
/bin:/usr/bin:/usr/local/bin
/bin:/usr/bin:/usr/local/bin:/bin
/bin:/usr/bin:/usr/local/bin:/bin:
/bin:/usr/bin:/usr/local/bin:/bin:/sbin
/bin:/bin
/bin:/bar:/bin/bar
/flup:/bin:/usr/bin:/usr/local/bin
/flup:/bin:/usr/bin:/usr/local/bin:/bin
/flup:/bin:/bin
/flup:/bin:/bar:/bin/bar
poof:oof:of
a:b:c:c:c:s:a -> a:b:c:s
/bin:/usr/bin:/usr/local/bin -> /bin:/usr/bin:/usr/local/bin
/bin:/usr/bin:/usr/local/bin:/bin -> /bin:/usr/bin:/usr/local/bin
/bin:/usr/bin:/usr/local/bin:/bin: -> /bin:/usr/bin:/usr/local/bin:
/bin:/usr/bin:/usr/local/bin:/bin:/sbin -> /bin:/usr/bin:/usr/local/bin:/sbin
/bin:/bin -> /bin
/bin:/bar:/bin/bar -> /bin:/bar:/bin/bar
/flup:/bin:/usr/bin:/usr/local/bin -> /flup:/bin:/usr/bin:/usr/local/bin
/flup:/bin:/usr/bin:/usr/local/bin:/bin -> /flup:/bin:/usr/bin:/usr/local/bin
/flup:/bin:/bin -> /flup:/bin
/flup:/bin:/bar:/bin/bar -> /flup:/bin:/bar:/bin/bar
poof:oof:of -> poof:oof:of
Abigail
--
perl -swleprint -- -_=Just\ another\ Perl\ Hacker
------------------------------
Date: Tue, 19 Oct 2004 19:32:12 -0400
From: Bob Walton <see@sig.invalid>
Subject: Re: Special encoded character
Message-Id: <4175a1e3$1_2@127.0.0.1>
Yoann Wyffels wrote:
...
> I catch text from a telnet session (with Net::Telnet Module).
> Unfortunately, in what I catch, I've got some strange characters which are
> encode like this: "\195\169.....".
> For exemple: \195 = é
>
> I don't know what's encode's name it is...? Do you have an idea ?
'Fraid not, not with the information provided. Maybe if you asked the
system administrator of the system you are telnet'ing to? And, BTW,
your question would be the same if you used any other telnet client, so
it's not a Perl question, and doesn't really belong on this newsgroup.
> And do you know how to transform them into normal character ?
...
> Yoann.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 7272
***************************************