[23921] in Perl-Users-Digest
Perl-Users Digest, Issue: 6122 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 12 14:05:48 2004
Date: Thu, 12 Feb 2004 11:05:11 -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 Thu, 12 Feb 2004 Volume: 10 Number: 6122
Today's topics:
Alternative to Export for constants <kj345@lycos.com>
Re: Alternative to Export for constants <usenet@morrow.me.uk>
Re: Alternative to Export for constants <usenet@morrow.me.uk>
Re: build_dir/perl uses /usr/lib/perl !? <bill_knight2@yahoo.com>
Re: build_dir/perl uses /usr/lib/perl !? <usenet@morrow.me.uk>
Re: build_dir/perl uses /usr/lib/perl !? <nospam-abuse@ilyaz.org>
Re: Comparing a string to filenames in a directory (nj_perl_newbie)
Debian Linux Perl installation (testing dist) <nomail_nospam@nopain.nopain.com>
Re: Encrypt and Decrypt for text ... <tadmc@augustmail.com>
GDBM and Perl 5.6.1 (JAG)
Re: GDBM and Perl 5.6.1 <usenet@morrow.me.uk>
Re: how to convert a string to an escaped string <bart.lateur@pandora.be>
Re: if for... <nobull@mail.com>
Re: if for... <bart.lateur@pandora.be>
Re: IO::Socket::INET Problem (Hobbit HK)
Re: Just curious: perl + C + asm, any? <peter@nospam.calweb.com>
Re: Matching strings with index – getting extra m (G)
Re: Matching strings with index – getting extra m <usenet@morrow.me.uk>
Re: perl 'sendmail' equivalent in windows <jwillmore@remove.adelphia.net>
Re: perl 'sendmail' equivalent in windows <cenxnfu@rpr.nevmban.rqh>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 12 Feb 2004 17:05:38 +0000 (UTC)
From: kj <kj345@lycos.com>
Subject: Alternative to Export for constants
Message-Id: <c0gbp2$m4o$1@reader2.panix.com>
One thing that bugs me about the Export module is that even when
you want the module to export everything, one still has to register
things in @EXPORT. I find it particularly annoying in cases when
I have a module that contains only constants to be shared by other
modules and scripts, like this:
# file My_Constants.pm
package My_Constants;
use base 'Exporter';
our @EXPORT = qw(FOO BAR ... );
use constant FOO => 1;
use constant BAR => 4;
# etc.
1;
# file some_script.pl
use My_Constants;
printf "%d %d\n", FOO, BAR;
Instead, I think I would prefer to do something like this:
# file My_Constants.pm
package My_Constants;
use constant FOO => 1;
use constant BAR => 4;
# etc.
1;
# file some_script.pl
use My_Constants;
our $Const = bless \{ my $c }, 'My_Constants';
printf "%d %d\n", $Const->FOO, $Const->BAR;
It works, though I've never thing anything like this done. Is
there anything particularly wrong with it?
Thanks,
kj
------------------------------
Date: Thu, 12 Feb 2004 18:33:28 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Alternative to Export for constants
Message-Id: <c0ggto$f34$6@wisteria.csv.warwick.ac.uk>
kj <kj345@lycos.com> wrote:
>
> One thing that bugs me about the Export module is that even when
^^ er
> you want the module to export everything, one still has to register
> things in @EXPORT. I find it particularly annoying in cases when
> I have a module that contains only constants to be shared by other
> modules and scripts, like this:
>
> # file My_Constants.pm
> package My_Constants;
> use base 'Exporter';
> our @EXPORT = qw(FOO BAR ... );
> use constant FOO => 1;
> use constant BAR => 4;
> # etc.
> 1;
<snip>
> # file My_Constants.pm
> package My_Constants;
> use constant FOO => 1;
> use constant BAR => 4;
> # etc.
> 1;
>
> # file some_script.pl
> use My_Constants;
>
> our $Const = bless \{ my $c }, 'My_Constants';
>
> printf "%d %d\n", $Const->FOO, $Const->BAR;
>
> It works, though I've never thing anything like this done. Is
> there anything particularly wrong with it?
You won't get constant inlining, and the interface is messy (do you
really want to have to do that 'bless' every time you use the module?)
A better answer is something like
package My_Constants;
use constant;
use base qw/Exporter/;
my %consts = (
FOO => 1,
BAR => 2,
);
our @EXPORT = keys %consts;
for (keys %consts) {
import constant $_ => $consts{$_};
}
1;
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: Thu, 12 Feb 2004 18:38:54 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Alternative to Export for constants
Message-Id: <c0gh7u$g59$1@wisteria.csv.warwick.ac.uk>
Ben Morrow <usenet@morrow.me.uk> wrote:
> kj <kj345@lycos.com> wrote:
> >
> > our $Const = bless \{ my $c }, 'My_Constants';
> >
> > printf "%d %d\n", $Const->FOO, $Const->BAR;
> >
> > It works, though I've never thing anything like this done. Is
> > there anything particularly wrong with it?
Another, stronger, objection is that this comes under the heading
'using the symbol table when you could use an ordinary hash' (method
calls are, essentially, symrefs).
package My_Constant;
use base qw/Exporter/;
our @EXPORT = qw/%Consts/;
out %Consts = (
FOO => 1,
BAR => 2,
);
1;
package main;
use My_Constant;
print $Const{FOO}, $Const{BAR};
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: Thu, 12 Feb 2004 13:24:21 +0000 (UTC)
From: bill <bill_knight2@yahoo.com>
Subject: Re: build_dir/perl uses /usr/lib/perl !?
Message-Id: <c0fuq5$i0g$1@reader2.panix.com>
In <c0aqef$9u4$1@wisteria.csv.warwick.ac.uk> Ben Morrow <usenet@morrow.me.uk> writes:
>bill <bill_knight2@yahoo.com> wrote:
>> I'm doing a re-installation of Perl 5.8.2-2, because the currently
>> installed version has threads enabled, which I don't want. When
>> I do make test, 2 tests fail. Not surprisingly, these tests also
>> fail when I run them individually using:
>>
>> bash-2.05b$ LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH; export
>> LD_LIBRARY_PATH; cd t; ./perl harness <test_file>
>>
>> The first failing test (run/fresh_perl.t) fails with the error:
>>
>> /home/knight/build/perl-5.8.2/perl: relocation error:
>> /usr/lib/perl/5.8.2/auto/NDBM_File/NDBM_File.so: undefined symbol:
>> Perl_Gthr_key_pt
>Whomever installed your previous version of perl should be shot
>:).
I guess that'd be me. My only defense is that I used Debian's
apt-get installation utility, which is entirely hands-off (at least
in my hands). As far as I can tell, all the decisions as to where
to put things are built into the downloaded package.
>I'd suggest moving the whole
>auto directory into an arch-specific subdirectory
Thanks. I'll try that.
>> The second failing test (../lib/ExtUtils/t/Embed.t) fails with
>>
>> /usr/bin/ld: cannot find -lperl
>> collect2: ld returned 1 exit status
>>
>> Again, another library related failure, but here I'm clueless as
>> to what may be going on.
>Looking at lib/ExtUtils/t/Embed.t, it is expecting to be run from t
>and find libperl in ..: is that where it is?
There's no libperl.so in .., only libperl.so.5.8.2. The strange thing is that, when I ran Configure, I gave it these flags:
$ sh Configure -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.8.2 -Darchlib=/usr/lib/perl/5.8.2 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.8.2 -Dsitearch=/usr/local/lib/perl/5.8.2 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Uusenm -Duseshrplib -Dlibperl=libperl.so.5.8.2 -Dd_dosuid -des
...which includes -Dlibperl=libperl.so.5.8.2, so I don't understand
why the libperl.so.5.8.2 in .. is not recognized as libperl by
lib/ExtUtils/t/Embed.t.
Another strange thing is that when I do ./perl -V, where "./perl"
is the newly build perl, in the config_args section, I get:
config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.8.2 -Darchlib=/usr/lib/perl/5.8.2 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.8.2 -Dsitearch=/usr/local/lib/perl/5.8.2 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Uusenm -Duseshrplib -Dlibperl=libperl.so.5.8.2 -Dd_dosuid -des'
...which has the usethreads flag set!!! The whole point of going
through all this hassle was to install perl without threads. Why
doesn't config_args match what I actually gave Configure? (The
usethread flag is the only place in which config_args differs from
the args I actually gave Configure.)
To make matters more cofusing, despite what config_arg says, './perl
-v' says:
This is perl, v5.8.2 built for i386-linux
So I have conflicting information about ./perl; I'm not sure what
to believe...
Thank you. I greatly appreciate your help.
bill
------------------------------
Date: Thu, 12 Feb 2004 15:36:11 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: build_dir/perl uses /usr/lib/perl !?
Message-Id: <c0g6hb$9mr$1@wisteria.csv.warwick.ac.uk>
bill <bill_knight2@yahoo.com> wrote:
>
> In <c0aqef$9u4$1@wisteria.csv.warwick.ac.uk> Ben Morrow
> <usenet@morrow.me.uk> writes:
>
> >Looking at lib/ExtUtils/t/Embed.t, it is expecting to be run from t
> >and find libperl in ..: is that where it is?
>
> There's no libperl.so in .., only libperl.so.5.8.2. The strange
> thing is that, when I ran Configure, I gave it these flags:
>
> $ sh Configure ... -Dlibperl=libperl.so.5.8.2 ...
>
> ...which includes -Dlibperl=libperl.so.5.8.2, so I don't understand
> why the libperl.so.5.8.2 in .. is not recognized as libperl by
> lib/ExtUtils/t/Embed.t.
Well, my (installed) perl has, in
/usr/lib/perl5/5.8.2/i686-linux-thread-multi/CORE,
libperl.so -> libperl.so.1 -> libperl.so.1.5.8
. Why did you pass that arg to Configure? I suspect you may be better
off without it: let Configure work out what the things should be
called, that's what it's there for :).
> Another strange thing is that when I do ./perl -V, where "./perl"
> is the newly build perl, in the config_args section, I get:
<schtuff>
> ...which has the usethreads flag set!!! The whole point of going
> through all this hassle was to install perl without threads. Why
> doesn't config_args match what I actually gave Configure? (The
> usethread flag is the only place in which config_args differs from
> the args I actually gave Configure.)
Yup, -V gets its info from Config.pm, and it will be finding the
installed one before the new one. When you move it all into an
arch-specific directory that should fix itself.
Ben
--
don't get my sympathy hanging out the 15th floor. you've changed the locks 3
times, he still comes reeling though the door, and soon he'll get to you, teach
you how to get to purest hell. you do it to yourself and that's what really
hurts is you do it to yourself just you, you and noone else * ben@morrow.me.uk
------------------------------
Date: Thu, 12 Feb 2004 16:56:26 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: build_dir/perl uses /usr/lib/perl !?
Message-Id: <c0gb7q$30ts$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
bill
<bill_knight2@yahoo.com>], who wrote in article <c0fuq5$i0g$1@reader2.panix.com>:
> To make matters more cofusing, despite what config_arg says, './perl
> -v' says:
One should run the uninstalled ./perl not as
./perl
but as
./perl -Ilib
Hope this helps,
Ilya
------------------------------
Date: 12 Feb 2004 07:10:04 -0800
From: aotoole@optonline.net (nj_perl_newbie)
Subject: Re: Comparing a string to filenames in a directory
Message-Id: <d7fb9254.0402120710.9dd460c@posting.google.com>
Okay, this is what I ended up with:
I get some warnings when it is run and I am still not able to run it
in "Taint mode", but it is moving the file. I am not receiving
e-mails so I don't think that the call to &mail is working properly.
Any thoughts?
sub chx_file { # moves change files associated with a confirmation
file to the transfer directory
#
#
use File::Basename;
my($email,$csv_path,$type) = @_;
my $input_file = &untaint_pathname($csv_path);
my $basename = &untaint_filename( basename($input_file,"\.csv") );
&log_entry($logfh, "sub chx_file") if $debug;
&log_entry($logfh, "input_file is: $input_file") if $debug;
open (FILE, "$input_file") or die("Cannot open file $input_file
because $!\n");
chdir($limbodir) or die "cannot cd to limbodir ($!)";
while (<FILE>) {
chomp;
my ($firstfield, $filename, $rest) = split /,/;
&log_entry($logfh, "limbo files are $limbodir/$filename");
&log_entry($logfh, "filename is: $filename");
if (defined($filename) and ($filename ne '') and (-e "$filename"))
{
move("$filename", "/export/ftp/transfer/") or die("move failed:
$!");
&log_entry($logfh, "File $filename moved");
&mail(
recipient => $email,
subject => "BulkAdmin input file $filename queued for production.",
body => "The BulkAdmin input file: $filename has been queued for
production.\n\nThis file will now be stored in the transfer directory
and will be run in production at 7:00 AM GMT \n\nAn email will be sent
to you after results are available.\n",
);
}
else {
&log_entry($logfh, "Confirm file doesn't match any files in
limbo directory");
}
}
}
------------------------------
Date: Thu, 12 Feb 2004 16:40:17 +0000 (UTC)
From: bill <nomail_nospam@nopain.nopain.com>
Subject: Debian Linux Perl installation (testing dist)
Message-Id: <c0ga9h$lhs$1@reader2.panix.com>
I have three questions for anyone knowledgeable about Linux Debian's
Perl installation.
The first question is, how can I change the Configure parameters
that apt-get or dpkg -i use? The default installation (at least
for the testing distribution) has these values, which I don't
entirely agree with:
-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.8.2 -Darchlib=/usr/lib/perl/5.8.2 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.8.2 -Dsitearch=/usr/local/lib/perl/5.8.2 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Uusenm -Duseshrplib -Dlibperl=libperl.so.5.8.2 -Dd_dosuid -des
My second question has to do with the default installation's library
directory structure. Mine (again, testing distribution) has library
files in
/usr/lib/perl/5.8.2/
/usr/lib/perl5
/usr/local/lib/perl/5.8.2/
/usr/share/perl/5.8.2/
/usr/local/share/perl/5.8.2/
/usr/share/perl5
What's up with lib vs. share? And perl/5.8.2 vs. perl5? What's
the rationale for breaking things up this way? Why not just a
single perl/5.8.2 directory, or at most /usr/lib/perl/5.8.2 and
/usr/local/lib/perl/5.8.2 (with corresponding arch-dependent
directories)?
My third question has to do with the location of auto subdirectories
and other architecture-dependent stuff. It appears that Debian's
default is to put this stuff directly in /usr/lib/perl/5.8.2/ and
/usr/local/lib/perl/5.8.2/, instead of segregating in directories
like /usr/lib/perl/5.8.2/some-architecture-string/ and
/usr/local/lib/perl/5.8.2/some-architecture-string/.
This can lead to installation bugs (as I've posted in another clpm
thread). What's Debian's rationale from deviating from Perl's
standard here? Will apt-get and dpkg get hopelessly confused if
I manually create these arch-dependent directories and move the
auto subdirectories to them?
Thanks!
bill
------------------------------
Date: Thu, 12 Feb 2004 07:01:56 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Encrypt and Decrypt for text ...
Message-Id: <slrnc2mua4.1jr.tadmc@magna.augustmail.com>
David K. Wall <dwall@fastmail.fm> wrote:
> roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote:
>
>> Encryption doesn't have to be perfect: it just has to be good
>> enough to not be worth the bother of breaking.
>
> ($encrypted = $plaintext) =~ tr/A-Za-z/N-ZA-Mn-za-m/;
>
> is often good enough... :-)
And if the data is really really secret, encode it as above twice!
:-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Feb 2004 10:01:43 -0800
From: jeffg@programmer.net (JAG)
Subject: GDBM and Perl 5.6.1
Message-Id: <6b40b6b9.0402121001.6941934@posting.google.com>
Hi. We're running Perl 5.6.1 on a Solaris 9 box.
We need GDBM support but it's not installed.
I can't find a standalone module on CPAN - it only seems
to come bundled with Perl 5.8.x.
Does anybody know either:
1) why my Perl 5.6.1 doesn't have GDBM and whether I can install it?
2) where I can get a standalone GDBM module?
Solaris 9 comes with Perl and I suspect that rebuilding Perl would be a really
bad idea. Is this suspicion correct?
Thanks in advance for your help.
------------------------------
Date: Thu, 12 Feb 2004 18:24:54 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: GDBM and Perl 5.6.1
Message-Id: <c0ggdm$f34$4@wisteria.csv.warwick.ac.uk>
jeffg@programmer.net (JAG) wrote:
> Hi. We're running Perl 5.6.1 on a Solaris 9 box.
> We need GDBM support but it's not installed.
> I can't find a standalone module on CPAN - it only seems
> to come bundled with Perl 5.8.x.
>
> Does anybody know either:
> 1) why my Perl 5.6.1 doesn't have GDBM and whether I can install it?
> 2) where I can get a standalone GDBM module?
If you donwload the perl-5.8.2 tarball and take the GDBM_File
directory out of the ext/ directory, you should be able to install
that with your perl.
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: Thu, 12 Feb 2004 13:25:58 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: how to convert a string to an escaped string
Message-Id: <6hvm20lkt7iq68rgv5gkt0rgrrqmst7fdn@4ax.com>
Lowell Kirsh wrote:
>I want to convert:
> blah blah "foo" blah
>to
> blah\ blah\ \"foo\"\ blah
>
>Is there an easy way to do it?
quotemeta()?
Otherwise, try
s/(?=[CHARLIST])/\\/g;
with CHARLIST replaced by a list of characters/ range of characters, for
example
s/(?=[\\\s\"])/\\/g;
to escape whitespace, quotes, and backslashes.
--
Bart.
------------------------------
Date: 12 Feb 2004 13:09:55 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: if for...
Message-Id: <u9isicmokc.fsf@wcl-l.bham.ac.uk>
Robert Wallace <robw@sofw.org> writes:
> print "hello" if (m/world/);
> I can:
> $x = 300 if ($ == 10);
>
> why can't I:
> foreach (@arr) if (m/str/) {
> ...}
I think you really meant to ask why can't I say:
.... if m/str/ for @arr;
Because you can't, so there! It has been decided and it ain't gonna
change. Very many people (including myself) have said they want it
but Larry Wall has put his foot down on this.
Some people 'round 'ere (notably Uri) here claim that there are real
technical reasons to be found in the p5p mailing list archives. I've
looked and I can't find them.
All I can find are:
[1] Because you can't, so there!
[2] Because you could abuse it to produce unreadable code
[3] Because using for without an explicit loop variable is bad
[4] For well known reasons I won't repeat
You'll note that [1] and [4] are no sort of explaintion. [2] applies
to pretty much everyting in Perl. [3] is an argument against the
"for" statement modifier per-se, not an argument against being able to
chain statement modifiers.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 12 Feb 2004 13:27:28 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: if for...
Message-Id: <8pvm209ijk2iuo8lbkg2df8s5b2r8jt5kn@4ax.com>
Robert Wallace wrote:
>why can't I:
>foreach (@arr) if (m/str/) {
>...}
Try grep.
foreach (grep m/str/, @arr) {
...}
--
Bart.
------------------------------
Date: 12 Feb 2004 09:51:28 -0800
From: hobbit_hk@hotmail.com (Hobbit HK)
Subject: Re: IO::Socket::INET Problem
Message-Id: <22ee5d47.0402120951.67a8245@posting.google.com>
Ben Morrow <usenet@morrow.me.uk> wrote in message news:<c0am1u$727$1@wisteria.csv.warwick.ac.uk>...
> > Yes, I want it to stop reading and move on... After a while when no
> > data has arrived to just stop reeading... It's kinda annoying with
> > IO::Select because it still waits the number of seconds I told it,
> > even if there's data...
>
> No it doesn't. It should return when there's data, or when the timeout
> has expired, whichever is the sooner.
>
Right... I don't know why it did before (or why I thought it did)...
> > > > Will Blocking=>0 in IO::Socket::INET's new() help?
> > > > I'm using $line=<$sock> to read from the socket.
> > >
> > > Might do. It won't if you use buffered reads, though, so you either
> > > want to switch to sysread or (if you have 5.8) push a :unix (NB. I
> > > have never tried this and, though it ought to work, I don't really
> > > know... :).
[snip]
>
> binmode $FH, ':unix';
>
> *ought* to make all reads on that FH unbuffered, even those done with
> <>... as I said, though, I've not tried it, and I wouldn't be
> surprised if it didn't work. See perldoc PerlIO.
>
> Ben
binmode $sock, ':unix' didn't work... At least I saw no change...
I hope IO::Selcet will do the trick...
------------------------------
Date: Thu, 12 Feb 2004 10:30:42 -0800
From: Penguinista <peter@nospam.calweb.com>
Subject: Re: Just curious: perl + C + asm, any?
Message-Id: <402bc419$0$49584$d368eab@news.calweb.com>
Ilya Zakharevich wrote:
> [A complimentary Cc of this posting was sent to
> Michele Dondi
> <bik.mido@tiscalinet.it>], who wrote in article <9s3n205furb165kosic3blkk7crejmde1o@4ax.com>:
>
>>As of the subject, I was wondering if anyone has ever written a binary
>>module for perl that in turn had some routines written in assembler,
>>for efficiency reasons.
>
>
> Why not? Take a module which uses an externally available C code
> which uses ASM (such as Math::Pari). This is a beast to compile,
> though, since Perl's Config.pm does not know how to run assembler...
>
> Or, less strict, take any Perl module which links with a library which
> is compiled from assembler code (such as Math::GMP).
>
> Hope this helps,
> Ilya
The efficiency margin of assembly over well written C is usually very
small, and comes at the cost of portability. Unless the algorithm is
written to utilize architecture specific features it's probably not
worth the trouble.
------------------------------
Date: 12 Feb 2004 08:22:58 -0800
From: bay_dar@yahoo.com (G)
Subject: Re: Matching strings with index – getting extra matches.
Message-Id: <cad04083.0402120822.1157857@posting.google.com>
Ben Morrow <usenet@morrow.me.uk> wrote in message news:<c0arqv$9u4$4@wisteria.csv.warwick.ac.uk>...
> bay_dar@yahoo.com (G) wrote:
> > Thanks for the suggestions so far, but I now realize I the sample text
> > file was flawed. For one there is Never white space around the '|'.
> > Secondly a line could have multiple codes but no duplicates(on that
> > line only). The sample file should have looked as follows:
> >
> > sales item aaa|543,m423a
> > sales item bbb|m423,543 'Note how code 543 is on the 1st 2nd
> > line.
> > sales item ccc|m423b
> > sales item ddd|423,423b,m523,652
> >
> > Given that the above has changed how could I get a match. e.g. a code
> > of 423 should return the description in line 4 "sales item ddd" Where
> > m423 only matches the 3rd line. etc.
>
> my $code = 'm423';
> while (<>) {
> my ($item, $codes) = split /\|/;
> my @codes = split /,/, $codes;
> print $item if grep { $_ eq $code } @codes;
> }
>
I finally gave this code a try, but it only partially works. For
instance a code of m423b will not pull up any results. Neither will
m523. My guess is we are not splitting things out right: my
@codes = split /,/, $codes;
Thanks,
C
------------------------------
Date: Thu, 12 Feb 2004 18:15:25 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Matching strings with index – getting extra matches.
Message-Id: <c0gfrt$f34$1@wisteria.csv.warwick.ac.uk>
bay_dar@yahoo.com (G) wrote:
> Ben Morrow <usenet@morrow.me.uk> wrote in message news:<c0arqv$9u4$4@wisteria.csv.warwick.ac.uk>...
> > my $code = 'm423';
> > while (<>) {
chomp;
> > my ($item, $codes) = split /\|/;
> > my @codes = split /,/, $codes;
> > print $item if grep { $_ eq $code } @codes;
> > }
>
> I finally gave this code a try, but it only partially works. For
> instance a code of m423b will not pull up any results. Neither will
> m523. My guess is we are not splitting things out right: my
> @codes = split /,/, $codes;
Ben
--
The cosmos, at best, is like a rubbish heap scattered at random.
- Heraclitus
ben@morrow.me.uk
------------------------------
Date: Thu, 12 Feb 2004 09:37:36 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: perl 'sendmail' equivalent in windows
Message-Id: <pan.2004.02.12.14.37.34.661317@remove.adelphia.net>
On Thu, 12 Feb 2004 01:51:51 -0800, KK wrote:
> Wondering if anyone can help me in finding the perl's 'sendmail'
> equivalent command for windows. I want to send a mail from a window
> machine. regards,
Think Perl (not shell) and use a module :-)
Net::SMTP or MIME::Lite or ....
HTH
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
"Protozoa are small, and bacteria are small, but viruses are
smaller than the both put together."
------------------------------
Date: Thu, 12 Feb 2004 09:51:34 -0700
From: Cognition Peon <cenxnfu@rpr.nevmban.rqh>
To: KK <kewlkarun@yahoo.com>
Subject: Re: perl 'sendmail' equivalent in windows
Message-Id: <Pine.GSO.4.50.0402120949590.27797-100000@shellfish.ece.arizona.edu>
Be Careful!! and don't use those modules to spam!!
Especially Employers!!
1:51am, IP packets from KK delivered:
> Wondering if anyone can help me in finding the perl's 'sendmail'
> equivalent command for windows. I want to send a mail from a window
> machine. regards,
>
--
echo cenxnfu@rpr.nevmban.rqh | perl -pe 'y/a-z/n-za-m/'
You are the product of a mutational union of ~640Mbytes of
genetic information.
-------------------------------------
Printed using 100% recycled electrons
------------------------------
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 6122
***************************************