[13423] in Perl-Users-Digest
Perl-Users Digest, Issue: 833 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 17 17:28:09 1999
Date: Fri, 17 Sep 1999 14:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <937602312-v9-i833@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 17 Sep 1999 Volume: 9 Number: 833
Today's topics:
Re: A question about some functions from CGI.pm. <zzhang@bayou.uh.edu>
Anomalous syscall timings from Perl (was Re: optimizing (Kragen Sitaker)
Re: cgi help (Abigail)
Re: cgi help <uri@sysarch.com>
Re: CGI probs with long email domains (Kragen Sitaker)
Re: Cleaning up lots of filenames.... <tchrist@mox.perl.com>
Re: CONTEST: Range Searching (Ilya Zakharevich)
Re: Encrypting (and decrypting) password (Alan Curry)
Evaluate variable in caller's namespace? jboes@my-deja.com
Re: Evaluate variable in caller's namespace? (Kragen Sitaker)
hidding information in the webpage <skywing@home.com>
Re: hidding information in the webpage (Kragen Sitaker)
Re: how to do this? <dchristensen@california.com>
Re: make install command fails (Kragen Sitaker)
Re: Making and using a DB. (Help!!!) <dheera@usa.net>
Re: my and hashes; Bug of PERL? (Chris Thompson)
Problem with XS and MakeMaker (Win98) <tlb@algonet.se>
Re: Problem with XS and MakeMaker (Win98) <randy@theoryx5.uwinnipeg.ca>
Re: REQ: tell-a-friend script (Kragen Sitaker)
Re: REQ: tell-a-friend script (Abigail)
Re: Setting a directory (Kragen Sitaker)
Re: What happens with this slice? <makkulka@cisco.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Sep 1999 15:49:37 -0500
From: "zzhang" <zzhang@bayou.uh.edu>
Subject: Re: A question about some functions from CGI.pm.
Message-Id: <7ru9em$m7u$1@Masala.CC.UH.EDU>
I am afraid that I didn't express my question clearly.
The following code is from Lincoln Stein's Official Guide to Programming
with CGI.pm:
%labels = ('eenie'=>'please',
'meenie'=>'stop',
'minie'=>'that');
print $p->radio_group(-name=>'pick_one',
-values=>['eenie', 'meenie', 'minie',
'moe'],
-default=>'meenie',
-linebreak=>1,
-labels=>\%labels);
It will generate the following html code:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>test</TITLE>
</HEAD><BODY BGCOLOR="white"><FORM METHOD="POST"
ENCTYPE="application/x-www-form-urlencoded">
<INPUT TYPE="radio" NAME="pick_one" VALUE="eenie">please<BR><INPUT
TYPE="radio" NAME="pick_one" VALUE="meenie" CHECKED>stop<BR><INPUT
TYPE="radio" NAME="pick_one" VALUE="minie">that<BR><INPUT TYPE="radio"
NAME="pick_one" VALUE="moe">moe<BR></FORM></BODY></HTML>
and the browser will display a set of radio buttons. Now I want to display
'please' in red. Of course I cannot add the html tags <font
color='red'></font> to the above file, since it is generated by Perl/CGI
dynamically. I tried to use:
%labels = ('eenie'=>"<font color='red'>please</font>",
'meenie'=>'stop',
'minie'=>'that');
It didn't work, since everything between the double quotation marks was
taken as a part of the label to
be displayed (means '<' will be changed to '<' and so on). Is there a
simple trick to do this while still
using CGI.pm function radio_group()? Thanks.
Michael de Beer <madebeer@igc.apc.org> wrote in message
news:APC&1'0'50775db2'16d@igc.apc.org...
> Perl scripts generate HTML. Browswers display HTML.
>
> perl scripts using CGI.pm (and not) can generate HTML that indicates
> the browser should change fonts/colors.
>
> This question is so basic I hope you'll read some more documentation
> before trying to write a CGI script. Maybe start here:
> http://www.perl.com/reference/query.cgi?tutorials
>
> Cheers,
> -Michael
------------------------------
Date: Fri, 17 Sep 1999 19:07:47 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Anomalous syscall timings from Perl (was Re: optimizing execution speed)
Message-Id: <7kwE3.16947$N77.1245484@typ11.nn.bcandid.com>
In article <slrn7u4ufo.pke.graham@wing.mirror.bt.co.uk>,
Graham Ashton <graham@mirror.bt.co.uk> wrote:
>In article <obsE3.16435$N77.1218474@typ11.nn.bcandid.com>, Kragen Sitaker wrote:
>>Benchmark: timing 1000000 iterations of null, openclose...
>> null: 12 wallclock secs ( 8.19 usr + 0.01 sys = 8.20 CPU)
>> openclose: 59 wallclock secs (39.27 usr + 4.40 sys = 43.67 CPU)
>>
>>. . . so doing a million open/close system calls took 4.4 seconds. So
>>on this machine (an ancient Sparc 20 running Solaris 2.6) an open/close
>>takes 4.4 microseconds.
>
>I tried it on my dual PII 400 with UW SCSI. Your system call speed beat mine
>into the ground;
>
>Benchmark: timing 1000000 iterations of null, openclose...
> null: 2 wallclock secs ( 1.75 usr + 0.65 sys = 2.40 CPU)
> openclose: 19 wallclock secs ( 9.73 usr + 8.53 sys = 18.26 CPU)
Very interesting. So Perl (which is presumably fairly close to being
the same) was about four times as fast on your box. But the system
calls were roughly half as fast.
Maybe Solaris is lying? Maybe Linux is lying? I have a hard time
understanding how 0.65 seconds could be spent in system calls doing
the null routine. That's more than a third of the total time!
Still, even with wallclock seconds . . .
I wrote a C program to satisfy my curiosity. It reports it's more like
300 microseconds per open/close. Something weird must be going on
here; maybe perl is caching filehandles?
/*
* Test system calls. Solaris results on a
* SunOS kirk 5.6 Generic_105181-13 sun4m sparc SUNW,SPARCstation-20
* :
kirk:/home/kragen/ gcc -O -Wall testopen.c -o testopen
kirk:/home/kragen/ time ./testopen 10000
Null loop: 0.00 user, 0.00 system, 0.00 wallclock
Open-close loop: 0.15 user, 3.30 system, 19.24 wallclock
0.17u 3.32s 0:19.26 18.1%
* This means we're talking 330 microseconds per call.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/times.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
struct rpt_time {
struct tms tms;
struct timeval tod;
};
void fill_rpt_time (struct rpt_time *x) {
times(&x->tms);
gettimeofday(&x->tod, NULL);
}
int report(struct rpt_time *before, char *label) {
struct rpt_time after;
fill_rpt_time(&after);
printf("%20.20s: %5.2f user, %5.2f system, %5.2f wallclock\n",
label,
(float)(after.tms.tms_utime - before->tms.tms_utime)/CLK_TCK,
(float)(after.tms.tms_stime - before->tms.tms_stime)/CLK_TCK,
after.tod.tv_sec - before->tod.tv_sec +
(float)(after.tod.tv_usec - before->tod.tv_usec)/
1000000.0
);
return 0;
}
int main(int argc, char **argv) {
int iterations, fd, i;
struct rpt_time ref;
if (argc != 2) {
fprintf(stderr, "Eat my shorts: %s iterations\n", argv[0]);
return -1;
}
iterations = atoi(argv[1]); /* yes, it's chintzy */
fill_rpt_time(&ref);
for (i = 0; i != iterations; i++) {
}
report(&ref, "Null loop");
fill_rpt_time(&ref);
for (i = 0; i != iterations; i++) {
fd = open(__FILE__, O_RDONLY);
if (fd == -1) {
fprintf(stderr, "open: ");
perror(__FILE__);
return -1;
}
close(fd);
}
report(&ref, "Open-close loop");
return 0;
}
C program ends here.
>Debian Linux 2.2, kernel 2.2.10, Perl 5.005. (I'm not trying to start a
>"my OS+hardware is faster than yours" war by the way, I just thought it
>was interesting that my box got trounced on the system call stuff)
I suspect your perl is doing something different from my perl.
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
Platform:
osname=solaris, osvers=2.6, archname=sun4-solaris
uname='sunos shadow 5.6 generic sun4m sparc sunw,sparcstation-20 '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='gcc', optimize='-O', gccversion=2.8.1
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under solaris
Compiled at May 17 1999 23:47:08
@INC:
/usr/local/lib/perl5/5.00503/sun4-solaris
/usr/local/lib/perl5/5.00503
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris
/usr/local/lib/perl5/site_perl/5.005
.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 17 Sep 1999 14:11:07 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: cgi help
Message-Id: <slrn7u54n9.1j0.abigail@alexandra.delanet.com>
Olli Aalto (olli@fidata.fi) wrote on MMCCVIII September MCMXCIII in
<URL:news:37E1F6EF.8F8D1113@fidata.fi>:
// How do I make my script update the client browser
// every second?
print <<EOT;
<title>Annoying page</title>
<p><font size = "+10000" color = "Hot-Sizzling-Pink">
<blink>Please reload this page every second</blink>
EOT
Make sure you don't put more text on the page, or else it will
take more than a second to download and render it.
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 17 Sep 1999 15:48:16 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: cgi help
Message-Id: <x7yae5gvzz.fsf@home.sysarch.com>
>>>>> "A" == Abigail <abigail@delanet.com> writes:
A> Olli Aalto (olli@fidata.fi) wrote on MMCCVIII September MCMXCIII in
A> <URL:news:37E1F6EF.8F8D1113@fidata.fi>:
A> // How do I make my script update the client browser
A> // every second?
A> print <<EOT;
A> <title>Annoying page</title>
A> <p><font size = "+10000" color = "Hot-Sizzling-Pink">
A> <blink>Please reload this page every second</blink>
A> EOT
how many time do we have to say, don't post in html! and blink is evil!!
any more posts like this and i will have to plonk you.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Fri, 17 Sep 1999 19:16:16 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: CGI probs with long email domains
Message-Id: <4swE3.16956$N77.1246478@typ11.nn.bcandid.com>
In article <37E28A52.1E82CA00@gunnison.com>, <spaul@gunnison.com> wrote:
>I am running Slackware 3.5, using sendmail and am having problems with a
>script that emails some form info to a client. It seems that perl will
>not allow an email address with a domain as long as
>"meridianhuntclub.com" in our CGI-bin.
You can have a Perl string consisting of hundreds of megabytes on any
machine where it'll fit into virtual memory. Perl is not the problem.
What is the problem?
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 17 Sep 1999 14:27:19 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Cleaning up lots of filenames....
Message-Id: <37e2a427@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.unix.shell, Al Weston <alweston@my-deja.com> writes:
:This works just fine if I run it inside any given directory, but I want
:a way to do it recursively. I tried using find, but it went into an
:infinite loop because it is trying to find files that have already been
:renamed. Here's the find command I used:
:
:find htdocs -type f -exec lowercase.sh {} \;
:
:Is there a way to do something like this?
Certainly:
$ find htdocs -type f -print | rename y/A-Z/a-z/
Where 'rename' is something like this:
#!/bin/perl
# rename -- original by Larry Wall, since hacked by Tom Christiansen
($op = shift) || die "Usage: rename expr [files]\n";
*func = eval "sub { $op }" || die;
chomp(@ARGV = <STDIN>) unless @ARGV; # names on stdin instead
for (@ARGV) {
my $had_been = $_;
func();
rename($had_been,$_) || die "can't rename $had_been to $_: $!"
unless $had_been eq $_;
}
I don't know why this gets asked seemingly everyday in the shell group.
It's in the Unix FAQ. Alas.
:And if anyone is feeling really helpful, I could use some tips as to how
:to go about updating all of the link references to the new lowercased
:filenames :)
*DING*
*DING*
*DING*
*DING*
*DING*
*DING*
*DING*
Yes, folks, we *have* a winner!
Congratulations, young man, today is your lucky day! Because you are
the the 91,999th requestor of the "how to I rename files" question, and
because today is the nineteenth day of the ninth month of the ninety-ninth
year of this century, you are the lucky recipient of a fabulous solution
guaranteed to far exceed even your wildest dreams.
Enjoy!
Here's the manpage:
NAME
hrefedit - rewrite href tags in HREF fields of HTML files
SYNOPSIS
hrefedit [ -l ] [ -i*extension* ] *editop* [ *file* ... ]
DESCRIPTION
The hrefedit program filters input files according to the *editop*
specified in the command line. This is expected to be a bit
of Perl code, such as `tr/A-Z/a-z/' or `s/\.htm$/.html/'. The
specified operation will be applied to the trailing path
component of the HREF portion of an anchor tag. It only pays
attention to HREFs that are of a "file:" schema type or else an
unspecified one.
The -l option says to read filenames from standard input instead
of from the command line. An argument of -- terminates option
processing.
If -i*extension* is used to update the file "in place". The new
copy is left in the original filename, and the old copy is placed
in a file whose name has the specified extension concatenated
on it. The default extension is ".bak".
EXAMPLES
This converts to lower case:
$ hrefedit 'tr/A-Z/a-z/' somefile.html
This would modify the file "in place", leaving a back-up in
somefile.html.orig:
$ hrefedit -i.orig 'tr/A-Z/a-z/' somefile.html
This changes trailing ".htm" to ".html":
$ hrefedit 's/\.htm$/.html/' somefile.html
And this does both:
$ hrefedit 'tr/A-Z/a-z/; s/\.htm$/.html/' somefile.html
For example, it would would change this:
<A HREF="http://www.remote.com/TEST.HTM#FRAG">stuff</A>
<A HREF="ftp://ftp.remote.com/TEST.HTM#FRAG">stuff</A>
<A HREF="file:///localhost/TEST.HTM#FRAG">stuff</A>
<A HREF="file:/localhost/TEST.HTM#FRAG">stuff</A>
<A HREF="/TEST.HTM#FRAG">stuff</A>
<A HREF="TEST.HTM#FRAG">stuff</A>
into this:
<A HREF="http://www.remote.com/TEST.HTM#FRAG">stuff</A>
<A HREF="ftp://ftp.remote.com/TEST.HTM#FRAG">stuff</A>
<a href="file:///localhost/test.html#FRAG">stuff</A>
<a href="file:/localhost/test.html#FRAG">stuff</A>
<a href="/test.html#FRAG">stuff</A>
<a href="test.html#FRAG">stuff</A>
This reads filenames from stdin:
$ find /var/htdocs -type f -print | hrefedit -l 'tr/A-Z/a-z/'
This fetches a document from the web and processes it using
the GET command, which is part of the LWP bundle, and is
essentially an alias for lwp-request -mGET:
$ GET http://www.somewhere.com/ |
hrefedit 'tr/A-Z/a-z/' > /tmp/save.html
And so does this, interestingly enough:
$ hrefedit 'tr/A-Z/a-z/' "GET http://www.somewhere.com/ |"
The hrefedit program is sometimes useful in conjunction with
the rename program:
$ OP='tr/A-Z/a-z/; s/\.htm$/.html/'
$ find /var/htdocs -name '*.HTM' -print | while read FILE; do
hrefedit -i.orig "$OP" "$FILE" &&
rename "$OP" "$FILE" &&
rm "$FILE.orig"
done
MODULES
Use the standard Carp module and the HTML::Filter, URI::URL,
and HTML::Entities modules from CPAN.
RESTRICTIONS
Doesn't handle image links.
Only considers the trailing path component, not the entire
URL.
You cannot use -i but omit the extension to avoid saving a
back-up file.
Doesn't only consider relative file links, although there is
an XXX comment that contains untested code to attempt that.
BUGS
None known.
AUTHOR
Tom Christiansen, tchrist@perl.com.
COPYRIGHT
Copyright 1999 Tom Christiansen
This program is free and open software. You may use, copy,
modify, distribute, and sell both this program as well as any
modified variants in any way that you wish, provided that you
do not restrict others from doing the same, nor remove this
copyright. Modified copies must be clearly indicated as such.
HISTORY
Initial release: 17 September 1999
And here's the program.
--tom
#!/usr/bin/perl -w
#
# hrefedit - rewrite href tags in <A HREF="..."> fields of HTML files
# by Tom Christiansen,
# using ideas distantly derived from Gisle Aas and Larry Wall
use Carp;
use strict;
my($In_Place, $Get_File_List);
sub usage {
print STDERR "@_\n" if @_;
die "usage: $0 operation [file] ...\n";
}
sub parse_opts {
ARG: while (@ARGV && $ARGV[0] =~ s/^-(?=.)//) { # getopts is for wimps
OPT: for (shift @ARGV) {
m/^$/ && do { next ARG; };
m/^-$/ && do { last ARG; };
s/^l// && do { $Get_File_List++; redo OPT; };
s/^i(.*)// && do { $In_Place = $1 || ".bak"; next ARG; };
usage("Unknown option: $_");
}
}
my $code_string;
unless ($code_string = shift @ARGV) {
usage("No operation given");
}
if ($Get_File_List && @ARGV) {
usage("Can't supply files if -l given");
}
# undef &operation; # silence -w
*User_OpFunc = eval "sub { $code_string }"
|| usage("Bad perl operation: $@");
}
sub do_files {
my $filename;
@ARGV = ('-') unless @ARGV || $Get_File_List;
if (@ARGV) {
for $filename (@ARGV) {
MyFilter->process_file($filename,\&User_OpFunc,$In_Place);
}
}
else {
while ($filename = <STDIN>) {
chomp $filename;
MyFilter->process_file($filename,\&User_OpFunc,$In_Place);
}
}
}
sub init_all {
# i hate not knowing what triggered an uncaught exception
$SIG{__DIE__} = sub {
my $fn = \&confess;
for (my $i = 0; my @ci = caller($i); $i++) {
if ($ci[3] eq 'Carp::confess') {
$fn = sub { print STDERR @_; exit(1) };
# XXX: should be POSIX::_exit(1)
}
}
$fn->("Uncaught exception:\n @_\n") if @_;
};
}
# Subclass HTML::Filter to do the parsing and everything
package MyFilter;
use Carp;
require HTML::Filter;
require URI::URL;
use vars qw(@ISA);
@ISA=qw(HTML::Filter);
use HTML::Entities qw(encode_entities);
# override parent method
sub start {
my($self, $tag, $attr, $attrseq, $orig) = @_;
if ($tag eq 'a' && exists $attr->{href}) {{ # doubled for next()
my $url = URI::URL->new($attr->{href});
next if $url->scheme && $url->scheme ne 'file';
my @path_components = $url->path_components;
# this next line would(should?) permit only relative paths
#XXX# next if length $path_components[0];
local $_ = $path_components[-1];
munge_func(); # will raise exception if undefined; see below
if ($_ ne $path_components[-1]) {
$path_components[-1] = $_;
$url->path_components(@path_components);
$attr->{href} = "$url"; # call stringify method
# must reconstruct the start tag based on $tag and $attr.
# wish we instead were told the extent of the 'href' value
# in $orig.
my $tmp = "<$tag";
for (@$attrseq) {
my $encoded = encode_entities($attr->{$_});
$tmp .= qq( $_="$encoded ");
}
$tmp .= ">";
$tmp =~ s/ ">$/">/;
$self->output($tmp);
return;
}
}}
$self->output($orig);
}
# this is (we hope) a new method
sub process_file {
local *usage = sub {
my $funcname = (caller(1))[3];
if (@_) { warn "$funcname: @_" }
croak("usage: $funcname(filename,editop[,inplace])");
};
shift @_; # object/class
usage("not enough args") if @_ < 2;
usage("too many args") if @_ > 3;
my($filename, $editor, $inplace) = @_;
usage("edit function not code reference")
unless UNIVERSAL::isa($editor,'CODE');
undef $inplace if $filename =~ / ^ \s* - | \| \s* $ /x;
my $tmpfile = "$filename.tmp$$";
local *TMP;
my $prev_select;
if ($inplace) {
open(TMP, "> $tmpfile") || die("can't write $tmpfile: $!");
$prev_select = select(TMP);
}
local *munge_func = $editor; # for our replacement start() above
MyFilter->new->parse_file($filename);
if ($inplace) {
select($prev_select);
close(TMP) || die("can't close $tmpfile: $!");
rename($filename, "$filename$inplace")
|| die("can't rename('$filename', '$filename$inplace'): $!");
rename($tmpfile, $filename)
|| die("can't rename('$tmpfile', '$filename'): $!");
}
}
# Now use the new class
package main;
MAIN:
parse_opts();
init_all();
do_files();
exit();
__END__
=head1 NAME
hrefedit - rewrite href tags in HREF fields of HTML files
=head1 SYNOPSIS
B<hrefedit> [ B<-l> ] [ B<-i>I<extension> ] I<editop> [ I<file> ... ]
=head1 DESCRIPTION
The B<hrefedit> program filters input files according to the I<editop>
specified in the command line. This is expected to be a bit of Perl code,
such as C<tr/A-Z/a-z/> or C<s/\.htm$/.html/>. The specified operation
will be applied to the trailing path component of the HREF portion of
an anchor tag. It only pays attention to HREFs that are of a "file:"
schema type or else an unspecified one.
The B<-l> option says to read filenames from standard input
instead of from the command line. An argument of B<--> terminates
option processing.
If B<-i>I<extension> is used to update the file "in place". The new
copy is left in the original filename, and the old copy is placed
in a file whose name has the specified extension concatenated on it.
The default extension is ".bak".
=head1 EXAMPLES
This converts to lower case:
$ hrefedit 'tr/A-Z/a-z/' somefile.html
This would modify the file "in place", leaving a back-up
in F<somefile.html.orig>:
$ hrefedit -i.orig 'tr/A-Z/a-z/' somefile.html
This changes trailing ".htm" to ".html":
$ hrefedit 's/\.htm$/.html/' somefile.html
And this does both:
$ hrefedit 'tr/A-Z/a-z/; s/\.htm$/.html/' somefile.html
For example, it would would change this:
<A HREF="http://www.remote.com/TEST.HTM#FRAG">stuff</A>
<A HREF="ftp://ftp.remote.com/TEST.HTM#FRAG">stuff</A>
<A HREF="file:///localhost/TEST.HTM#FRAG">stuff</A>
<A HREF="file:/localhost/TEST.HTM#FRAG">stuff</A>
<A HREF="/TEST.HTM#FRAG">stuff</A>
<A HREF="TEST.HTM#FRAG">stuff</A>
into this:
<A HREF="http://www.remote.com/TEST.HTM#FRAG">stuff</A>
<A HREF="ftp://ftp.remote.com/TEST.HTM#FRAG">stuff</A>
<a href="file:///localhost/test.html#FRAG">stuff</A>
<a href="file:/localhost/test.html#FRAG">stuff</A>
<a href="/test.html#FRAG">stuff</A>
<a href="test.html#FRAG">stuff</A>
This reads filenames from stdin:
$ find /var/htdocs -type f -print | hrefedit -l 'tr/A-Z/a-z/'
This fetches a document from the web and processes it using the B<GET>
command, which is part of the LWP bundle, and is essentially an alias
for B<lwp-request -mGET>:
$ GET http://www.somewhere.com/ |
hrefedit 'tr/A-Z/a-z/' > /tmp/save.html
And so does this, interestingly enough:
$ hrefedit 'tr/A-Z/a-z/' "GET http://www.somewhere.com/ |"
The B<hrefedit> program is sometimes useful in conjunction
with the B<rename> program:
$ OP='tr/A-Z/a-z/; s/\.htm$/.html/'
$ find /var/htdocs -name '*.HTM' -print | while read FILE; do
hrefedit -i.orig "$OP" "$FILE" &&
rename "$OP" "$FILE" &&
rm "$FILE.orig"
done
=head1 MODULES
Use the standard Carp module and the HTML::Filter, URI::URL, and
HTML::Entities modules from CPAN.
=head1 RESTRICTIONS
Doesn't handle image links.
Only considers the trailing path component, not the entire URL.
You cannot use B<-i> but omit the extension to avoid saving
a back-up file.
Doesn't only consider relative file links, although there is
an XXX comment that contains untested code to attempt that.
=head1 BUGS
None known.
=head1 AUTHOR
Tom Christiansen, tchrist@perl.com.
=head1 COPYRIGHT
Copyright 1999 Tom Christiansen
This program is free and open software. You may use, copy, modify,
distribute, and sell both this program as well as any modified variants
in any way that you wish, provided that you do not restrict others from
doing the same, nor remove this copyright. Modified copies must be
clearly indicated as such.
=head1 HISTORY
Initial release: 17 September 1999
--
Sun and MicroSoft and Netscape have the entire Internet by the short curlies. As long as
they throw enough marketing dollars at something, we all have to fall in line, regardless
of anything. So much for "open standards". -- Aaron Watters in <4d0c0d$9fr@mtinsc01-mgt.ops.worldnet.att.net>
------------------------------
Date: 17 Sep 1999 18:19:09 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: CONTEST: Range Searching
Message-Id: <7ru0mt$9vh$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tom Christiansen
<tchrist@mox.perl.com>],
who wrote in article <37e1043e@cs.colorado.edu>:
> 3) Write a "patba" program that prints out up to
> X lines before the match and Y lines after the match.
>
> patba [-A X] [-B T] pattern [files ...]
>
> or both N before and after:
>
> patba [-C N] pattern [files ...]
Here is YAO. It takes one file only, and matches for /\b\w\b/ with 3
lines of context before and a fter the match.
Changing it to correspond to the above API is left as an exersize to
the reader.
Ilya
#!/usr/bin/perl -w
use strict;
package TH;
# Array: 0: FH, 1: buffer, 2: pre, 3: pre + 1 + post, 4: count, 5: closed, 6: last-output
sub TIEHANDLE {
shift;
local *T; # Requires *T below, not \*T
open T, shift or die;
my ($pre, $post, @buf) = (shift, shift);
my $me = bless [*T, \@buf, $pre, $pre + $post + 1, 0, 0, -1 ];
$me->fill for 1..$post;
$me;
}
sub fill {
my $self = shift;
return if $self->[5];
my $in = readline $self->[0];
$self->[5] = 1, (close $self->[0] or die), return unless defined $in;
$self->[1][$self->[4]++ % $self->[3]] = $in;
}
sub READLINE {
my $self = shift;
$self->fill;
return if $self->[6] >= $self->[4] - 1;
$self->[1][++$self->[6] % $self->[3]]
}
sub report {
my $self = shift;
my $f = $self->[6] - $self->[2];
my $l = $f + $self->[3];
$f = 0 if $f < 0;
$l = $self->[4]-1 if $l >= $self->[4];
grep defined, map $self->[1][ $_ % $self->[3] ], $f..$l;
}
package main;
tie *FH, 'TH', shift, 3, 3;
/\b\w\b/ and print "vvvvvv\n",(tied *FH)->report, "^^^^^^\n" while <FH>;
------------------------------
Date: Fri, 17 Sep 1999 19:40:28 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Encrypting (and decrypting) password
Message-Id: <MOwE3.16987$N77.1248521@typ11.nn.bcandid.com>
In article <0E16861EE7BCD111BE9400805FE6841F0B726A95@c1s5x001.cor.srvfarm.origin-it.com>,
Steve Button <steve.button@nl.origin-it.com> wrote:
>Yes, that's what I want to do! (for now) I assume you're suggeting that I
>simply XOR each of the characters with some (known) bitmask and then do the
>same thing again at the other end, to switch it back again. This sounds like
>what I need. I don't need anything more fancy than that, because I'm only
FWIW, I have written a module to do this, which could might be useful to you.
I called it CQA::Session (the "CQA" is derived from the name of the company I
work for and the name of the first script I wrote to use this module... I'd
appreciate some suggestions on a better name.)
http://www.cqc.com/~pacman/projects/cqasession/ is the pod2html and a
download link.
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Fri, 17 Sep 1999 19:00:22 GMT
From: jboes@my-deja.com
Subject: Evaluate variable in caller's namespace?
Message-Id: <7ru33u$mqd$1@nnrp1.deja.com>
Here's my problem. I want to create a routine that logs the value of a
variable in a particular format:
$foo = 23;
&logVar($foo);
results in
$foo: 23
The catch is passing in $foo's name and value at the same time. I hit
upon this:
&logVar('foo');
and then evaluating the string passed in as a variable name:
sub logVar {
$name = shift;
print STDERR "\$$name: " . eval("\$$name") . "\n";
}
This works as long as the caller isn't a package, or doesn't use 'my'
to declare the variable!
Next step was to evaluate the caller and use that as a symbol table,
e.g.,
use Symbol;
$name = qualify shift, caller();
# name is now 'main::foo';
But this doesn't work if the caller is in a 'require' file. Any hints?
(Okay, I'll admit I'm lazy, but there's a reason I don't just say
print STDERR '$foo: ', $foo;
I had this working when the associated package of code was just
'required' in where needed, but then I converted this to a module so
that it could use carp and override it.)
--
Jeff Boes jboes@qtm.net
http://www.qtm.net/~jboes/
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 17 Sep 1999 19:31:06 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Evaluate variable in caller's namespace?
Message-Id: <_FwE3.16977$N77.1246146@typ11.nn.bcandid.com>
In article <7ru33u$mqd$1@nnrp1.deja.com>, <jboes@my-deja.com> wrote:
>$foo = 23;
>&logVar($foo);
>
>results in
>
>$foo: 23
Not sure how to do that, other than logVar('$foo', $foo).
>and then evaluating the string passed in as a variable name:
>
>sub logVar {$name = shift; print STDERR "\$$name: ".eval("\$$name")."\n";}
>
>This works as long as the caller isn't a package, or doesn't use 'my'
>to declare the variable!
If the caller uses 'my', they did it so nobody would be able to access
the variable outside its lexical scope. This could be thought of as a
good thing.
You could do some black magic with 'caller' to get at package
variables. But you already tried that, and it didn't work with
required files.
What you really need are macros.
There *must* be a way to do this, though; the Perl debugger is written
in Perl, isn't it?
So the answer is: I don't know.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 17 Sep 1999 15:17:39 -0400
From: "ken" <skywing@home.com>
Subject: hidding information in the webpage
Message-Id: <7ru42l$mds$1@winter.news.rcn.net>
Hi:
I developed a very simple web base e-mail that can let user connect to
their pop server anywhere by using the perl libnet module. I figure out the
this module will put the user name and their password in the webpage in
order to read all mails in the pop server. Is anybody know how I can hide
these information in the webpage or what should I do to improve this? Thanks
------------------------------
Date: Fri, 17 Sep 1999 19:33:36 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: hidding information in the webpage
Message-Id: <kIwE3.16982$N77.1248294@typ11.nn.bcandid.com>
In article <7ru42l$mds$1@winter.news.rcn.net>, ken <skywing@home.com> wrote:
> I developed a very simple web base e-mail that can let user connect to
>their pop server anywhere by using the perl libnet module. I figure out the
>this module will put the user name and their password in the webpage in
>order to read all mails in the pop server. Is anybody know how I can hide
>these information in the webpage or what should I do to improve this? Thanks
Preferably keep the username and password on the server (for a little
while) after they send it. Use a cookie or HTTP basic authentication
to authenticate the browser.
Hiding information in web pages in <input type=hidden>, with the idea
of keeping it secret, is a really bad idea. Hiding it with the idea of
keeping the user from having to read fields they don't care about is
probably OK.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 17 Sep 1999 13:24:20 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: how to do this?
Message-Id: <37e2a085_5@news5.newsfeeds.com>
Lovenox:
I never found a newby newsgroup. I've lots of burns and scars as a
result ;-)
Note that Perl/Cgi is better served by
comp.infosystems.www.authoring.cgi.
As for the details, my ISP was good enough to post readme's and
FAQ's that explained their specifics. However, I was expected to
understand and operate FTP, Telnet, and the Un*x shell of my choice
(Bash). Find a good computer bookstore and start here:
Peek, Jerry / Todino, Grace / Strang, John, 12/1997, "Learning
the UNIX Operating System", 4 ed., O'Reilly, & Associates, ISBN
1565923901.
--
David Christensen
dchristensen@california.com
Lovenox wrote in message
<7rtqg0$1e7$1@birch.prod.itd.earthlink.net>...
> Is there a novice perl forum that addresses simple stuff such as
how to
>change variables, chmod to 755, configure the program, etc?
Basically learn
>how to set up Perl scripts in the right directories so they
actually work.
>Can a good FTP program do all this? The freeware isn't very
helpful as far
>as FTP clients go.
>
> Thanks in advance,
>
>
>
>
>
>--
>______________________________________________
>
>- Lovenox
>
>
>
>
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 17 Sep 1999 19:08:49 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: make install command fails
Message-Id: <5lwE3.16949$N77.1245999@typ11.nn.bcandid.com>
In article <37E2811B.2A48FAD@1185design.com>,
mikej <mikej@1185design.com> wrote:
>Im trying to install some perl modules, and I got the perl Makefile.PL
>command to work by entering the full path to perl (BTW how do I set it
>up so I can just type perl then the filename, and not the whole path, is
>there some config
>file in Apache?) but now I try to do the make test and make install
>commands to finish installing the module but it gives me this error:
>
>make: not found
>
>am I missing something? Thanks for any help.
A bunch of people replied to you several days ago. Was something wrong
with our answers? Presumably it won't help you if we just post them again.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 17 Sep 1999 20:00:42 GMT
From: Dheera <dheera@usa.net>
Subject: Re: Making and using a DB. (Help!!!)
Message-Id: <7ru6l4$peg$1@nnrp1.deja.com>
Here is the exact address (DB_File and a bunch of others are available
here):
http://www.activestate.com/packages/zips/
In article <7rsl52$q16$1@news.uk.ibm.com>,
"Matt King" <mattking@techie.com> wrote:
> Please tell me where I can get it. I tried the Active web site and
there was
> not DB_File package for download. Perhaps they have more then one
area? Or
> perhaps it's got some strange name?
>
> Do you know if using the DB_File will solve the current problems I'm
having
> with the SDBM_File package? Are there any other alternatives to this
that
> can be installed in the Active version? (I don't have the make utility
> so..... ppm or manual installation it has to be (please not manual,
please)
> (anyone know where I can find a Win32/Active make? Found a pmake,
doesn't
> work though.) ).
>
> I'm begining to see why it's called active perl, you have to be real
active
> to get it to work, and continue working, like real perl =P
>
> Matt
>
> Eric Bohlman <ebohlman@netcom.com> wrote in message
> news:7rs94i$b24@dfw-ixnews6.ix.netcom.com...
> > DB_File is available for ActivePerl and can be installed with PPM.
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 17 Sep 1999 20:28:15 GMT
From: nospam@nospam.nospam (Chris Thompson)
Subject: Re: my and hashes; Bug of PERL?
Message-Id: <7ru88v$ct8$1@pegasus.csx.cam.ac.uk>
In article <Pine.GSO.4.10.9909090657550.16999-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> wrote:
>On Thu, 9 Sep 1999, Bernd Kronmueller wrote:
>
[...]
>
>> #! /usr/loacal/bin/perl -w
>
>It's generally better to cut-and-paste your actual code, rather than
>retyping it, when you're reporting a problem.
It's an unwarranted assumption on your part that he wasn't doing that.
After all, it's not *mandatory* to keep perl in /usr/cloacal/bin/perl.
Chris Thompson
Email: cet1 [at] cam.ac.uk
------------------------------
Date: Fri, 17 Sep 1999 21:27:08 +0200
From: Andreas Hagelberg <tlb@algonet.se>
Subject: Problem with XS and MakeMaker (Win98)
Message-Id: <37E2960C.AD4278EE@algonet.se>
Hi,
I'm trying to create modules in C/C++ to link into Perl (on Win98), only
it doesn't work. I've done exactly as all manuals and tutorials say.
I've tried making just a HelloWorld-program (via the tutorial found in
Perl pod-documentation) and not even that works. The problem I think is
with MakeMaker. Everything works fine up till when I run Makefile.pl.
Instead of outputting the proper format I get the following message:
Usage: xsubpp [-v] [-C++] [-except] [-prototypes] [-noversioncheck]
[-nolinenumb
ers] [-s pattern] [-typemap typemap]... file.xs
Writing Makefile for Mytest
Obviously Makemaker tries to execute xsubpp with errornous parameters or
something of the kind. The makefile.pl is the standard generated one and
I havn't modified it in any way.
I'm using ActiveState Perl 5.005_3 Build 519. A complete output from
"Perl -V" on my system can be found last in the message. The only thing
I've changed is the name of my C-compiler (Borland C++ 5.02).
I just can't seem to get it to work. The porblem is that I don't really
know anything about XS or the Perl API and that's way I'm asking all you
guys and gals out there.
Thank you in advance
/Andreas
--
______________________________________________________________________
ANDREAS HAGELBERG - Student at "Högskolan i Karlskrona/Ronneby
- IT-consultant at Ericsson Software Technology AB
- Webmaster at AllGlobal (http://allglobal.com)
+ E-mail: tlb@algonet.se or di97aha@student.hk-r.se
+ Web: http://www.algonet.se/~tlb - Visual Systems Check
+ Address: Stenbocksvägen 6, SE-372 37 Ronneby, SWEDEN
+ ICQ UIN: 128240
+ Tel: +46-(0)457-19141 ________________________________________
c:\>perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 03) configuration:
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32-x86-object
uname=''
hint=recommended, useposix=true, d_sigaction=undef
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='bcc32.exe', optimize='-Od -MD -DNDEBUG -TP -GX', gccversion=
cppflags='-DWIN32'
ccflags ='-Od -MD -DNDEBUG -TP -GX -DWIN32 -D_CONSOLE -DNO_STRICT
-DHAVE_DE
S_FCRYPT -DPERL_OBJECT'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -release -machine:x86'
libpth="C:\program\Perl\lib\core"
libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.
lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib wsock
32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
PerlCRT.lib
libc=C:\program\Perl\lib\CORE\PerlCRT.lib, so=dll, useshrplib=yes,
libperl=p
erlcore.lib
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
-machine:x86'
Characteristics of this binary (from libperl):
Locally applied patches:
ActivePerl Build 519
Built under MSWin32
Compiled at Aug 12 1999 09:50:30
@INC:
C:/Program/Perl/lib
C:/Program/Perl/site/lib
.
------------------------------
Date: 17 Sep 1999 20:30:03 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: Problem with XS and MakeMaker (Win98)
Message-Id: <7ru8cb$po6$1@canopus.cc.umanitoba.ca>
In comp.lang.perl.misc, Andreas Hagelberg <tlb@algonet.se> wrote:
> I'm trying to create modules in C/C++ to link into Perl (on Win98), only
> it doesn't work. I've done exactly as all manuals and tutorials say.
> I've tried making just a HelloWorld-program (via the tutorial found in
> Perl pod-documentation) and not even that works. The problem I think is
> with MakeMaker. Everything works fine up till when I run Makefile.pl.
> Instead of outputting the proper format I get the following message:
> Usage: xsubpp [-v] [-C++] [-except] [-prototypes] [-noversioncheck]
> [-nolinenumb
> ers] [-s pattern] [-typemap typemap]... file.xs
Hi,
In a directory ExtUtils in your perl tree, there is a
file MM_Unix.pm. In that file there's two subroutines - xs_o
and xs_c - each with a line of the form
command_1 > file && command_2
The DOS "shell" can get confused over the '&&'. Try changing these
two instances to
command_1 > file
command_2
and see if that helps.
You may also look for instances of redirections like
command > some_place 2>&1
and get rid of the '2>&1', which can also confuse the
(standard) DOS shell in Windows 9x.
best regards,
Randy Kobes
--
Physics Department Phone: (204) 786-9399
University of Winnipeg Fax: (204) 774-4134
Winnipeg, Manitoba R3B 2E9 e-mail: randy@theoryx5.uwinnipeg.ca
Canada http://theory.uwinnipeg.ca/
------------------------------
Date: Fri, 17 Sep 1999 19:21:47 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: REQ: tell-a-friend script
Message-Id: <fxwE3.16968$N77.1247284@typ11.nn.bcandid.com>
In article <slrn7u5481.1j0.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMCCVIII September
>MCMXCIII in <URL:news:m1d7vh33ou.fsf@halfdome.holdit.com>:
>%% Ahh, but elsif is *not* misspelled, unless you happen to type it as
>%% elseif... then *you* are the one mispelling it.
>
>So, what makes "elsif" not misspelled, and "HTTP_REFERER" misspelled?
If there were an English word pronounced "else if", it could be spelled
"elsif". It probably would not be spelled "elseif"; "ei" is the wrong
spelling for the sound.
On the other hand, I had some ghoti last night.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 17 Sep 1999 15:22:25 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: REQ: tell-a-friend script
Message-Id: <slrn7u58su.1j0.abigail@alexandra.delanet.com>
Kragen Sitaker (kragen@dnaco.net) wrote on MMCCVIII September MCMXCIII in
<URL:news:fxwE3.16968$N77.1247284@typ11.nn.bcandid.com>:
%% In article <slrn7u5481.1j0.abigail@alexandra.delanet.com>,
%% Abigail <abigail@delanet.com> wrote:
%% >Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMCCVIII September
%% >MCMXCIII in <URL:news:m1d7vh33ou.fsf@halfdome.holdit.com>:
%% >%% Ahh, but elsif is *not* misspelled, unless you happen to type it as
%% >%% elseif... then *you* are the one mispelling it.
%% >
%% >So, what makes "elsif" not misspelled, and "HTTP_REFERER" misspelled?
%%
%% If there were an English word pronounced "else if", it could be spelled
%% "elsif". It probably would not be spelled "elseif"; "ei" is the wrong
%% spelling for the sound.
How do you pronounce an underscore? How would you pronounce
"HTTP_REFERRER", with the first part being an acronym, and the latter
part being a word? Is "HTTP_REFERRER" a single word?
Abigail
--
perl -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
print chr 0x$& and q
qq}*excess********}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 17 Sep 1999 19:10:54 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Setting a directory
Message-Id: <2nwE3.16951$N77.1246156@typ11.nn.bcandid.com>
In article <494318b282nik@pop.onlinehome.de>,
Nik Gare <nik@cheddarcheese.de> wrote:
>Is their a way to find the name of the directory using perl?
Read the posts earlier this week on the subject.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 17 Sep 1999 12:01:02 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: What happens with this slice?
Message-Id: <37E28FEE.84441455@cisco.com>
[ Alex Farber wrote:
> But I wonder, why doesn't the first approach
> work?
This worked for me. No errors.
-
use Data::Dumper;
@loh =(
{ day=>1},
{ day=>7},
{ day=>4},
{ day=>2},
{ day=>7},
{ day=>8},
{ day=>9},
{ day=>21},
{ day=>34},
{ day=>9}
);
for $href ((sort {$a -> {day} <=> $b -> {day}} @loh)[0..9]) # take top 10
{
$href -> {rank} = ++$rank;
}
print Dumper ( \@loh );
-- results --
$VAR1 = [
{
'rank' => 1,
'day' => 1
},
{
'rank' => 4,
'day' => 7
},
{
'rank' => 3,
'day' => 4
},
{
'rank' => 2,
'day' => 2
},
{
'rank' => 5,
'day' => 7
},
{
'rank' => 6,
'day' => 8
},
{
'rank' => 7,
'day' => 9
},
{
'rank' => 9,
'day' => 21
},
{
'rank' => 10,
'day' => 34
},
{
'rank' => 8,
'day' => 9
}
];
--perl -v --
This is perl, version 5.005_02 built for sun4-solaris
--
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 833
*************************************