[21788] in Perl-Users-Digest
Perl-Users Digest, Issue: 3992 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 18 06:05:40 2002
Date: Fri, 18 Oct 2002 03:05:10 -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 Fri, 18 Oct 2002 Volume: 10 Number: 3992
Today's topics:
ANNOUNCE: DBIx::HTML::ClientDB V 1.00 <ron@savage.net.au>
ANNOUNCE: DBIx::HTML::LinkedMenus V 1.00 <ron@savage.net.au>
ANNOUNCE: DBIx::HTML::PopupRadio V 1.01 <ron@savage.net.au>
ANNOUNCE: Debug::Trace 0.04 -- tracing subroutine calls (Johan Vromans)
Re: Anything better than eval("\$$class\::x") ? <goldbb2@earthlink.net>
CGI::Cache 1.30 released <david@coppit.org>
Re: Controlling recursion depth with File::Find <goldbb2@earthlink.net>
Re: Convert Perl script to C program (and Why was this (Helgi Briem)
Re: DBD::mysql - $dbh->do() failed <goldbb2@earthlink.net>
Re: expanding variables in text strings (Helgi Briem)
Re: expanding variables in text strings <bernard.el-hagin@DODGE_THISlido-tech.net>
maximum string length with the system command (Richard Hospital)
Need advice on a project (wrt to tie'ing to a file and <bik.mido@tiscalinet.it>
Re: Newbie help extracting strings (Helgi Briem)
newbie question ... <patrick@-/abazar\-.nl>
Passing array in the middle of the parrameter list <glodalec@yahoo.com>
Re: Passing array in the middle of the parrameter list <nospam@nospam.com>
Re: Passing array in the middle of the parrameter list <vm.mayer@comcast.net>
Re: Passing array in the middle of the parrameter list <garry@ifr.zvolve.net>
Re: Passing array in the middle of the parrameter list <Tassilo.Parseval@post.rwth-aachen.de>
perlfs has a new home <perlfs@ericgarland.com>
Re: REGEXP probolem (Philip Lees)
Re: Small syntax utility function (Richard J. Rauenzahn)
Re: Switching from Python to Perl <goldbb2@earthlink.net>
Re: Switching from Python to Perl <derek@wedgetail.com>
Re: using regexp to add spaces (Tad McClellan)
Re: using regexp to add spaces <mbudash@sonic.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 16 Oct 2002 19:12:20 +1000
From: "Ron Savage" <ron@savage.net.au>
Subject: ANNOUNCE: DBIx::HTML::ClientDB V 1.00
Message-Id: <3daf93f9$1_8@news.teranews.com>
DBIx::HTML::ClientDB - Convert sql into a client-side db with keyed access.
Documentation and Installation: http://savage.net.au/Perl-modules.html
Help with Perl modules in general: http://savage.net.au/Perl-modules/html/installing-a-module.html
--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html
------------------------------
Date: Wed, 16 Oct 2002 19:12:56 +1000
From: "Ron Savage" <ron@savage.net.au>
Subject: ANNOUNCE: DBIx::HTML::LinkedMenus V 1.00
Message-Id: <3daf93ff_1@news.teranews.com>
DBIx::HTML::LinkedMenus - Convert db data to 2 linked HTML popup menus.
Documentation and Installation: http://savage.net.au/Perl-modules.html
Help with Perl modules in general: http://savage.net.au/Perl-modules/html/installing-a-module.html
--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html
------------------------------
Date: Wed, 16 Oct 2002 19:13:39 +1000
From: "Ron Savage" <ron@savage.net.au>
Subject: ANNOUNCE: DBIx::HTML::PopupRadio V 1.01
Message-Id: <3daf9421$1_8@news.teranews.com>
DBIx::HTML::PopupRadio - Convert sql into a popup menu or radio group.
Documentation and Installation: http://savage.net.au/Perl-modules.html
Help with Perl modules in general: http://savage.net.au/Perl-modules/html/installing-a-module.html
Changes:
1.01 Tue Oct 15 11:41:13
- Change the meaning of the 'default' parameter so it refers
to the visible menu item and not the value associated with
the visible menu item. This now matches the meaning of the
'default' parameter used in DBIx::HTML::ClientDB
- Add a primitive test program t/test.t
- Minor documentation changes
--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html
------------------------------
Date: 17 Oct 2002 22:47:25 +0200
From: jvromans@squirrel.nl (Johan Vromans)
Subject: ANNOUNCE: Debug::Trace 0.04 -- tracing subroutine calls
Message-Id: <3daf9437$1_5@news.teranews.com>
How often have you been worrying why your Perl program did not quite
behave as you intended? Reluctantly considering to use the "-d"
command-line option? Well, in many cases there's something much easier
you can do.
Introducing: Debug::Trace, an Amsterdam.pm production.
With Debug::Trace, you can easily instrument one or more of your
subroutines to reveal when they are called, what the arguments are,
and what result is returned. In many cases this is sufficient
information to track down the cause of misbehaving.
Debug::Trace is intended to be used from the command line, so there's
no need to make any changes at all to your program! If you want to
trace your routines 'readinput' and 'convert', just insert
-MDebug::Trace=readinput,convert
on the command line, and that's all.
You want a complete call trace of the 'convert' routine, but not of
'readinput'?
-MDebug::Trace=readinput,:stacktrace,convert
will do the job. Read the documentation for more details.
URL: http://search.cpan.org/author/JV/Debug-Trace-0.04/
Debug::Trace is conceived and developed by Amsterdam.pm, the Amsterdam
Perl Mongers, in particular Jan-Pieter Cornet, Johan Vromans en Jos
Boumans. It requires Perl 5.005_03 or better.
------------------------------
Date: Fri, 18 Oct 2002 00:11:55 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Anything better than eval("\$$class\::x") ?
Message-Id: <3DAF8A0B.C657F24A@earthlink.net>
Da Witch wrote:
>
> Consider a method like this:
>
> sub static_x {
> my $proto = shift;
> my $class = ref $proto || $proto;
>
> my $x = "\$$class\::x"; # $x holds a string of the form '$Foo::x'
>
> if(@_) {
> eval("$x = $_[0]");
> }
> eval($x);
> }
>
> For example, if Foo is a class that has inherited this method, then
> Foo->static_x(3) sets $Foo::x to 3, and returns this value.
>
> Is there a way to achieve this (i.e. accessing a global from a package
> determined at runtime) without using eval?
sub static_x {
my $self_or_class = shift;
my $class = ref($self_or_class) || $self_or_class;
my $ref_to_x = do { no strict 'refs'; \${ $class . "::x" } };
return (@_ ? $$ref_to_x = shift : $$ref_to_x);
}
[untested]
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Wed, 16 Oct 2002 20:18:19 GMT
From: David Coppit <david@coppit.org>
Subject: CGI::Cache 1.30 released
Message-Id: <3daf942a$1_3@news.teranews.com>
Description:
- Perl extension to cache output of time-intensive CGI scripts so that
subsequent visits to such scripts will not cost as much time.
Download:
- You can download CGI::Cache from CPAN:
http://www.cpan.org/authors/id/D/DC/DCOPPIT/CGI-Cache-1.30.tar.gz
- Until the file propagates to the mirrors, you can use the following URL:
http://prdownloads.sourceforge.net/cgicache/CGI-Cache-1.30.tar.gz
Changes:
- Added enable_output feature.
- Verified SpeedyCGI compatibility.
- Added a new section on use in persistent environments.
- Corrected tie, tied, and untie syntax--apparently not a bug, although it
should have been.
David
_____________________________________________________________________
David Coppit david@coppit.org
The College of William and Mary http://coppit.org/
One thing the blues ain't... is funny. Stephen Stills, "Black Queen"
------------------------------
Date: Fri, 18 Oct 2002 00:20:43 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Controlling recursion depth with File::Find
Message-Id: <3DAF8C1B.22800F38@earthlink.net>
Michele Dondi wrote:
>
> Is there any easy/preferred way to impose limits to recursion depth
> for File::Find::find, as for the -mindepth, -maxdepth parameteres of
> the find command?
>
> Have I to count the number of directory separators?
my $path = "/some/directory/path/";
my $len;
find sub {
my $depth = substr( $_, $len ) =~ tr!/!!;
return $File::Find::prune = 1 if $depth > $n;
# do rest of processing here.
}, $path;
> Note: I tried the above parameters with find2perl, but they were not
> recognized.
>
> Michele
> --
> Liberta' va cercando, ch'e' si' cara,
> Come sa chi per lei vita rifiuta.
> [Dante Alighieri, Purg. I, 71-72]
>
> I am my own country - United States Confederate of Me!
> [Pennywise, "My own country"]
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Fri, 18 Oct 2002 09:31:20 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Convert Perl script to C program (and Why was this group's name changed?)
Message-Id: <3dafd356.195139816@news.cis.dfn.de>
On Thu, 17 Oct 2002 20:03:20 +0200, "Alan J. Flavell"
<flavell@mail.cern.ch> wrote:
>On Oct 17, Jilla Villa inscribed on the eternal scroll:
>
>> But the problem is also that the regular visitors of the opera are
>> also yelling back at the new comers, causing just as much noise.
>
>You do realise that what you're asking for is - silence?
>
>I hope you're taking careful note of all the respondents who are
>following that plan.
>
>When you've collected enough of them, you can tell us whether the
>policy is working, OK?
>
>As for your criticism of Tad: I never cease to be astonished at the
>degree of patience which he manages to bring to his responses in the
>face of demonstrations of advanced cluelessness.
In fact, apart from the "one off-topic CGI question"
hit and run merchants, there appear to be only 2
totally clueless people here, shouting their heads
off at the opera. Manfred (Manny, Jilla, Al, Jim Rogers,
Robin, Fredo) and his dozens ofother pseudonyms and
"The Horror that Cannot be Named". The Horror
can at least be killfiled as it only changes its mask
a couple of times a year. Manny is hard to killfile
because he is a moving target, as well as being more
annoying than piles. I'm beginning to loathe the little,
umm....beggar.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Fri, 18 Oct 2002 00:27:35 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: DBD::mysql - $dbh->do() failed
Message-Id: <3DAF8DB7.B03B5DEC@earthlink.net>
user wrote:
[snip]
> $dbh->do("INSERT INTO lastseen VALUES (?,?,?)",
> "$ssn","$sid","$simsenroll");
This should be:
$dbh->do(
"INSERT INTO lastseen VALUES (?,?,?)",
{}, $ssn, $sid, $simsenroll,
) or die $DBI::errstr;
Note the empty hashref after the sql string and before the parameters
for the placeholders.
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Fri, 18 Oct 2002 09:34:45 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: expanding variables in text strings
Message-Id: <3dafd54c.195641918@news.cis.dfn.de>
On Fri, 18 Oct 2002 02:45:36 GMT,
jason@generationterrorists.com (Jason Quek) wrote:
>>If you use double quotes, the variables will be interpolated as
>>you assign to $string.
>Thank you for your post. Unfortunately, I need to use single quote
>marks in this case.
What?!? Why on earth would you have such a completely
moronic, clueless requirement?
"I want to open a file, but I can't use open. I have to use
close instead."
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Fri, 18 Oct 2002 10:01:10 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: expanding variables in text strings
Message-Id: <slrnaqvmrm.15m.bernard.el-hagin@gdndev25.lido-tech>
In article <3dafd54c.195641918@news.cis.dfn.de>, Helgi Briem wrote:
> On Fri, 18 Oct 2002 02:45:36 GMT,
> jason@generationterrorists.com (Jason Quek) wrote:
>
>>>If you use double quotes, the variables will be interpolated as
>>>you assign to $string.
>
>>Thank you for your post. Unfortunately, I need to use single quote
>>marks in this case.
>
> What?!? Why on earth would you have such a completely
> moronic, clueless requirement?
>
> "I want to open a file, but I can't use open. I have to use
> close instead."
-------------------------
&close (*IN, 'filename');
while (<IN>) {
print;
}
sub close {
my ($fh, $file) = @_;
open ($fh, $file);
}
-------------------------
;)
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: 18 Oct 2002 01:08:17 -0700
From: richard.hospital@st.com (Richard Hospital)
Subject: maximum string length with the system command
Message-Id: <6c14c143.0210180008.abdc307@posting.google.com>
Hi all,
What is the maximum string length that can be passed to the system
command under PC (W2000) ? And is it possible to modify the default
value ?
Thanks in advance.
------------------------------
Date: Fri, 18 Oct 2002 09:14:31 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Need advice on a project (wrt to tie'ing to a file and general strategy)
Message-Id: <ltcvqusvru4fnv3m2lstnuotnfe99cgmv3@4ax.com>
A few years ago I wrote a shell script to find duplicates in a
directory tree and remove them (keeping only the 1st one wrt
alphabetical order).
My script, though gross and primitive, has worked reliably for me for
a long time, but now I'd like to rewrite it in perl with some
enhancements too, one difference being that it should run also (and
possibly, mainly) on Windows.
Let me explain how it did work first. Necessary conditions for two
files to be identical are
(i) They have the same size,
(ii) They have the (a) same checksum.
I assume that (i) AND (ii) are also a sufficient condition, even if
that's simply not true, that is, I don't mind extremely rare cases of
different files having both same size and checksum.
My script worked by calculating (how is a detail) the file sizes of
files in the directory tree, sorting by the sizes and comparing the
checksums of files with the same size. To be precise, fwim, I used the
md5sum program to calculate checksums.
I used the above strategy because calculating a checksum is always
more time-consuming than printing a file size.
So, the first question regards how to calculate checksums with perl:
do I have to resort to external programs (thus, possibly, having to
use a Windows port of a *nix one for compatibility) or is there a
(recommended) module suitable for this task?
Also, I know (more than) one way to make such a program, but an
important consideration to take into account is that now I should run
it on huge (for me) "data sets" (that is of the size of 10^5 files).
I know from FAQs, etc. that a solution is to tie to a file (whatever I
will use: array, hash...), but there are many modules designed for
that. Which one do you recommend? I'd prefer a KISS solution, that is,
I know that some of them use some sort of database libraries
transparently, but it seems to me an overhead.
In case I decide to use a DB-oriented module, are there any
portability issues wrt the abovementioned libraries (e.g. are they
available and work reliably on "all" platforms?).
Also, I would like to cache the data relative to size/checksums when
they are calculated, so to "include them on the list" when running the
program subsequent times. Notice that I'm aware this strategy won't
catch all duplicates between one run and the other, but I'm sure it
would be nevertheless an enhancement for my purposes...
Michele
--
Liberta' va cercando, ch'e' si' cara,
Come sa chi per lei vita rifiuta.
[Dante Alighieri, Purg. I, 71-72]
I am my own country - United States Confederate of Me!
[Pennywise, "My own country"]
------------------------------
Date: Fri, 18 Oct 2002 09:18:46 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Newbie help extracting strings
Message-Id: <3dafd0ed.194522939@news.cis.dfn.de>
On 17 Oct 2002 16:54:58 -0700, lesh_philling@hotmail.com
(LeshPhilling) wrote:
>I am aware of the LWP and other HTML extraction modules (I'm reading
>Perl & LWP at the moment), but I wanted to use this example to
>practice my regexp skills.
The LWP family of modules are *NOT* HTML extraction
modules. They mostly allow you to "fetch" documents from
the internet. For example:
#!perl
use warnings;
use strict;
use LWP::Simple;
getprint("http://www.perldoc.com");
__END__
will fetch the front page of the Perl documentation
server and print it to your console, complete with
HTML tags.
If you wanted to do something with that HTML
afterwards, such as extract certain elements,
you would use an HTML parsing module. Examples
of these would be HTML::Parser and the much
simpler to use HTML::TokeParser.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Fri, 18 Oct 2002 10:28:32 +0200
From: Patrick <patrick@-/abazar\-.nl>
Subject: newbie question ...
Message-Id: <Pine.LNX.4.44.0210181027190.20386-100000@abazar.nl>
Hi,
Is the following possible. I have a file with some lines like this:
CA020007 blahblahblah 18,000 16,000
CA020011 alsoblahdieblah 26,000 24,000
CD115002 some text 27,000 26,000
CD115003 again some text 22,000 22,000
All tab-delimited.
What I want to is:
Search for CA, var search=CA, put the first collum into var1, second in
var2 etc. until no more CA, skip to next search. If the next search (CD)
is found, var search=CD, first collum in var1 etc.
/Patrick.
------------------------------
Date: Fri, 18 Oct 2002 07:19:44 +0200
From: Glodalec <glodalec@yahoo.com>
Subject: Passing array in the middle of the parrameter list
Message-Id: <MPG.1819b85ffcfdb7fb989698@news.siol.net>
Hi !
Is there any way to pass an array as a parametter in the middle of the
parameter list ?
@A=qw(a b c);
DoIt("This","is","ok",@A) ;
sub DoIt
{
my ($FIRST,$SECOND,$THIRD,@A)=@_ ;
}
Can I do this way ?
DoIt("Array",@A, "is","the second") ;
Probably the only solution is to pass it as a reference (\@A)
------------------------------
Date: Thu, 17 Oct 2002 22:37:33 -0700
From: "Tan Nguyen" <nospam@nospam.com>
Subject: Re: Passing array in the middle of the parrameter list
Message-Id: <3daf9d91_7@nopics.sjc>
"Glodalec" <glodalec@yahoo.com> wrote in message
news:MPG.1819b85ffcfdb7fb989698@news.siol.net...
> Hi !
>
> Is there any way to pass an array as a parametter in the middle of the
> parameter list ?
>
>
> @A=qw(a b c);
> DoIt("This","is","ok",@A) ;
>
> sub DoIt
> {
> my ($FIRST,$SECOND,$THIRD,@A)=@_ ;
> }
>
> Can I do this way ?
> DoIt("Array",@A, "is","the second") ;
>
> Probably the only solution is to pass it as a reference (\@A)
Try it...
------------------------------
Date: Fri, 18 Oct 2002 01:53:08 -0400
From: Mike Mayer <vm.mayer@comcast.net>
Subject: Re: Passing array in the middle of the parrameter list
Message-Id: <vm.mayer-762AD9.01530818102002@news-east.giganews.com>
In article <MPG.1819b85ffcfdb7fb989698@news.siol.net>,
Glodalec <glodalec@yahoo.com> wrote:
> Hi !
>
> Is there any way to pass an array as a parametter in the middle of the
> parameter list ?
>
>
> @A=qw(a b c);
> DoIt("This","is","ok",@A) ;
>
> sub DoIt
> {
> my ($FIRST,$SECOND,$THIRD,@A)=@_ ;
> }
>
> Can I do this way ?
> DoIt("Array",@A, "is","the second") ;
>
> Probably the only solution is to pass it as a reference (\@A)
>
I'm a little confused. Your question asks if you can pass an array in
the middle of the parm list. Your example passes it at the end of the
parm list.
You are correct that you cannot pass an arbitrarily sized array in the
middle of a list. But, it is perfectly acceptable to pass it at the end
of the list.
As you've written your DoIt routine, $FIRST will grab the first
parameter, $SECOND will grab the second, $THIRD will grab the third,
and @A will grab all remaining arguments... which in your example is
exactly what you want.
If, however, you were to have tried:
sub DoIt
{
my ($first, $second, @A, $third) = @_;
}
and invoked it as:
DoIt("This","is",@A,"ok);
then, you would have not gotten the "desired" behavior---$first will
grab the first parameter, $second will grab the second, and @A will grab
the rest, i.e:
$first will equal "This"
$second will equal "is"
@A will equal ("a","b","c","ok");
$third will be empty
You are correct again, that you will need to pass by reference:
sub DoIt
{
my ($first, $second, $A, $third) = @_;
my @a = @$A;
}
DoIt("This","is",\@A,"ok");
Note that if you modify the contents of $A in DoIt, that you will modify
the contents of the @A. If you modify the contents of @a, you will
modify a COPY of @A and will leave @A untouched.
Hope this helps.
mike
------------------------------
Date: Fri, 18 Oct 2002 06:06:36 GMT
From: Garry Williams <garry@ifr.zvolve.net>
Subject: Re: Passing array in the middle of the parrameter list
Message-Id: <slrnaqv906.d52.garry@zfw.zvolve.net>
On Fri, 18 Oct 2002 07:19:44 +0200, Glodalec <glodalec@yahoo.com> wrote:
> Hi !
>
> Is there any way to pass an array as a parametter in the middle of the
> parameter list ?
>
>
> @A=qw(a b c);
> DoIt("This","is","ok",@A) ;
>
> sub DoIt
> {
> my ($FIRST,$SECOND,$THIRD,@A)=@_ ;
> }
>
> Can I do this way ?
> DoIt("Array",@A, "is","the second") ;
>
> Probably the only solution is to pass it as a reference (\@A)
Yes.
This is a FAQ.
perldoc -q pass
"How can I pass/return a {Function, FileHandle, Array, Hash,
Method, Regex}?"
--
Garry Williams
------------------------------
Date: 18 Oct 2002 06:26:19 GMT
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Passing array in the middle of the parrameter list
Message-Id: <aoo9ib$ihr$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Glodalec:
> Is there any way to pass an array as a parametter in the middle of the
> parameter list ?
>
>
> @A=qw(a b c);
> DoIt("This","is","ok",@A) ;
>
> sub DoIt
> {
> my ($FIRST,$SECOND,$THIRD,@A)=@_ ;
> }
>
> Can I do this way ?
> DoIt("Array",@A, "is","the second") ;
>
> Probably the only solution is to pass it as a reference (\@A)
Indeed. But you can hide that from the one using the subroutine by
declaring a prototype:
sub DoIt($$\@$) {
my ($first, $second, $arr_ref, $third) = @_;
for (@$arr_ref) {
...
}
...
}
my @A = qw/a b c/;
DoIt(1, 2, @A, 3);
You have to pass an array, though:
DoIt(1, 2, qw/a b c/, 3); # compile time error
Tassilo
--
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;
------------------------------
Date: Tue, 15 Oct 2002 19:30:59 GMT
From: Eric Garland <perlfs@ericgarland.com>
Subject: perlfs has a new home
Message-Id: <3daf93e5$1_3@news.teranews.com>
The Perl Filesystem Lives!
PerlFS source code is being hosted on sourceforge now at
http://perlfs.sourceforge.net/
There is a pre-release version that works with the 2.4
kernels. I have tested on RedHat 7.2 and it seems to
work fine.
Help from any C/kernel developers willing to patch and
update the code would be much appreciated. It also needs
perl programmers looking to build useful filesystems
based on PerlFS. One example I could see is a SunOS
automounter /net style directory that will
automatically NFS mount machines when accessed. Another
would be something that would do NAS mirroring writing
to two devices when writes happen and reading from one of
them when reading (It could even stripe the reads).
Both of these things would be easy to do with PerlFS.
-Eric
------------------------------
Date: Fri, 18 Oct 2002 08:37:36 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: REGEXP probolem
Message-Id: <3dafc81e.70372687@news.grnet.gr>
On 18 Oct 2002 02:09:07 GMT, admin@hotmail.com (Mark Healey) wrote:
>On Thu, 17 Oct 2002 23:51:45, ctcgag@hotmail.com wrote:
>
>> admin@hotmail.com (Mark Healey) wrote:
>> > Why doesn't /reviews\.gif/ match "reviews.gif"?
^^
> if (/reviews.gif/)
^
Spot the difference?
Phil
--
Ignore coming events if you wish to send me e-mail
------------------------------
Date: 15 Oct 2002 20:37:11 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: Small syntax utility function
Message-Id: <1034714231.152400@hpvablab>
xach@xach.com writes:
>In article <x7r8esett1.fsf@mail.sysarch.com>, Uri Guttman wrote:
>>>>>>> "ZB" == Zachary Beane <xach@xach.com> writes:
>>
>> ZB> for (my $x = 0; $x < $#_; $x += 2) {
>> ZB> local ($a, $b) = @_[$x, $x + 1];
>>
>> don't use $a and $b. they are special (see sort) and are scoped to the
>> current package.
>
>I was hoping to use them exactly because they are special; they don't
>trigger failures under "use strict" and they also make foreachpair
>seem more like a built-in function like sort.
List::Util gets to use them, so I don't see why you shouldn't be allowed
to!
How about....?
sub foreachpair(&@) {
my $code = shift @_;
for my $i ( 0 .. $#_ / 2 ) {
local ($a,$b) = @_[ $i * 2, $i * 2 + 1 ];
&$code();
}
}
foreachpair { print "$a => $b\n"; } 1,2,3,4,5,6;
--
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant | I speak for me, | 19055 Pruneridge Ave.
Development Alliances Lab| *not* HP | MS 4173
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014
------------------------------
Date: Fri, 18 Oct 2002 01:29:44 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Switching from Python to Perl
Message-Id: <3DAF9C48.3F70F904@earthlink.net>
Derek Thomson wrote:
>
> Benjamin Goldberg wrote:
[snip]
> > And even for perl5, someone with sufficient tuits might decide to
> > try and write a B::Java class.
>
> That's possible, but probably the simplest bit. You then have to
> implement the Perl runtime libraries (like the regex engine)
Well, java's regex engine is supposed to be compatible with perl's, so
theoretically, one could make it so that calls to perl's regex engine
get translated to calls to Java's regex engine.
> in Java, and then all the standard modules.
Many of the standard modules are pure-perl. Whichever standard modules
are needed could probably be converted via B::Java, once that exists.
Only the ones with C/XS extentions should need to be rewritten.
> Jython's already done all this WRT Python over the last few years. It
> didn't start out anywhere near as complete as it is at the moment. So,
> if someone started this right now, you can expect to wait two years at
> an absolute minimum. I guess I'd expect a similar kind of timeframe
> even for perl6, unless perl6 itself is going to be written in perl6 so
> that the bytecode translater can do the porting of *everything* to the
> JVM for us.
>
> So, is perl6 going to be written in perl6?
Currently, perl6 source is parsed using perl5, and the Parse::RecDescent
module. That outputs code in the Parrot Intermediary Language (PIR),
which is a sort of high level assembler, which handles register
allocation and spillage, constant folding, and optomization. This gets
translated by the Intermediate Code Compiler (imcc), which is written in
C and Bison, into either parrot assembler or to parrot bytecode.
There are a number of code branches for the perl6->PIR compiler which
simply die, saying that that feature is unimplemented. I suppose that
when all of (or enough of) perl6 parsing is implemented in perl5, the
parser will get rewritten in perl6.
The PIR->PASM translation is done in C and Bison for speed and ease of
maintenance.
Translation from Parrot assembler to Parrot bytecode is done by a
program written in Parrot assembler.
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Fri, 18 Oct 2002 06:04:41 GMT
From: Derek Thomson <derek@wedgetail.com>
Subject: Re: Switching from Python to Perl
Message-Id: <ZvNr9.7$r55.1396@news.optus.net.au>
Hi Benjamin,
Benjamin Goldberg wrote:
> Derek Thomson wrote:
>
>>Benjamin Goldberg wrote:
>
> [snip]
>
>>>And even for perl5, someone with sufficient tuits might decide to
>>>try and write a B::Java class.
>>
>>That's possible, but probably the simplest bit. You then have to
>>implement the Perl runtime libraries (like the regex engine)
>
>
> Well, java's regex engine is supposed to be compatible with perl's, so
> theoretically, one could make it so that calls to perl's regex engine
> get translated to calls to Java's regex engine.
Oh, no you can't. Having used both I can safely say that Java's regexes
are nowhere near as powerful as Perl's. But it would be a starting
point, I guess.
>
>
>>in Java, and then all the standard modules.
>
>
> Many of the standard modules are pure-perl. Whichever standard modules
> are needed could probably be converted via B::Java, once that exists.
>
> Only the ones with C/XS extentions should need to be rewritten.
Yes.
>>I guess I'd expect a similar kind of timeframe
>>even for perl6, unless perl6 itself is going to be written in perl6 so
>>that the bytecode translater can do the porting of *everything* to the
>>JVM for us.
>>
>>So, is perl6 going to be written in perl6?
>
>
> [snip informative description of how perl6 is implemented in perl5]
>
> I suppose that
> when all of (or enough of) perl6 parsing is implemented in perl5, the
> parser will get rewritten in perl6.
Yes, that's all fine for *user* code, but you're missing the point.
What is the *runtime* system written in? That's what I'm asking about.
Take for example, the regex engine. Is that written in C, or perl5/6, or
parrot? If it's C, that's bad. If it's perl5/6 or parrot, that's much
better, as the bytecode translator can do the work of porting the regex
engine for us.
--
D.
------------------------------
Date: Thu, 17 Oct 2002 23:14:56 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: using regexp to add spaces
Message-Id: <slrnaqv2m0.1n4.tadmc@magna.augustmail.com>
Cosmic Cruizer <XcosmicX.XcruizerX@sbcglobal.com> wrote:
> $str =~ s/\good/g o o d/g;
^
^
You should always enable warnings when developing Perl code!
> print "$str";
^ ^
print $str; # those quotes do not do anything...
> output is... g o o d to you
>
> But this requires me to manually enter the spaces between the word. I would
> like to be able to automatically have the spaces done without having to do
> it manually.
$str =~ s/(good)/ join ' ', split m##, $1/ge;
> This leads to the second part of my problem... "good" may only be the first
> part of the word.
> $str =~ /\good*/; (I don't know what do to here)
> and have the output say: g o o d m o r n i n g to you
$str =~ s/(good\w*)/ join ' ', split m##, $1/ge;
or
$str =~ s/(good)/ my $x=$1; $x =~ s#(.)#$1 #g; $x /ge;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 18 Oct 2002 04:35:37 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: using regexp to add spaces
Message-Id: <mbudash-52AD50.21353617102002@typhoon.sonic.net>
In article <Xns92AAC8C6E909Eccruizermydejacom@64.164.98.29>,
XcosmicX.XcruizerX@sbcglobal.com (Cosmic Cruizer) wrote:
> The first part is what I can do, but the second part is what I need to
> accomplish.
>
> $str = "good to you";
>
> $str =~ s/\good/g o o d/g;
> $str =~ s/(\d)/$1 /g;
>
> print "$str";
>
> output is... g o o d to you
>
> But this requires me to manually enter the spaces between the word. I would
> like to be able to automatically have the spaces done without having to do
> it manually.
>
> This leads to the second part of my problem... "good" may only be the first
> part of the word.
>
> For instance, what I would like to do is take the following:
>
> $str = "goodmorning to you";
>
> $str =~ /\good*/; (I don't know what do to here)
>
> print "$str";
>
> and have the output say: g o o d m o r n i n g to you
>
> Any suggestions? Thanks.
$str = 'goodmorning to you';
$str =~ s|^(\w+)|join ' ', (split //, $1)|e;
print "$str";
yields:
g o o d m o r n i n g to you
note that using this code on 'good-morning to you' yields:
g o o d-morning to you
so you might actually want to use:
$str =~ s|^(\S+)|join ' ', (split //, $1)|e;
hth -
------------------------------
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.
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 3992
***************************************