[23873] in Perl-Users-Digest
Perl-Users Digest, Issue: 6076 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 3 21:05:51 2004
Date: Tue, 3 Feb 2004 18:05:07 -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, 3 Feb 2004 Volume: 10 Number: 6076
Today's topics:
Re: Array / scalar conversions <mbroida@fake.domain>
Re: Callback during FTP <usenet@morrow.me.uk>
Re: CGI syntax error not behaving as I expected but... <jgibson@mail.arc.nasa.gov>
Re: Clarifications <usenet@morrow.me.uk>
Re: Clarifications <jwkenne@attglobal.net>
Re: Cursing my objects? <usenet@morrow.me.uk>
Re: ithreads at runtime? (Walter Roberson)
Re: Looking for MD5-like fingerprint for JPG-files <1usa@llenroc.ude>
Re: Microsoft AD <mbroida@fake.domain>
Re: Microsoft AD (Walter Roberson)
Re: network card <javier@t-online.de>
Re: newbie help <jill_krugman@yahoo.com>
Re: Perl For Amateur Computer Programmers <usenet@morrow.me.uk>
Re: Searching through worperfect files <nobody@tatooine.homelinux.net>
Understanding Net::CIDR 0.09 output <gj@freeshell.org>
Re: Understanding Net::CIDR 0.09 output <noreply@gunnar.cc>
Re: Understanding Net::CIDR 0.09 output (Walter Roberson)
Re: Understanding Net::CIDR 0.09 output <gj@hell.org>
Re: Understanding Net::CIDR 0.09 output <1usa@llenroc.ude>
Re: Understanding Net::CIDR 0.09 output <noreply@gunnar.cc>
Re: V 5.8 specific problem? (Marty Landman)
Re: V 5.8 specific problem? <usenet@morrow.me.uk>
Re: V 5.8 specific problem? <emschwar@pobox.com>
Re: When to "use strict" when teaching? <drumspoorly@reachone.net>
Re: When to "use strict" when teaching? <uri@stemsystems.com>
Re: When to "use strict" when teaching? <noreply@gunnar.cc>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 3 Feb 2004 22:57:04 GMT
From: MPBroida <mbroida@fake.domain>
Subject: Re: Array / scalar conversions
Message-Id: <40202740.DC18A618@fake.domain>
starwars wrote:
>
> Idiot perlbie questions...
>
> If have on proceedure that requires input of a list of text, i.e., as an @
> array.
>
> The other procedure I have requires a simple scalar, i.e. $ .
>
> I want BOTH procedures to operate on a block of text (mail message).
>
> So, I use join on the @ and feed it to the $ only procedure.
>
> And, vice-versa, using split.
>
> It seems to work, but because of my ignorance, I wonder if I am doing it
> "right"?
>
> Question: is there an easy way to convert (or reference) array contents as
> scalars without using the join function?
Question: You're not gonna screw up this newsgroup the
way you have comp.databases.ms-access, are you??
------------------------------
Date: Tue, 3 Feb 2004 23:12:49 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Callback during FTP
Message-Id: <bvp9th$g71$1@wisteria.csv.warwick.ac.uk>
jon@actcom.co.il (Yehuda Berlinger) wrote:
> I would like to do a callback while transferring via FTP, so as to
> print % finished, etc... (and to activate my Tk::Progressbar).
> Net::FTP doesn't seem to support this. Is that correct? Is there any
> other tool that can do this? Is there anyway to do this using the
> 'hash' mechanism?
If you're downloading you could try using LW,P which I think does
support this kind of callback. Otherwise... I think the only way to do
it is with a tied filehandle. Something like (completely untested):
package My::App::FTPCallback;
use Symbol;
sub new {
my ($c, $cback) = @_;
my $H = *{Symbol::gensym};
tie $H, $c, $cback;
return $H;
}
sub TIEHANDLE {
my ($c, $cback) = @_;
return bless {
count => 0,
cback => $cback,
}, $c;
}
sub PRINT {
my $s = shift;
my $hashes = join '', @_;
$s->{count} += length $hashes;
$s->{cback}->($s->{count});
return 1;
}
package main;
my $HASH = My::App::FTPCallback->new(sub {
my $count = shift;
# do stuff here
});
$FTP->hash($HASH, 1024);
# the callback will now be called for every KB transferred, with its
# first argument the number of KB transferred so far.
Ben
--
Razors pain you / Rivers are damp
Acids stain you / And drugs cause cramp. [Dorothy Parker]
Guns aren't lawful / Nooses give
Gas smells awful / You might as well live. ben@morrow.me.uk
------------------------------
Date: Tue, 03 Feb 2004 17:48:22 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: CGI syntax error not behaving as I expected but...
Message-Id: <030220041748220950%jgibson@mail.arc.nasa.gov>
In article <bvoddm$mqu$1@news.storm.ca>, mmosher <mmosher@storm.ca>
wrote:
> ... doing exactly what its supposed to do.
>
> I wrote a perl script to allow me to look at portions of the log that is
> kept for people searching. It was written some time ago and seemed to
> work perfectly. It was not until last week that I noticed that after
> 12pm the time would jump back an hour and stay that way until 12am. I
> suspected a bug but doubled check incase of some weird virus or something.
>
> Of course it was a bug:
>
> if (substr($date_time_raw[$loop],8,2)<12) {##do something}
> elsif (substr($date_time_raw[$loop],8,2)=12) {##do something}
>
> else
> {##do something}
>
> Of course the error is in the elsif statement it should be ==12 not =12.
> So of course it works in the am the pm messes up.
>
> My question is this: I thought a syntax error of this type would not run
> and that I would get an error with no output? Or is this type of error
> considered a warning?
>
>
As pointed out by others, this is not a syntax error. However, if you
had put "use warnings" at the top of your program, perl would have
flagged the assignment in the if conditional as a warning:
"Found = in conditional, should be == at myprogram.pl line 2."
The same compiler laxity is present in C and C++, and this is a common
error there, too. I have seen programmers turn the conditional around,
putting the constant first:
if( 12 == substr($date_time_raw[$loop] ) { ## do something }
Then, if they forget the second equal sign, the compiler terminates
with a syntax error:
"Can't modify constant item in scalar assignment at myprogram.pl line
2, near ") ) "
I don't do this because I don't like the readability of the result, but
it does work.
------------------------------
Date: Tue, 3 Feb 2004 23:33:26 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Clarifications
Message-Id: <bvpb46$guj$1@wisteria.csv.warwick.ac.uk>
Michele Dondi <bik.mido@tiscalinet.it> wrote:
> >Michele Dondi wrote:
> >>
> >> BTW: just to be fussy as much as possible, I *think* that (also in
> >> English) the correct term should be "abbreviation" and not "acronym"
> >> (it is definitely so in Italian, where one finds a sharp distinction
> >> between "acronimo" and "sigla"), but in fact one most often finds
> >> "acronym" in that acceptation...
>
> However you may find it interesting to know what my own dictionary
> says about these two terms:
>
<snip>
> And here you have their respective translations (modulo my limited
> linguistic skills!):
>
> [probably from the lating "singula littera"] abbreviation of one or
> more words most often represented by their initials.
>
> Noun formed with the initial letters of other words.
> ^^^^
>
> Now, I underlined that detail because I've always thought that an
> "acronimo" (and possibly an "acronym" too) can be more generally a
> *word* or even a *phrase* formed with the initial letters of other
> words. I *think* this is actually the case, but I don't have other
> dictionaries at home to check...
Certainly in English usage the distinction is between an abbreviation
such as USA or CIA which is pronounced by its initials, or such as Mr
or etc which is a generic shortening rather than necessarily initial
letters; and an acronym such as NATO or BASIC which is pronounced as a
word. Properly speaking, an abbreviation should be written with dots
U.S.A. unless the last letter of the abbrev is the last letter of the
word (so Mr. is wrong); an acronym should have no dots, and probably
be in small caps. These are the classical rules, anyhow: as usual, the
times they are a-changin'.
This means that PERL would be an acronym.
Ben
BTW your English is at least as good as most English people's... :)
--
Like all men in Babylon I have been a proconsul; like all, a slave ... During
one lunar year, I have been declared invisible; I shrieked and was not heard,
I stole my bread and was not decapitated.
~ ben@morrow.me.uk ~ Jorge Luis Borges, 'The Babylon Lottery'
------------------------------
Date: Wed, 04 Feb 2004 01:00:15 GMT
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: Clarifications
Message-Id: <zuXTb.25993$fA.5951877@news4.srv.hcvlny.cv.net>
Michele Dondi wrote:
> However you may find it interesting to know what my own dictionary
> says about these two terms:
>
> SIGLA sf. [prob. dal lat. singula littera] abbreviatura di una o
> piu' parole per lo piu' rappresentata dalle iniziali di esse.
>
> ACRONIMO sm. nome formato con le lettere iniziali di altre parole.
> ^^^^
>
> And here you have their respective translations (modulo my limited
> linguistic skills!):
>
> [probably from the lating "singula littera"] abbreviation of one or
> more words most often represented by their initials.
>
> Noun formed with the initial letters of other words.
> ^^^^
>
> Now, I underlined that detail because I've always thought that an
> "acronimo" (and possibly an "acronym" too) can be more generally a
> *word* or even a *phrase* formed with the initial letters of other
> words. I *think* this is actually the case, but I don't have other
> dictionaries at home to check...
Interesting. In the 40 or so years since my dictionary was published,
"sigla" seems to have shifted its meaning a little; I have only
"initials, monogram; abbreviation". Of course, there are far, far more
acronyms now than there were then, thanks to computers. (But none as
famous as "Vittorio Emmanuele, Re D'Italia".)
I notice that the two entries you quote above label the words "sf" and
"sm". That suggests to me that your dictionary's editors call a noun a
"sostantivo", not a "nome", and that "nome" in the definition of
"acronimo" simply has its ordinary meaning of "name".
By the way, on the derivation of "sigla", I confess that I had guessed
it to derive from Lat. "sigilium", which appears in English as "sigil".
But I am very ignorant in these matters.
--
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
-- Charles Williams. "Judgement at Chelmsford"
------------------------------
Date: Tue, 3 Feb 2004 23:17:36 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Cursing my objects?
Message-Id: <bvpa6g$g71$2@wisteria.csv.warwick.ac.uk>
oso@uncoma.edu.ar (Eduardo) wrote:
> > This doesn't break encapsulation as badly as it seems to. If the
> > implementation changes and object isn't a hashref anymore, you can
> > always overload "%{}" to restore the behavior of "%$t". It gets
> > cumbersome when the object remains a hashref, but the contents change
> > so that "%$t" isn't usable in the old way any longer, but that can be
> > worked around too.
>
> Thank you! I am really amazed at your explanations, people. How would
> I go about overloading %{}?
Surprisingly enough, perldoc overload.
Ben
--
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk
------------------------------
Date: 3 Feb 2004 23:08:36 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: ithreads at runtime?
Message-Id: <bvp9lk$jtj$1@canopus.cc.umanitoba.ca>
In article <bvnnf9$dcm$4@wisteria.csv.warwick.ac.uk>,
Ben Morrow <usenet@morrow.me.uk> wrote:
:roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote:
:> I wonder if someone could give me some hints how to enable
:> ithread support conditionally at run-time ?
:> I rejigged my modules to do require's instead of use's, and built in
:> the appropriate run-time logic to know whether to bother to place
:> lock() and share() calls.
:There's no need to do that. If you 'use threads::shared' without
:having a previous 'use threads' those lock and share calls will become
:noops.
Thanks, I had forgotten that. I've re-rejigged and that part seems to
working fine.
:> Is it fair game to examine @ARGV in a BEGIN block?
:Err... yes.
Okay, I'll work towards that. I'll have to do a little code restructuring
to make it work right in my situation, but it shouldn't be too bad.
--
Can a statement be self-referential without knowing it?
------------------------------
Date: 4 Feb 2004 00:57:32 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: Looking for MD5-like fingerprint for JPG-files
Message-Id: <Xns9484CB0A2AED7asu1cornelledu@132.236.56.8>
abrey@gmx.net (dede) wrote in news:166f59a6.0402031413.1d41f251
@posting.google.com:
> Dear all,
>
> in order to provide a convenient method for photographer like me to
> detect "equal" or "similar" pictures I am trying to develop a perl
> function/method that does exactly this:
>
> Input: JPG file
> Output: MD5-like fingerprint of JPG (to be stored in a db)
Well, I don't think you want MD5-like: Those algorithms are designed so
that small variations in input cause large variations in the output (not
that I know much).
> It should be a hash-value that is very close if two pics are "almost
> identical". It must be robust against at least JPG-rotations
> (90/180/270 degrees) and "reasonable" scalings. The analysis will be
> stored in the EXIF-data of the JPG so the analysed data should be only
> the "naked JPG-data" itself.
That is not an easy problem since JPEG is a lossy algorithm. This is the
same issue that crops up in trying to digitally watermark compressed
music files (again, I do not know that much about this stuff).
OTOH, I know there is research in this area. Google is your friend.
http://www.linux-mag.com/2003-08/perl_01.html
Looks like a promising starting point.
Sinan
--
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)
------------------------------
Date: Tue, 3 Feb 2004 22:48:30 GMT
From: MPBroida <mbroida@fake.domain>
Subject: Re: Microsoft AD
Message-Id: <4020253E.777D4234@fake.domain>
gnari wrote:
>
> <stan.holmes@eskom.co.za> wrote in message
> news:bvnita$6ao$1@newsreader02.ops.uunet.co.za...
> > Hi
> > I know this is not a helpdesk, but I need to update an AD from a HR
> Oracle
> > DB. The Oracle is not a problem, but I have no experience with MS AD. Can
> > someone assist me with a web site or sample code on how to read and update
> > the AD
>
> well, you might start by telling us what AD is, and how it has anything to
> do
> with perl. have you looked at CPAN ? try search.cpan.org.
> have you tried google?
> have you tried microsoft ? (apologies if the MS in MS AD is something else)
> have you looked at the AD documentation (if any)?
Considering his later post, perhaps:
AD == Access Database
??
Mike
------------------------------
Date: 3 Feb 2004 23:29:47 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Microsoft AD
Message-Id: <bvpatb$kea$1@canopus.cc.umanitoba.ca>
In article <4020253E.777D4234@fake.domain>,
MPBroida <mbroida@fake.domain> wrote:
: Considering his later post, perhaps:
: AD == Access Database
Hmmm, I read it as MS's Active Directory. Which is tied in with LDAP,
and if you had an Oracle database of users, you might well want to
export information from the Oracle database into Active Directory.
--
Warhol's Law: every Usenet user is entitled to his or her very own
fifteen minutes of flame -- The Squoire
------------------------------
Date: Wed, 04 Feb 2004 00:27:02 +0100
From: Xaver Biton <javier@t-online.de>
Subject: Re: network card
Message-Id: <bvpamg$n41$07$1@news.t-online.com>
>>but by make it give me an error:
>>Makefile:299 *** multiple target patterns. Stop.
>>
>>what is that?
>
>
> Are you using cygwin make? For AS Perl you probably need M$ nmake
> (free download from M$), unless you mess with the configuration.
ok, now, I've compiled it sucsessful with nmake, but I've alway the same
error as it was istalled manually. when I run the script example.pl I
recieve the error message:
Win32::RASE::TAPIlineGetTranslateCaps() called too early to check
prototype at c:/Perl/site/lib/Win32/RASE.pm line 266.
No one RAS entry were found
BEGIN failed--compilation aborted at examples.pl line 500.
The line 500 is a correctly closed curly bracket.
BEGIN {
require Win32::API;
unless ($hwnd = (FindOpenedFolders())[0]) {
system 'start explorer /n,C:\\';
$start_time = time;
while (!($hwnd = (FindOpenedFolders())[0]) && $start_time+3 < time) {}
$hwnd or die "Could not open C:\\ window\n";
$hwnd_opened = 1;
}
$first_RAS_entry = (RasEnumEntries())[0]
or die "No one RAS entry were found\n";
} ##this is the line 500
whats happend whit it?
Thks.
Xaver
------------------------------
Date: Tue, 3 Feb 2004 23:42:06 +0000 (UTC)
From: J Krugman <jill_krugman@yahoo.com>
Subject: Re: newbie help
Message-Id: <bvpbke$c3$1@reader2.panix.com>
In <bvp7nu$v8rpc$1@ID-184292.news.uni-berlin.de> Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
>J Krugman wrote:
>> Gunnar Hjalmarsson writes:
>>> Assuming the data is in $_:
>>>
>>> my ($lastmatch) = /.*(<ordsts>.*<\/ordsts>).*/s;
>>
>> Why doesn't this match everthing between the very first <ordsts> in
>> the file and the last </ordsts>?
>Because the first .* is greedy.
OK, I missed that. Thanks.
jill
------------------------------
Date: Tue, 3 Feb 2004 23:38:31 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Perl For Amateur Computer Programmers
Message-Id: <bvpbdn$guj$2@wisteria.csv.warwick.ac.uk>
Michele Dondi <bik.mido@tiscalinet.it> wrote:
> On Mon, 2 Feb 2004 19:26:09 +0000 (UTC), Ben Morrow
> <usenet@morrow.me.uk> wrote:
>
> >Eh? What do powers of 5 have to do with the price of cheese? Don't you
> >mean 10^3 ~~ 2^10?
>
> Ben, I must admit I'm a bit scared of replying to your comments,
> taking into account the kind and the number of mistakes I'm doing
> lately! However I think you'll find that the problem of finding
> approximate solutions to 5^n=2^m has *much* to do with that of finding
> approximate solutions to 10^n=2^m.
Yes, OK. I'm a mathematician, I can't do arithmetic... :)
> But is that really ISO or SI? (I *think* there's a difference between
> them, even though both have to do with "standardization".)
ISO is the body that write the standards, SI is the system of units
based on the kilogram/second/metre put forward by them.
SI => POSIX as ISO => IEEE, if that helps.
Ben
--
It will be seen that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher convinces them that their institutions are not based
on the strictest morality. [Samuel Butler, paraphrased] ben@morrow.me.uk
------------------------------
Date: Wed, 4 Feb 2004 02:23:49 +0100 (CET)
From: starwars <nobody@tatooine.homelinux.net>
Subject: Re: Searching through worperfect files
Message-Id: <fafcd81eb87177fcdf7038ae7fcceb68@tatooine.homelinux.net>
starwars wrote:
> Any body know of a wordperfect file converter that can be wrapped around a
> perl script for searching through file contents in subdirectories?
>
Looks like libwpd at sourceforge does the trick. Thanks any way.
------------------------------
Date: Wed, 4 Feb 2004 00:15:56 +0000 (UTC)
From: Gerald Jones <gj@freeshell.org>
Subject: Understanding Net::CIDR 0.09 output
Message-Id: <bvpdjs$edu$1@chessie.cirr.com>
Hi,
So this output might be shorthand for something but, I'm a newjack at
networking and I'd like to know if this is a bug (doubtful) or not. I have the
following snippet:
--8<--
#!/usr/bin/perl
use Net::CIDR; # using version 0.09
$cidr = Net::CIDR::range2cidr("1.2.3.0 - 1.2.3.255");
print "$cidr\n"; # outputs: 1.2.3.0/24
$cidr = Net::CIDR::range2cidr("1.2.3.4 - 1.2.3.255");
print "$cidr\n"; # outputs: 6
$cidr = Net::CIDR::range2cidr("1.2.3.4 - 1.5.6.7");
print "$cidr\n"; # outputs: 17
-->8--
So, what does the second two outputs mean? How do I convert it to the form of
the first output line?
Thanks,
Gerald.
------------------------------
Date: Wed, 04 Feb 2004 01:35:05 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Understanding Net::CIDR 0.09 output
Message-Id: <bvpekh$vdfmq$1@ID-184292.news.uni-berlin.de>
Gerald Jones wrote:
> So this output might be shorthand for something ...
Do not multi-post!
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 4 Feb 2004 00:40:14 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Understanding Net::CIDR 0.09 output
Message-Id: <bvpf1e$m83$1@canopus.cc.umanitoba.ca>
In article <bvpdjs$edu$1@chessie.cirr.com>,
Gerald Jones <gj@freeshell.org> wrote:
:So this output might be shorthand for something but, I'm a newjack at
:networking and I'd like to know if this is a bug (doubtful) or not. I have the
:following snippet:
:$cidr = Net::CIDR::range2cidr("1.2.3.0 - 1.2.3.255");
:print "$cidr\n"; # outputs: 1.2.3.0/24
OK.
:$cidr = Net::CIDR::range2cidr("1.2.3.4 - 1.2.3.255");
:print "$cidr\n"; # outputs: 6
Net::CIDR::range2cidr probably wanted to return a list of 6 elements,
but you wanted the result put into a scalar, so perl automagically did
scalar() on the result. scalar() applied to a list returns the number
of elements in the list.
:$cidr = Net::CIDR::range2cidr("1.2.3.4 - 1.5.6.7");
:print "$cidr\n"; # outputs: 17
Same thing.
Try
@cidr = Net::CIDR::range2cidr("1.2.3.4 - 1.5.6.7");
print "@cidr\n";
--
Strange but true: there are entire WWW pages devoted to listing
programs designed to obfuscate HTML.
------------------------------
Date: Wed, 4 Feb 2004 01:11:50 +0000 (UTC)
From: Gerald Jones <gj@hell.org>
Subject: Re: Understanding Net::CIDR 0.09 output
Message-Id: <bvpgsm$fe6$1@chessie.cirr.com>
In comp.lang.perl.misc Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Do not multi-post!
Have you ever heard of the Breidbart Index, Gunnar?
<http://www.stopspam.org/usenet/mmf/breidbart.html>
and, Proverbs 17:28?
Even a fool, when he holdeth his peace, is counted wise:
and he that shutteth his lips is esteemed a man of understanding.
------------------------------
Date: 4 Feb 2004 01:19:02 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: Understanding Net::CIDR 0.09 output
Message-Id: <Xns9484CEAF52B2Easu1cornelledu@132.236.56.8>
Gerald Jones <gj@hell.org> wrote in news:bvpgsm$fe6$1@chessie.cirr.com:
> In comp.lang.perl.misc Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
>
>> Do not multi-post!
>
> Have you ever heard of the Breidbart Index, Gunnar?
>
> <http://www.stopspam.org/usenet/mmf/breidbart.html>
If you have a point, I do not get it. Clearly, BI ranks your multipost
higher on the spam scale. That is, according to the criterion that you are
using to counter Gunnar's objection to your spam, you are a spammer. So,
why not apologize and stop doing that?
Sinan.
--
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)
------------------------------
Date: Wed, 04 Feb 2004 02:38:09 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Understanding Net::CIDR 0.09 output
Message-Id: <bvpiaq$vg6oo$1@ID-184292.news.uni-berlin.de>
Gerald Jones wrote:
> In comp.lang.perl.misc Gunnar Hjalmarsson <noreply@gunnar.cc>
> wrote:
>>
>> Do not multi-post!
>
> Have you ever heard of the Breidbart Index, Gunnar?
>
> <http://www.stopspam.org/usenet/mmf/breidbart.html>
>
> and, Proverbs 17:28?
>
> Even a fool, when he holdeth his peace, is counted wise: and he
> that shutteth his lips is esteemed a man of understanding.
No, I hadn't heard of either.
But I try to apply common sense when posting to newsgroups, and
posting multiple copies of the same help request to different
newsgroups is simply rude. Why? Because it might lead to somebody
making efforts to help you without knowing that you already got the
help you need somewhere else.
Cross-posting, on the other hand, may occationally be motivated.
You may think it's foolish to react when somebody multi-posts. Well, I
disagree, and I'll keep reacting to that rude behaviour. Would guess
that most people who use Usenet regularly would agree with me.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 3 Feb 2004 16:03:10 -0800
From: marty@face2interface.com (Marty Landman)
Subject: Re: V 5.8 specific problem?
Message-Id: <b9e0e6f4.0402031603.1075a607@posting.google.com>
Eric Schwartz <emschwar@pobox.com> wrote:
> Check the documentation on Perl diagnostics with 'perldoc perldiag'
> and read the entry your message refers to.
Got it. You can see I'm new to OOPing and apparently owing to the Perl
versions was able to get away with an incorrect way of doing things.
I have been blessing into either the package string, or if the package
had already been instantiated with a hash ref would use that. But by
just changing the line of code to bless into the package name the hash
ref is automagically associated. Guess that's part of the point,
right?
> $Quiz (as a personal aside, I hate it when a line of code includes two
> variables named identically except for case) is probably not what you
> think it is.
No, I knew exactly what it was and hope I explained clearly above.
Just that I didn't realize this was the wrong way to do this.
TMTOWTDI aside, I wonder how bad my variable naming style is. Although
what I do privately is obviously my own business, I don't want to
develop habits that are unfriendly to others, y'know?
To me it makes more sense to have e.g.
my ($quiz, @quiz, %quiz)
than to have
my ($quiz_sca, @quiz_ary, %quiz_hsh);
Well ok, not more sense but just easier for me to read the code.
Marty Landman Face 2 Interface Inc 845-679-9387
This Month's New Quiz --- Past Superbowl Winners
Make a Website: http://face2interface.com/Home/Demo.shtml
------------------------------
Date: Wed, 4 Feb 2004 00:40:50 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: V 5.8 specific problem?
Message-Id: <bvpf2i$jr7$1@wisteria.csv.warwick.ac.uk>
marty@face2interface.com (Marty Landman) wrote:
> Eric Schwartz <emschwar@pobox.com> wrote:
>
> > Check the documentation on Perl diagnostics with 'perldoc perldiag'
> > and read the entry your message refers to.
>
> Got it. You can see I'm new to OOPing and apparently owing to the Perl
> versions was able to get away with an incorrect way of doing things.
>
> I have been blessing into either the package string, or if the package
> had already been instantiated with a hash ref would use that. But by
> just changing the line of code to bless into the package name the hash
> ref is automagically associated. Guess that's part of the point,
> right?
I'm not sure I follow you here... blessing an object associates it
with a package. ref $obj will return that package. So if $obj has been
blessed into package Package, the code
my $newobj = bless {...}, ref $obj;
will also bless $newobj into package Package. There is no association
between $obj and $newobj beyond the fact they are both blessed into
the same package.
> > $Quiz (as a personal aside, I hate it when a line of code includes two
> > variables named identically except for case) is probably not what you
> > think it is.
>
> TMTOWTDI aside, I wonder how bad my variable naming style is. Although
> what I do privately is obviously my own business, I don't want to
> develop habits that are unfriendly to others, y'know?
>
> To me it makes more sense to have e.g.
>
> my ($quiz, @quiz, %quiz)
My 2d:
Temporary variables should be in a small enough scope that essentialy
it doesn't matter what they're called, as you can see all uses of the
variable at once; thus they should have short, concise names. I do
sometimes use $foo and @foo; though there are often better names, like
@quizzes and $curquiz.
Globals (in which class I include lexicals whose scope covers more
than one sub, as well as package globals) should be meaningfully
named, and clearly rather than concisely. They are as much a part of
the interface to a given section of code as its sub names are. I tend
to name globals with an initial cap, just to distinguish them.
The only time I would use two variables with the same name in
different cases is where I have a scalar naming a file and a FH open
on that file, e.g.
my $config = $ENV{MY_CONFIG} || "$ENV{HOME}/.myconfig";
open my $CONFIG, '<', $config or die 'horribly';
Ben
--
$.=1;*g=sub{print@_};sub r($$\$){my($w,$x,$y)=@_;for(keys%$x){/main/&&next;*p=$
$x{$_};/(\w)::$/&&(r($w.$1,$x.$_,$y),next);$y eq\$p&&&g("$w$_")}};sub t{for(@_)
{$f&&($_||&g(" "));$f=1;r"","::",$_;$_&&&g(chr(0012))}};t # ben@morrow.me.uk
$J::u::s::t, $a::n::o::t::h::e::r, $P::e::r::l, $h::a::c::k::e::r, $.
------------------------------
Date: Tue, 03 Feb 2004 17:53:32 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: V 5.8 specific problem?
Message-Id: <etoznbzbr77.fsf@fc.hp.com>
marty@face2interface.com (Marty Landman) writes:
> Eric Schwartz <emschwar@pobox.com> wrote:
> To me it makes more sense to have e.g.
>
> my ($quiz, @quiz, %quiz)
>
> than to have
>
> my ($quiz_sca, @quiz_ary, %quiz_hsh);
>
> Well ok, not more sense but just easier for me to read the code.
I'm not suggesting Hungarian notation, heaven forfend (though I've
been known to suffix scalar refs with _ref to remind myself that it's
not a real scalar), but just that you pick maybe more useful variable
names.
For instance, you have a data structure that is a quiz. Well, it's
unlikely to be a scalar, but could be an array or hash, depending on
how you build it. So instead of $quiz, pick something more useful,
like $question or $entry or some such. And you shouldn't need @quiz
and %quiz both. I have no idea how you structure your code, but
here's how I might dynamically build a quiz:
my %quiz = (title => "Countries in Europe",
creator => "Eric",
entries => []);
my @questions =( { q => "Is France in Europe?", a => "yes" },
{ q => "Is China in Europe?", a => "no" } );
foreach my $question (@questions) {
push @{$quiz{entries}}, $question
}
Of course, there are good reasons to use $foo and %foo and @foo in the
same program, and I'm not saying you should always avoid it. But I
find programs are easier to maintain if I don't do that very much.
Mostly I do things like above, where I have the aggregate @questions,
and alias $question to each member of it.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: Tue, 03 Feb 2004 15:25:38 -0800
From: Steve May <drumspoorly@reachone.net>
Subject: Re: When to "use strict" when teaching?
Message-Id: <1020b7apo0ngk66@corp.supernews.com>
Uri Guttman wrote:
>>>>>>"TM" == Tad McClellan <tadmc@augustmail.com> writes:
>
>
> TM> Robert <bobx@linuxmail.org> wrote:
> >> Ah...as a newbie looking at code I don't see "exit;" used much. Could
> >> you enlighten me on the "why"?
>
>
> TM> Sure, if you could enlighten us as to why you think it should be
> TM> "used much".
>
> TM> It isn't _needed_ much, so it isn't used much.
>
> i like to use it in some shorter scripts to mark the end of the main
> code. i organize them like this:
>
> declarations and stuff
>
> handle args
>
> call top level subs (only a few calls. if more, wrap that in a sub!)
>
> exit - mainline logic is done. the rest is subs.
>
> sub code ....
>
>
> that makes it very easy to see and modify the top level logic.
>
> i have seen too many scripts which have no subs and are so hard to
> follow and modify. even though the top level (and some other) subs are
> called only once, they are useful just as an organizing technique.
>
> so i use exit there to tell the reader that the main line code is done.
>
> uri
>
Pretty much my thinking:
1. It doesn't hurt anything (that I know of)
2. It makes it pretty clear where the end is, especially for newbies.
s.
------------------------------
Date: Tue, 03 Feb 2004 23:25:54 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: When to "use strict" when teaching?
Message-Id: <x7fzdr924e.fsf@mail.sysarch.com>
>>>>> "SM" == Steve May <drumspoorly@reachone.net> writes:
>> so i use exit there to tell the reader that the main line code is
SM> Pretty much my thinking:
SM> 1. It doesn't hurt anything (that I know of)
SM> 2. It makes it pretty clear where the end is, especially for newbies.
and i have another use i just recalled. during development i may have
some of the earlier top levels subs being tested but the later ones
either aren't ready or they need good results from the ealry subs. so i
will just drop an exit in there to stop the program. sometimes i have
done this inside a sub to help isolate the part i am debugging. why run
later code which could generate output (which is noise to me at this
moment)? an early exit does what i want nicely.
i am sure there are other uses for it. i use die much more often but
exit has its place.
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: Wed, 04 Feb 2004 00:35:34 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: When to "use strict" when teaching?
Message-Id: <bvpb53$s9pcc$1@ID-184292.news.uni-berlin.de>
Steve May wrote:
> 1. [calling exit()] doesn't hurt anything (that I know of)
If you run your program under mod_perl, you'd better think twice
before calling exit(), though.
http://groups.google.se/groups?selm=bubu9f%24fpt5r%241%40ID-184292.news.uni-berlin.de
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
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 V10 Issue 6076
***************************************