[16717] in Perl-Users-Digest
Perl-Users Digest, Issue: 4129 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 25 09:05:30 2000
Date: Fri, 25 Aug 2000 06:05:12 -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: <967208712-v9-i4129@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 25 Aug 2000 Volume: 9 Number: 4129
Today's topics:
Re: @_ as array <amir_e_a@netvision.net.il>
Re: Docs on Mac (Martien Verbruggen)
Re: Docs on Mac (Jakob Schmidt)
Re: Extracting a number of lines in a text file (Rafael Garcia-Suarez)
Re: Extracting a number of lines in a text file <hasant@trabas.com>
Re: Extracting a number of lines in a text file <uackermann@orga.com>
Re: Just another silly post. (Martien Verbruggen)
Re: legal date (Marcel Grunauer)
Re: Local install of perl modules (Marcel Grunauer)
Re: Modifying @INC: my problem and solution (any commen <hasant@trabas.com>
Re: Perl vs. other scripting languages (Helgi Briem)
Re: perl/Informix <e.g.ijff@chello.nl>
Re: RegEx (Martien Verbruggen)
Re: Remove a backslash from a string. (Martien Verbruggen)
Re: Self-Answering Questions (Was Re: Flipflop matching (Martien Verbruggen)
Re: Stumped by Reg Exp Problem - help?? <shamilton@plateausystems.holdthespam.com>
stupid question probably <info@ezboo.com.xx>
Re: stupid question probably <vikingrscup@rogue-spear.com>
Re: stupid question probably <info@ezboo.com.xx>
uc problems (Laurent de Lasteyrie)
Re: uc problems <stephenk@cc.gatech.edu>
Re: uc problems (Jakob Schmidt)
Re: URLs ending in / <vikingrscup@rogue-spear.com>
Re: URLs ending in / <flavell@mail.cern.ch>
Re: use CGI to remove files <lincolnmarr@nospam.europem01.nt.com>
Re: Win32 Registry and IP addresses. <carvdawg@patriot.net>
Re: Win32 Registry and IP addresses. <psb154@yahoo.com>
Re: Win32 Registry and IP addresses. psb154@my-deja.com
Re: Wrong @INC in Apache (Marcel Grunauer)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 25 Aug 2000 14:33:42 +0200
From: "Amir E. Aharoni" <amir_e_a@netvision.net.il>
Subject: Re: @_ as array
Message-Id: <8o5ldp$ilb$1@news.netvision.net.il>
i wrote:
> > On Tue, 22 Aug 2000 13:11:46 +0200, "LecturaX Porodum"
> > <haak12@remove.ie.hva.nl> wrote:
> >
> > >Hi,
> > >
> > >How can I best achieve to retrieve the second element (element 1) from
> @_?
> > >
> > >I get a warning when I do @_[1], but I imagine $_[1] wouldn't work
> either,
> > >as $_ is a reserved variable as well.
> > >
> >
> > my ($notwanted,$wanted) = @_;
> >
>
> Actually $_[1] will do just what you want.
>
> $_ and @_ are _completely different_ variables; just as $keanu and @keanu
> are completely different variables; the $ and @ characters are inseparable
> parts of variables' names.
>
> # Creates a scalar variable called $keanu and assigns "Reeves" to it
> my $keanu = "Reeves";
>
> # prints "Reeves"
> print $keanu;
>
> # Creates an array called @keanu and assigns 3 values to it
> my @keanu = ("Speed", "Matrix", "Devil's Advocate");
>
> # Prints "Matrix"
> print @keanu[1];
>
> # Prints 3 - the size of the array
> print @keanu;
>
> See the document perldata for the complete explanation about Perl's
> variables and perlsub about writing your own subroutines (aka functions).
> ___________________________________________
> Amir Elisha Aharoni, the original Israelite
> "Bartender! Put all my meals in one plate.
> Don't ask me what kind of music I play.
> I play the good kind." - Oliver Lake
Whoops, my bad.
print @keanu; # it doesn't print 3, it prints all the array's members.
print scalar @keanu; # will print 3.
the "scalar" keyword is often optional, depending on context.
___________________________________________
Amir Elisha Aharoni, the original Israelite
"Bartender! Put all my meals in one plate.
Don't ask me what kind of music I play.
I play the good kind." - Oliver Lake
------------------------------
Date: Fri, 25 Aug 2000 20:40:12 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Docs on Mac
Message-Id: <slrn8qcj8c.5ap.mgjv@martien.heliotrope.home>
On Fri, 25 Aug 2000 01:51:18 +0200,
Jakob Schmidt <sumus@aut.dk> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>
> > If you ever find yourself wondering if a problem or question you have is
> > possibly a common one, and one encountered or asked by many other
> > people, then you should consult the Perl FAQ[0].
> [ heavy snip ]
>
> Gee, Martien - I hope you had that one written in advance and ready to
> past into your followup. Or at least that you're a very fast typer ;-)
I only have one prewritten reply, and I don't use than anymore nowadays.
I just type fast. Comes from the practice of having to report to CIO's
as well as program. Multitask, and work fast. :)
> > [2] I believe that Mac users don't have this command line thing that
> > everyone keeps talking about?
>
> We Mac users ain't got no command line, it's true. We do have the .pods
> and a GUI application (Shuck) to read them and search through them. But
> we lack
I'll remember that for the next time I feel like posting a lengthy
advice on how to read the documentation, thanks.
> perldoc -q
> perldoc -f
pity. The person who wrote Shuch is maybe willing to build it in? If
Shuck would just be a front-end to the output of perldoc, then maybe it
would be a lot easier to implement.
Martien
--
Martien Verbruggen |
Interactive Media Division | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd. | from a rich salesperson.
NSW, Australia |
------------------------------
Date: Fri, 25 Aug 2000 14:54:09 +0200
From: sumus@aut.dk (Jakob Schmidt)
Subject: Re: Docs on Mac
Message-Id: <1efxcvo.1y5qitg4o5slcN@[192.168.88.117]>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> I just type fast. Comes from the practice of having to report to CIO's
> as well as program. Multitask, and work fast. :)
Phew - sounds tough
> > perldoc -q
> > perldoc -f
>
> pity. The person who wrote Shuch is maybe willing to build it in?
That'd be Matthias Neeracher. Guess I could ask him. But as hinted I'm
in LinuxPPC most of the time so I don't use MacPerl and Shuck much
> If
> Shuck would just be a front-end to the output of perldoc, then maybe it
> would be a lot easier to implement.
Sounds reasonable
--
Jakob
------------------------------
Date: Fri, 25 Aug 2000 10:24:56 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Extracting a number of lines in a text file
Message-Id: <slrn8qcimk.j4j.rgarciasuarez@rafael.kazibao.net>
Minh Le wrote in comp.lang.perl.misc:
>Hi,
>I have been strucgling, from my perl script, to extract a number of text
>lines from a file and them to a new file.
>The text string that I would like to extract, always starts with a + sign
>and then has a whitespace then the rest is a text (ie + hello I need
>help..)
>and when it writes to these text strings to a new file, I need to drop the
>"+" sign and only add the rest of the text strings to the new file.
>Please help !!!
Here's a one-liner that does it:
perl -ne '/^\+(\s.*)/s && print $1' oldfile > newfile
See the perlrun documentation for info on the -n and -e switches.
--
Rafael Garcia-Suarez
------------------------------
Date: Fri, 25 Aug 2000 10:30:26 GMT
From: Hasanuddin Tamir <hasant@trabas.com>
Subject: Re: Extracting a number of lines in a text file
Message-Id: <8o5hs2$5om$1@nnrp1.deja.com>
In article <8o5drh$b91$1@perki.connect.com.au>,
"Minh Le" <lem@ocean.com.au> wrote:
> Hi,
> I have been strucgling, from my perl script, to extract a number of
text
> lines from a file and them to a new file.
> The text string that I would like to extract, always starts with a +
sign
> and then has a whitespace then the rest is a text (ie + hello I need
> help..)
> and when it writes to these text strings to a new file, I need to drop
the
> "+" sign and only add the rest of the text strings to the new file.
> Please help !!!
>
Iterate the file and for each line,
s/^\+ //;
In case you the file directly modified instead of printing
the modification to the new file you can use the inplace-edit
at command line,
perl -pi.bak -e 's/^\+ //' filename
The original file would be in filename.bak
HTH,
--
san
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 25 Aug 2000 13:21:45 +0200
From: Ulrich Ackermann <uackermann@orga.com>
Subject: Re: Extracting a number of lines in a text file
Message-Id: <39A656C9.87EE6474@orga.com>
Ulrich Ackermann wrote:
>
>
> while (<INFILE>) {
> $_ =~ /^+(.*)/;
^^^
of course, here is a backslash missing:
$_ =~ /^\+(.*)/;
Ulrich
--
Ulrich Ackermann
ORGA Kartensysteme GmbH (SY-PEAT-STA)
Tel.:+49.5254.991-925
mailto:uackermann@orga.com
------------------------------
Date: Fri, 25 Aug 2000 20:34:53 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Just another silly post.
Message-Id: <slrn8qciud.5ap.mgjv@martien.heliotrope.home>
On 25 Aug 2000 07:25:16 GMT,
Abigail <abigail@foad.org> wrote:
> Martien Verbruggen (mgjv@verbruggen.comdyn.com.au) wrote on MMDLI
> September MCMXCIII in <URL:news:slrn8qbn6n.ma.mgjv@verbruggen.comdyn.com.au>:
> -: On Fri, 25 Aug 2000 00:39:07 GMT,
> -: Craig Berry <cberry@cinenet.net> wrote:
> -: >
> -: > sub dirx { map { -l $_ ? () : -d $_ ? (dirx(glob("$_/*")), $_) : $_ } @_ }
> -:
> -:
> -: You'll be missing out on the directories and files that start with a
> -: '.'. Inlcuding those, and then excluding . and .. is going to be a bit
> -: more work..
> -:
> -: Something like
> -:
> -: dirx(grep !m!/\.\.?$!, glob("$_/* $_/.*"))
>
>
> Eh, no, that will filter out some perfectly legal filenames.
I hesitate to doubt your word, but, as I see it; all it will filter
out is
$_/.
$_/..
Since that is all that comes out of the glob. Lemme just test it. Just
to make absolutely sure, And I'll make sure there are some oddball file
names in there.
$ ls -a
. .. ... ..foo ..foo.. .foo .foo. foo. foo..
$ perl -wle 'print for (grep !m!/\.\.?$!, glob("./* ./.*"))'
./foo.
./foo..
./...
./..foo
./..foo..
./.foo
./.foo.
$
I'm wondering which sorts of file names this would get rid of, or did
you miss the '/' at the start of the regexp? I find that hard to believe
from the queen of the YAPH.
Martien
--
Martien Verbruggen |
Interactive Media Division | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: Fri, 25 Aug 2000 10:44:59 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: legal date
Message-Id: <slrn8qcjfh.27o.marcel@gandalf.local>
On Fri, 25 Aug 2000 08:53:33 GMT, eastking@my-deja.com
<eastking@my-deja.com> wrote:
>I want to get a legal day most close(forward) to the day encrypted by
>the three variable '19990931'. In this case it should be '19990930'.
If you want the next _forward_ date, shouldn't it be '19991001'?
Anyway, localtime and Time::Local's timelocal() do that for you:
$ cat legaldate.pl
#!/opt/perl/bin/perl
use warnings;
use strict;
use Time::Local;
my ($year, $month, $day) = @ARGV;
($day, $month, $year) =
(localtime(timelocal(0, 0, 0, $day, $month - 1, $year - 1900)))[3..5];
$month++;
$year += 1900;
my $legaldate = sprintf("%04d%02d%02d", $year, $month, $day);
print "$legaldate\n";
__END__
$ ./legaldate.pl 1999 09 31
19991001
$ ./legaldate.pl 1999 09 30
19990930
$ ./legaldate.pl 1999 08 31
19990831
$ ./legaldate.pl 2000 02 29
20000229
$ ./legaldate.pl 2000 02 30
20000301
It will cope with days in the range 1..31, and months in the range of 1..12:
$ ./legaldate.pl 2000 12 35
Day '35' out of range 1..31 at ./legaldate.pl line 9
$ ./legaldate.pl 2000 13 31
Month '12' out of range 0..11 at ./legaldate.pl line 9
(Remember that months are counted from 0.)
--
Marcel Gr\"unauer - Codewerk plc . . . . . . . . . . . <http://www.codewerk.com>
Perl Consulting, Programming, Training, Code review . . . <marcel@codewerk.com>
mod_perl, XML solutions - email for consultancy availability
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();
------------------------------
Date: Fri, 25 Aug 2000 10:45:59 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: Local install of perl modules
Message-Id: <slrn8qcjhn.27o.marcel@gandalf.local>
On Fri, 25 Aug 2000 09:20:54 GMT, Mark Williams <mark@orctel.co.uk> wrote:
>Is it possible to install perl modules in a local directory?
>My problem is my cgi host will not install modules that I need. Can I
>install modules on my local machine in a local directory and copy them
>up to my host into a local directory?
You can use 'use lib ...'. See 'perldoc -q library' (How do I keep my
own module/library directory?) and 'perldoc lib'.
--
Marcel Gr\"unauer - Codewerk plc . . . . . . . . . . . <http://www.codewerk.com>
Perl Consulting, Programming, Training, Code review . . . <marcel@codewerk.com>
mod_perl, XML solutions - email for consultancy availability
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();
------------------------------
Date: Fri, 25 Aug 2000 09:57:27 GMT
From: Hasanuddin Tamir <hasant@trabas.com>
Subject: Re: Modifying @INC: my problem and solution (any comment?)
Message-Id: <8o5fu1$3lq$1@nnrp1.deja.com>
In article <%Oap5.1$n23.24@news.aa.ans.net>,
scs@ans.net (Steve Simmons) wrote:
> hasant@trabas.com writes:
>
> >The Problem
>
> >Determine a non-standard module path dynamically in the scripts.
>
> We ran into a different flavor of the problem; here's our problem
> and (probable) solution:
>
> We release new versions of tools (which are often perl scripts) with
> the name `newtool' or `tool.new'. Once we're convinced they're
working
> right, they are rotated to production use.
>
> Sometimes the modifications to a tool must be matched to modifications
> to an internal module. The modified module cannot be released
directly;
> doing so puts current performance of every tool using it at risk.
>
> Our desire -- have tools check their name, and if it starts with
> `new', load a different (newer) module.
I guess this is similiar to one of my examples when presenting
comparison among some alternative solutions at our local PM group.
It's when the need for *multiple development versions* raise. See
http://www.zp.f2s.com/perl/modules/BaseLib.examples
for more detail.
> Probable Solution --
>
> A subdirectory named `new' is created underneath our product library
> tree (not the standard perl library). If the production copy of
> Module.pm lives in $TLIB, the new version will live in $TLIB/new.
> At the top of all tools which use Module.pm, this boiler plate is
> placed:
Taking your situation, I might have this set of tool with its base
directory, `toolname', and its internal lib directory, `toolname/lib'.
I will show you the possibility of the usage of BaseLib.pm.
The production copy is installed under `/usr/local/pkg', so in order
to access the modules, I have all the scripts say,
# no need the second argument since `lib' is
# the default value.
use BaseLib 'toolname';
to refer to `/usr/local/pkg/toolname/lib'.
If have a development version, I prefer to set the whole structure
of the tool new directory, say, it's under `/usr/local/pkg/2.0-beta'.
Oh wait, I want to branch this application to version 3 as well, so
I put the copy of the tool structure under, `/usr/local/pkg/3.0'
For both situation, the use() statement for BaseLib.pm in all the
scripts remain intact, no change needed. The scripts will refer
to their respective paths to internal lib. So the beta version will
refer to `/usr/local/pkg/2.0-beta/toolname/lib' and 3.0 will refer to
`/usr/local/pkg/3.0/toolname/lib'.
[snipped]
> > use lib '/usr/local/pkg/bdtools/lib';
> > BEGIN {
> > my $TOOL = basename( $0 ) ;
> > if ( $TOOL =~ /(.*\.new$|new.*$)/ ) {
> > #print "new tool $TOOL requiring 'Module' with new in lib\n"
;
> > eval "use lib qw(/usr/local/pkg/bdtools/lib/new);use
Module";
> > } else {
> > #print "Std tool $TOOL requiring 'Module' without new in
lib\n" ;
> > eval "use Module";
> > }
> > }
So these lines of code could be replaced by,
use BaseLib 'bdtools';
use Module;
> Why do I say `probable' solution? Because similar code has worked in
my
> tests, but the first release of a `newtool' won't this code won't
happen
> until next month.
What about BaseLib solution? Does it fit to your need :-)
> For a longer term (translation: better) solution, see my proposed
perl6
> versioning mechanism at http://tmtowtdi.perl.org/rfc/78.pod. Comments
> are appreciated.
I read it briefly, it talks about broader scope, IMHO. I have no
comment yet regarding you perl6 RFC. It's a totally different topic
of discussion. All I can say is that it offers a more flexible
mechanism in module usage by evaluating a module's version and/or
location.
(Oh, just wanted to remain that in case you're interested in trying
out BaseLib, please note that the name is still subjected to change.)
Best regards,
--
san
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 25 Aug 2000 09:10:20 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Perl vs. other scripting languages
Message-Id: <39a63778.345178159@news.itn.is>
On Thu, 24 Aug 2000 00:25:26 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
>My observation is, for the most part, those who use late
>releases of Perl 5 are obsessive Techno-Geeksters whom are
>addicted to having the latest and greatest of the worst.
>A trend has been established with Perl. Each new release
>is worse than the last. This Perl 5.6 is, by far, the most
>rabbit hole ridden and buggy version released. With this
>trend in mind, a ventured safe guess is Perl 6 will be the
>last small handful of coffin nails for Perl.
>
>Perl 6 most likely will be a Death Knell for Perl as a
>popular programming language. Word will wildly spread,
>as it has with Perl 5.6,
>
>"Your Perl programs won't run under new versions."
Perl 5.6 is the best version of Perl so far and all our
old programs, some written in Perl 4, most written
in Perl 5, run perfectly under it. It has no serious
bugs so far encountered.
Helgi (2nd opinion) Briem
------------------------------
Date: Thu, 24 Aug 2000 19:25:57 +0200
From: Bert IJff <e.g.ijff@chello.nl>
Subject: Re: perl/Informix
Message-Id: <39A55AA5.3A00797E@chello.nl>
jblatz2@my-deja.com wrote:
>
> We are using perl to insert rows into an Informix table. We are using:
>
> Online Dynamic Server ver 7.24
> Perl ver 5.004
> Unix on a Siemens platform
>
> The database is non-logging.
>
> When we run the program it inserts 2408 of 16,683 rows and then hangs.
>
> 'onstat -u' looks normal.
How much memory does it use?
A few months ago I had a memory consuming program, where I didn't
understand why it needed that huge amount of memory for.
I upgraded to version 5.6.0 and the problem was gone.
<SNIP>
regards,
Bert
--
perl -e '$l=(@j=split//,"\nnPcutrete !A aJoekshlr rH");
$a=$l<<2&0x3f|1; do{print$j[$i+=$a,$i%=$l];} while $i;'
------------------------------
Date: Fri, 25 Aug 2000 20:59:23 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: RegEx
Message-Id: <slrn8qckcb.5ap.mgjv@martien.heliotrope.home>
On Fri, 25 Aug 2000 08:36:29 GMT,
zejames@my-deja.com <zejames@my-deja.com> wrote:
>
>
> Hello,
>
> > If what you expected was 'perl' you could have done either
> >
> > m#.*/(.*)#
> >
> > which works because the first .* gets the first shot at being greedy
> or
>
> Yes, that's what I did to have what I wanted (the substring 'perl').
> But I think I don't really understand what it does. I thought that
> being greedy means, with m#/(.*)#
>
> /(usr/local/bin/perl) matches
> /usr/(local/bin/perl) matches too
> /usr/local/(bin/perl) matches :-))
> /usr/local/bin/(perl) matches
>
> How does it choose between all this possibilities. Can anyone tell
> what it really does internally?
Well.. for that you probably want to read the perlre documentation, and
maybe dive into the code of perl itself :)
I think you are a bit confused about what 'matching' means, and what the
parentheses do. The patterns above all match, but the part that gets
matched between the parentheses differs. That part between the
parentheses gets assigned to the numbered builting variables ($1, $2,
etc..) and it also gets returned by the whole operation. Witness:
$ perl -wl
$foo = '/usr/local/bin/perl';
@matchlist = $foo =~ m#/(usr)/(local)/(bin)/(perl)#;
print join "-", @matchlist;
print "$1-$2-$3-$4";
__END__
usr-local-bin-perl
usr-local-bin-perl
As you can see, both the elements of @matchlist and the builtins $1 - $4
are now set to the bits that matched between the parens.
$ perl -wl
$foo = '/usr/local/bin/perl';
($bin) = $foo =~ m#.*/(.*)#;
print $bin;
__END__
perl
The above works, because the * modifier is greedy, meaning it matches as
often as it can (more info in the perlre documentation again.
Other combinations will give you other bits. If you want the bit of the
path between the second and third slash:
($bin) = $foo =~ m#^/.*?/(.*?)/#;
To read about the anchors (^ and $) and the modifiers (+, *, ?, {n,m})
you should probably read the perlre docuemntation, and experiment a lot.
Regexes are not the easiest thing to get your head around, but once you
do, they're really powerful tools.
# perldoc perlre
Martien
--
Martien Verbruggen |
Interactive Media Division | +++ Out of Cheese Error +++
Commercial Dynamics Pty. Ltd. | Reinstall Universe and Reboot +++
NSW, Australia |
------------------------------
Date: Fri, 25 Aug 2000 20:36:19 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Remove a backslash from a string.
Message-Id: <slrn8qcj13.5ap.mgjv@martien.heliotrope.home>
On 25 Aug 2000 08:24:22 GMT,
Abigail <abigail@foad.org> wrote:
> Martien Verbruggen (mgjv@verbruggen.comdyn.com.au) wrote on MMDLI
> September MCMXCIII in <URL:news:slrn8qbvv7.ma.mgjv@verbruggen.comdyn.com.au>:
>
> "" PS. The 5.005 documentation won't have the U and C options.
>
>
> And neither will 5.6.1. tr///UC was a mistake and it will be dropped
> in the next version of Perl.
thank God... No.. Larry.
Martien
--
Martien Verbruggen |
Interactive Media Division | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: Fri, 25 Aug 2000 21:05:04 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Self-Answering Questions (Was Re: Flipflop matching)
Message-Id: <slrn8qckn0.5ap.mgjv@martien.heliotrope.home>
On Thu, 24 Aug 2000 10:10:08 -0700,
Larry Rosler <lr@hpl.hp.com> wrote:
> [Posted and a courtesy copy mailed.]
>
> In article <x7wvh7sbq7.fsf@home.sysarch.com> on Thu, 24 Aug 2000
> 01:13:04 GMT, Uri Guttman <uri@sysarch.com> says...
> > >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
>
> ...
>
> > that list just shows you larry (the wall's) linguistic background. and it
> > highlights the interesting split of perl into line noise and well chosen
> > english words.
>
> A lot of the background is in Unix, because many of those English words
> are the names of traditional Unix system calls. But at least he spared
> us from 'creat'.
>
> Many of the other words (including syntactic elements I didn't quote,
> such as 'do', 'for' and 'while') are adopted from C. I don't know why
> 'last' replaced 'break', or 'next' replaced 'continue', though. And
> there's still no 'switch' or 'case'. :-)
Which is a real bummer. I know we have many possible alternatives to
switch logic, but none of them are very elegant.
Anyway, IIRC perl inherits from many languages and tools, (c)shell, awk,
sed, and I believe even Fortran and (shudder) Basic were in that list.
The last and next probably have their roots in there, allthough it's
often hard to tell with all the similarities between languages. One of
the ugliest things that I think Perl has is the elsif. And yes, I have
read the rationale for the thing. I still don't like it. :)
Martien
--
Martien Verbruggen |
Interactive Media Division | Begin at the beginning and go on
Commercial Dynamics Pty. Ltd. | till you come to the end; then stop.
NSW, Australia |
------------------------------
Date: Fri, 25 Aug 2000 10:53:02 GMT
From: "Scott" <shamilton@plateausystems.holdthespam.com>
Subject: Re: Stumped by Reg Exp Problem - help??
Message-Id: <iesp5.69522$eS6.1013379@news1.rdc1.md.home.com>
Eli the Bearded <elijah@workspot.net> wrote in message
news:eli$0008242009@qz.little-neck.ny.us...
> In comp.lang.perl.misc, Scott <shamilton@plateausystems.holdthespam.com>
wrote:
> > Here's what I can't figure out, though: if the link in question is
ALREADY
> > formatted as an HTML link, then I don't want to perform the conversion,
> > otherwise things get REAL messy.
>
> Surround the above with:
>
> if (!/<a \s+ [^>]* \b href=/i) {
> # s!!!xig here
> }
>
Thanks Eli - the whole post was really helpful!
Now, regarding the part I quoted above, I'm not sure if this is gonna work.
I need to take into account the possibility that the string I am performing
the replacement on might have more than one HTTP address in it. While the
odds of having a mix of both already-formatted and unformatted URLS in the
text are small, the possibility exists, so for each instance of a match, I
need to make that determination.
Does that make sense? I realize it complicates the problem, but is this
still possibly to do using a regular expression?
Thanks,
Scott
------------------------------
Date: Fri, 25 Aug 2000 10:18:40 GMT
From: "Thierry" <info@ezboo.com.xx>
Subject: stupid question probably
Message-Id: <4Krp5.4907$6x7.5481612@nnrp5.proxad.net>
My Perl script works alone, but
How the hell can I insert a small Perl script within my existing HTML page.
For exemple to write date....
Thanks
Thierry
------------------------------
Date: Fri, 25 Aug 2000 13:37:56 +0200
From: "Viking" <vikingrscup@rogue-spear.com>
Subject: Re: stupid question probably
Message-Id: <8o5lpf$c7h$1@news0.skynet.be>
If your server supports is, you can use Server side includes. For example:
<!--#exec cgi="cgi-bin/date.cgi" -->
Thierry <info@ezboo.com.xx> wrote in message
news:4Krp5.4907$6x7.5481612@nnrp5.proxad.net...
> My Perl script works alone, but
> How the hell can I insert a small Perl script within my existing HTML
page.
> For exemple to write date....
>
> Thanks
> Thierry
>
>
>
------------------------------
Date: Fri, 25 Aug 2000 14:23:56 +0200
From: "Thierry" <info@ezboo.com.xx>
Subject: Re: stupid question probably
Message-Id: <8o5p2t$3jf$1@reader1.fr.uu.net>
That does not work !
No error message, just a blank line.
Any other idea ?
Thanks
Thierry
Viking <vikingrscup@rogue-spear.com> a écrit dans le message :
8o5lpf$c7h$1@news0.skynet.be...
> If your server supports is, you can use Server side includes. For example:
>
> <!--#exec cgi="cgi-bin/date.cgi" -->
> Thierry <info@ezboo.com.xx> wrote in message
> news:4Krp5.4907$6x7.5481612@nnrp5.proxad.net...
> > My Perl script works alone, but
> > How the hell can I insert a small Perl script within my existing HTML
> page.
> > For exemple to write date....
> >
> > Thanks
> > Thierry
> >
> >
> >
>
>
>
------------------------------
Date: Fri, 25 Aug 2000 11:54:38 GMT
From: lasteyrie@iname.com (Laurent de Lasteyrie)
Subject: uc problems
Message-Id: <39a65e73.251798747@news.issy.cnet.fr>
I have to upcase the word with accents like "trélazé", there
is 2 accents in this word. I add "use locale;" at the beginning of my
program, and when i use "uc" it give me "TRéLAZé". I try with the
command :
=~ tr/àâä|éèê|îï|ôö|ùûü/A|E|I|O|U/;
But, it give me back "TRILAZI",
Does anyone can help me, please...
--
Laurent de Lasteyrie
lasteyrie@iname.com
------------------------------
Date: Fri, 25 Aug 2000 08:48:32 -0400
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: uc problems
Message-Id: <39A66B1F.543D84E8@cc.gatech.edu>
Laurent de Lasteyrie wrote:
> I have to upcase the word with accents like "trélazé", there
> is 2 accents in this word. I add "use locale;" at the beginning of my
> program, and when i use "uc" it give me "TRéLAZé". I try with the
> command :
> =~ tr/àâä|éèê|îï|ôö|ùûü/A|E|I|O|U/;
> But, it give me back "TRILAZI",
>
> Does anyone can help me, please...
tr/\340-\366/\300-\326/;
Granted, the character set included is a little larger than just vowels,
but all vowels you need are here.
If you want to convert English and European letters all at once, use
tr/a-z\340-\366/A-Z\300-\326/;
--
Stephen Kloder | "I say what it occurs to me to say.
stephenk@cc.gatech.edu | More I cannot say."
Phone 404-874-6584 | -- The Man in the Shack
ICQ #65153895 | be :- think.
------------------------------
Date: Fri, 25 Aug 2000 14:54:10 +0200
From: sumus@aut.dk (Jakob Schmidt)
Subject: Re: uc problems
Message-Id: <1efxd3j.1bih21e1mbmps0N@[192.168.88.117]>
Laurent de Lasteyrie <lasteyrie@iname.com> wrote:
> =~ tr/àâä|éèê|îï|ôö|ùûü/A|E|I|O|U/;
> But, it give me back "TRILAZI",
That's because é is fourth char on the left side and I is fourth char on
right side. Read perlop and try:
$_ = 'trélazé';
$_ = uc;
tr/àâäéèêîïôöùûü/ÀÂÄÉÈÊÎÏÔÖÙÛÜ/;
print "$_\n";
BTW - there must be some Locale (or something) module that'll make uc
function more reasonable for your language but I don't know about that.
--
Jakob
------------------------------
Date: Fri, 25 Aug 2000 13:33:37 +0200
From: "Viking" <vikingrscup@rogue-spear.com>
Subject: Re: URLs ending in /
Message-Id: <8o5lhc$sfo$1@news1.skynet.be>
I read somewhere that the trailing slash is preferred ro the non-trailing
one, because witht he non-trailing slash, the browser makes 2 requests to
the web server(one to chekc if it's a file or directory, 2nd to fetch the
info).
<cbdeja@my-deja.com> wrote in message news:8o5bsc$vca$1@nnrp1.deja.com...
> What is the difference between the URLs (for example):
>
> http://www.acme.com/support
> http://www.acme.com/support/
>
> The only difference I could guess at is that the first could concievably
> be referencing a file, whereas the second implies that it MUST be a
> directory.
>
> However, as you wouldn't be able to have a file and a directory with the
> same name, it seems to me that the trailing / is redundant. Is there
> really a need for it?
>
> Perhaps the server would send an error page if 'support' was actually a
> file on the server but the submitted URL ended in a /.
>
> But normally if you were embedding a URL in one of your pages which
> points to directory, can you safely omit the trailing / in the URL ?
>
> Colin
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Fri, 25 Aug 2000 13:45:54 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: URLs ending in /
Message-Id: <Pine.GHP.4.21.0008251342120.19604-100000@hpplus03.cern.ch>
On Fri, 25 Aug 2000, Viking blurted out:
> I read somewhere that the trailing slash is preferred ro the non-trailing
^^^^^^^^^^^^^^^^
> one,
And what light is this supposed to throw on Perl programming?
It's not as if we are so short here on people who know their stuff,
that we would have to rely on people who can't recognise an off-topic
thread, who have "read somewhere" but don't actually know what they're
talking about (even though there was a grain of truth in your
otherwise misleading answer), and who post upside-down fullquotes.
(Score duly adjusted).
all the best
------------------------------
Date: Fri, 25 Aug 2000 14:38:12 +0200
From: "Lincoln Marr" <lincolnmarr@nospam.europem01.nt.com>
Subject: Re: use CGI to remove files
Message-Id: <8o5pb3$ch3$1@qnsgh006.europe.nortel.com>
Could you possibly use the 'unlink' command which is virtually a synonym for
unix's 'rm' command?
ie
$file = "/path/filename";
unlink $file;
inserting that in your subroutine may work. You are using cgi so you could
do the following to invoke it:
$q = new CGI;
$action = $q->param("action");
# then put a html form here... with <INPUT TYPE="submit" NAME="action"
VALUE="delete">
if($action =~ /delete/i) { if(-e $file) {unlink $file;} exit; }
------------------------------
Date: Fri, 25 Aug 2000 06:56:22 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: Win32 Registry and IP addresses.
Message-Id: <39A650D6.7CEC9D5F@patriot.net>
> Given the following information:
> IP address.
> SubNet mask
> Default Gateway
> DNS server
>
> How would I get PERL on win32, to put them in the correct places in the
> NT4 registry?
>
> Have not thought this through too much so any suggestions would be great.
I don't mean any offense, but it's pretty obvious that you haven't put any
thought into
this.
Most of the info you want to add to the Registry is located in:
HKLM\System\CurrentControlSet\Services\[device]\Parameters\Tcpip
Some is in:
HKLM\System\CurrentControlSet\Services\TCPIP\Parameters
I find Win32::TieRegistry by far the easiest module to use with the
Registry...
--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.
------------------------------
Date: Fri, 25 Aug 2000 11:11:39 GMT
From: Paul Butterfield <psb154@yahoo.com>
Subject: Re: Win32 Registry and IP addresses.
Message-Id: <upumxzjlu.fsf@yahoo.com>
Thank you for the advice.
Best regards
--Paul.
------------------------------
Date: Fri, 25 Aug 2000 12:33:49 GMT
From: psb154@my-deja.com
Subject: Re: Win32 Registry and IP addresses.
Message-Id: <8o5p3c$djv$1@nnrp1.deja.com>
Idiot!
In article <39A650D6.7CEC9D5F@patriot.net>,
H C <carvdawg@patriot.net> wrote:
> > Have not thought this through too much so any suggestions would be
great.
> I don't mean any offense, but it's pretty obvious that you haven't
put any
> thought into
> this.
> Most of the info you want to add to the Registry is located in:
>
> HKLM\System\CurrentControlSet\Services\[device]\Parameters\Tcpip
>
> Some is in:
This should be: "Some are in"
>
> HKLM\System\CurrentControlSet\Services\TCPIP\Parameters
>
> I find Win32::TieRegistry by far the easiest module to use with the
> Registry...
This is NOT where they are located on my computer dude! HKLM\System yes
but the rest of it... you are pretty much clueless.
>
> --
> Q: Why is Batman better than Bill Gates?
> A: Batman was able to beat the Penguin.
>
So, if you are a Linux advocate, why are you using NT to post your news
messages?
I don't mean any offense, but you might want to get a grown up to read
you messages before you post.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 25 Aug 2000 10:48:04 GMT
From: marcel@codewerk.com (Marcel Grunauer)
Subject: Re: Wrong @INC in Apache
Message-Id: <slrn8qcjl9.27o.marcel@gandalf.local>
On Fri, 25 Aug 2000 01:07:01 -0700, Gabe <grichards@flashcom.net> wrote:
>After installing 5.6.0 I deleted all the 5.00503 directories and
>programs. Upon boot, Apache tells me it can't find Cwd.pm in @INC and
>it displays the contents of @INC. The @INC Apache is working with is for
>the 5.00503 distribution (i.e. /usr/lib/perl5/5.00503). Well, that
>directory doesn't exist anymore and @INC should contain things like
>/usr/lib/perl5/5.6.0/. Funny thing is, when I have Perl print out @INC
>it prints out what I expect. So apparently, somehow Apache is operating
>with the prior distribution's @INC, how do I get it to see the @INC for
>5.6.0?
Recompile mod_perl when having perl 5.6 in your $PATH. Recompiling
mod_perl is pretty painless, see perl.apache.org, especially the
mod_perl guide.
--
Marcel Gr\"unauer - Codewerk plc . . . . . . . . . . . <http://www.codewerk.com>
Perl Consulting, Programming, Training, Code review . . . <marcel@codewerk.com>
mod_perl, XML solutions - email for consultancy availability
sub AUTOLOAD{($_=$AUTOLOAD)=~s;^.*::;;;y;_; ;;print} Just_Another_Perl_Hacker();
------------------------------
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 4129
**************************************