[28884] in Perl-Users-Digest
Perl-Users Digest, Issue: 128 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 12 16:12:33 2007
Date: Mon, 12 Feb 2007 13:09:25 -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 Mon, 12 Feb 2007 Volume: 11 Number: 128
Today's topics:
Accessing Access QoS@domain.invalid.com
Re: Accessing Access (Marc Espie)
ANNOUNCE: XMail::Install V 1.00 <ron@savage.net.au>
Basic question...? <edMbj@aes-intl.com>
Re: Basic question...? <edMbj@aes-intl.com>
Re: Basic question...? <lambik@kieffer.nl>
Re: Basic question...? <edMbj@aes-intl.com>
Re: Basic question...? <spamtrap@dot-app.org>
Re: Basic question...? <edMbj@aes-intl.com>
Re: Basic question...? <someone@example.com>
Re: Basic question...? <spamtrap@dot-app.org>
Build libperl.so shared library from static library or <DJStunks@gmail.com>
Re: Build libperl.so shared library from static library <spamtrap@dot-app.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 12 Feb 2007 17:22:27 GMT
From: QoS@domain.invalid.com
Subject: Accessing Access
Message-Id: <nn1Ah.2617$2%1.2205@trndny02>
Hello, what would be a good module for accessing data contained in
a MS Access database file? Are there any examples of doing this
that you know of?
------------------------------
Date: Mon, 12 Feb 2007 20:08:50 +0000 (UTC)
From: espie@lain.home (Marc Espie)
Subject: Re: Accessing Access
Message-Id: <eqqhgi$2fja$1@biggoron.nerim.net>
In article <nn1Ah.2617$2%1.2205@trndny02>, <QoS@domain.invalid.com> wrote:
>
>Hello, what would be a good module for accessing data contained in
>a MS Access database file? Are there any examples of doing this
>that you know of?
Depends what kind of platform you can use.
If you are under Windows, DBD::ODBC will work wonders.
If you `bridge' Windows <-> Unix, you can set up a DBI::ProxyServer on
a windows box using DBD::ODBC, and talk to it from a DBD::Proxy on the Unix
machine (works wonders, allows you to read and write stuff, the only problem
I've had so far with it is that it cannot be used to dump schema via
DBIx::Class::Schema::Loader).
If you just have the Access file on a new windows machine, as far as I can
tell, you can use commercial tools that I don't know quite well, or you can
use a sourceforge project called mdbtools. The main catch with it is that
they don't release very often, the official release does not read a lot
of Access files correctly, and you will have to compile it from CVS.
The end result is not a DBD driver, it's a bit more akward to use. And I
wouldn't use it to write to the database...
KDE also includes keximdb along its koffice suite. I have little experience
with it, but it should be usable to convert access files.
------------------------------
Date: Sun, 11 Feb 2007 02:51:03 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: XMail::Install V 1.00
Message-Id: <JDA809.1MLz@zorch.sf-bay.org>
The pure Perl module XMail::Install V 1.00
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
Revision history for Perl extension XMail::Install.
1.00 Tue Jan 09 11:30:45 2007
- Original version
------------------------------
Date: Sun, 11 Feb 2007 10:53:52 -0800
From: Ed Jay <edMbj@aes-intl.com>
Subject: Basic question...?
Message-Id: <f4pus2t3rg4m92nlhc6oufadoohqtd6d10@4ax.com>
I'm a newbie trying to learn a bit about Perl. I'm currently working with
files.
My example.txt file comprises several lines of raw text, each line of text
terminates with a CR/LF.
My script:
chdir $rptPath;
local ($filename) = "example.txt";
open (TFILE,"<$filename") or die $!;
local ($filename) = "example2.txt";
open (T2FILE,">$filename") or die $!;;
while (<TFILE>) {
print ": $_ <br>";
print T2FILE ": $_ ";
}
close (TFILE);
close (T2FILE);
rename ($example2.txt, $test.txt) or die $!;
The script doesn't crash, but I'm having two issues:
The lines are printed to the screen properly, but in the file example2.txt,
the lines are double-spaced. Additionally, example2.txt is not undergoing
the name change, although I'm getting no warning or die. I've read and read
until my eyes are purple, but I can't find what am I missing that's causing
these two issues. Hints (or answers), please.
--
Ed Jay (remove 'M' to respond by email)
------------------------------
Date: Sun, 11 Feb 2007 11:13:14 -0800
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Basic question...?
Message-Id: <6kqus2hmo7e545t57frp07037p4tktmd0o@4ax.com>
Ed Jay scribed:
>I'm a newbie trying to learn a bit about Perl. I'm currently working with
>files.
>
>My example.txt file comprises several lines of raw text, each line of text
>terminates with a CR/LF.
>
>My script:
>
>chdir $rptPath;
>
>local ($filename) = "example.txt";
>open (TFILE,"<$filename") or die $!;
>
>local ($filename) = "example2.txt";
>open (T2FILE,">$filename") or die $!;;
>
>while (<TFILE>) {
>print ": $_ <br>";
>print T2FILE ": $_ ";
>}
>
>close (TFILE);
>close (T2FILE);
>rename ($example2.txt, $test.txt) or die $!;
>
>The script doesn't crash, but I'm having two issues:
>
>The lines are printed to the screen properly, but in the file example2.txt,
>the lines are double-spaced.
Solved the double-spacing issue...a dumb error on my part.
>Additionally, example2.txt is not undergoing
>the name change, although I'm getting no warning or die.
Still battling this one.
--
Ed Jay (remove 'M' to respond by email)
------------------------------
Date: Sun, 11 Feb 2007 20:46:37 +0100
From: "Lambik" <lambik@kieffer.nl>
Subject: Re: Basic question...?
Message-Id: <45cf71ca$0$757$5fc3050@dreader2.news.tiscali.nl>
"Ed Jay" <edMbj@aes-intl.com> wrote in message
news:f4pus2t3rg4m92nlhc6oufadoohqtd6d10@4ax.com...
> I'm a newbie trying to learn a bit about Perl. I'm currently working with
> files.
>
> My example.txt file comprises several lines of raw text, each line of text
> terminates with a CR/LF.
>
> My script:
>
> chdir $rptPath;
>
> local ($filename) = "example.txt";
> open (TFILE,"<$filename") or die $!;
>
> local ($filename) = "example2.txt";
> open (T2FILE,">$filename") or die $!;;
>
> while (<TFILE>) {
> print ": $_ <br>";
> print T2FILE ": $_ ";
> }
>
> close (TFILE);
> close (T2FILE);
> rename ($example2.txt, $test.txt) or die $!;
Why the '$' ? You have a variable namend $example2 and $tekst? Else it
renames ".txt" to ".txt"
------------------------------
Date: Sun, 11 Feb 2007 11:50:06 -0800
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Basic question...?
Message-Id: <qqsus2dkr1fao3sqm82fomk7idfvtp3g4h@4ax.com>
Lambik scribed:
>
>"Ed Jay" <edMbj@aes-intl.com> wrote in message
>news:f4pus2t3rg4m92nlhc6oufadoohqtd6d10@4ax.com...
>> I'm a newbie trying to learn a bit about Perl. I'm currently working with
>> files.
>>
>> My example.txt file comprises several lines of raw text, each line of text
>> terminates with a CR/LF.
>>
>> My script:
>>
>> chdir $rptPath;
>>
>> local ($filename) = "example.txt";
>> open (TFILE,"<$filename") or die $!;
>>
>> local ($filename) = "example2.txt";
>> open (T2FILE,">$filename") or die $!;;
>>
>> while (<TFILE>) {
>> print ": $_ <br>";
>> print T2FILE ": $_ ";
>> }
>>
>> close (TFILE);
>> close (T2FILE);
>> rename ($example2.txt, $test.txt) or die $!;
>
>Why the '$' ? You have a variable namend $example2 and $tekst? Else it
>renames ".txt" to ".txt"
>
Doh! Thank you.
--
Ed Jay (remove 'M' to respond by email)
------------------------------
Date: Sun, 11 Feb 2007 15:05:22 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Basic question...?
Message-Id: <m2hctse9z1.fsf@local.wv-www.com>
Ed Jay <edMbj@aes-intl.com> writes:
> My example.txt file comprises several lines of raw text, each line of text
> terminates with a CR/LF.
>
> My script:
Always, yes always, ask Perl for as much helpful info as it can give you:
use strict;
use warnings;
> chdir $rptPath;
>
> local ($filename) = "example.txt";
Local() doesn't do what you think it does. Don't use local() for this, use
a lexical variable:
my $filename = 'example.txt';
See "perldoc -f local" and "perldoc -f my" for details.
> open (TFILE,"<$filename") or die $!;
Good job, checking for errors! Most newbies forget that for some reason.
It could be better though; you could use lexical file handles, 3-argument
open(), and expand on the error message a little:
open (my $input_file, '<', $filename) or
die "Could not open $filename for input: $!";
Have a look at "perldoc perlopentut" for more.
> local ($filename) = "example2.txt";
If this were a lexical, you wouldn't need to re-declare it:
$filename = 'example2.txt';
> open (T2FILE,">$filename") or die $!;;
Ditto above:
open (my $output_file, '>', $filename) or
die "Could not open $filename for output: $!";
> while (<TFILE>) {
> print ": $_ <br>";
> print T2FILE ": $_ ";
> }
>
> close (TFILE);
> close (T2FILE);
Close() can fail too - check for errors:
close($input_file) or die "Could not close input: $!";
close($output_file) or die "Could not close output: $!";
> rename ($example2.txt, $test.txt) or die $!;
Perl would have reported an error here, if you had asked it to. The dot
operator is string concatenation - see "perldoc perlop". So, what you're
trying to do here is call a sub txt(), and append the result to the value
of the $example2 variable, and then repeat that with $test.
The problem is, you have neither variable $example2 nor $test, and no sub
named txt() to call. You're confusing the use of $ to refer to a scalar
variable, and the quotes '' that are used to refer to a literal string:
rename ( 'example2.txt', 'test.txt' ) or die "Could not rename: $!";
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Sun, 11 Feb 2007 12:18:10 -0800
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Basic question...?
Message-Id: <4fuus2pdguja4k361ppf5odrtmds7c7j29@4ax.com>
Sherm Pendley scribed:
>Ed Jay <edMbj@aes-intl.com> writes:
>
>> My example.txt file comprises several lines of raw text, each line of text
>> terminates with a CR/LF.
>>
>> My script:
>
>Always, yes always, ask Perl for as much helpful info as it can give you:
>
>use strict;
>use warnings;
>
>> chdir $rptPath;
>>
>> local ($filename) = "example.txt";
>
>Local() doesn't do what you think it does. Don't use local() for this, use
>a lexical variable:
>
>my $filename = 'example.txt';
>
>See "perldoc -f local" and "perldoc -f my" for details.
>
>> open (TFILE,"<$filename") or die $!;
>
>Good job, checking for errors! Most newbies forget that for some reason.
>It could be better though; you could use lexical file handles, 3-argument
>open(), and expand on the error message a little:
>
>open (my $input_file, '<', $filename) or
> die "Could not open $filename for input: $!";
>
>Have a look at "perldoc perlopentut" for more.
>
>> local ($filename) = "example2.txt";
>
>If this were a lexical, you wouldn't need to re-declare it:
>
>$filename = 'example2.txt';
>
>> open (T2FILE,">$filename") or die $!;;
>
>Ditto above:
>
>open (my $output_file, '>', $filename) or
> die "Could not open $filename for output: $!";
>
>> while (<TFILE>) {
>> print ": $_ <br>";
>> print T2FILE ": $_ ";
>> }
>>
>> close (TFILE);
>> close (T2FILE);
>
>Close() can fail too - check for errors:
>
>close($input_file) or die "Could not close input: $!";
>close($output_file) or die "Could not close output: $!";
>
>> rename ($example2.txt, $test.txt) or die $!;
>
>Perl would have reported an error here, if you had asked it to. The dot
>operator is string concatenation - see "perldoc perlop". So, what you're
>trying to do here is call a sub txt(), and append the result to the value
>of the $example2 variable, and then repeat that with $test.
>
>The problem is, you have neither variable $example2 nor $test, and no sub
>named txt() to call. You're confusing the use of $ to refer to a scalar
>variable, and the quotes '' that are used to refer to a literal string:
>
>rename ( 'example2.txt', 'test.txt' ) or die "Could not rename: $!";
>
Thanks a lot Sherm. I appreciate your comprehensive response...a bunch.
--
Ed Jay (remove 'M' to respond by email)
------------------------------
Date: Sun, 11 Feb 2007 20:27:00 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Basic question...?
Message-Id: <o_Kzh.51383$Fd.29858@edtnps90>
Sherm Pendley wrote:
> Ed Jay <edMbj@aes-intl.com> writes:
>>
>>rename ($example2.txt, $test.txt) or die $!;
>
> Perl would have reported an error here, if you had asked it to. The dot
> operator is string concatenation - see "perldoc perlop". So, what you're
> trying to do here is call a sub txt(), and append the result to the value
> of the $example2 variable, and then repeat that with $test.
Actually, without warnings or strict enabled and without a subroutine named
'txt' perl is interpreting that line as:
rename( $example2 . 'txt', $test . 'txt' ) or die $!;
Or to put it another way:
rename( "${example2}txt", "${test}txt" ) or die $!;
Use B::Deparse to see for yourself. :-)
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: Sun, 11 Feb 2007 16:07:25 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Basic question...?
Message-Id: <m2abzke73m.fsf@local.wv-www.com>
"John W. Krahn" <someone@example.com> writes:
> Sherm Pendley wrote:
>> Ed Jay <edMbj@aes-intl.com> writes:
>>>
>>>rename ($example2.txt, $test.txt) or die $!;
>>
>> Perl would have reported an error here, if you had asked it to. The dot
>> operator is string concatenation - see "perldoc perlop". So, what you're
>> trying to do here is call a sub txt(), and append the result to the value
>> of the $example2 variable, and then repeat that with $test.
>
> Actually, without warnings or strict enabled and without a subroutine named
> 'txt' perl is interpreting that line as:
>
> rename( $example2 . 'txt', $test . 'txt' ) or die $!;
I knew barewords are legal as hash keys, but I thought that was a special
case that only applied there. I didn't realize how permissive Perl is about
them in other places when strict 'subs' isn't active - probably because in
my own code it's always active. :-)
The barewords section of "perldoc perldata" was an eye-opener!
> Or to put it another way:
>
> rename( "${example2}txt", "${test}txt" ) or die $!;
>
>
> Use B::Deparse to see for yourself. :-)
No need. For one thing, I've no reason to doubt your word. And for another,
upon reflection my own explanation makes no sense. :-(
Ed said his script wasn't crashing, but if Perl were interpreting txt as a
call to an unknown sub as I suggested, he would have gotten an error.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: 9 Feb 2007 20:16:06 -0800
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Build libperl.so shared library from static library or source?
Message-Id: <1171080966.451540.258230@v33g2000cwv.googlegroups.com>
Hey all,
I recently installed RHEL4, which included an RPM'd Perl (5.8.5
IIRC). I downloaded the source for Perl 5.8.8 which I managed to
build and install but I didn't opt to build the shared library
libperl.so.
After the newly built Perl seemed happy, I tore out the RPM'd Perl,
and replaced /usr/bin/perl with a link to the new executable.
However, /usr/bin/vim (and probably many other programs) are still
looking for the shared library.
Question: as I'm far from expert in this field, can I somehow build a
shared version of libperl either from libperl.a or from the source
files, or do I need to go through the entire Configure/make/test/
install procedure from scratch making sure I select the shared library
option?
TIA,
-jp
------------------------------
Date: Sat, 10 Feb 2007 06:18:47 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Build libperl.so shared library from static library or source?
Message-Id: <m2zm7mdzvs.fsf@local.wv-www.com>
"DJ Stunks" <DJStunks@gmail.com> writes:
> I recently installed RHEL4, which included an RPM'd Perl (5.8.5
> IIRC). I downloaded the source for Perl 5.8.8 which I managed to
> build and install but I didn't opt to build the shared library
> libperl.so.
>
> After the newly built Perl seemed happy, I tore out the RPM'd Perl,
> and replaced /usr/bin/perl with a link to the new executable.
> However, /usr/bin/vim (and probably many other programs) are still
> looking for the shared library.
That's why most admins don't touch the vendor-supplied Perl. Too many things
depend on it, from applications that are linked to libperl to scripts that
haven't been fully tested on other versions.
> Question: as I'm far from expert in this field, can I somehow build a
> shared version of libperl either from libperl.a or from the source
> files, or do I need to go through the entire Configure/make/test/
> install procedure from scratch making sure I select the shared library
> option?
A better idea: Just reinstall the system Perl from RPMs. Seriously. Apps
that link against libperl are only binary-compatible with an identically-
configured libperl with the same minor version number, and even then it's
not a sure thing. There are often problems from one patch release to the
next too - i.e. 5.8.[012] for instance, where the changing hash algorithm
resulted in broken binary compatibility.
In other words, you can't simply plop any random libperl into the directory
where the vendor libperl was, and expect vim et al to be able to deal with
it. It has to be one that's identically configured, and very close to the
same version - and if that were the case, you probably be just as well off
using the vendor Perl anyway.
It's far more reliable, and far easier, to simply install your customized
Perl in an out-of-the-way location, and begin your scripts with a shebang
line that points to it, such as #!/usr/local/bin/perl.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
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 128
**************************************