[23640] in Perl-Users-Digest
Perl-Users Digest, Issue: 5847 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 23 06:05:40 2003
Date: Sun, 23 Nov 2003 03:05:06 -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 Sun, 23 Nov 2003 Volume: 10 Number: 5847
Today's topics:
Re: access win32 from unix? <ccya86@yahoo.com>
Re: Bit counting benchmarks Was: count of 1s in a binar <nospam-abuse@ilyaz.org>
Re: Capture external command output line by line on Win <DibUrim@hotmail.com>
Re: code structure <eddhig22@yahoo.com>
Re: code structure <eddhig22@yahoo.com>
Re: DBI Question <kbass@midsouth.rr.com>
Re: dumb newbie question (or newbie dumb question) (Tad McClellan)
Re: dumb newbie question (or newbie dumb question) <REMOVEsdnCAPS@comcast.net>
Re: dumb newbie question (or newbie dumb question) <uri@stemsystems.com>
how to find script directory <aolblowz@yahoo.com>
Re: how to find script directory <me@privacy.net>
Re: how to find script directory (Jay Tilton)
Re: Listing Functions Called In A Script <hal@thresholddigital.com>
Re: Listing Functions Called In A Script <kuujinbo@hotmail.com>
Re: newbie regular expression questions <noreply@gunnar.cc>
Re: newbie regular expression questions <me@privacy.net>
Re: newbie regular expression questions <joeyperro@yahoo.com>
Re: newbie regular expression questions <noreply@gunnar.cc>
Re: Printing to one x-y co-ord (William Herrera)
Problem with nlink from stat(). (DJ Austin)
Re: reading and writing to text file via form newbie <mike@no_address.tld>
Re: reading and writing to text file via form newbie <noreply@gunnar.cc>
Re: Top level blocks and indentation <parv_@yahooWhereElse.com>
Re: Top level blocks and indentation (Tad McClellan)
Re: Top level blocks and indentation <tassilo.parseval@rwth-aachen.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 22 Nov 2003 19:14:34 -0600
From: "len v" <ccya86@yahoo.com>
Subject: Re: access win32 from unix?
Message-Id: <SRTvb.2617$5M.65356@dfw-read.news.verio.net>
"Mike" <mikee@mikee.ath.cx> wrote in message
news:vrd8pm93hh79ac@corp.supernews.com...
> Given the need to monitor win32 (win2k and winxp) boxes from unix,
> and given that there are modules to access win32 performance
> and other data, and given that this data can be accessed accross
> the network, is there a way using perl to access this data
> from unix (i.e. a unix box asks a windows box how much disk
> space remains, etc)?
>
> Mike
How about using Socket or IO::Socket. There are good examples in the
perlipc doc. You could write a perl *server* running on the win server(s)
which uses the Win32 modules to obtain the required performance data then
send the perf data back to the perl *client* running on the unix server.
The client then connects to each win32 server you wish to monitor waiting
for a response. The examples under "Internet TCP Clients and Servers"
should work for a simple request.
If you need to pass params from the client to the server, there are examples
further down using IO::Socket
As for disk space, there are win32 ports of du, df, ls. That should keep
you from having to install cygwin.
Len
------------------------------
Date: Sat, 22 Nov 2003 23:18:58 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Bit counting benchmarks Was: count of 1s in a binary number
Message-Id: <bpoqt2$8m0$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de>], who wrote in article <bpnmtk$fja$1@mamenchi.zrz.TU-Berlin.DE>:
> Not an attempt to revive this thread (it *was* a good one)
Ok, so let *me* attempt to revive it. ;-)
> I just want
> to mention that I have code that compiles, in either Perl or C, the
> mask/shift/add-method (thread-insiders know what I mean) according to
> the current word length. By itself it doesn't quite make a CPAN module,
> but if anyone wants to make use of it, it's at
>
> http://www.tu-berlin.de/zrz/mitarbeiter/anno4000/clpm/bench.bitcount
I do not see the *other* optimization I (kinda ;-) mentioned used:
"MASKING" is required only on steps when "the step number" is a
power of 2 (so only with 1-bit, 2-bit, 4-bit, 16-bit, 256-bit etc
"nibbles").
Hope this helps,
Ilya
------------------------------
Date: Sun, 23 Nov 2003 11:52:59 +0200
From: "Dib Urim" <DibUrim@hotmail.com>
Subject: Re: Capture external command output line by line on Windows 98
Message-Id: <bpq07c$dos$1@news2.netvision.net.il>
Hello Ben,
Thank for you quick replay.
What abut command/utils that are not in the command interpreter.
Specially I need to capture the output/error of utility called rsync.exe
Dib
"Ben Liddicott" <ben.liddicott@comodogroup.com> wrote in message
news:bpimso$phl$1@kylie.comodogroup.com...
> Hi Dib,
>
> DIR is a built in to the command interperter, command.com.
>
> You have to do this:
>
> open(PROC, "command.com /c DIR |");
>
> Cheers,
> Ben Liddicott
>
> "Dib Urim" <DibUrim@hotmail.com> wrote in message
> news:bpikqt$f40$1@news2.netvision.net.il...
> > Hello,
> >
> > I'm trying to Capture external command output and error line by line.
> > I wrote this example witch work excellent on Windows 2000:
> >
> > open(PROC,"DIR 2>&1 |");
>
>
------------------------------
Date: Sun, 23 Nov 2003 14:58:07 +1100
From: Edo <eddhig22@yahoo.com>
Subject: Re: code structure
Message-Id: <3FC0304F.4030408@yahoo.com>
here is a striped code of what I am tying to do, I know there is
somthing not correct with it
sub load ($\%);
sub prepare (\%\%);
foreach my $item ( @things ) {
tie my (%data), 'Tie::IxHash';
load ($item => %data); # %data will automatically become \%data
tie my (%info), 'Tie::IxHash';
prepare (%data => %info); # automatically referenced
print Dumper %info;
}
sub load ($\%) {
my ($i, $d) = @_;
my $key = (split /,/,$i)[1];
push @{$data{$key}}, $_;
return %data;
}
sub prepare (\%\%) {
my ($data, $info) = @_;
foreach my $key ( keys %data ) {
my $val = ...code
$info{$date} = $value;
}
return %info;
}
------------------------------
Date: Sun, 23 Nov 2003 18:23:56 +1100
From: Edo <eddhig22@yahoo.com>
Subject: Re: code structure
Message-Id: <3FC0608C.2020504@yahoo.com>
Edo wrote:
> here is a striped code of what I am tying to do, I know there is
> somthing not correct with it
>
>
> sub load ($\%);
> sub prepare (\%\%);
>
> foreach my $item ( @things ) {
> tie my (%data), 'Tie::IxHash';
> load ($item => %data); # %data will automatically become \%data
>
> tie my (%info), 'Tie::IxHash';
> prepare (%data => %info); # automatically referenced
>
> print Dumper %info;
> }
>
> sub load ($\%) {
> my ($i, $d) = @_;
> my $key = (split /,/,$i)[1];
> push @{$data{$key}}, $_;
> return %data;
> }
>
> sub prepare (\%\%) {
> my ($data, $info) = @_;
> foreach my $key ( keys %data ) {
> my $val = ...code
> $info{$date} = $value;
> }
> return %info;
> }
>
even this is not working, I guss I am trying to add to a hash ref. how
on earth is this done?
my $key = (split /,/)[1];
%{$data{$key}}= $_;
------------------------------
Date: Sun, 23 Nov 2003 07:34:02 GMT
From: "kbass" <kbass@midsouth.rr.com>
Subject: Re: DBI Question
Message-Id: <KpZvb.31049$oC5.8396@clmboh1-nws5.columbus.rr.com>
"cp" <cpryce@nospam.pryce.net> wrote in message
news:211120031015241008%cpryce@nospam.pryce.net...
> In article <oycvb.30938$oC5.21697@clmboh1-nws5.columbus.rr.com>, kbass
> <kbass@midsouth.rr.com> wrote:
>
> > No, I posted a snippet of the code. Here is part of the real code if it
will
> > help you.
> >
> > use DBI qw(:sql_types);
> > use strict;
> > use diagnostics; #debugging purposes
> > use CGI qw(:standard);
> > use CGI::Carp qw(fatalsToBrowser);
> > use VCP::Connect;
>
> [ snip impossibly long list of variables ]
>
> Don't do that. Declare them as you need them, in the smallest possible
> scope. If you don't need them until a sub, delcare them inside in the
> sub. It's so hard to debug otherwise.
> >
> > # Autoflush the output buffer
> > $| = 1;
> >
> > # Establish database connections for the CompAlign and Sales databases.
> > $dbh = Connect->compalignDB;
>
> In your original post, you gave the clue to what is happening. It ran
> from the command line, but not from the Web server. This connection
> string looks suspiciously like it gets default values from the user's
> environment. The Web server runs as a different user than you do, and
> it definitely does not have those same default values. You'd need to
> provide them. See perldoc DBI.
>
> At the VERY least, CHECK to see if the connection works:
>
> # one way
> die "Unable to connect to compalignDB" unless $dbh;
>
> Better set RaiseError or PrintError in your connection package.
>
> >
> > # Check action variable. If this CGI program is accessed without a
> > parameter
> > # within the URL, the default value of 'view' will be given. This is a
work
> > # around that for the '... Use of uninitialized value in string' error
> > # message.
>
> warning message. Errors cause programs to terminate. Warnings try to
> keep you from doing something stupid.
>
>
> > $territory = param("STerr");
> > $table_name = param("table");
> > $adjustment = param("anbr");
> >
> > #$territory = '1-1-1-1-1-2-0';
> >
> > View_Info();
> >
> > ##############################
> > # Procedure: View_Info #
> > ##############################
> > sub View_Info {
> >
> > # IMPORTANT - This function is for debugging purposes only.
> > # Make sure this function is comments after use.
> > #unlink 'dbtrace.log' if -e 'dbtrace.log';
> > #DBI->trace( 4, 'dbtrace.log' );
> >
> >
> > $sql = "select fyear ...
> [snip SQL staement ]
>
> > from fy04q1bulletin
> > where subdist = ?
>
> > $sth = $dbh->prepare($sql);
> > my $territory_quoted = $dbh->quote( $territory);
>
> this is not needed if you are using placeholders.
>
> > $sth->execute($territory_quoted);
> >
> [ snip rest ]
>
> --
> cp
Thanks for the responses. I have found the problem. The code was correct
but there was a problem (or bug) in the DBD::PgPP module. I used the
DBD::Pg module and all problems got resolved. Thanks!
Kevin
------------------------------
Date: Sat, 22 Nov 2003 16:12:13 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: dumb newbie question (or newbie dumb question)
Message-Id: <slrnbrvnpt.9hn.tadmc@magna.augustmail.com>
Uri Guttman <uri@stemsystems.com> wrote:
>>>>>> "MWS" == Master Web Surfer <raisin@delete-this-trash.mts.net> writes:
> MWS> use English;
>
> MWS> $sentence =~ m/\d\d/;
> MWS> print $MATCH;
>
> oh crap! no one uses English for two reasons. it is dumb and it slows
> down all your s/// operations since it refers to $& and brethren. there
> is no need to ever use $& when you can just explicitly grab the match
> you want.
I already told him that the last time he gave the same "answer"...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 22 Nov 2003 20:31:23 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: dumb newbie question (or newbie dumb question)
Message-Id: <Xns943BDB1F1D63Bsdn.comcast@216.196.97.136>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Uri Guttman <uri@stemsystems.com> wrote in
news:x7wu9s3zzz.fsf@mail.sysarch.com:
> oh crap! no one uses English for two reasons. it is dumb and it slows
> down all your s/// operations since it refers to $& and brethren.
> there is no need to ever use $& when you can just explicitly grab the
> match you want.
$& isn't as slow as it used to be.
I do agree that "use English" is dumb, though. :-)
- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBP8AcOGPeouIeTNHoEQIEIACg5777diYK2IcbEAlVM+00wyfC2WYAmwRc
bAPc0z+B2ig+xTx7P1saFZPx
=V6AL
-----END PGP SIGNATURE-----
------------------------------
Date: Sun, 23 Nov 2003 04:11:37 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: dumb newbie question (or newbie dumb question)
Message-Id: <x78ym74tc7.fsf@mail.sysarch.com>
>>>>> "TM" == Tad McClellan <tadmc@augustmail.com> writes:
TM> Uri Guttman <uri@stemsystems.com> wrote:
>>>>>>> "MWS" == Master Web Surfer <raisin@delete-this-trash.mts.net> writes:
MWS> use English;
>>
MWS> $sentence =~ m/\d\d/;
MWS> print $MATCH;
>>
>> oh crap! no one uses English for two reasons. it is dumb and it slows
>> down all your s/// operations since it refers to $& and brethren. there
>> is no need to ever use $& when you can just explicitly grab the match
>> you want.
TM> I already told him that the last time he gave the same "answer"...
well then, he is no master perl hacker and i doubt master of much else
either.
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: Sun, 23 Nov 2003 05:00:18 -0500
From: lucas <aolblowz@yahoo.com>
Subject: how to find script directory
Message-Id: <meGdnR5WhvCsGF2iRVn-sw@golden.net>
I run a perl app from different dirctories, and when i do a print `pwd`; it
shows the directory where I invoked the program. Problem is, I need to
read a file from the directory where the perl program is stored. Is there
a way to get the fully qualified location of the perl script? I've searched
through the system varibles, but found nothing.
thx
--
lucas
-------------------------
Perl Coder since 2001
shift || die;
-------------------------
------------------------------
Date: Sun, 23 Nov 2003 23:05:39 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: how to find script directory
Message-Id: <bpq0r6$1qmujt$1@ID-172104.news.uni-berlin.de>
"lucas" <aolblowz@yahoo.com> wrote in message
news:meGdnR5WhvCsGF2iRVn-sw@golden.net...
> I run a perl app from different dirctories, and when i do a print `pwd`;
it
> shows the directory where I invoked the program. Problem is, I need to
> read a file from the directory where the perl program is stored. Is there
> a way to get the fully qualified location of the perl script? I've
searched
> through the system varibles, but found nothing.
use Find::Bin;
------------------------------
Date: Sun, 23 Nov 2003 10:09:21 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: how to find script directory
Message-Id: <3fc08718.17517258@news.erols.com>
"Tintin" <me@privacy.net> wrote:
:
: "lucas" <aolblowz@yahoo.com> wrote in message
: news:meGdnR5WhvCsGF2iRVn-sw@golden.net...
: > I run a perl app from different dirctories, and when i do a print `pwd`;
: it
: > shows the directory where I invoked the program. Problem is, I need to
: > read a file from the directory where the perl program is stored. Is there
: > a way to get the fully qualified location of the perl script? I've
: searched
: > through the system varibles, but found nothing.
:
: use Find::Bin;
Its name is "FindBin" .
------------------------------
Date: Sun, 23 Nov 2003 00:12:56 GMT
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Re: Listing Functions Called In A Script
Message-Id: <cYSvb.210032$275.783279@attbi_s53>
John W. Krahn wrote:
> Hal Vaughan wrote:
>>
>> I can't remember much about this, but I thought I remembered a reference
>> somewhere to a program or utility that would scan a Perl script and list
>> the functions/subroutines it called and which modules each one was in.
>> Is
>> there a utility like this? If so, what's it called?
>
> perldoc B::Xref
Thanks. I looked that up. But I couldn't find anything before 5.8.2 -- is
there anything for earlier verisions?
Hal
>
> John
------------------------------
Date: Sun, 23 Nov 2003 09:30:21 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: Listing Functions Called In A Script
Message-Id: <bpov97$oji$1@pin3.tky.plala.or.jp>
Hal Vaughan wrote:
> John W. Krahn wrote:
[snip]
>>perldoc B::Xref
>
>
> Thanks. I looked that up. But I couldn't find anything before 5.8.2 -- is
> there anything for earlier verisions?
>
> Hal
http://search.cpan.org/~nwclark/perl-5.8.2/
under 'Other Releases'
HTH -keith
------------------------------
Date: Sun, 23 Nov 2003 00:05:13 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: newbie regular expression questions
Message-Id: <bpoq8f$1o6bdp$1@ID-184292.news.uni-berlin.de>
bbxrider wrote:
> i' ve found this code for parsing form input
> foreach (split(/[&;]/, $buffer)) {
> s/\+/ /g ;
> ($name, $value)= split('=', $_, 2) ;
> $name=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
> $value=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
> ..........
> i know it works but the data is ascii characters to begin with and
> don't understand what is the need for the substitution after
> converting all the +'s to spaces??
Your questions are not regular expression questions.
Data gets URI encoded when sent to a web server, so it has to be
decoded before used. To get a better understanding of it, you can for
instance study the documentation of URI::Escape:
http://www.perldoc.com/perl5.8.0/lib/URI/Escape.html
Of course, if there are no characters in any of the names and values
besides the restricted set of characters for URI strings, the decoding
does not make a difference. You'd better not count on that, though.
> is type of conversion only necessary due to properties of form
> input data on the web????
It's necessary when data is submitted through a query string as well.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 23 Nov 2003 13:12:16 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: newbie regular expression questions
Message-Id: <bpou2j$1rbfi6$1@ID-172104.news.uni-berlin.de>
"bbxrider" <bxtrap01@comcast.net> wrote in message
news:ZqRvb.280961$Fm2.290586@attbi_s04...
> i' ve found this code for parsing form input
> foreach (split(/[&;]/, $buffer)) {
> s/\+/ /g ;
> ($name, $value)= split('=', $_, 2) ;
> $name=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
> $value=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
> ..........
> i know it works
Do you really? How do you know it works if you don't fully understand the
code?
------------------------------
Date: Sat, 22 Nov 2003 20:37:22 -0800
From: Joe Y Perro <joeyperro@yahoo.com>
Subject: Re: newbie regular expression questions
Message-Id: <vs0apttm6rcpca@corp.supernews.com>
bbxrider wrote:
> i' ve found this code for parsing form input
> foreach (split(/[&;]/, $buffer)) {
> s/\+/ /g ;
> ($name, $value)= split('=', $_, 2) ;
> $name=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
> $value=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
> ..........
> i know it works but the data is ascii characters to begin with and don't
> understand what is the need for the substitution after converting all the
> +'s to spaces??
HTTP protocol translates characters like spaces, and others, to their
hex equivalent. For exampele, a space is translated to %20. I'm sure
you've seen this in the URL bar of your browser, or maybe you just
haven't been watching.Do some googling to find the spec.
This code is checking if a char has been encoded and reverse translates
it back to the original character.
> is type of conversion only necessary due to properties of form input data on
> the web????
Yes.
------------------------------
Date: Sun, 23 Nov 2003 05:50:26 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: newbie regular expression questions
Message-Id: <bppeh2$1qo56v$1@ID-184292.news.uni-berlin.de>
Joe Y Perro wrote:
> bbxrider wrote:
>>
>> i' ve found this code for parsing form input
>> foreach (split(/[&;]/, $buffer)) {
>> s/\+/ /g ;
>> ($name, $value)= split('=', $_, 2) ;
>> $name=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
>> $value=~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
<snip>
>> is type of conversion only necessary due to properties of form
>> input data on the web????
>
> Yes.
No, not only _form_ input.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 23 Nov 2003 04:38:28 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: Printing to one x-y co-ord
Message-Id: <3fc039c3.96211974@news2.news.adelphia.net>
On Sat, 22 Nov 2003 22:14:57 GMT, Default@IO_Error_1011101.xyz wrote:
>> # turn output buffering off
>> $| = 1;
>
>Ahh very cool, didn't know that trick.
>
>> # pause to see things
>> sleep 1;
>
>Yes! ive been looking for a built in pause like function.
>I've been using <STDIN> to create pauses. That sleep command is very
>helpfull indeed, thank you very much.
>
>Ahh yes and not only all that.. your solution works :-)
>It was the output buffering setting.
>Thanks
You're welcome. BTW, normally when doing this sort of thing you should erase
and then write, not write and erase, ie
loop: {
print "\b\b\ \b\b\$number";
do stuff;
redo loop;
}
---
Use the domain skylightview (dot) com for the reply address instead.
------------------------------
Date: 23 Nov 2003 00:18:00 -0800
From: djonli@yahoo.com (DJ Austin)
Subject: Problem with nlink from stat().
Message-Id: <d2365135.0311230018.c2a0ba8@posting.google.com>
Hi All,
I'm losing a lot of hair with this problem, and I hope some of you had
bumped into this problem before and can help me out.
I have 2 Windows XP machines. One desktop and one laptop. I installed
both cygwin (www.cygwin.com) and perl (www.activestate.com) late last
year (sometime in November 2002) on both computers, and everything
works fine.
My laptop disk went bad 2 weeks ago and I had to replace it and
reinstall XP, cygwin and perl. I went to cygwin.com and
activestate.com to install the latest version of both software.
My perl script that had never failed before fails now on my laptop. I
had isolated the problem to the following test case:
#!/usr/local/bin/perl
($dev, $ino, $mode, $nlink) = stat ('.') unless $nlink;
print "nlnk = $nlink\n";
print "dev = $dev\n";
print "ino = $ino\n";
print "mode = $mode\n";
The problem is: the nlink is always 1 no matter what directory/file I
stat.
Please note that the same test case above runs fine (as expected) on
my desktop. I notice that I have perl 5.6.1, and my laptop has 5.8.1,
so I uninstall 5.8.1 and install 5.6.1 thinking that it has conflict
with cygwin. Problem still exists. So, next step is to remove cygwin
and re-install it again thinking it was corrupted. No go.
Please note that when I install cygwin, I did not include perl, so I
know cygwin doesn't install perl, and my perl comes from
activestate.com installation.
I have searched the FAQ to no avail, and search on google returns a
lot of result but mostly on ctime/mtime issues.
Any help/pointer will be highly appreciated. Thanks in advance!
------------------------------
Date: Sun, 23 Nov 2003 05:07:09 GMT
From: "M" <mike@no_address.tld>
Subject: Re: reading and writing to text file via form newbie
Message-Id: <1gXvb.282470$Fm2.293086@attbi_s04>
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:bpojil$1r7ah1$1@ID-184292.news.uni-berlin.de...
> That's a bad approach. Really bad. Never use such code unless you
> don't understand what it does!!
My thoughts exactly...!?!!
:)
mike
------------------------------
Date: Sun, 23 Nov 2003 06:24:11 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: reading and writing to text file via form newbie
Message-Id: <bppggg$1rjikm$1@ID-184292.news.uni-berlin.de>
M wrote:
> Gunnar Hjalmarsson wrote:
>> That's a bad approach. Really bad. Never use such code unless you
>> don't understand what it does!!
>
> My thoughts exactly...!?!!
> :)
Not _exactly_, I hope... (should of course have been "unless you
understand" or "if you don't understand"). ;-)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 23 Nov 2003 01:14:26 GMT
From: parv <parv_@yahooWhereElse.com>
Subject: Re: Top level blocks and indentation
Message-Id: <slrnbs02n4.1c2.parv_@localhost.holy.cow>
in message <bpo542$n65$1@mamenchi.zrz.TU-Berlin.DE>,
wrote Anno Siegel ...
> The main question is, of course, how much does the lack of indentation
> hurt? I don't notice more block structure mixups in sources where I'm
> using that style, but then I'm biased. I did notice more mixups when
> trying to *nest* double braces, so I'm not totally insensitive. Never
> nest them, by definition double braces only apply to top level blocks.
...
> If anyone cares to take a look at some code, I have put up two examples,
> a module and a test file, under
>
> http://www.tu-berlin.de/zrz/mitarbeiter/anno4000/clpm/double_brace/Module.pm
> http://www.tu-berlin.de/zrz/mitarbeiter/anno4000/clpm/double_brace/test-file
I read only Module.pm. At the first sight there is no trouble in
understanding or reading the code. But when i see '{{' or '}}' the
second or more times, a strong urge comes up to indent the text
contained within.
If the text could fit in all in one line, there is no need to, or
a question of, to indent.
- parv
--
In order to reach me, do away w/ WhereElse in the address.
------------------------------
Date: Sat, 22 Nov 2003 20:40:46 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Top level blocks and indentation
Message-Id: <slrnbs07he.cp0.tadmc@magna.augustmail.com>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Top level blocks, that is, blocks at file level, serve many useful
> purposes.
> In such cases, indentation comes as a nuisance. I have taken to using
> double braces, '{{' and '}}' to delimit top level blocks that aren't
> indented.
If it was me, I'd go with
{ # top level block
} # end top level block
That is better because you can understand what it's significance
is, even if you know no Perl at all. :-)
OTOH, that is worse because the compiler won't tell you when you
forget to comment the corresponding close...
So to me, it looks kinda like "saving typing" of the undesirable kind.
> I'm using them because the don't appear "naturally" in Perl
> (or do they?) and they don't hurt (or do they?). I also hope to say
> something like "Yes, this *is* a block. I'm still not indenting", but
{ # Yes, this *is* a block. I'm still not indenting <heh>
> that is perhaps hoping a bit much.
You've always impressed me as being insightful, and it's showing there. :-)
> In any case, before I release any code in this style to CPAN, I'd like
> to test the waters and ask if that would, umm..., get me talked about.
In the eclectic mix of the Perl world, there are bound to be folks
on both sides, each of which might talk about you^H^H^Hit.
I don't find it particularly annoying or distressing.
_I_ wouldn't do it that way, but that probably just me.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 23 Nov 2003 08:13:12 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Top level blocks and indentation
Message-Id: <bppq6o$4m4$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Tad McClellan:
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> Top level blocks, that is, blocks at file level, serve many useful
>> purposes.
>
>> In such cases, indentation comes as a nuisance. I have taken to using
>> double braces, '{{' and '}}' to delimit top level blocks that aren't
>> indented.
>
>
> If it was me, I'd go with
>
> { # top level block
>
> } # end top level block
>
> That is better because you can understand what it's significance
> is, even if you know no Perl at all. :-)
>
> OTOH, that is worse because the compiler won't tell you when you
> forget to comment the corresponding close...
At least during development stage a source filter could be used to
ensure that the markers are all there:
package TopLevel;
use Filter::Simple;
FILTER {
my $where;
my $opened = () = /\{ # top level block(?{ $where = pos })/g;
my $closed = () = /\} # end top level block/g;
my $line = substr($_, 0, $where) =~ tr/\n//;
die "Found uneven top-level blocks: ",
"$opened opened (last one around line $line), $closed closed.\n"
if $opened - $closed;
};
1;
The reported line number is a little off, though.
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: 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 5847
***************************************