[23576] in Perl-Users-Digest
Perl-Users Digest, Issue: 5783 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 11 18:05:48 2003
Date: Tue, 11 Nov 2003 15:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 11 Nov 2003 Volume: 10 Number: 5783
Today's topics:
@ARGV params with space? <kevin@calypso.karoo.co.uk>
Re: @ARGV params with space? <jurgenex@hotmail.com>
Re: @ARGV params with space? (Greg Bacon)
Re: Checking environment variable existence <usenet@morrow.me.uk>
Re: Creating and submitting POST form in Perl <glex_nospam@qwest.invalid>
Re: Creating and submitting POST form in Perl <usenet@morrow.me.uk>
Re: globals and while (Roy Johnson)
Re: globals and while (Roy Johnson)
Re: globals and while <perl@my-header.org>
I am having problems installing PDL using CPAN <jeffsilv@u.washington.edu>
Re: installing perl <syscjm@gwu.edu>
Re: installing perl <usenet@morrow.me.uk>
Re: installing perl <kingsman22004@yahoo.com>
Re: newbie 4th JaPH <bik.mido@tiscalinet.it>
OLE and Internet Explorer <r.brooks@mail.uhs.utexas.edu>
perl -p with a use <nid_oizo@yahoo.com_remove_the_>
Re: perl -p with a use <grazz@pobox.com>
Re: perl -p with a use (Greg Bacon)
Re: print statement spanning multiple lines (the zorg )
Re: simplify this if loop (Roy Johnson)
Re: Sort array of objects using a method <uri@stemsystems.com>
Re: Sort array of objects using a method (Anno Siegel)
Re: Sort array of objects using a method <uri@stemsystems.com>
Why Camel is Better than Perldoc (Sara)
Re: Why Camel is Better than Perldoc <tassilo.parseval@rwth-aachen.de>
Re: Why Camel is Better than Perldoc <syscjm@gwu.edu>
Re: Why Camel is Better than Perldoc (Randal L. Schwartz)
Win32::OLE and CDO Message Filters <delius@no.spam.for.me.progsoc.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 11 Nov 2003 22:18:02 +0000
From: Kev <kevin@calypso.karoo.co.uk>
Subject: @ARGV params with space?
Message-Id: <born5s$q3n$1@newsreaderm1.core.theplanet.net>
Apologies if this is something simple but I can't find the answer
anywhere...Anyone able to point me in the right direction?
All I want to do is pass files to a perl script on the command line
(Windows) - simple enough usually. I'm having problems when the file I
want to pass has a space in the path...
i.e. perl script.pl c:\a dir with spaces\file.txt etc...
@ARGV[0] only contains as far as the first space.
What do I need to do pass the full path? I feel this should be really
simple but whatever it is I can't spot it.
Cheers and TIA,
Kev
------------------------------
Date: Tue, 11 Nov 2003 22:27:51 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: @ARGV params with space?
Message-Id: <Hndsb.40105$p9.17214@nwrddc02.gnilink.net>
Kev wrote:
> All I want to do is pass files to a perl script on the command line
> (Windows) - simple enough usually. I'm having problems when the file
> I want to pass has a space in the path...
>
> i.e. perl script.pl c:\a dir with spaces\file.txt etc...
>
> @ARGV[0] only contains as far as the first space.
>
> What do I need to do pass the full path? I feel this should be really
> simple but whatever it is I can't spot it.
It is indeed simple, although it has nothing to do with Perl.
You would do exactly the same as if you would want to pass the name to any
other program: just enclose the name in quotes.
That is how DOS and most other shells identify command line parameters that
span over several words.
jue
------------------------------
Date: Tue, 11 Nov 2003 22:28:34 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: @ARGV params with space?
Message-Id: <vr2okil3s409c5@corp.supernews.com>
In article <born5s$q3n$1@newsreaderm1.core.theplanet.net>,
Kev <kevin@calypso.karoo.co.uk> wrote:
: All I want to do is pass files to a perl script on the command line
: (Windows) - simple enough usually. I'm having problems when the file I
: want to pass has a space in the path...
:
: i.e. perl script.pl c:\a dir with spaces\file.txt etc...
:
: @ARGV[0] only contains as far as the first space.
:
: What do I need to do pass the full path? I feel this should be really
: simple but whatever it is I can't spot it.
In general, it depends on your shell. You mentioned that you're
using Win32 (my sincerest sympathies), so use doublequotes:
C:\Temp>type try
#! perl
$" = "]["; # mjd's trick
print "\@ARGV = [@ARGV]";
C:\Temp>perl try foo bar baz "quux uushnu"
@ARGV = [foo][bar][baz][quux uushnu]
Hope this helps,
Greg
--
If possible, so far as it depends on you, be at peace with all men.
-- Romans 12:18 (NASB)
------------------------------
Date: Tue, 11 Nov 2003 21:59:43 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Checking environment variable existence
Message-Id: <borm4f$t4j$1@wisteria.csv.warwick.ac.uk>
tassilo.parseval@post.rwth-aachen.de wrote:
> Also sprach Peter J. Acklam:
>
> > merlyn@stonehenge.com (Randal L. Schwartz) wrote:
> >
> >>>>>>> "Anno" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
> >>
> >> Anno> Grammar describes usage, not the other way around.
> >> Anno> Otherwise, you'd have to correct everyone who used
> >> Anno> "impedance". For grammatical reasons "impedance" is
> >> Anno> wrong, it should be "impedience". The same goes for a lot
> >> Anno> of technical terms, and not only technical terms.
> >>
> >> Or "Commentator", which makes me cringe every time I hear it. A
> >> person who provides comments is a "commenter". Otherwise, what
> >> are they doing... commentating? :)
> >
> > How about "hierarchical". Nowadays it's "hierarchical menus" and
> > the "hierarchical data format" (HDF) etc. No dictionary I have
> > seen contains "hierarchical". They all say it's "hierarchal".
>
> My Oxford however mentions "hierarchical" and not "hierarchal".
> Likewise "commentator" and not "commenter". Btw, the verb "commentate"
> also exists according to the Oxford:
>
> com-ment-ate v [I,Ipr] ~ (on sth)
> (a) describe, esp on TV or radio, an event as it
> happens: [...]
>
> And so, it's quite naturally a "commentator".
Mine states that 'commenter' was Middle English, but is obsolete.
Ben
--
Joy and Woe are woven fine,
A Clothing for the Soul divine William Blake
Under every grief and pine 'Auguries of Innocence'
Runs a joy with silken twine. ben@morrow.me.uk
------------------------------
Date: Tue, 11 Nov 2003 14:11:01 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: Creating and submitting POST form in Perl
Message-Id: <2kbsb.231$Rn.36147@news.uswest.net>
J.P. wrote:
> I've been seeking a way to create a POST form in Perl and handling the
> auto-submission. But, how can I do this? I don't need to display my
> form that Perl will create....I just need to create the request and
> fire it off.
LWP will help you out.
perldoc lwpcook
------------------------------
Date: Tue, 11 Nov 2003 22:41:02 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Creating and submitting POST form in Perl
Message-Id: <borohu$1e1$2@wisteria.csv.warwick.ac.uk>
"J. Gleixner" <glex_nospam@qwest.invalid> wrote:
> J.P. wrote:
>
>
> > I've been seeking a way to create a POST form in Perl and handling the
> > auto-submission. But, how can I do this? I don't need to display my
> > form that Perl will create....I just need to create the request and
> > fire it off.
>
> LWP will help you out.
>
> perldoc lwpcook
Or perhaps WWW::Automate.
Ben
--
Every twenty-four hours about 34k children die from the effects of poverty.
Meanwhile, the latest estimate is that 2800 people died on 9/11, so it's like
that image, that ghastly, grey-billowing, double-barrelled fall, repeated
twelve times every day. Full of children. [Iain Banks] ben@morrow.me.uk
------------------------------
Date: 11 Nov 2003 12:04:01 -0800
From: rjohnson@shell.com (Roy Johnson)
Subject: Re: globals and while
Message-Id: <3ee08638.0311111204.4480bd9d@posting.google.com>
"Ala Qumsieh" <qumsieh@cim.mcgill.ca> wrote in message news:<B7%rb.10279$IP4.1026@newssvr25.news.prodigy.com>...
> Btw, is this related to the fact that in statements of the form "EXPR
> foreach EXPR" you can only use $_ as your loop variable?
Yes. The issue is that your declared variable doesn't exist until the
end of the declaration. Anything that happens in the same statement
cannot use that variable:
my $x = 3, print "$x\n";
will cause strict to give the same complaint.
Note that assigments are sort of a special case. You can use the
result of an assignment/declaration, e.g.,:
my $x = my $y = 3;
so you could do
my $y = abs(my $x = -3);
but not
my $x = 3, my $y = abs($x);
Even this is ok:
sub mod_arg { $_[0]++ }
my $y = mod_arg(my $x = -3);
print "$x and $y\n";
or even
my $y = (my $x = -3)++;
But you can't use an assignment/declaration as a loop variable.
You can do this little weirdo with nary a peep from strict (though
warnings gives you a heads-up):
print --$a,"\n" and sleep 1 while (my $a = 3);
Note that the $a in the print is $main::a and not the lexical $a in
the while. If you make it a block-form while, you are declaring $a on
every pass through the loop, so the printed value never changes.
------------------------------
Date: 11 Nov 2003 12:21:27 -0800
From: rjohnson@shell.com (Roy Johnson)
Subject: Re: globals and while
Message-Id: <3ee08638.0311111221.67a0aaa8@posting.google.com>
"Ala Qumsieh" <qumsieh@cim.mcgill.ca> wrote in message news:<B7%rb.10279$IP4.1026@newssvr25.news.prodigy.com>...
> Btw, is this related to the fact that in statements of the form "EXPR
> foreach EXPR" you can only use $_ as your loop variable?
Actually, I should have said "no" to this. In general, loop variables
are localized global variables, so in theory, Perl could have allowed
you to specify loop variables for one-line loops (even if not "my"
variables). So fundamentally, it's a syntax issue that disallows named
loop vars for one-line loops.
On the other hand, if they were allowed, the scoping problem would
still be a problem.
------------------------------
Date: Tue, 11 Nov 2003 22:38:29 +0100
From: Matija Papec <perl@my-header.org>
Subject: Re: globals and while
Message-Id: <2bl2rv8a9tec00j1b2s7j5tq4adlkqq2bm@4ax.com>
X-Ftn-To: Uri Guttman
Uri Guttman <uri@stemsystems.com> wrote:
>$sub isn't declared yet so the $sub inside the closure refers to a
>global (or earlier lexical) $sub. your code has the same problem,
>refering to a lexical declared the same statement.
>
>the main reason for this is so you can do stuff like:
>
>my $foo ;
>
>{
># this assigns the value of the current foo to the new lexical foo
># if your code worked, then this would not be possible.
>
> my $foo = $foo ;
>
> mung with $foo
>}
>
># print untouched foo
>print $foo ;
>
>perldoc -f my refers you to the private variables section of perlsub
>which does cover this point.
>
> The declared variable is not introduced (is not visible)
> until after the current statement. Thus,
>
> my $x = $x;
>
> can be used to initialize a new $x with the value of the old
> $x, and the expression
>
> my $x = 123 and $x == 123
Tnx, this was insightful; so only what matters is a statement which can't
define lexical and use it at the same time.
--
Matija
------------------------------
Date: Tue, 11 Nov 2003 12:26:02 -0800
From: Jeff Silverman <jeffsilv@u.washington.edu>
Subject: I am having problems installing PDL using CPAN
Message-Id: <borgkr$1k0k$1@nntp6.u.washington.edu>
I am running Perl 5.8.0 on a RedHat 9 machine (2.4.20-20.9smp #1
Kernel). I am trying to install PDL using CPAN. So, as root, I give
the command
perl -MCPAN -e shell
and then the subcommant
install PDL.
So then it generates lots and lots of messages about things going well,
and then it says:
* Gentle warning from PDL::IO::Misc: *
Hmmm. You don't appear to have the Astro::FITS::Header module installed.
You'll be able to read and write FITS files anyway, but FITS support is
greatly improved if you install it.
You can get the latest Astro::FITS::Header module from CPAN --
point your browser at http://www.cpan.org.
Makefile:93: *** missing separator. Stop.
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible
cpan>
If I go into the /root/.cpan/build/PDL-2.4.0 and run
perl Makefile.PL
then it creates a makefile, but when I give the command
make
make ends immediately, saying Makefile:93: *** missing separator. Stop.
So I looked at the makefile and there is something weird at line 93.
Here is an excerpt from the Makefile:
INSTALLBIN = /usr/bin'
installhtml1dir=''
installhtml3dir=''
installman1
INSTALLSITEBIN = /usr
INSTALLVENDORBIN = /usr/bin'
installvendorhtml1=''
installvendorhtml3=''
installvendorlib='/u
INSTALLSCRIPT = /usr/bin
PERL_LIB = /usr/lib/perl5/5.8.0
PERL_ARCHLIB = /usr/lib/perl5/5.8.0/i386-linux-thread-multi
SITELIBEXP = '/usr/lib/perl5/site_perl'
sit
SITEARCHEXP = /usr/lib/pe
LIBPERL_A = libperl.a'
libc='
I don't see any setting the perldl.conf file. Any other ideas, please?
Many thanks,
Jeff
------------------------------
Date: Tue, 11 Nov 2003 14:41:46 -0500
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: installing perl
Message-Id: <3FB13B7A.5000706@gwu.edu>
You really need to do something about that stutter. For about
the last five or six go-rounds, you've posted your reply three
times.
Chris Mattern
------------------------------
Date: Tue, 11 Nov 2003 22:39:44 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: installing perl
Message-Id: <borofg$1e1$1@wisteria.csv.warwick.ac.uk>
news@group.com wrote:
> isn't ture that with debian, I better install perl in a different
> directory so it does not interfere with debian stock perl? and what does
> that mean?
Yes, that's true. Debian puts its perl (perl 5.6.1) in /usr/bin; the
perl you (should) have just installed is in /usr/local/bin. I would
have hoped that would be clear by now...
> when make install puts its files in whatever place it likes
> and that include locations other than -r /home/username/perl-5.8.1.
I'm not sure what you mean by '-r': ITYM 'in or somewhere underneath
this directory'?
Yes, this is true. This is what is meant by 'installing' a
program. This is both why 'make install' must be run as root, and also
why you should read the READMEs/INSTALL files/whatever before you
install anything to make sure you know what it is going to put where.
> I don't understand the objective here inorder not to interfere with
> debian stock perl. ok back to my problem solving steps.
The objective is that everything provided by Debian should live under
/usr, and everything you build yourself should live under
/usr/local, so they don't interfere. That's what it's there for.
> now what... when I run a file.pl, do I need to start the file with
> #!/usr/local/bin/perl instead of #!/usr/bin/perl?
It depends which perl you want to run it with... you have two
installed. If you want it to use 5.6.1, then use /!/usr/bin/perl; if
you want it to use 5.8.1, use #!/usr/local/bin/perl.
Also, it is neither necessary nor usual in a Unix environment to use
the extension '.pl' on Perl scripts.
> how about installing tha CPAN to keep up with cpan modules?
CPAN.pm is already installed: it comes with the core.
> also I need to install Data::Dumpber,
Become root, then
# /usr/local/bin/perl -MCPAN -e'install "Data::Dumper"'
> I never did this before, do I follow instruction off the net from a
> reliable source like perlmonks, or I need to do thing differently. I
> will try not to do somthing I don't full understand next time.
In general it is a very bad idea to attempt to follow instructions you
don't understand, even when they are from a 'reliable' source like
perlmonks.
Ben
--
I've seen things you people wouldn't believe: attack ships on fire off the
shoulder of Orion; I've watched C-beams glitter in the darkness near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die. |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-| ben@morrow.me.uk
------------------------------
Date: Wed, 12 Nov 2003 09:46:08 +1100
From: King <kingsman22004@yahoo.com>
Subject: Re: installing perl
Message-Id: <3FB166B0.4080403@yahoo.com>
Chris Mattern wrote:
> You really need to do something about that stutter. For about
> the last five or six go-rounds, you've posted your reply three
> times.
>
> Chris Mattern
>
sorry Chris, thats what happens when more than one roommate uses the
same computer.
------------------------------
Date: Tue, 11 Nov 2003 23:28:25 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: newbie 4th JaPH
Message-Id: <nhh2rvk3vsu12mqms5mfkb6d97b4ffa0nk@4ax.com>
On 10 Nov 2003 17:28:06 GMT, Pedro Graca <hexkid@hotpop.com> wrote:
>I'm trying to understand Your JaPH.
>All those dots are really obfuscating me ... but I'm not giving up!
Oh, it's not that difficult:
$\=q.,.,$_=q.print' ,\g,,( w,a'c'e'h,,map{$_-=qif/g/;chr
}107..q[..117,q)[map+hex,split//,join' ,2B,, w$ECDF078D3'
F9'5F3014$,$,];];$\.=$/,s,q,32,g,s,g,112,g,y,' , q,,eval;
Basically it consists of two statements:
$\=q.,.,$_=q.print' ,\g,,( w,a'c'e'h,,map{$_-=qif/g/;chr
}107..q[..117,q)[map+hex,split//,join' ,2B,, w$ECDF078D3'
F9'5F3014$,$,];];
$\.=$/,s,q,32,g,s,g,112,g,y,' , q,,eval;
The first one sets $\ and $_.
To be precise it does something like
$_="print' ,\g,,( w,a'c'e'h,,map{$_-=qif/g/;chr
}107" .
"..117,q)[map+hex,split//,join' ,2B,, w$ECDF078D3'
F9'5F3014$,$,];";
Now $_ contains another JAPH, only a bit "shuffled", in fact...
The second one appends something to $\ and makes some substitutions in
$_. Then $_ is eval()ed: change eval() to print() and you'll see a
"less obfuscated core", modulo an extra "," at the end.
Michele
--
# This prints: Just another Perl hacker,
seek DATA,15,0 and print q... <DATA>;
__END__
------------------------------
Date: Tue, 11 Nov 2003 15:15:19 -0600
From: "newshost.cc.utexas.edu" <r.brooks@mail.uhs.utexas.edu>
Subject: OLE and Internet Explorer
Message-Id: <borjh8$5vo$1@geraldo.cc.utexas.edu>
Hello, does anyone know how to read client side cookies from client itself
using Win32::OLE and InternetExplorer?
------------------------------
Date: Tue, 11 Nov 2003 16:28:15 -0500
From: Nicolas Fleury <nid_oizo@yahoo.com_remove_the_>
Subject: perl -p with a use
Message-Id: <Qvcsb.105492$PD3.5448996@nnrp1.uunet.ca>
Hi,
I make a script to run on Windows with ActivePerl and I would like to
make the script run with a -p or -n argument, but I want the script to
be called by its extension, which means I cannot do as on Unix and use
the #! syntax.
Is there a way to specify these parameters with a use clause, as with
"use warnings" for "perl -w"? Is the only solution to add other
extensions, like .plp and .pln, for scripts to be called with "perl -p"
and "perl -n" (or write it by hand)?
Thx
Nicolas Fleury
------------------------------
Date: Tue, 11 Nov 2003 22:11:38 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: perl -p with a use
Message-Id: <u8dsb.13708$hB5.1499@nwrdny02.gnilink.net>
Nicolas Fleury <nid_oizo@yahoo.com_remove_the_> wrote:
> I make a script to run on Windows with ActivePerl and I would like to
> make the script run with a -p or -n argument, but I want the script to
> be called by its extension, which means I cannot do as on Unix and use
> the #! syntax.
Perl still reads the shebang line, even if the OS doesn't use
it to find the script's interpreter.
> Is there a way to specify these parameters with a use clause, as with
> "use warnings" for "perl -w"? Is the only solution to add other
> extensions, like .plp and .pln, for scripts to be called with "perl -p"
> and "perl -n" (or write it by hand)?
Writing it by hand is trivial, though... The -n switch just inserts
a "while (<>) {" before your program text, and a "}" after. The -p
switch inserts "} continue { print }" after.
--
Steve
------------------------------
Date: Tue, 11 Nov 2003 22:38:09 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: perl -p with a use
Message-Id: <vr2p6h8rl23de5@corp.supernews.com>
In article <Qvcsb.105492$PD3.5448996@nnrp1.uunet.ca>,
Nicolas Fleury <nid_oizo@yahoo.com_remove_the_> wrote:
: I make a script to run on Windows with ActivePerl and I would
: like to make the script run with a -p or -n argument, but I want the
: script to be called by its extension, which means I cannot do as on
: Unix and use the #! syntax.
Yes, you can:
C:\Temp>type try.pl
#! perl -p
$_ = "PREFIX: $_";
C:\Temp>try.pl try.pl
PREFIX: #! perl -p
PREFIX:
PREFIX: $_ = "PREFIX: $_";
: Is there a way to specify these parameters with a use clause, as
: with "use warnings" for "perl -w"? Is the only solution to add other
: extensions, like .plp and .pln, for scripts to be called with "perl
: -p" and "perl -n" (or write it by hand)?
Careful: there are subtle but important differences between -w and
C<use warnings>.
Greg
--
...all of our social problems are the direct consequence of a general
failure to respect the inviolability of one another's property interests!
-- Butler Shaffer
------------------------------
Date: Tue, 11 Nov 2003 19:51:00 +0000 (UTC)
From: zorg@zed.com (the zorg )
Subject: Re: print statement spanning multiple lines
Message-Id: <3fb13dc3.215521813@news.btopenworld.com>
On Tue, 11 Nov 2003 12:02:26 +0900, ko <kuujinbo@hotmail.com> wrote:
>Iain Chalmers wrote:
>> In article <ceXrb.6024$aT.23@news-server.bigpond.net.au>,
>> "Voitec" <voitec@zzzzzzzzz.com> wrote:
>
>[snip]
>
>>>How can I make a print statement span several lines without affecting the
>>>final formatting?
>>
>>
>> how about:
>>
>> print "line 1",
>> "line 2",
>> "line 3";
>>
>> or:
>>
>> print "line 1".
>> "line 2".
>> "line 3";
>
>Those two examples will just concatenate into one long string, not keep
>the indenting like the OP wanted - unless you included variables with
>indenting/whitespace :) Maybe something like this:
No, I believe the first example is what the OP wanted. He wants to
indent the code, not the output.
Thus;
print "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"bbbbbbbbbbbbbbbbbbbbbb";
would indeed seem to do the trick.
Z
>
>print "
>line1
>line2
> line3
>";
>
>> or perhaps even:
>>
>> print <<END;
>> line 1
>> line 2
>> line 3
>> END
>>
>> big
>>
>
>Yes :)
>
>To the OP - if you type
>
>perldoc -q "here document"
>
>from your shell, you'll the relevant details of how to correctly use a
>'here' document (last example).
>
>HTH - keith
>
------------------------------
Date: 11 Nov 2003 11:32:53 -0800
From: rjohnson@shell.com (Roy Johnson)
Subject: Re: simplify this if loop
Message-Id: <3ee08638.0311111132.3236f62@posting.google.com>
With some refactoring, that becomes:
for my $i ( $m-1..$#data ) {
print $i+1, " ", $data[$i], " ", avg( @data[ $i - ( $m - 1 ) .. $i ]), "\n";
}
------------------------------
Date: Tue, 11 Nov 2003 19:27:08 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Sort array of objects using a method
Message-Id: <x7brriyad0.fsf@mail.sysarch.com>
>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
AS> Ah, hat doesn't look half bad. It preserves the essential of the GRT,
AS> default sorting, and the only extra cost is another access to the
AS> original array (okay, and indexed access when the strings are built).
AS> Is that still GRT? Uri?
>>
>> i would say it is. the main point of the GRT is to call sort with no
>> comparison block. all the various techniques used to make that happen
>> all fall under the same GRT umbrella IMNSHO. :)
AS> Well, that's how it works, isn't it? :)
well you asked it is GRT and i said it was!
this got me thinking about my long delayed GRT module. i had started one
about the time i co-wrote the paper but it got shelved early on. so
today i had a flash about making it much simpler. i had previously
wanted to have a specification for how to extract each sort key from the
record. but the flash was to just have the user supply the perl code for
that (assuming the record is in $_). this removes much of the complexity
of the module and allows it to focus on making the GRT combined key and
to not need code for key extractions (which can be very complex). in my
next batch of tuits, i may go back to this module and do it this way. i
think the name would be Sort::GRT (it was to be Sort::Records). there is
a Sort::Fields module but it only handles string records i think.
>> my coauthor (larry rosler) would prefer to use pack instead of sprintf
>> and use a binary 4 byte sequence field and also binary formats for the
>> real keys. it makes for a shorter key which makes for a faster
>> comparison. i don't think i ever benchmarked pack vs sprintf in the GRT.
AS> "Sprintf" and "pack/unpack" are comparatively slow functions, for similar
AS> reasons: the do a run-time interpretation of a format string. One would
AS> probably want to factor them out to see the influence of key length on
AS> sorting efficiency.
they also can do different things with regard to the keys. i think
floats have to be compared in binary format (we never came up with a
satisfactory string format that was easy to generate).
AS> Another variant is to use an array slice to put the final sorted list
AS> together: "@raw[ map substr( $_, ...), sort ... ]". It's less readable,
AS> imo, so to be acceptable it would have to be faster, which I doubt.
that is a good point. a map could be faster with certain sizes of sort
lists. my module could support both kinds of output conversions. more on
that when i get a tuit.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 11 Nov 2003 20:15:07 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Sort array of objects using a method
Message-Id: <borg0b$sn1$1@mamenchi.zrz.TU-Berlin.DE>
Uri Guttman <uri@stemsystems.com> wrote in comp.lang.perl.misc:
> >>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
[Uri about resuming work on Sort::GRT]
> record. but the flash was to just have the user supply the perl code for
> that (assuming the record is in $_). this removes much of the complexity
> of the module...
Way to go... Open the interface barn-door wide and let the user deal
with it. :)
> AS> Another variant is to use an array slice to put the final sorted list
> AS> together: "@raw[ map substr( $_, ...), sort ... ]". It's less readable,
> AS> imo, so to be acceptable it would have to be faster, which I doubt.
>
> that is a good point. a map could be faster with certain sizes of sort
> lists. my module could support both kinds of output conversions. more on
> that when i get a tuit.
Looking forward to it.
Anno
------------------------------
Date: Tue, 11 Nov 2003 22:26:49 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Sort array of objects using a method
Message-Id: <x73ccuy21j.fsf@mail.sysarch.com>
>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
AS> Uri Guttman <uri@stemsystems.com> wrote in comp.lang.perl.misc:
>> >>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
AS> [Uri about resuming work on Sort::GRT]
>> record. but the flash was to just have the user supply the perl code for
>> that (assuming the record is in $_). this removes much of the complexity
>> of the module...
AS> Way to go... Open the interface barn-door wide and let the user deal
AS> with it. :)
and it removes over half the work from my shoulders. and it is the more
complex half at that!
AS> Looking forward to it.
send some tuits. or $$$. or free labor. :)
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 11 Nov 2003 11:07:01 -0800
From: genericax@hotmail.com (Sara)
Subject: Why Camel is Better than Perldoc
Message-Id: <776e0325.0311111107.3b46dc8d@posting.google.com>
grrrrr....
tuxy> perldoc regex
No documentation found for "regex".
tuxy> perldoc perlreg
No documentation found for "perlreg".
tuxy> perldoc perldoc regular
No documentation found for "regular".
brksun10-feot> perldoc expression
No documentation found for "expression".
.
.
.
...pull out trusty Camel, find regex switch in 3 seconds..
I mean c'mon guys nothing for "regex", the virtual epicentre of Perl?
That would be like:
IRS-Search, enter your query: 1040
Sorry, nothing found, we have no idea what a 1040 is...
At least put in a -k (like "man apropos") for common words?
Camel-online now THAT'S the ticket! Or Damian in your spare time make
perdoc smarter? A learning perldoc would be cool (AI) ...
Ack.
G
------------------------------
Date: 11 Nov 2003 19:48:59 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Why Camel is Better than Perldoc
Message-Id: <borefb$ipd$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Sara:
> tuxy> perldoc regex
> No documentation found for "regex".
> tuxy> perldoc perlreg
> No documentation found for "perlreg".
> tuxy> perldoc perldoc regular
> No documentation found for "regular".
> brksun10-feot> perldoc expression
> No documentation found for "expression".
> .
> .
> .
>
> ...pull out trusty Camel, find regex switch in 3 seconds..
>
> I mean c'mon guys nothing for "regex", the virtual epicentre of Perl?
For cases such as this one it is a good idea to issue a
perldoc perl
and then finding (either by eye or by /)
perlrequick Perl regular expressions quick start
perlretut Perl regular expressions tutorial
[...]
perlre Perl regular expressions, the rest of the story
> That would be like:
>
> IRS-Search, enter your query: 1040
> Sorry, nothing found, we have no idea what a 1040 is...
>
> At least put in a -k (like "man apropos") for common words?
ethan@ethan:~$ apropos regular | grep perlre
perlre (1) - Perl regular expressions
perlrequick (1) - Perl regular expressions quick start
perlretut (1) - Perl regular expressions tutorial
The standard perldocs also get installed as manpages so it's already
there.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Tue, 11 Nov 2003 14:56:30 -0500
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: Why Camel is Better than Perldoc
Message-Id: <3FB13EEE.9030306@gwu.edu>
Sara wrote:
> grrrrr....
>
> tuxy> perldoc regex
> No documentation found for "regex".
$ perldoc -q regex
<eight screens of info about regexes snipped>
> tuxy> perldoc perlreg
> No documentation found for "perlreg".
> tuxy> perldoc perldoc regular
> No documentation found for "regular".
$ perldoc -q regular
<ten screens of info about regular expressions snipped>
> brksun10-feot> perldoc expression
> No documentation found for "expression".
$ perldoc -q expression
<ten screens of info about regular expressions snipped>
"perldoc perl" also gave up a couple of .pod files that
deal at length with regexes. Try "perldoc perlrequick"
and "perldoc perlretut". I found all this within five
minutes from a dead start, never having looked up anything
to do with regexes in perldoc before.
> .
> .
> .
>
> ...pull out trusty Camel, find regex switch in 3 seconds..
>
> I mean c'mon guys nothing for "regex", the virtual epicentre of Perl?
> That would be like:
>
> IRS-Search, enter your query: 1040
> Sorry, nothing found, we have no idea what a 1040 is...
>
> At least put in a -k (like "man apropos") for common words?
>
> Camel-online now THAT'S the ticket! Or Damian in your spare time make
> perdoc smarter? A learning perldoc would be cool (AI) ...
>
It's all there in perldoc, you just need to look.
Chris Mattern
------------------------------
Date: Tue, 11 Nov 2003 20:13:42 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: genericax@hotmail.com (Sara)
Subject: Re: Why Camel is Better than Perldoc
Message-Id: <af8fb956bfd8a05ae40949e64a6a4522@news.teranews.com>
>>>>> "Sara" == Sara <genericax@hotmail.com> writes:
Sara> grrrrr....
tuxy> perldoc regex
Sara> No documentation found for "regex".
tuxy> perldoc perlreg
Sara> No documentation found for "perlreg".
tuxy> perldoc perldoc regular
Sara> No documentation found for "regular".
brksun10-feot> perldoc expression
Sara> No documentation found for "expression".
Sara> .
Sara> .
Sara> .
When in doubt, "perldoc perl" gives a TOC of the rest of the pages,
which includes:
Tutorials
perlreftut Perl references short introduction
...
Reference Manual
...
perlre Perl regular expressions, the rest of the story
perlreref Perl regular expressions quick reference
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 11 Nov 2003 21:40:58 GMT
From: "Shaun Clowes" <delius@no.spam.for.me.progsoc.org>
Subject: Win32::OLE and CDO Message Filters
Message-Id: <KHcsb.244$z31.6107@news.optus.net.au>
Hi All,
I'm having some trouble trying to set the properites of the MessageFilter
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_
olemsg_messagefilter_object.asp) object in a CDO messages collection using
Win32::OLE. Nothing I do seems to be able to change any of the properties. A
snippet of the code I'm trying:
print "We have a folder of type " . Win32::OLE->QueryObjectType($Folder) .
"\n";
print "The filter is of type " .
Win32::OLE->QueryObjectType($Folder->Messages->Filter) . "\n";
print "Currently filtering for size " . $Folder->Messages->Filter->Size .
"\n";
$Folder->{"Messages"}->{"Filter"}->{"Size"} = 12;
print "Currently filtering for size " . $Folder->Messages->Filter->Size .
"\n";
$Folder->Messages->Filter->LetProperty('Size', 12);
print "Currently filtering for size " . $Folder->Messages->Filter->Size .
"\n";
$Folder->Messages->Filter->SetProperty('Size', 12);
print "Currently filtering for size " . $Folder->Messages->Filter->Size .
"\n";
The output without -w:
We have a folder of type Folder
The filter is of type MessageFilter
Currently filtering for size
Currently filtering for size
Currently filtering for size
Currently filtering for size
The output with -w:
The filter is of type MessageFilter
OLE exception from "Collaboration Data Objects":
[Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]
Win32::OLE(0.17) error 0x8004010f
in METHOD/PROPERTYGET "Size" at AssignPrNumbers.pl line 65
Use of uninitialized value in concatenation (.) or string at
AssignPrNumbers.pl
line 65.
Currently filtering for size
OLE exception from "Collaboration Data Objects":
[Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]
Win32::OLE(0.17) error 0x8004010f
in METHOD/PROPERTYGET "Size" at AssignPrNumbers.pl line 67
Use of uninitialized value in concatenation (.) or string at
AssignPrNumbers.pl
line 67.
Currently filtering for size
OLE exception from "Collaboration Data Objects":
[Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]
Win32::OLE(0.17) error 0x8004010f
in METHOD/PROPERTYGET "Size" at AssignPrNumbers.pl line 69
Use of uninitialized value in concatenation (.) or string at
AssignPrNumbers.pl
line 69.
Currently filtering for size
OLE exception from "Collaboration Data Objects":
[Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]
Win32::OLE(0.17) error 0x8004010f
in METHOD/PROPERTYGET "Size" at AssignPrNumbers.pl line 71
Use of uninitialized value in concatenation (.) or string at
AssignPrNumbers.pl
line 71.
Currently filtering for size
Anyone have any ideas what I'm doing wrong?
Thanks,
Shaun
------------------------------
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 5783
***************************************