[30129] in Perl-Users-Digest
Perl-Users Digest, Issue: 1372 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 18 18:10:19 2008
Date: Tue, 18 Mar 2008 15:09:08 -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 Tue, 18 Mar 2008 Volume: 11 Number: 1372
Today's topics:
DBD::ODBC as "middleware" between Crystal Reports and M <dh1760@gmail.com>
Re: DBD::ODBC as "middleware" between Crystal Reports a <ben@morrow.me.uk>
Re: decrease MAC <yankeeinexile@gmail.com>
Re: FAQ 5.39 Why do I get weird spaces when I print an <brian.d.foy@gmail.com>
Re: FAQ 5.39 Why do I get weird spaces when I print an <brian.d.foy@gmail.com>
Re: FAQ 6.5 How do I substitute case insensitively on t <brian.d.foy@gmail.com>
Re: Inside-out objects are slow! (or how to accelerate <koszalekopalek@interia.pl>
Re: Inside-out objects are slow! (or how to accelerate <koszalekopalek@interia.pl>
Re: Inside-out objects are slow! (or how to accelerate <koszalekopalek@interia.pl>
Re: LWP::Simple yields "protocol" error (was Re: Need P <brian.helterline@hp.com>
Re: Need Perl module to get <TITLE> tag of a web page <brian.d.foy@gmail.com>
Net::Blacklist::Client use? <mikee@mikee.ath.cx>
Re: Net::Blacklist::Client use? <glex_no-spam@qwest-spam-no.invalid>
Re: Net::Blacklist::Client use? <mikee@mikee.ath.cx>
opening file for appending doesn't work for me <test@example.com>
Re: opening file for appending doesn't work for me <joost@zeekat.nl>
Re: opening file for appending doesn't work for me xhoster@gmail.com
Re: opening file for appending doesn't work for me <noreply@gunnar.cc>
Re: Problem with loop control LAST exiting prematurely <brian.helterline@hp.com>
Re: Problem with loop control LAST exiting prematurely <yankeeinexile@gmail.com>
Re: Problem with loop control LAST exiting prematurely <yankeeinexile@gmail.com>
Re: Problem with loop control LAST exiting prematurely <devnull4711@web.de>
Re: Problem with loop control LAST exiting prematurely <yankeeinexile@gmail.com>
Re: Problem with loop control LAST exiting prematurely <devnull4711@web.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 18 Mar 2008 11:41:49 -0700 (PDT)
From: Dave Hammond <dh1760@gmail.com>
Subject: DBD::ODBC as "middleware" between Crystal Reports and MySQL
Message-Id: <8fbc1363-02e9-4e20-bb40-2c14ddfe6080@m36g2000hse.googlegroups.com>
For those who are thinking "just install the MySQL ODBC driver and
point Crystal to it", bear with me...
Most users connect to our MySQL databases via web applications. The
web apps and databases live on hosts which are in a "DMZ" segment of
our network, thus protecting our LAN from any direct Internet access.
However, in addition to the web apps, some power users use Crystal
Reports to directly access the databases, in exactly the manner you
might have assumed -- via the MySQL ODBC driver.
We have been tasked with moving the MySQL databases off the DMZ hosts
and into the LAN. This won't cause problems for the web apps, however
the Crystal users will be S.O.L. unless we can install some kind of
middleware app which lives in the DMZ and shuttles data between
Crystal and the MySQL databases.
I was thinking that we might be able to use DBD::ODBC for such an
app. Ideally, Crystal would connect to the middleware app via
DBD::ODBC, the app would validate and forward the SQL query to the
MySQL server, and then shuttle the results back to Crystal.
Does anyone have any comments on if something like this would be do-
able with DBD::ODBC? Or, maybe I'm trying to reinvent the wheel and
there is something already existing which does what we need?
Thanks in advance!
-Dave H.
------------------------------
Date: Tue, 18 Mar 2008 19:52:10 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: DBD::ODBC as "middleware" between Crystal Reports and MySQL
Message-Id: <a4j5b5-nl7.ln1@osiris.mauzo.dyndns.org>
Quoth Dave Hammond <dh1760@gmail.com>:
> For those who are thinking "just install the MySQL ODBC driver and
> point Crystal to it", bear with me...
>
> Most users connect to our MySQL databases via web applications. The
> web apps and databases live on hosts which are in a "DMZ" segment of
> our network, thus protecting our LAN from any direct Internet access.
> However, in addition to the web apps, some power users use Crystal
> Reports to directly access the databases, in exactly the manner you
> might have assumed -- via the MySQL ODBC driver.
>
> We have been tasked with moving the MySQL databases off the DMZ hosts
> and into the LAN. This won't cause problems for the web apps, however
> the Crystal users will be S.O.L. unless we can install some kind of
> middleware app which lives in the DMZ and shuttles data between
> Crystal and the MySQL databases.
>
> I was thinking that we might be able to use DBD::ODBC for such an
> app. Ideally, Crystal would connect to the middleware app via
> DBD::ODBC, the app would validate and forward the SQL query to the
> MySQL server, and then shuttle the results back to Crystal.
>
> Does anyone have any comments on if something like this would be do-
> able with DBD::ODBC? Or, maybe I'm trying to reinvent the wheel and
> there is something already existing which does what we need?
No, you've got your thinking backwards. DBD::ODBC is an ODBC *client*:
that is, it runs at the application end of the connection. What you want
is an ODBC-capable *server*: something that runs at the database end, so
Crystal can talk to it. DBIx::MyServer allows you to create a fake MySQL
server that forwards all requests to another database; in combination
with the MySQL ODBC driver at the Crystal end, this may do what you
need.
Ben
------------------------------
Date: 18 Mar 2008 12:10:12 -0600
From: Lawrence Statton <yankeeinexile@gmail.com>
Subject: Re: decrease MAC
Message-Id: <87bq5bsy2j.fsf@hummer.cluon.com>
jammer <jameslockie@mail.com> writes:
> >
> > Pragmatic approach: split up into smaller parts, do the math, then
> > re-assemble.
> >
> Good idea. :-)
Especially when you consider that a MAC is made up of two sections of
3-octets each (a 3-octet mfr block ID and a 3-octet part assigned by
that mfr), such that a borrow across that border makes no sense ...
--
Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
place them into the correct order.
------------------------------
Date: Tue, 18 Mar 2008 16:15:49 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 5.39 Why do I get weird spaces when I print an array of lines?
Message-Id: <180320081615497142%brian.d.foy@gmail.com>
In article <frk6bk$oqm$1@ml.accsnet.ne.jp>, Ben Bullock
<benkasminbullock@gmail.com> wrote:
> On Sun, 16 Mar 2008 06:03:03 -0700, PerlFAQ Server wrote:
>
> > 5.39: Why do I get weird spaces when I print an array of lines?
> >
> > Saying
> >
> > print "@lines\n";
> >
> > joins together the elements of @lines with a space between them.
>
> I recently learnt from a post here by Ben Morrow that it joins together
> the elements of @lines with a $" between them:
>
> ben ~ 502 $ perl -e '$"="bu";@ba=("bo","be");print "@ba\n";'
> bobube
>
> Shouldn't this FAQ entry mention $"?
The FAQ shouldn't mention $". The answer is not about how to change
what happens, but to recognize in the default case that interpolating
an array has behavior.
But, the answer could be better.
------------------------------
Date: Tue, 18 Mar 2008 16:16:29 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 5.39 Why do I get weird spaces when I print an array of lines?
Message-Id: <180320081616299515%brian.d.foy@gmail.com>
In article <86myox9znf.fsf@lifelogs.com>, Ted Zlatanov
<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.
It's not wrong, it just isn't that good.
------------------------------
Date: Tue, 18 Mar 2008 16:43:45 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 6.5 How do I substitute case insensitively on the LHS while preserving case on the RHS?
Message-Id: <180320081643457714%brian.d.foy@gmail.com>
In article <47DE486E.9060102@gmx.de>, Achim Peters <achimpeters@gmx.de>
wrote:
> PerlFAQ Server schrieb:
> > 6.5: How do I substitute case insensitively on the LHS while preserving
> > case on the RHS?
> > $a = "this is a TEsT case";
>
> I thought, $a should _NEVER_ be used as variable name, even not in
> examples, except when in sorting context?
Yes, using $a outside of a sort subroutine is now bad form. It's not
wrong, just bad practice. It wasn't always a bad practice though, and
most of the FAQ pre-dates people thinking like that.
I'll adjust the answer.
Thanks,
--
Posted via a free Usenet account from http://www.teranews.com
------------------------------
Date: Tue, 18 Mar 2008 13:27:08 -0700 (PDT)
From: Koszalek Opalek <koszalekopalek@interia.pl>
Subject: Re: Inside-out objects are slow! (or how to accelerate OO Perl?)
Message-Id: <b1b219ce-fa20-40f7-b5c4-d4a92a1da648@e39g2000hsf.googlegroups.com>
On Mar 18, 5:29 pm, Ted Zlatanov <t...@lifelogs.com> wrote:
> On 17 Mar 2008 21:28:09 GMT xhos...@gmail.com wrote:
>
> x> Ted Zlatanov <t...@lifelogs.com> wrote:>> On Mon, 17 Mar 2008 11:18:47 -0700 (PDT) Koszalek Opalek
> >> <koszalekopa...@interia.pl> wrote:
>
> KO> Actually, I've been entertaining the idea of rewriting the module in
> KO> C/C++ for some time. Chances are it would make it blindingly fast,
> KO> but the ease and convenience of Perl (and the ability to hack/extend
> KO> it by anyone) is not something I want to give up lightly.
>
> >> Try Inline::C. It's a very good compromise between C and Perl.
>
> x> I'm a fan of Inline::C, but I don't see it being very good for this type of
> x> OO, where you have a very large number of very light-weight objects. To
> x> get good benefits, you would probably have to push the container of the
> x> objects--not just the objects themselves--plus all operations operating on
> x> the container, down into C.
>
> It really depends on the application, but generally I agree (except I
> didn't recommend Inline::C for OO work, and I wouldn't).
I had a look at it today, had "blah" working immediately (somehow
I never bother to printf hello world, I printf blah). Unfortunately
it's not part of the default installation, requires a C compiler
(not an issue on *nix but more so on Windows; even people with VS
installed usually do not have the environment - vsvars32.bat - set),
and does not work on paths containing spaces (at least it did not
for me).
Overall, looks pretty cool though. Maybe I'll use it one day but
as Xho pointed out with so many light-weight objects doing little
things and communicating with each other I would probably end up
hiding the whole thing in C/C++.
Koszalek
------------------------------
Date: Tue, 18 Mar 2008 13:48:47 -0700 (PDT)
From: Koszalek Opalek <koszalekopalek@interia.pl>
Subject: Re: Inside-out objects are slow! (or how to accelerate OO Perl?)
Message-Id: <219c2be2-ded8-49e8-b5f3-0061bd3af7b4@v3g2000hsc.googlegroups.com>
On Mar 18, 8:37 am, Koszalek Opalek <koszalekopa...@interia.pl> wrote:
> On Mar 17, 8:44 am, Koszalek Opalek <koszalekopa...@interia.pl> wrote:
>
> Wooow, look at this:
>
> bash-3.2$ time perl ./makeregularobj.pl 100000
> Created 100000 objects (blessed hashes), data stored in ten fields
> inside a hash.
>
> real 0m0.734s
> user 0m0.655s
> sys 0m0.015s
>
> bash-3.2$ time perl ./makeinsideoutobj.pl 100000
> Created 100000 inside-out objects (blessed scalars).
>
> real 0m0.436s
> user 0m0.343s
> sys 0m0.031s
>
> Wet your appetite. I will send details in the evening.
> Until then ;-)
Instead of using the object address to index the inside-out
fields, I used an ID.
#!/usr/bin/perl
use strict;
my $no_obj = $ARGV[0] || 10_000;
{
#inside-out arrays
my @field0;
my @field1;
# ...
# ...
my @field9;
{
package P;
my $cnt = 0;
sub new
{
my $_class = shift;
my $self = $cnt++;
bless \$self, $_class;
$field0[$self]=2;
$field1[$self]++;
# ....
# ....
$field9[$self]++;
return \$self;
};
sub getf0
{
return $field0[${$_[0]}];
};
};
};
You can do the same thing using inside-out hashes instead of arrays
but arrays are somewhat faster -- both for creation (the larger the
number of objects the better the ratio) and for data access.
One benchmark I ran (for reading data from one field) was:
1m42.289s for hashes
1m23.724s for arrays
I guess most of that time is spend in calling the methods,
not in accessing the data inside an array/a hash.
The problem with arrays is garbage collection.
For me it does not really matter, I can do Class->cleanup() after
I've done the processing. (cleanup() would empty all arrays).
I was thinking I could also collect the numbers (id's) of
DESTROY-ed objects and then splice() the arrays when the number
reaches a certain threshold (e.g. 1000). Then the existing
objects would have to be renumbered. The problem is that
I cannot store the object references in some array in the
class because if I do, they will never be DESTROY-ed. So it
is a catch-22 unless we can work-around it with some low-level
magic.
Anyway, given 4x performance (compared to 'regular' inside-out
objects) and thread-safety I think that this might be an
interesting solution.
Koszalek
------------------------------
Date: Tue, 18 Mar 2008 13:57:22 -0700 (PDT)
From: Koszalek Opalek <koszalekopalek@interia.pl>
Subject: Re: Inside-out objects are slow! (or how to accelerate OO Perl?)
Message-Id: <28e3704b-6582-492f-8b7a-1ecfcdd7d409@e60g2000hsh.googlegroups.com>
On Mar 18, 9:48 pm, Koszalek Opalek <koszalekopa...@interia.pl> wrote:
> Instead of using the object address to index the inside-out
> fields, I used an ID.
Actually I had to do the very same thing in a somewhat different
scenario. I overloaded the "" operator and after that I could no
longer compare objects using ==; I had to also overload == (Look
for "Side-effects of overloading quotes" elsewhere in the group).
Someone pointed that out (i.e. pointed that I have to overload ==)
and suggested using refaddr for comparison.
That worked but the drop in performance was visible immediately.
So I resorted to comparing ID's instead of refaddr. (I already
had ID's in my objects). And that was so much quicker...
Koszalek
------------------------------
Date: Tue, 18 Mar 2008 12:53:41 -0700
From: Brian Helterline <brian.helterline@hp.com>
Subject: Re: LWP::Simple yields "protocol" error (was Re: Need Perl module to get <TITLE> tag of a web page)
Message-Id: <frp6k5$mt$1@usenet01.boi.hp.com>
J.D. Baldwin wrote:
>
> The other replies to my post suggested LWP with other tools. Now I
> cannot get LWP to work with a valid proxy setting. My script will
> work with the http_proxy variable unset ... but I'm still curious why
> this should be so (perl 5.8.8, LWP::Simple 1.4.1):
>
> $ http_proxy='' perl -MLWP::Simple -e 'getprint "http://www.sn.no"' | head
> <!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
> <head>
> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
>
> [...]
>
> $ http_proxy='valid_host' perl -MLWP::Simple -e 'getprint "http://www.sn.no"' | head
> 501 Protocol scheme '' is not supported <URL:http://www.sn.no>
if you had set http_proxy, it would have printed something inside the
single quotes rather than ''.
Also make sure you specify http_proxy as starting with "http://", not
just the proxy name.
------------------------------
Date: Tue, 18 Mar 2008 16:53:50 -0500
From: brian d foy <brian.d.foy@gmail.com>
To: news@baldwin.users.panix.com
Subject: Re: Need Perl module to get <TITLE> tag of a web page
Message-Id: <180320081653503999%brian.d.foy@gmail.com>
[[ This message was both posted and mailed: see
the "To," "Cc," and "Newsgroups" headers for details. ]]
In article <frmrj2$ceu$1@reader2.panix.com>, J.D. Baldwin
<INVALID_SEE_SIG@example.com.invalid> wrote:
> In the previous article, Keith Keller
> <kkeller-usenet@wombat.san-francisco.ca.us> wrote, quoting me:
> > > Simple problem. Given a URL http://www.example.com/some/file/here.html,
> > > retrieve and extract the title of the web page -- i.e., the content
> > > of the <title> tag. Is there an equally simple solution? Thanks in
> > > advance for any advice.
> Oh, my, "TreeBuilder" is *exactly* what I needed. Thank you!
If you just want to get the title, HTML::HeadParser is what you need.
It already does all of the hard work for you.
------------------------------
Date: 18 Mar 2008 18:00:32 GMT
From: Mike <mikee@mikee.ath.cx>
Subject: Net::Blacklist::Client use?
Message-Id: <47e00340$0$26111$88260bb3@free.teranews.com>
I'm working on a program to help with my site's mail filtering. I'm
using Net::Blacklist::Client and the module for the most part works.
Is there a return code passed back from $res->search($peeraddr)
that says the site is definitly on a blacklist or do I need to
search the {'txt'} key for 'v=spf1 -all' and 'spam'?
Mike
--
Posted via a free Usenet account from http://www.teranews.com
------------------------------
Date: Tue, 18 Mar 2008 14:14:56 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Net::Blacklist::Client use?
Message-Id: <47e014b1$0$48228$815e3792@news.qwest.net>
Mike wrote:
> I'm working on a program to help with my site's mail filtering. I'm
> using Net::Blacklist::Client and the module for the most part works.
> Is there a return code passed back from $res->search($peeraddr)
You need to first tell us what is '$res'.
> that says the site is definitly on a blacklist or do I need to
> search the {'txt'} key for 'v=spf1 -all' and 'spam'?
------------------------------
Date: 18 Mar 2008 18:55:46 GMT
From: Mike <mikee@mikee.ath.cx>
Subject: Re: Net::Blacklist::Client use?
Message-Id: <47e01032$0$26081$88260bb3@free.teranews.com>
In article <47e014b1$0$48228$815e3792@news.qwest.net>, J. Gleixner wrote:
> Mike wrote:
>> I'm working on a program to help with my site's mail filtering. I'm
>> using Net::Blacklist::Client and the module for the most part works.
>
>
>> Is there a return code passed back from $res->search($peeraddr)
>
> You need to first tell us what is '$res'.
>
>> that says the site is definitly on a blacklist or do I need to
>> search the {'txt'} key for 'v=spf1 -all' and 'spam'?
>
$ perldoc Net::Blacklist::Client
Net::Blacklist::ClientUser Contributed Perl DocumentaNet::Blacklist::Client(3)
NAME
Net::Blacklist::Client - Queries multiple RBLs or URIBLs in parallel.
SYNOPSIS
use Net::Blacklist::Client;
my $rbl = Net::Blacklist::Client->new;
my $result = $rbl->lookup_ip('127.0.0.2');
foreach my $list (keys %$result){
printf "%s: %s (%s)\n", $list, $result->{$list}->{a}, $result->{$list}->{txt};
}
DESCRIPTION
This module is used to discover what RBL's are listing a particular IP address. It parallelizes requests for fast
response.
This module is heavily based on Net::RBLClient by Asher Blum. It adds an updated list of RBLs and removes many dead ones,
the ability to look up domains in domain-specific RBLs, and changes the output format. Although it is very similar and
does the same job, due to the changes in the output formats, it is not suitable as a drop-in replacement.
An RBL, or Realtime Blackhole List, is a list of IP addresses meeting some criteria such as involvement in Unsolicited
Bulk Email. Each RBL has its own criteria for addition and removal of addresses. If you want to block email or other
traffic to/from your network based on one or more RBLs, you should carefully study the behavior of those RBLs before and
during such blocking.
$res -> $result
--
Posted via a free Usenet account from http://www.teranews.com
------------------------------
Date: Tue, 18 Mar 2008 20:57:59 GMT
From: Ron Eggler <test@example.com>
Subject: opening file for appending doesn't work for me
Message-Id: <r1WDj.86702$FO1.69678@edtnps82>
Hi,
I would like to open a file for appending content and create it if it
doesn't exist. I have been trying to do all I can but it just wouldn't open
it. My code looks like:
@files = </usr/share/NovaxTSP/logs/*>; #path where the log files are saved
my $key_indicator="----Public key----"; #string that specifies that there
is an ssh public key in the next lines and it will need to be appended to
~/.ssh/authorized_keys
my $key_file="~/.ssh/authorized_keys"; #path the the authorized-keys file
foreach $file (@files) { # read out the directory content
print "parse file ".$file.":\n";
file_parser($file);
}
sub file_parser
{
$file = $_[0]; # get 1st parameter (filename)
open(INFO, $file); #opens file systemstats
@lines = <INFO>; #assigns lines to array
$num=0;
foreach $line (@lines){ #go through each line in file
$num++;
print " ".$num ." - ". $line;
if(rindex($line,$key_indicator)>-1){
print "Dude, append the rest of the file to ~/.ssh/authorized_keys
file\n"; #ah, there's an ssh key, the rest of the file will need to be
appended to ~/.ssh/authorized_keys
sysopen (KEY, ">>$key_file", 0644);
print $lines[$num+1]."\n";
print KEY $lines[$num+1];
print $lines[$num+2]."\n";
print KEY $lines[$num+2];
close(KEY);
}
}
}
I appreciate any kind of help!
Thank you so much!
--
chEErs roN
------------------------------
Date: Tue, 18 Mar 2008 22:09:16 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: opening file for appending doesn't work for me
Message-Id: <87wsnzrb7n.fsf@zeekat.nl>
Ron Eggler <test@example.com> writes:
> Hi,
> sysopen (KEY, ">>$key_file", 0644);
sysopen doesn't work like that.
See perldoc -f sysopen
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
------------------------------
Date: 18 Mar 2008 21:24:59 GMT
From: xhoster@gmail.com
Subject: Re: opening file for appending doesn't work for me
Message-Id: <20080318172502.360$ig@newsreader.com>
Ron Eggler <test@example.com> wrote:
> Hi,
>
> I would like to open a file for appending content and create it if it
> doesn't exist. I have been trying to do all I can but it just wouldn't
> open it. My code looks like:
> sysopen (KEY, ">>$key_file", 0644);
sysopen does not parse the filename slot to get the mode, so you are trying
to open a file whose name literally starts with two greater than signs.
0644 looks like permission, but it is in sysopen's slot for mode, not
permission.
You aren't checking for success and inspecting $! upon failure.
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: Tue, 18 Mar 2008 22:57:27 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: opening file for appending doesn't work for me
Message-Id: <64as6gF290gp8U1@mid.individual.net>
Ron Eggler wrote:
>
> I would like to open a file for appending content and create it if it
> doesn't exist.
<snip>
> sysopen (KEY, ">>$key_file", 0644);
use Fcntl;
sysopen KEY, $key_file, O_WRONLY|O_APPEND|O_CREAT, 0644 or die $!;
See "perldoc -f sysopen".
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 18 Mar 2008 12:42:57 -0700
From: Brian Helterline <brian.helterline@hp.com>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <frp602$q31$1@usenet01.boi.hp.com>
Rodion wrote:
> Jednom davno, ne znam vise kad, John W. Krahn duboko zamisljen/a rece:
>
>> Couldn't you just write that as:
>>
>> $found = 1 if exists $cb{$cbName}{$data};
>
> Well, I have to thank you for putting me on the right track!
>
> There was a problem with some numeric data having prefixed zeroes while
> some of the hash keys did not so there could be no match ( 0567 != 567).
If you are doing the testing using numeric comparison, then they are equal.
print "equal" if '0567' == '567';
--
-brian
------------------------------
Date: 18 Mar 2008 13:58:22 -0600
From: Lawrence Statton <yankeeinexile@gmail.com>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <873aqnst29.fsf@hummer.cluon.com>
Brian Helterline <brian.helterline@hp.com> writes:
> If you are doing the testing using numeric comparison, then they are equal.
>
> print "equal" if '0567' == '567';
>
> --
> -brian
Does not print "equal"
However
perl -le 'print "equal" if '0567' == '375''
Does.
Why can't programmers tell Haloween from Christmas?
Because OCT 31 == DEC 25
--
Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
place them into the correct order.
------------------------------
Date: 18 Mar 2008 13:58:37 -0600
From: Lawrence Statton <yankeeinexile@gmail.com>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <87zlsvrehe.fsf@hummer.cluon.com>
Brian Helterline <brian.helterline@hp.com> writes:
> If you are doing the testing using numeric comparison, then they are equal.
>
> print "equal" if '0567' == '567';
>
> --
> -brian
Does not print "equal"
However
perl -le 'print "equal" if '0567' == '375''
Does.
Why can't programmers tell Haloween from Christmas?
Because OCT 31 == DEC 25
--
Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
place them into the correct order.
------------------------------
Date: Tue, 18 Mar 2008 21:09:03 +0100
From: Frank Seitz <devnull4711@web.de>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <64alr1F2acok7U2@mid.individual.net>
Lawrence Statton wrote:
> Brian Helterline <brian.helterline@hp.com> writes:
>>
>>If you are doing the testing using numeric comparison, then they are equal.
>>
>>print "equal" if '0567' == '567';
>
> Does not print "equal"
>
> However
>
> perl -le 'print "equal" if '0567' == '375''
>
> Does.
You should test your programs!
> Why can't programmers tell Haloween from Christmas?
>
> Because OCT 31 == DEC 25
$ perldoc -f dec
No documentation for perl function `dec' found
Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel
------------------------------
Date: 18 Mar 2008 14:17:49 -0600
From: Lawrence Statton <yankeeinexile@gmail.com>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <87ve3jrdle.fsf@hummer.cluon.com>
Frank Seitz <devnull4711@web.de> writes:
> Lawrence Statton wrote:
> > However
> >
> > perl -le 'print "equal" if '0567' == '375''
> >
> > Does.
>
> You should test your programs!
>
lawrence@hummer - /tmp % perl -le 'print "equal" if '0567' == '375''
equal
--
Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
place them into the correct order.
------------------------------
Date: Tue, 18 Mar 2008 21:46:12 +0100
From: Frank Seitz <devnull4711@web.de>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <64ao0mF2acok7U3@mid.individual.net>
Lawrence Statton wrote:
> Frank Seitz <devnull4711@web.de> writes:
>>
>>You should test your programs!
>
> lawrence@hummer - /tmp % perl -le 'print "equal" if '0567' == '375''
> equal
You're right, but it depends on the shell.
% perl
print "equal\n" if '0567' == '375'
^D
%
% perl
print "equal\n" if '0567' == '567'
^D
equal
%
Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel
------------------------------
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 1372
***************************************