[23664] in Perl-Users-Digest
Perl-Users Digest, Issue: 5871 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 28 21:05:58 2003
Date: Fri, 28 Nov 2003 18:05:16 -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 Fri, 28 Nov 2003 Volume: 10 Number: 5871
Today's topics:
config::inifiles and retrieval of delimiter <joeminga@yahoo.com>
Re: config::inifiles and retrieval of delimiter <invalid-email@rochester.rr.com>
Re: config::inifiles and retrieval of delimiter <usenet@morrow.me.uk>
Re: config::inifiles and retrieval of delimiter <usenet@morrow.me.uk>
Re: DBI error handling <REMOVEsdnCAPS@comcast.net>
Re: DBI error handling <tore@aursand.no>
Re: Does alarm work on w2k? <bart.lateur@pandora.be>
Re: find2perl and File::Find examples <bik.mido@tiscalinet.it>
Re: module selction <allidance2002@hotmail.com>
Re: module selction <usenet@morrow.me.uk>
Re: Newsgroup Searching Program <mikeflan@earthlink.net>
Re: Newsgroup Searching Program <mikeflan@earthlink.net>
Re: Newsgroup Searching Program <mikeflan@earthlink.net>
Re: Newsgroup Searching Program <flavell@ph.gla.ac.uk>
Re: Perl SSL Variable <No_4@dsl.pipex.com>
Re: Perl SSL Variable <flavell@ph.gla.ac.uk>
Perl unicode and :crlf, was Re: regexp: \x0a => \x0d\x0 <flavell@ph.gla.ac.uk>
Seeking Perl / Linux tutor (Felix Smith)
Re: Seeking Perl / Linux tutor <ww3140@_yah-oo.com>
Re: sorting multiple different entries using Perl <REMOVEsdnCAPS@comcast.net>
Re: store password in a module ? <usenet@morrow.me.uk>
Re: subnets eating each other? <jwillmore@remove.adelphia.net>
Re: subnets eating each other? <perl@my-header.org>
Re: subnets eating each other? <perl@my-header.org>
Re: Using perl -e to remove times/dates from a file <bik.mido@tiscalinet.it>
Will trade money for quick help <bry333@bellsouth.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 28 Nov 2003 16:04:49 -0500
From: "Domenico Discepola" <joeminga@yahoo.com>
Subject: config::inifiles and retrieval of delimiter
Message-Id: <kPOxb.112398$PD3.5769238@nnrp1.uunet.ca>
Hi all. I'm using the Config::IniFiles module & I want to store a literal
representation of a delimiter in an ini file. For ex, my ini file looks
like:
[GLOBAL]
#double quote, backslash, n, double quote
delimiter = "\n"
when I retrieve the value of the parameter delimiter, my perl variable
${delimiter} is obviously storing the literal '\n';
my ${my_iniinput} = Config::IniFiles->new( -file => "$file_ini", -nocase =>
1);
my ${delimiter} = ${my_iniinput}->val('GLOBAL', 'delimiter');
Is there a way to assign the "interpreted" value into my variable?
Unfortunately, I didn't know how to search for such a function in perldoc.
TIA
------------------------------
Date: Fri, 28 Nov 2003 23:20:51 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: config::inifiles and retrieval of delimiter
Message-Id: <3FC7D6AE.9020701@rochester.rr.com>
Domenico Discepola wrote:
> Hi all. I'm using the Config::IniFiles module & I want to store a literal
> representation of a delimiter in an ini file. For ex, my ini file looks
> like:
>
> [GLOBAL]
> #double quote, backslash, n, double quote
> delimiter = "\n"
>
> when I retrieve the value of the parameter delimiter, my perl variable
> ${delimiter} is obviously storing the literal '\n';
>
> my ${my_iniinput} = Config::IniFiles->new( -file => "$file_ini", -nocase =>
> 1);
> my ${delimiter} = ${my_iniinput}->val('GLOBAL', 'delimiter');
>
> Is there a way to assign the "interpreted" value into my variable?
Sure. Just eval it in an interpolated string, like [untested]:
my $delimiter=eval "\"$my_iniinput->val('GLOBAL','delimiter')\"";
...
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Fri, 28 Nov 2003 23:42:34 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: config::inifiles and retrieval of delimiter
Message-Id: <bq8mha$bu$1@wisteria.csv.warwick.ac.uk>
"Domenico Discepola" <joeminga@yahoo.com> wrote:
> Hi all. I'm using the Config::IniFiles module & I want to store a literal
> representation of a delimiter in an ini file. For ex, my ini file looks
> like:
>
> [GLOBAL]
> #double quote, backslash, n, double quote
> delimiter = "\n"
>
> when I retrieve the value of the parameter delimiter, my perl variable
> ${delimiter} is obviously storing the literal '\n';
>
> my ${my_iniinput} = Config::IniFiles->new( -file => "$file_ini", -nocase =>
> 1);
> my ${delimiter} = ${my_iniinput}->val('GLOBAL', 'delimiter');
<untested>
my %backwhacked = (
'\\n' => '"\n"',
'\\r' => '"\r"',
'\\t' => '"\t"',
'\\x{([[:xdigit:]]+)} => 'chr hex $1',
'\\x([[:xdigit:]]{2})' => 'chr hex $1',
'\\(0\d{1,3})' => 'chr oct $1',
etc...
);
$delimiter =~ s/$_/$backwhacked{$_}/ge for keys %backwhacked;
Ben
--
'Deserve [death]? I daresay he did. Many live that deserve death. And some die
that deserve life. Can you give it to them? Then do not be too eager to deal
out death in judgement. For even the very wise cannot see all ends.'
:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: ben@morrow.me.uk
------------------------------
Date: Fri, 28 Nov 2003 23:49:50 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: config::inifiles and retrieval of delimiter
Message-Id: <bq8muu$bu$2@wisteria.csv.warwick.ac.uk>
totally@bogus.email.invalid wrote:
> Domenico Discepola wrote:
> > Is there a way to assign the "interpreted" value into my variable?
>
> Sure. Just eval it in an interpolated string, like [untested]:
>
> my $delimiter=eval "\"$my_iniinput->val('GLOBAL','delimiter')\"";
Better is:
my $delimiter = $my_iniinput->val(...);
eval "\$delimiter = <<__EOS__;\n$delimiter\n__EOS__";
substr($delimiter, -1) = "";
as someone (Brian?) posted here not long ago. But
BE CAREFUL...
While this is the Right Answer, it will also intepolate all manner of
other things, most of which are probably undesirable. Consider
carefully before you use this.
(This is not to say that having the format of your config file be Perl
code is necessarily a bad thing, just that you need to be aware of the
implications of this.)
Ben
--
I've seen things you people wouldn't believe: attack ships on fire off the
shoulder of Orion; I've watched C-beams glitter in the darkness near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die. |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-| ben@morrow.me.uk
------------------------------
Date: Fri, 28 Nov 2003 18:05:13 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: DBI error handling
Message-Id: <Xns9441C2513704Csdn.comcast@216.196.97.136>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
James Willmore <jwillmore@remove.adelphia.net> wrote in
news:20031128125046.46d457b0.jwillmore@remove.adelphia.net:
> What would be better is the following (untested)
>
> my $dbh = DBI->connect("dbi:ODBC:$dsn", $user, $pass,
> {PrintError=>1,
> RaiseError=>1}
> or die "Can't connect: ", $DBI::errstr,"\n";
>
> #create a statement with placeholders
> my $stmt =
> 'INSERT INTO table field1,field2, ... fieldn VALUES(?,?,... ?)';
>
> #prepare *once*
> #you *should* die here if you can't prepare the statement
> #especial if you're only printing errors
> $rs = $dbh->prepare($stmt)
> or die "Can't prepare: ", $dbh->errstr,"\n";
"or die"...? You set RaiseError above. You're not going to get the
chance to die; prepare() will die for you.
> #now execute the statement foreach value
> while(my(@row) = $sth->fetchrow_array){
> $rs->execute(@row)
> or warn "Insert failed for the following:\n", join("|",@row),"\n",
Ditto here -- you won't get the chance to warn.
- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBP8fi7WPeouIeTNHoEQKeZACgl/IqFwZ8uquDcFgHjpHeKi17YowAoPzg
rzyGg2Mf4SdDVgLxsI4Q0jaG
=tG40
-----END PGP SIGNATURE-----
------------------------------
Date: Sat, 29 Nov 2003 01:47:59 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: DBI error handling
Message-Id: <pan.2003.11.28.19.51.12.549549@aursand.no>
On Thu, 27 Nov 2003 08:39:09 -0700, Ron Reidy wrote:
>>> I've a perl script which inserts data to a database. Sometime I get an
>>> error on the execute() statement. Now I want the script not to die but
>>> to exit the loop and to try again with the next record.
>> [...]
>> See 'perldoc DBI' for more information.
> And perldoc -f eval
Why?
--
Tore Aursand <tore@aursand.no>
"To cease smoking is the easiset thing I ever did. I ought to know,
I've done it a thousand times." -- Mark Twain
------------------------------
Date: Sat, 29 Nov 2003 00:34:43 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Does alarm work on w2k?
Message-Id: <dspfsv4v2o6r3ab2frdsohcg8v51dfemku@4ax.com>
Default@IO_Error_1011101.xyz wrote:
>Does this alarm work on w2k?
Since perl 5.8.0, yes. Not on older perls, like 5.6.1. See
<http://groups.google.com/groups?threadm=MPG.18a1bbf086a3da8a989695%40news-central.giganews.com>
<http://perlmonks.org/index.pl?node_id=300279>
<http://perlmonks.org/index.pl?node_id=307024>
--
Bart.
------------------------------
Date: Sat, 29 Nov 2003 00:19:54 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: find2perl and File::Find examples
Message-Id: <3tkfsvk4i31644k70hsf0pvcvqv9j2t4jg@4ax.com>
On Fri, 28 Nov 2003 13:59:02 +0530, "Sunil"
<sunil_franklin@hotmail.com> wrote:
> Where can I find good ( & simple) examples of find2perl and File::Find.
> The perldoc documentation is not very helpful (for me).
I can't understand what the issue could be with the documentation.
IMHO it's very clear. Do you have anything particular in mind?
Also, examples of 'find2perl' are more or less "plain" examples of
'find', with the exception that you can further customize the code
beyond the limits of the 'find' utility.
Personally, by seeing the code posted here every now and again I think
that in many cases it could be worth (but is not done!) to use the
\%options form of the function call and in particular the preprocess
and postprocess "methods".
I don't know it the following examples of mine are good (& simple) -
for sure they are very naive (& old), but in any case here are my
2cents:
#!/usr/bin/perl -i.bak
use strict;
use warnings;
use File::Find;
die "Usage: $0 <dir> [<dir>...]\n" unless @ARGV;
-d or die "`$_' either doesn't exist or is not a directory\n" for
@ARGV;
File::Find::find { preprocess => \&sel,
wanted => \&extr }, @ARGV;
sub sel { grep { /\.(?:asp|html?)/i or -d } @_ }
sub extr {
return unless -f;
print "Processing `$File::Find::name'\n";
local @ARGV=$_;
s/(\.asp)\?/$1_/gi, print while <>;
}
__END__
#!/usr/bin/perl
use strict;
use warnings;
use File::Find;
use File::Copy;
our ($name, $dir);
*name=*File::Find::name;
*dir=*File::Find::dir;
my %counts;
die "Usage: $0 <dir> [<dir>...]\n" unless @ARGV;
-d or die "`$_' either doesn't exist or is not a directory\n" for
@ARGV;
File::Find::find { preprocess => \&mkbakdir,
wanted => \&bakfile,
postprocess =>\&report }, @ARGV;
sub mkbakdir {
return if $_ eq '.bak';
if (-e '.bak') {
die "`.bak' exist in $dir but is not a directory\n"
unless -d '.bak';
} else {
mkdir '.bak'
}
@_;
}
sub bakfile {
return unless -f;
my $dest='.bak/' . $_;
unlink $dest or
die "Can't remove previous backup copy of `$name': $!\n"
if -e $dest;
copy $_, $dest or
die "Can't copy `$name' to .bak dir: $!\n";
print "`$name' copied to .bak dir\n";
$counts{$dir}++;
}
sub report {
$counts{$dir}=0 unless defined $counts{$dir};
print 'made backup copies for ', $counts{$dir},
' files in ', $dir, "\n";
}
__END__
Michele
--
# This prints: Just another Perl hacker,
seek DATA,15,0 and print q... <DATA>;
__END__
------------------------------
Date: Sat, 29 Nov 2003 06:21:29 +1100
From: Alison <allidance2002@hotmail.com>
Subject: Re: module selction
Message-Id: <3FC7A039.6010505@hotmail.com>
Ben Morrow wrote:
> Alison <allidance2002@hotmail.com> wrote:
>
>>thanks, now installing it GD then GD::Text then GD::Graph
>>/usr/local/bin/perl -MCPAN -e 'install "GD"'
>>.
>>.
>>.
>>Please choose the features that match how libgd was built:
>>Build JPEG support? [y]
>>I am not sure, how do find this out?
>
>
> You could try 'ldd /usr/lib/libgd.so*' and see if libjpeg is
> mentioned.
>
> Ben
>
# ldd /usr/lib/libgd.so*
/usr/lib/libgd.so.2:
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x4003d000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x4005c000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x400c9000)
libz.so.1 => /usr/lib/libz.so.1 (0x400ea000)
libm.so.6 => /lib/libm.so.6 (0x400f8000)
libc.so.6 => /lib/libc.so.6 (0x4011a000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
/usr/lib/libgd.so.2.0.15:
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x4003d000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x4005c000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x400c9000)
libz.so.1 => /usr/lib/libz.so.1 (0x400ea000)
libm.so.6 => /lib/libm.so.6 (0x400f8000)
libc.so.6 => /lib/libc.so.6 (0x4011a000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
# ldd /usr/lib/libgd.so* | grep XPM
#
SO I did
Please choose the features that match how libgd was built:
Build JPEG support? [y]
Build FreeType support? [y]
Build XPM support? [y] n
.
.
.
/usr/lib/gcc-lib/i386-linux/2.95.4/include/limits.h:117: limits.h: No
such file or directory
In file included from
/usr/local/lib/perl5/5.8.2/i686-linux/CORE/perl.h:1805,
from GD.xs:5:
/usr/local/lib/perl5/5.8.2/i686-linux/CORE/handy.h:121: inttypes.h: No
such file or directory
In file included from
/usr/local/lib/perl5/5.8.2/i686-linux/CORE/perl.h:1969,
from GD.xs:5:
/usr/local/lib/perl5/5.8.2/i686-linux/CORE/unixish.h:107: signal.h: No
such file or directory
In file included from
/usr/local/lib/perl5/5.8.2/i686-linux/CORE/iperlsys.h:51,
from
/usr/local/lib/perl5/5.8.2/i686-linux/CORE/perl.h:2323,
from GD.xs:5:
/usr/local/lib/perl5/5.8.2/i686-linux/CORE/perlio.h:65: stdio.h: No such
file or directory
In file included from GD.xs:5:
/usr/local/lib/perl5/5.8.2/i686-linux/CORE/perl.h:2837: math.h: No such
file or directory
In file included from GD.xs:5:
/usr/local/lib/perl5/5.8.2/i686-linux/CORE/perl.h:4107: sys/ipc.h: No
such file or directory
/usr/local/lib/perl5/5.8.2/i686-linux/CORE/perl.h:4108: sys/sem.h: No
such file or directory
/usr/local/lib/perl5/5.8.2/i686-linux/CORE/perl.h:4225: sys/file.h: No
such file or directory
GD.xs:7: gd.h: No such file or directory
GD.xs:14: stdio.h: No such file or directory
make: *** [GD.o] Error 1
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible
#
------------------------------
Date: Fri, 28 Nov 2003 20:53:30 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: module selction
Message-Id: <bq8cka$mb3$2@wisteria.csv.warwick.ac.uk>
Alison <allidance2002@hotmail.com> wrote:
> /usr/lib/gcc-lib/i386-linux/2.95.4/include/limits.h:117: limits.h: No
> such file or directory
> In file included from
> /usr/local/lib/perl5/5.8.2/i686-linux/CORE/perl.h:1805,
> from GD.xs:5:
> /usr/local/lib/perl5/5.8.2/i686-linux/CORE/handy.h:121: inttypes.h: No
> such file or directory
<snip>
Either you said something else wrong in the configuration (something
about compiler search paths), or you don't have some appropriate
'-dev' package installed, or something is *seriously* broken.
Ben
--
Heracles: ben@morrow.me.uk
Vulture! Here's a titbit for you / A few dried molecules of the gall
From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
(Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
/Alcestis/) [ flame, and falls out of sight. ]
------------------------------
Date: Fri, 28 Nov 2003 21:57:47 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Re: Newsgroup Searching Program
Message-Id: <3FC7C59C.A33B975@earthlink.net>
Bob Walton wrote:
> You could:
>
> use Net::NNTP;
>
> It should already be on your hard drive.
> ...
Thanks for the response. It is on my hard drive.
Boy, I guess this is going to be harder than I thought. I
read the documentation and it's not at all clear to me
that it can be used for searching newsgroups, but I'm
sure you are right.
Get a load of this description of the module:
DESCRIPTION
Net::NNTP is a class implementing a simple NNTP client
in Perl as described in RFC977. Net::NNTP inherits its
communication methods from Net::Cmd
Anyway, that's exactly what I was asking for.
A place to start looking.
Mike
------------------------------
Date: Fri, 28 Nov 2003 22:04:10 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Re: Newsgroup Searching Program
Message-Id: <3FC7C71A.3A702A05@earthlink.net>
James Willmore wrote:
> > use Net::NNTP;
> >
> > It should already be on your hard drive.
> > ...
>
> And ... use Google :-)
>
> There is a *long* thread from about 2 months ago on this very subject
> :-)
That long thread wasn't on this comp.lang.perl.misc group,
was it? So far I haven't been able to find it on Google.
Still looking.
------------------------------
Date: Fri, 28 Nov 2003 22:59:07 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Re: Newsgroup Searching Program
Message-Id: <3FC7D3FC.F380922E@earthlink.net>
Mike Flannigan wrote:
> snip
>
> I'd like to get started doing some newsgroup searching.
> Right now I use Netscape 4.72 for manually perusing
> a few newsgroups. I'd like to do a broad search of
> thousands of newsgroups on a daily basis. Just the
> recent posts I guess.
>
> snip
Well, after looking around, I'm questioning my original
premise. I'm not sure I want to search the newsgroups.
I didn't know they had even gotten worse than they
were before. What a wasteland. This newsgroup
is a gem compared to many others I just visited.
Mike
------------------------------
Date: Fri, 28 Nov 2003 23:12:50 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Newsgroup Searching Program
Message-Id: <Pine.LNX.4.53.0311282311050.6681@ppepc56.ph.gla.ac.uk>
On Fri, 28 Nov 2003, Mike Flannigan wrote:
> Well, after looking around, I'm questioning my original
> premise. I'm not sure I want to search the newsgroups.
> I didn't know they had even gotten worse than they
> were before. What a wasteland. This newsgroup
> is a gem compared to many others I just visited.
Usenet happiness is a well-tended killfile.
Occasionally I check with Google Groups, and marvel at the tripe from
which my killfile has shielded me. But only occasionally!
------------------------------
Date: Fri, 28 Nov 2003 21:37:59 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: Perl SSL Variable
Message-Id: <3fc7c036$0$9393$cc9e4d1f@news-text.dial.pipex.com>
Josh Harlan wrote:
>
> I am running a perl program in an unsecure directory and I would like
> to know if there is an environmental variable or equivalent
So, as has been noted, nothing to do with Perl, actually something to
do (probably) how CGI works.
> that will
> display the SSL path (e.g. "https://ssl.website.com" or
> "ssl.website.com"). Unfortunately, "https://ssl.$ENV{'SERVER_NAME'}"
> will not work as the website domain and the SSL domain are not related
> since I have a shared SSL.
Shouldn't matter - the SERVER_NAME should be set to the name of the
server handling the call. If it isn't you could configure the server
(using virtual hosts) so that it is.
If you are using Apache you will probably find that the HTTP headers
are passed on, and the server name which was used by the client to get to
you will be in teh Host: header, so look for the value of $ENV{'HTTP_HOST'}.
Of course, *all* of this is dependent on the Web server you are
actually using and how it has been configured.
You could always try a simple approach and add a short script to you
Web server which just echoes all of the keys in %ENV (and their values)
(just needs to be text/plain output) and see which, if any, of them
contains the info you want.
--
-*- Just because I've written it here doesn't -*-
-*- mean that you should, or I do, believe it. -*-
------------------------------
Date: Fri, 28 Nov 2003 22:03:13 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Perl SSL Variable
Message-Id: <Pine.LNX.4.53.0311282155190.6681@ppepc56.ph.gla.ac.uk>
On Fri, 28 Nov 2003, Big and Blue wrote:
> So, as has been noted, nothing to do with Perl, actually something to
> do (probably) how CGI works.
CGI is an interworking specification. Nothing specific to Perl,
though, as you rightly say.
> Of course, *all* of this is dependent on the Web server you are
> actually using and how it has been configured.
If it's part of the CGI specification, it's not allowed to be
dependent on the Web server. You'd have to be a monopoly vendor to be
able to get away with disregarding that.
So which is it? - except that the answer is also off-topic here :-}
> You could always try a simple approach and add a short script to you
> Web server which just echoes all of the keys in %ENV (and their values)
Well, you _could_, but if you want to develop something reliable,
perhaps you'd do better to read the interworking specification to find
out what it does (and more importantly, does not) require the server
to do.
If (for whatever reason) you want it to work not only with
interworking software but also with a certain monopoly vendor, then
you'd have a bit more work to do.
But it would be no different in principle if you were developing your
server-side software in COBOL or whatever. So we're still in the
wrong place to discuss those aspects.
------------------------------
Date: Fri, 28 Nov 2003 18:56:21 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Perl unicode and :crlf, was Re: regexp: \x0a => \x0d\x0a
Message-Id: <Pine.LNX.4.53.0311281824460.6403@ppepc56.ph.gla.ac.uk>
On Fri, 28 Nov 2003, Ben Morrow wrote:
> Please excuse the rather long post.
Speaking for myself (and who else is going to do that if I don't? ;-)
I'm extremely grateful to have your input on this, as I had been
beginning to think I was doing something seriously wrong with the
layers. Anyway, some technical detail makes a pleasant change from
the interminable arguments from crabby newbies who want to impose
their TOFU-posting and FAQ-ignorant demands around here.
Incidentally I've found that for utf-8 data the "od -t x1" format is
handy, rather than "od -x".
This is only a partial response. I'll be looking at this some more
yet. (Just for interest's sake, actually. I don't actually play
with the Microsoft train sim myself[1], which is what lay behind the
originally posted problem.)
> So the problem here is that :crlf fails to set the utf8 flag on the
> data when it should.
Aha, looks like a key observation...
> This is not actually quite such nonsense as it seems: because 'od -x'
> byteswaps everything,
(that's why I recommend od -t x1 instead...)
> the file actually ends '6f 00 0d 0a 00 0d 0a 00',
> which is the perfectly reasonable result of treating the binary
> UTF16 data as text.
Good point.
> Having a look at perlio.c suggests to me (though I can't entirely
> follow it) that a :crlf layer always has PERLIO_F_UTF8 off, when in
> fact it should check the state of the layer below and set itself
> accordingly.
Sounds right to me. Is one of us expected to call this in as a bug,
or do we have developers lurking who would be willing to take this on?
> Having a think about the issued involved suggests to me
> that Microsoft should *really* have taken to opportunity of changing
> to utf16 to ditch using \r\n... but there we go.
I like that idea, but as you say, it's a bit late for them to do that
now.
> I would seriously consider not using :crlf at all, but instead writing
> a :nl layer that maps any of \n, \r, \r\n to \n on input and any of
> \n, \r, \r\n to \r\n on output... seems to me that'd be more use, in
> general. I guess it would probably be slower.
If it was part of the infrastructure, I doubt that the difference in
speed would be noticeable.
Whenever this topic comes up, there's usually someone who offers
anomalous data and asks what we'd do with it (mixed unix/mac/dos
newlines...), but that's just as much a problem for :crlf as it would
be for your hypothetical :nl, so I don't see it as a show-stopper.
thanks for the observations, anyway. In fact you're clearly ahead of
me. all the best
[1] I will admit to playing with BVE, http://mackoy.cool.ne.jp/
but that's entirely off-topic here!
------------------------------
Date: 28 Nov 2003 11:56:06 -0800
From: vvz2@yahoo.com (Felix Smith)
Subject: Seeking Perl / Linux tutor
Message-Id: <901f024b.0311281156.68938ac5@posting.google.com>
I am looking for a Linux/ Perl tutor who I can contact via Yahoo
Instant Messenger to obtain instant advice when needed. Compensation
will be on an incident by incident basis. Fluency in English is
required.
I already have intermediate skills in both, Linux and Perl.
The Yahoo IM requirement is an important one since I would like to be
able to obtain advice instantly when I need it. Ideally, you already
have a habit of usually being online with Yahoo IM.
If interested, please contact me at www.7xyz.com/perl
Please provide professional references if possible.
Thank you.
------------------------------
Date: Sat, 29 Nov 2003 02:04:50 GMT
From: ww <ww3140@_yah-oo.com>
Subject: Re: Seeking Perl / Linux tutor
Message-Id: <3ivfsvou2jj2306f0flphbivk8cipmiah5@4ax.com>
Good luck trying to get somone to stay up all day and night waiting on
your IM.
try this http://perlmonks.com/index.pl?node=fullpage+chat instead.
Yoll need to make an account to chat tho.
-w w
On 28 Nov 2003 11:56:06 -0800, vvz2@yahoo.com (Felix Smith) wrote:
>I am looking for a Linux/ Perl tutor who I can contact via Yahoo
>Instant Messenger to obtain instant advice when needed. Compensation
>will be on an incident by incident basis. Fluency in English is
>required.
>
>I already have intermediate skills in both, Linux and Perl.
>
>The Yahoo IM requirement is an important one since I would like to be
>able to obtain advice instantly when I need it. Ideally, you already
>have a habit of usually being online with Yahoo IM.
>
>If interested, please contact me at www.7xyz.com/perl
>
>Please provide professional references if possible.
>
>Thank you.
------------------------------
Date: Fri, 28 Nov 2003 19:52:16 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: sorting multiple different entries using Perl
Message-Id: <Xns9441D476D93CCsdn.comcast@216.196.97.136>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
ramthen@yahoo.com (rusneht) wrote in
news:ab96940e.0311252023.6f5d831f@posting.google.com:
> Data that I need to handle is this:
>
> /vob/dir/file1@@/br1/10
> /vob/dir/file1@@/br1/9
> /vob/dir/file1@@/br1/8
> /vob/dir/file2@@/br1/3
> /vob/dir/file4@@/br1/7
>
> I would like to extract from this list, not unique values, but an
> output like this :
>
> /vob/dir/file1@@/br1/10
> /vob/dir/file1@@/br1/8
> /vob/dir/file2@@/br1/3
> /vob/dir/file4@@/br1/7
>
> As you can see if a file has multiple entrues I would like to take
> most recent and old ones from list; if only one entry for a file only
> that needs to be extracted.
I don't follow what you mean by "most recent and old ones". Why is br1/9
not output for file1, but br1/10 and br1/8 are?
- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBP8f8A2PeouIeTNHoEQLYLwCg8bhs/P1TYHJprT2dHIZcK4eVH7QAoJEx
HIeQB8PbUg9L1Nh3Kv8Vf/UW
=PG2u
-----END PGP SIGNATURE-----
------------------------------
Date: Fri, 28 Nov 2003 20:50:47 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: store password in a module ?
Message-Id: <bq8cf7$mb3$1@wisteria.csv.warwick.ac.uk>
ctcgag@hotmail.com wrote:
> I think it would pretty elegant if there were a variant of "use", let's
> call it "abuse", which instead of loading and compiling the abused module
> into the original executing interpreter, would instead fire up a setuid
> interpreter for the module, acting as a server, and connect the abusing
> module to it as a client. Then it would do all the necessary shenanigans
> to make it (mostly) transparent.
http://morrow.me.uk/Acme-Abuse-0.02.tar.gz
Quite a lot of emphasis on the 'mostly' :).
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: Fri, 28 Nov 2003 19:15:37 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: subnets eating each other?
Message-Id: <20031128141537.49f3b4c7.jwillmore@remove.adelphia.net>
On Fri, 28 Nov 2003 19:19:19 +0100
Matija Papec <perl@my-header.org> wrote:
>
> I would like to discover situations when one ip/mask is able to
> cover another one, eg. does 22.122.0.0/16 cover 122.0.0.0/24?
> I made integer conversion for ip/mask but don't know what to do
> further..
*If* you wanted to use a module, you could use the Net::Netmask module
(http://search.cpan.org/~muir/Net-Netmask-1.9004/Netmask.pod)
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 ...
Confidence is the feeling you have before you understand the
situation.
------------------------------
Date: Fri, 28 Nov 2003 21:00:52 +0100
From: Matija Papec <perl@my-header.org>
Subject: Re: subnets eating each other?
Message-Id: <o7afsvcaubc4l5nb6452r6364if8ov864o@4ax.com>
X-Ftn-To: James Willmore
James Willmore <jwillmore@remove.adelphia.net> wrote:
>> I would like to discover situations when one ip/mask is able to
>> cover another one, eg. does 22.122.0.0/16 cover 122.0.0.0/24?
>> I made integer conversion for ip/mask but don't know what to do
>> further..
>
>*If* you wanted to use a module, you could use the Net::Netmask module
>(http://search.cpan.org/~muir/Net-Netmask-1.9004/Netmask.pod)
Right now I'm looking at it, tnx! :)
--
Matija
------------------------------
Date: Fri, 28 Nov 2003 23:12:52 +0100
From: Matija Papec <perl@my-header.org>
Subject: Re: subnets eating each other?
Message-Id: <fohfsvo75n398771utmss76kvaaa21jep6@4ax.com>
X-Ftn-To: Matija Papec
Matija Papec <perl@my-header.org> wrote:
>>> I would like to discover situations when one ip/mask is able to
>>> cover another one, eg. does 22.122.0.0/16 cover 122.0.0.0/24?
>>> I made integer conversion for ip/mask but don't know what to do
>>> further..
>>
>>*If* you wanted to use a module, you could use the Net::Netmask module
>>(http://search.cpan.org/~muir/Net-Netmask-1.9004/Netmask.pod)
>
>Right now I'm looking at it, tnx! :)
Unfortunately Netmask.pm does not what I want, it can't tell if
22.3.0.0/16 can "eat" 22.3.1.0/24
cmpblocks does just simple check,
$_[0]->{IBASE} <=> $_[1]->{IBASE} || $_[0]->{BITS} <=> $_[1]->{BITS}
--
Matija
------------------------------
Date: Sat, 29 Nov 2003 00:19:55 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Using perl -e to remove times/dates from a file
Message-Id: <3ptesvgh6i7s65qsc3hkoon81l33a9eq2b@4ax.com>
On Fri, 28 Nov 2003 10:16:15 -0000, "Paul Tomlinson"
<rubberducky703@hotmail.com> wrote:
>All I have a file called "DirList.txt" which was generated by redirecting
>the results of a DOS dir to a file.
>
>What I want is to have perl remove the times (and preferably dates) from
>this file.
perl -lpi.bak -e "s|\d{2}/d{2}/\d{2}\s+\d+.\d{2}||" DirList.txt
or some reasonable variation. But isn't it that you really needed
dir /b
>c:\perl\bin\perl.exe -e tr/09:36//; "c:\DirList.txt"
>
>I know that this will only translate the time 09:36 to null but for now
>anything is a start.
NO! It will do something different.
Michele
--
# This prints: Just another Perl hacker,
seek DATA,15,0 and print q... <DATA>;
__END__
------------------------------
Date: Fri, 28 Nov 2003 18:41:48 -0500
From: "Jenny" <bry333@bellsouth.net>
Subject: Will trade money for quick help
Message-Id: <12Rxb.5033$5d.218@bignews4.bellsouth.net>
I have a freebie whois script I got for our webserver so that visitors can
check to see if a website name is available.. It is based on the webwho
script (which is great) from http://www.webwho.co.uk/ and I have figured
out everything but I
have one other change that I want to make that I can't figure out. I will
paypal whoever can fix this last thing $25. If you email me, I will send
you the current state of the cgi script and details on the one thing I can't
figure out. Time is of the essence and first person to respond that gives
me the fix, gets the money. Jenny at bry333@bellsouth.net
Thanks
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 5871
***************************************