[30152] in Perl-Users-Digest
Perl-Users Digest, Issue: 1395 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 26 21:09:48 2008
Date: Wed, 26 Mar 2008 18:09:13 -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 Wed, 26 Mar 2008 Volume: 11 Number: 1395
Today's topics:
Aspell, perl and piping <bill@ts1000.us>
Re: Aspell, perl and piping <spamtrap@dot-app.org>
bare underscore? <miknrene@drizzle.com>
Re: bare underscore? <someone@example.com>
Re: bare underscore? <spamtrap@dot-app.org>
BEGIN, INIT etc... <pgodfrin@gmail.com>
Re: BEGIN, INIT etc... <noreply@gunnar.cc>
Re: BEGIN, INIT etc... <pgodfrin@gmail.com>
Re: BEGIN, INIT etc... xhoster@gmail.com
Re: BEGIN, INIT etc... <pgodfrin@gmail.com>
Re: Digest Authentication encoding issue <nikos1337@gmail.com>
Re: display in a tree structure <m@rtij.nl.invlalid>
excel, install perl scripts <drubnone@yahoo.com>
Re: FAQ 5.39 Why do I get weird spaces when I print an <tzz@lifelogs.com>
Re: Faster file iteration <vijay@iavian.com>
Re: Faster file iteration xhoster@gmail.com
Re: Faster file iteration <ben@morrow.me.uk>
mysql_server_init error <ela@yantai.org>
pipe for stderr and stdout <ivan@0x4849.net>
Re: pipe for stderr and stdout <noreply@gunnar.cc>
Re: Problem with loop control LAST exiting prematurely <tzz@lifelogs.com>
Re: Readline using foreach and while xhoster@gmail.com
utf8->any+(html|xml) does not work? delfin_soft@homoludens.elte.hu
Re: utf8->any+(html|xml) does not work? <smallpond@juno.com>
Re: What's better than Template Toolkit? (Randal L. Schwartz)
Re: What's better than Template Toolkit? <jimsgibson@gmail.com>
Re: What's better than Template Toolkit? <joost@zeekat.nl>
Re: What's better than Template Toolkit? <tzz@lifelogs.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 26 Mar 2008 16:46:08 -0700 (PDT)
From: Bill H <bill@ts1000.us>
Subject: Aspell, perl and piping
Message-Id: <c96eae0d-3925-4860-936e-72bb10d4f51e@a1g2000hsb.googlegroups.com>
I am hoping someone can give me a few pointers on where to look for
more information on this. I am using Aspell on a linux box to suggest
corrections for mispelled words using a command such as:
aspell -a < checkthis.txt > errors.txt
at the command prompt and this is fine. What I want to do next is
receive the text from an html form and using perl pipe this out to
aspell and get the list of errors back. I could write the text to be
checked to a file and then use somthing like
system("aspell -a < checkthis.txt > errors.txt");
but I would like to avoid if possible having to write the file and
then open and read the errors.txt file. Is there a way to pipe this
information straight from perl and get the results back?
If I am missing something or if I could find this in the perldocs,
please let me know.
Bill H
------------------------------
Date: Wed, 26 Mar 2008 20:51:06 -0400
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: Aspell, perl and piping
Message-Id: <m1bq51ugzp.fsf@dot-app.org>
Bill H <bill@ts1000.us> writes:
> I am hoping someone can give me a few pointers on where to look for
> more information on this. I am using Aspell on a linux box to suggest
> corrections for mispelled words using a command such as:
>
> aspell -a < checkthis.txt > errors.txt
>
> at the command prompt and this is fine. What I want to do next is
> receive the text from an html form and using perl pipe this out to
> aspell and get the list of errors back. I could write the text to be
> checked to a file and then use somthing like
>
> system("aspell -a < checkthis.txt > errors.txt");
>
> but I would like to avoid if possible having to write the file and
> then open and read the errors.txt file. Is there a way to pipe this
> information straight from perl and get the results back?
Have a look at IPC::Open2, or IPC::Open3 if you're also interested in
stderr.
sherm--
--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Wed, 26 Mar 2008 16:54:36 -0700
From: Michael Slass <miknrene@drizzle.com>
Subject: bare underscore?
Message-Id: <m3bq51ujlv.fsf@drizzle.com>
I was looking at the standard module lib.pm, and saw this puzzling (to
me) bit:
foreach (reverse @_) {
my $path = $_; # we'll be modifying it, so break the alias
if ($path eq '') {
require Carp;
Carp::carp("Empty compile time value given to use lib");
}
$path = _nativize($path);
if (-e $path && ! -d _) {
require Carp;
Carp::carp("Parameter to use lib must be directory, not file");
}
What does the _ with no sigil before it mean in
if (-e $path && ! -d _) {
?
Thanks.
--
Mike Slass
------------------------------
Date: Thu, 27 Mar 2008 00:18:36 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: bare underscore?
Message-Id: <wJBGj.512$pb5.183@edtnps89>
Michael Slass wrote:
> I was looking at the standard module lib.pm, and saw this puzzling (to
> me) bit:
>=20
> foreach (reverse @_) {
> my $path =3D $_; # we'll be modifying it, so break the alias
> if ($path eq '') {
> require Carp;
> Carp::carp("Empty compile time value given to use lib");
> }
>=20
> $path =3D _nativize($path);
>=20
> if (-e $path && ! -d _) {
> require Carp;
> Carp::carp("Parameter to use lib must be directory, not file");
> }
>=20
> What does the _ with no sigil before it mean in
> if (-e $path && ! -d _) {
perldoc -f -d
[ SNIP ]
If any of the file tests (or either the "stat" or "lstat"
operators) are given the special filehandle consisting of a
solitary underline, then the stat structure of the previous file=
test (or stat operator) is used, saving a system call. (This
doesn=92t work with "-t", and you need to remember that lstat()
and "-l" will leave values in the stat structure for the
symbolic link, not the real file.) (Also, if the stat buffer
was filled by an "lstat" call, "-T" and "-B" will reset it with
the results of "stat _"). Example:
print "Can do.\n" if -r $a || -w _ || -x _;
stat($filename);
print "Readable\n" if -r _;
print "Writable\n" if -w _;
print "Executable\n" if -x _;
print "Setuid\n" if -u _;
print "Setgid\n" if -g _;
print "Sticky\n" if -k _;
print "Text\n" if -T _;
print "Binary\n" if -B _;
John
--=20
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
------------------------------
Date: Wed, 26 Mar 2008 20:59:58 -0400
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: bare underscore?
Message-Id: <m17ifpugkx.fsf@dot-app.org>
Michael Slass <miknrene@drizzle.com> writes:
> What does the _ with no sigil before it mean in
> if (-e $path && ! -d _) {
>
> ?
When used with a file test operator, the unadorned _ re-uses the information
returned from the preceding test or stat() call. This can avoid race condi-
tions that might cause stat() to return different results from one test to
the next. It can also be a big win where stat() is relatively expensive,
such as network shares.
sherm--
--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Wed, 26 Mar 2008 12:22:56 -0700 (PDT)
From: pgodfrin <pgodfrin@gmail.com>
Subject: BEGIN, INIT etc...
Message-Id: <46af9aa1-991a-4c0d-b325-15ba3836fc52@i29g2000prf.googlegroups.com>
Greetings,
Anyone know of a good article that discusses when and why you would
use the BEGIN, UNITCHECK, CHECK, INIT and END code blocks?
thanks,
pg
------------------------------
Date: Wed, 26 Mar 2008 21:49:46 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: BEGIN, INIT etc...
Message-Id: <64vr3qF2dufp7U1@mid.individual.net>
pgodfrin wrote:
> Anyone know of a good article that discusses when and why you would
> use the BEGIN, UNITCHECK, CHECK, INIT and END code blocks?
perldoc perlmod
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 26 Mar 2008 13:49:51 -0700 (PDT)
From: pgodfrin <pgodfrin@gmail.com>
Subject: Re: BEGIN, INIT etc...
Message-Id: <add1b958-fc39-4749-aa45-09bc25fc0b08@e6g2000prf.googlegroups.com>
On Mar 26, 3:49 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> pgodfrin wrote:
> > Anyone know of a good article that discusses when and why you would
> > use the BEGIN, UNITCHECK, CHECK, INIT and END code blocks?
>
> perldoc perlmod
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl
been there done that. Can we do better?
pg
------------------------------
Date: 26 Mar 2008 22:37:12 GMT
From: xhoster@gmail.com
Subject: Re: BEGIN, INIT etc...
Message-Id: <20080326183712.747$GZ@newsreader.com>
pgodfrin <pgodfrin@gmail.com> wrote:
> On Mar 26, 3:49 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> > pgodfrin wrote:
> > > Anyone know of a good article that discusses when and why you would
> > > use the BEGIN, UNITCHECK, CHECK, INIT and END code blocks?
> >
> > perldoc perlmod
> >
>
> been there done that. Can we do better?
What parts do you think need improving?
After reading my installed perlmod, I know what BEGIN and END do, and I
know that if I want to do what they do, then I should use the one that does
what I want done. I don't know what more to ask of documentation than
that. For CHECK and INIT, I know that they are used for things I will
probably rarely if ever need to do, but they are in the back of mind,
reminding me to re-read the docs if I ever do decide I might need them.
Again, It isn't clear to me what more is needed.
After reading the 5.10 perlmod, I see that UNITCHECK should be used if
I need something like CHECK but which is run in string evals (and some
other special constructs) unlike CHECK. Maybe it should point out that
UNITCHECK is newer and perhaps existing CHECK and INIT code would be better
done in the newer style as UNITCHECK code.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Wed, 26 Mar 2008 17:00:06 -0700 (PDT)
From: pgodfrin <pgodfrin@gmail.com>
Subject: Re: BEGIN, INIT etc...
Message-Id: <44508b82-26f0-4d16-acd0-8b4a812d8f92@s12g2000prg.googlegroups.com>
On Mar 26, 5:37 pm, xhos...@gmail.com wrote:
> pgodfrin <pgodf...@gmail.com> wrote:
> > On Mar 26, 3:49 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> > > pgodfrin wrote:
> > > > Anyone know of a good article that discusses when and why you would
> > > > use the BEGIN, UNITCHECK, CHECK, INIT and END code blocks?
>
> > > perldoc perlmod
>
> > been there done that. Can we do better?
>
> What parts do you think need improving?
>
> After reading my installed perlmod, I know what BEGIN and END do, and I
> know that if I want to do what they do, then I should use the one that does
> what I want done. I don't know what more to ask of documentation than
> that. For CHECK and INIT, I know that they are used for things I will
> probably rarely if ever need to do, but they are in the back of mind,
> reminding me to re-read the docs if I ever do decide I might need them.
> Again, It isn't clear to me what more is needed.
>
> After reading the 5.10 perlmod, I see that UNITCHECK should be used if
> I need something like CHECK but which is run in string evals (and some
> other special constructs) unlike CHECK. Maybe it should point out that
> UNITCHECK is newer and perhaps existing CHECK and INIT code would be better
> done in the newer style as UNITCHECK code.
>
> Xho
>
> --
> --------------------http://NewsReader.Com/--------------------
> The costs of publication of this article were defrayed in part by the
> payment of page charges. This article must therefore be hereby marked
> advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
> this fact.
Hi Xho,
Sorry - didn't mean to impugn the quality of the docs. All I was
looking for is some sort of article from a trade rag, for instance,
that discussed the utility of those code blocks. You know, maybe some
sort of article where a really good Perl programmer describes how he
(or she :) ) uses those code blocks in an effective manner.
That's all.
smiles,
pg
------------------------------
Date: Wed, 26 Mar 2008 09:35:47 -0700 (PDT)
From: =?ISO-8859-7?B?zd/q7/I=?= <nikos1337@gmail.com>
Subject: Re: Digest Authentication encoding issue
Message-Id: <2d8881e4-139f-4e00-acca-db8d9ca820d8@s19g2000prg.googlegroups.com>
Thanks for the help.
------------------------------
Date: Thu, 27 Mar 2008 00:19:48 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: display in a tree structure
Message-Id: <pan.2008.03.26.23.19.48@rtij.nl.invlalid>
On Wed, 26 Mar 2008 16:37:32 +0530, Vakayil Thobias wrote:
> Hello,
>
> I have to display the data from a file in tree structure(perl). The file
> format is as follows(first field parent, second field child) :
>
> PM01 PM02
> PM01 PM1A
> PM02 PM03
> PM03 PM04
> PM04 PM05
> PM04 PM06
> PM1A PM1B
> PM1A PM1C
>
> The output should be like this :
> PM01 -- PM02 -- PM03 -- PM04 -- PM05
> PM06
> PM01 PM1A -- PM1B
> PM1C
>
> Anybody have idea ?
Something like (got a bit more complicated than I thought at first,
someone is bound to come up with a better/shorter solution):
#!/usr/bin/perl
use strict;
use warnings;
# Note all the commented out debug code!
#use Data::Dumper;
# read in the file
# remember both parent -> children and
# child -> parent
# Need to remember all children to print the tree
my %children;
# Need to remember all parents to find all roots
my %parent;
while (<DATA>) {
my ($parent, $child) = split;
die if exists $parent{$child};
$parent{$child} = $parent;
push @{$children{$parent}}, $child;
}
#print Data::Dumper->Dump([\%parent], ["*parent"]), "\n";
#print Data::Dumper->Dump([\%children], ["*children"]), "\n";
# Get all nodes without a parent, those are the roots
my @roots = grep { not exists $parent{$_} } keys %children;
#print Data::Dumper->Dump(\@roots, ["*roots"]), "\n";
# Print the tree
for (@roots) {
print "$_";
print_children(1, $children{$_} );
}
# Print all children of the current node
#
# Parameters:
# - $indent: The amount of nodes to indent
# - $children_ref: reference to an array containing all children
# or undef if there are no children.
#
sub print_children {
my ($indent, $children_ref) = @_;
# No children? Print a newline and quit this branch.
unless ($children_ref) {
print "\n";
return;
}
# There are children, print each one on a new line,
# with the proper indent. Use "+-" if more than one child,
# use "--" if only one. That way we get a nice tree look.
my @children = @$children_ref;
my $sep = @children==1 ? "--" : "+-";
my $first = 1;
for (@children) {
my $spaces = $first ? 0 : $indent*8-4;
$first = 0;
print " "x$spaces, " $sep ", $_;
print_children($indent+1, $children{$_});
}
}
__DATA__
PM01 PM02
PM01 PM1A
PM02 PM03
PM03 PM04
PM04 PM05
PM04 PM06
PM1A PM1B
PM1A PM1C
HTH,
M4
------------------------------
Date: Wed, 26 Mar 2008 16:25:23 -0700 (PDT)
From: werwer <drubnone@yahoo.com>
Subject: excel, install perl scripts
Message-Id: <d6bca32f-2341-491f-9ddf-82df823dd7f0@m3g2000hsc.googlegroups.com>
I can call up perl and the OLE scripts from within an Excel sheet
(send path to wb). I've seen this done b4; how do you install the
script within the workbook? Thank you.
excel 2003+, perl 5.8+
------------------------------
Date: Wed, 26 Mar 2008 16:27:15 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: FAQ 5.39 Why do I get weird spaces when I print an array of lines?
Message-Id: <86fxud2n2k.fsf@lifelogs.com>
On Tue, 18 Mar 2008 16:16:29 -0500 brian d foy <brian.d.foy@gmail.com> wrote:
bdf> In article <86myox9znf.fsf@lifelogs.com>, Ted Zlatanov
bdf> <tzz@lifelogs.com> wrote:
>> The problem is that the simple FAQ answer is wrong exactly when people
>> may be looking for reasons why there are weird separators in a list.
bdf> It's not wrong, it just isn't that good.
Do you want rewrite suggestions or will you do it?
Ted
------------------------------
Date: Wed, 26 Mar 2008 10:43:32 -0700 (PDT)
From: "vijay@iavian.com" <vijay@iavian.com>
Subject: Re: Faster file iteration
Message-Id: <9808dbf8-1676-41c7-9853-633987b05db0@d4g2000prg.googlegroups.com>
On Mar 14, 4:33 pm, bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
>
> Overall performance is O(NlogN) + O(N) + O(NlogN) which is O(NlogN)
> which is rather better than your present O(N^2)
>
> BugBear
Any suggestions on using Thread?
#!/usr/bin/perl
use strict;
#use Data::Dumper;
#use CGI;
use Date::Calc qw(Delta_YMD);
use Thread;
my $file_1 = '1.txt'; # File 1
my $file_2 = '2.txt'; # File 2
my $file_3 = 'f.txt'; # Final output file
if(open(FH1 , $file_1)){
print "File $file_1 Opened\n";
close(FH1);
}else{
print "Failed to Open file $file_1\n";
exit;
}
if(open(FH2 , $file_2)){
print "File $file_2 Opened\n";
}else{
print "Failed to Open file $file_2\n";
close FH1;
exit;
}
if(open(FH3,">$file_3")){
print "File $file_3 Opened\n";
print FH3 "serialno\tfileno\tdate\tlabel4\tlabel5\n";
}else{
print "Failed to Open file $file_3\n";
close FH1;close FH2;
exit;
}
while(my $line_2 = <FH2>){
chomp($line_2);print $line_2."\n";
my($dummy,$file2_no,$file2_date) = split(/\s+/,$line_2);
next if($file2_no !~ /\d+/);
my $counter = 0;
my $least_date = date_compare($file2_date);
my $thr = new Thread \&traverse, $dummy,$file2_no,$file2_date,
$counter,$least_date;
#$counter = traverse($file2_no,$file2_date);
}
sleep(500);
close FH1;
close FH2;
close FH3;
sub traverse{
my($dummy,$file2_no,$file2_date,$counter,$least_date) = @_;
my $counter = 0;
open(FHT , $file_1);
seek(FHT,0,0);
while(my $line_1 = <FHT>){
chomp($line_1);
my ($d,$file1_no,$file1_date) = split(/;/,$line_1);
if($file1_no == $file2_no){
#print $file1_date."=".$file2_date."\n";
if((date_compare5($file1_date,$file2_date)) == 1){
$counter++;
}
}
}
close(FHT);
$least_date = 0 if($counter == 0);
print "$dummy\t$file2_no\t$file2_date\t$counter\t$least_date\n";
print FH3 "$dummy\t$file2_no\t$file2_date\t$counter\t$least_date
\n";
return $counter;
}
sub date_compare5{ # Comparision for 5 Years
my($date_1,$date_2) = @_;
$date_1 =~/(\d\d\d\d)(\d\d)(\d\d)/;
my $yr1 = $1;
$date_2 =~/(\d\d\d\d)(\d\d)(\d\d)/;
my $yr2 = $1;
#print "$yr1=$mn1=$dt1: ";print "$yr2=$mn2=$dt2\n";
if(($yr1 - $yr2) < 5){
#print "$yr1=$mn1=$dt1: ";print "$yr2=$mn2=$dt2\n";
return 1;
}
return -1;
}
sub date_compare{ # Comparision for actual date , return 1 if date1 is
big otherwise -1 , if equal then 0
my($date_1) = @_;
$date_1 =~/(\d\d\d\d)(\d\d)(\d\d)/;
my($yr1,$mn1,$dt1) = ($1,$2,$3);
if($yr1 < 1996){
return "5 Yrs";
}elsif($yr1 == 1996 && $mn1 < 12){
return "5 Yrs";
}elsif($yr1 == 1996 && $mn1 == 12 && $dt1 <= 25 ){
return "5 Yrs";
}elsif($yr1 < 2001 && $yr1 > 1996){
return delta($yr1,$mn1,$dt1);
}elsif($yr1 == 1996 && $mn1 == 12 && $dt1 >=25){
return delta($yr1,$mn1,$dt1);
}elsif($yr1 == 2001 && $mn1 < 12 ){
return delta($yr1,$mn1,$dt1);
}elsif($yr1 == 2001 && $mn1 == 12 && $dt1 <=24){
return delta($yr1,$mn1,$dt1);
}elsif($yr1 > 2001){
return delta($yr1,$mn1,$dt1);
}elsif($yr1 == 2001 && $mn1 == 12 && $dt1 > 24 ){
return delta($yr1,$mn1,$dt1);
}else{
return "No case ".$date_1;
}
}
sub delta{
my $yr = shift;my $mn = shift; my $dt= shift;
($yr,$mn,$dt) = Delta_YMD($yr,$mn,$dt,2001,12,25);
return "$yr-$mn-$dt";
}
------------------------------
Date: 26 Mar 2008 19:03:21 GMT
From: xhoster@gmail.com
Subject: Re: Faster file iteration
Message-Id: <20080326150323.581$mk@newsreader.com>
"vijay@iavian.com" <vijay@iavian.com> wrote:
> On Mar 14, 4:33 pm, bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
> >
> > Overall performance is O(NlogN) + O(N) + O(NlogN) which is O(NlogN)
> > which is rather better than your present O(N^2)
> >
> > BugBear
>
> Any suggestions on using Thread?
God, I hope not. It seems like you want to try every bad way to solve
this problem. What about the suggestions you already received--ones that
would actually work and make things fast?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Wed, 26 Mar 2008 23:03:44 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Faster file iteration
Message-Id: <gb1rb5-spj.ln1@osiris.mauzo.dyndns.org>
Quoth "vijay@iavian.com" <vijay@iavian.com>:
> On Mar 14, 4:33 pm, bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
> >
> > Overall performance is O(NlogN) + O(N) + O(NlogN) which is O(NlogN)
> > which is rather better than your present O(N^2)
>
> Any suggestions on using Thread?
Thread.pm is deprecated: it supported the old 5005-threads threading
model, which never worked right and was removed from perl 5.8. Thread.pm
is just a passthrough to threads.pm; new code should be using this
directly.
Ben
------------------------------
Date: Thu, 27 Mar 2008 08:47:45 +0800
From: "Ela" <ela@yantai.org>
Subject: mysql_server_init error
Message-Id: <fseqrk$tu5$1@ijustice.itsc.cuhk.edu.hk>
Google search returns few results, if any,
perl: relocation error:
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBD/mysql/mysql.so:
undefined symbol: mysql_server_init
using CPAN to update DBI and DBD::mysql is of little help, neither do I
download the modules and install them help solve the problem.
Would anybody have any idea on solving this problem?
------------------------------
Date: Wed, 26 Mar 2008 16:17:02 -0700 (PDT)
From: Ivan Novick <ivan@0x4849.net>
Subject: pipe for stderr and stdout
Message-Id: <d89e907a-ca8a-4815-825f-34bd204d007d@h11g2000prf.googlegroups.com>
Hi,
From within perl i want to start a first process 'A' which writes to
both STDOUT and STDERR.
From the same perl script i want to start 2 more processes.
One, 'B', that reads from STDOUT of 'A"
The other, 'C', that reads from STDERR 'A'
Is this possible from within perl?
Thanks,
Ivan Novick
http://www.myperlquiz.com/
------------------------------
Date: Thu, 27 Mar 2008 01:33:10 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: pipe for stderr and stdout
Message-Id: <65086mF2dou0dU1@mid.individual.net>
Ivan Novick wrote:
> From within perl i want to start a first process 'A' which writes to
> both STDOUT and STDERR.
>
> From the same perl script i want to start 2 more processes.
>
> One, 'B', that reads from STDOUT of 'A"
>
> The other, 'C', that reads from STDERR 'A'
>
> Is this possible from within perl?
Yes.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 26 Mar 2008 17:18:20 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <86myol164z.fsf@lifelogs.com>
On Tue, 18 Mar 2008 21:09:03 +0100 Frank Seitz <devnull4711@web.de> wrote:
>> Why can't programmers tell Haloween from Christmas?
>>
>> Because OCT 31 == DEC 25
FS> $ perldoc -f dec
FS> No documentation for perl function `dec' found
Obviously you needed "perldoc -f DEC" :)
Ted
------------------------------
Date: 26 Mar 2008 15:35:22 GMT
From: xhoster@gmail.com
Subject: Re: Readline using foreach and while
Message-Id: <20080326113523.580$SZ@newsreader.com>
"szr" <szrRE@szromanMO.comVE> wrote:
> >
> > I think the 'weirdness' stems from the notion that 'for' supposedly
> > builds up a list prior to iterating over it,
>
> Exactly. It builds a list, when necessary (like when you
> use for (<FH>) { ... } ),
I would argue that it is not *necessary* to do that. It *could* be
special-cased to read from <FH> one line at a time rather than building
a list at the beginning, rather like the special cases that exist for
a single array, or a simple range (1..1e6). Of course, then the docs would
have to add a "so don't do that" warning on doing insane things like
reading from the file handle in side the loop or changing $/.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: 26 Mar 2008 21:09:16 +0100
From: delfin_soft@homoludens.elte.hu
Subject: utf8->any+(html|xml) does not work?
Message-Id: <yqXoXVNJp6hX@ludens>
utf8->any+html does not work?
for sourcefiles {
s/Encode::FB_HTMLCREF/(Encode::FB_HTMLCREF & ~ Encode::LEAVE_SRC)/gs
}
utf8->any+xml does not work?
for previous idea {
s/HTML/XML/g
}
Bye delfin
------------------------------
Date: Wed, 26 Mar 2008 14:33:38 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: utf8->any+(html|xml) does not work?
Message-Id: <64297058-2d1b-4b38-b8f2-4fa17cc5638b@s50g2000hsb.googlegroups.com>
On Mar 26, 4:09 pm, delfin_s...@homoludens.elte.hu wrote:
> utf8->any+html does not work?
>
> for sourcefiles {
> s/Encode::FB_HTMLCREF/(Encode::FB_HTMLCREF & ~ Encode::LEAVE_SRC)/gs
>
> }
>
> utf8->any+xml does not work?
>
> for previous idea {
> s/HTML/XML/g
>
> }
>
> Bye delfin
what content-type meta tag?
------------------------------
Date: Wed, 26 Mar 2008 09:50:51 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: What's better than Template Toolkit?
Message-Id: <86lk455t04.fsf@blue.stonehenge.com>
>>>>> "Joost" == Joost Diepenmaat <joost@zeekat.nl> writes:
Joost> fishfry <BLOCKSPAMfishfry@your-mailbox.com> writes:
>> I'm starting a little project. I've used TT for the front end before,
>> but it has some limitations and quirks as I'm sure people know. I was
>> wondering if anyone can recommend a better templating package.
Joost> This is probably controversial, but I really don't see the point of
Joost> template-specific languages unless they're a superset of the "real"
Joost> language for most purposes.
The theory is that by having a simpler template language, you get
two benefits:
You don't have to explain @a vs $a to a web designer, and yet they
can probably pick up the simpler templating language to edit their own
templates for common cases.
If it's starts getting difficult to write in the mini-language, it
probably means it should have been factored out into model or controller
code (that is, it's not view code any more).
This comes from lots of experience with TT.
print "Just another Perl hacker,"; # the original!
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 26 Mar 2008 10:11:24 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: What's better than Template Toolkit?
Message-Id: <260320081011248518%jimsgibson@gmail.com>
In article
<BLOCKSPAMfishfry-6C6867.22382225032008@comcast.dca.giganews.com>,
fishfry <BLOCKSPAMfishfry@your-mailbox.com> wrote:
> I'm starting a little project. I've used TT for the front end before,
> but it has some limitations and quirks as I'm sure people know. I was
> wondering if anyone can recommend a better templating package.
The only one I have used is Text::Template. I like it because it uses
Perl syntax instead of defining a separate language. You insert Perl
expression blocks into your template file surrounded by '{}' or some
other block delimiters, and the values of the block expressions are
substituted into your template to generate the output.
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Wed, 26 Mar 2008 18:26:38 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: What's better than Template Toolkit?
Message-Id: <87r6dxmm5t.fsf@zeekat.nl>
merlyn@stonehenge.com (Randal L. Schwartz) writes:
>>>>>> "Joost" == Joost Diepenmaat <joost@zeekat.nl> writes:
> Joost> This is probably controversial, but I really don't see the point of
> Joost> template-specific languages unless they're a superset of the "real"
> Joost> language for most purposes.
>
> The theory is that by having a simpler template language, you get
> two benefits:
>
> You don't have to explain @a vs $a to a web designer, and yet they
> can probably pick up the simpler templating language to edit their own
> templates for common cases.
I'm reluctant to accept this, because
1. CSS is finally at a point where the precise structure of the HTML
doesn't matter much anymore, so the coders can write the HTML.
2. IME, designers suck at using templates efficiently. Even *if* they
can produce nice HTML. I think coders are better at creating templates
than designers.
> If it's starts getting difficult to write in the mini-language, it
> probably means it should have been factored out into model or controller
> code (that is, it's not view code any more).
This is mostly true, but it takes a lot of fine-tuning to get the mini
language and the model to a point where you can do all of the things you
need for formatting, access all kinds of models without requiring a lot
of template-specific code at the back end and still be easy "enough".
I prefer to have a bit more wiggling room in the templating language.
I seem to recall reading something about a "practical extraction and
reporting language". Sounds perfect :-)
> This comes from lots of experience with TT.
It's certainly possible the designers you worked with are better coders
than the ones I know. :-)
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
------------------------------
Date: Wed, 26 Mar 2008 16:39:40 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: What's better than Template Toolkit?
Message-Id: <86bq512mhv.fsf@lifelogs.com>
On Wed, 26 Mar 2008 09:50:51 -0700 merlyn@stonehenge.com (Randal L. Schwartz) wrote:
RLS> The theory is that by having a simpler template language, you get
RLS> two benefits:
RLS> You don't have to explain @a vs $a to a web designer, and yet they
RLS> can probably pick up the simpler templating language to edit their own
RLS> templates for common cases.
RLS> If it's starts getting difficult to write in the mini-language, it
RLS> probably means it should have been factored out into model or controller
RLS> code (that is, it's not view code any more).
RLS> This comes from lots of experience with TT.
To append from my own experience...
I've tried templates for web designers, using:
- Mason
- Template Toolkit
- invented syntax (supposedly simpler)
- Javacript-interpreted templates
Eventually the designer has to program with any of them, and some
designers just aren't good at programming. I find it easier to ask the
designer to create an example, convert it into the template toolkit of
choice (with all the loops, conditionals, etc.), and then let the
designer iterate the template further while *carefully* supervising them
to make sure they don't screw it up.
Ted
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 1395
***************************************