[25151] in Perl-Users-Digest
Perl-Users Digest, Issue: 7400 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 13 06:05:39 2004
Date: Sat, 13 Nov 2004 03:05:15 -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 Sat, 13 Nov 2004 Volume: 10 Number: 7400
Today's topics:
Re: backreferneces in search pattern <eric-amick@comcast.net>
Re: Binary files in PERL? <flavell@ph.gla.ac.uk>
Re: Could someone swing by the Lakes? (Becky)
FAQ 1.10: Can I do [task] in Perl? <comdog@panix.com>
FAQ 4.23: How do I find matching/nesting anything? <comdog@panix.com>
Re: Fun problem: Overlapping words (Anno Siegel)
Re: Fun problem: Overlapping words <wyzelli@yahoo.com>
Re: how greedy is nongreedy in regexp ? <nobull@mail.com>
Re: how greedy is nongreedy in regexp ? <nobull@mail.com>
Re: how greedy is nongreedy in regexp ? <nobull@mail.com>
Re: Perl golf: lowercasing all path names <lv@aol.com>
Re: syntax problem <noreply@gunnar.cc>
Re: syntax problem <jurgenex@hotmail.com>
Using DBI for Remote myql connection <thelma@alpha2.csd.uwm.edu>
Re: Using DBI for Remote myql connection <jwillmore@fastmail.us>
Re: Using DBI for Remote myql connection <spamtrap@dot-app.org>
Re: Using DBI for Remote myql connection <nospam@bigpond.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 12 Nov 2004 19:58:17 -0500
From: Eric Amick <eric-amick@comcast.net>
Subject: Re: backreferneces in search pattern
Message-Id: <btmap0pgsahio7ts0k4abs1pm41opve46v@4ax.com>
On Fri, 12 Nov 2004 21:49:03 +0000 (UTC), Hue-Bond
<responder_solo_en_el_grupo@yahoo.es> wrote:
>Marek Stepanek, Fri20041112@20:42:43(CET):
>>
>> while (<>) {
>> my @results =
>> m!onmouseover="[^']+'([^']+)'(?:(?:(?:;\s+[^']+)'([^']+)')+)?(?:(?:[^']+)'([
>> ^']+)')?"!g;
>> foreach $i (0..$#results) {
>> print "'", $i, "',\n";
>> }
>> }
>>
>> but this gives me a funny result :
>>
>> '0',
>> '1',
>> '2',
>
>I think you want to print $results[$i] instead.
Better still
foreach $i (@results) {
print "'$i'\n";
}
or even
print "'$_'\n" for @results;
--
Eric Amick
Columbia, MD
------------------------------
Date: Sat, 13 Nov 2004 00:19:47 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Binary files in PERL?
Message-Id: <Pine.LNX.4.61.0411130011100.22282@ppepc56.ph.gla.ac.uk>
On Thu, 11 Nov 2004, Arndt Jonasson wrote:
> "Alan J. Flavell" <flavell@ph.gla.ac.uk> writes:
> [about using and not using 'binmode']
> > Indeed. And of course it also makes software less portable to
> > other platforms - even in those older Perl versions. Which might
> > be what the unix bigots were hoping - but that's hardly to be
> > commended, in a language like Perl which aims to be rather
> > platform-neutral.
>
> Were you feeling a little conspirational when you wrote the above?
My own feelings are surely of little importance here. More to the
point is what Perl is aiming at.
And I'm glad to see that subsequent Perl developments have favoured
portability.
As it happens, I don't write programs for the Windows environment, and
I never even used OS/2 in earnest. But as someone who met their first
computer in 1958, and have used multiple architectures and OSes
(VAX/VMS might be worthy of note), I do think I have a certain
weakness for portability, and was not well pleased by those Unix
bigots who (by their actions) apparently didn't have the confidence
that unix-like OSes would win on their own merits, and implied that
they needed to be promoted by bigotry instead.
all the best
------------------------------
Date: Fri, 12 Nov 2004 23:12:17 GMT
From: misfitskissfan@aol.com (Becky)
Subject: Re: Could someone swing by the Lakes?
Message-Id: <4195432b.31979046@decaxp.HARVARD.EDU>
On Fri, 12 Nov 2004 22:58:27 GMT, "Rusty Swing" <rustyswing@yahoo.com>
wrote:
>Could someone swing by The Lakes and check on Big Mikey?
>
I did but it turns out he doesn't live there.
------------------------------
Date: Sat, 13 Nov 2004 05:03:02 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 1.10: Can I do [task] in Perl?
Message-Id: <cn44i6$t37$1@reader1.panix.com>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.
--------------------------------------------------------------------
1.10: Can I do [task] in Perl?
Perl is flexible and extensible enough for you to use on virtually any
task, from one-line file-processing tasks to large, elaborate systems.
For many people, Perl serves as a great replacement for shell scripting.
For others, it serves as a convenient, high-level replacement for most
of what they'd program in low-level languages like C or C++. It's
ultimately up to you (and possibly your management) which tasks you'll
use Perl for and which you won't.
If you have a library that provides an API, you can make any component
of it available as just another Perl function or variable using a Perl
extension written in C or C++ and dynamically linked into your main perl
interpreter. You can also go the other direction, and write your main
program in C or C++, and then link in some Perl code on the fly, to
create a powerful application. See perlembed.
That said, there will always be small, focused, special-purpose
languages dedicated to a specific problem domain that are simply more
convenient for certain kinds of problems. Perl tries to be all things to
all people, but nothing special to anyone. Examples of specialized
languages that come to mind include prolog and matlab.
--------------------------------------------------------------------
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-2002 Tom Christiansen and Nathan
Torkington, and other contributors as noted. All rights
reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
------------------------------
Date: Sat, 13 Nov 2004 11:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 4.23: How do I find matching/nesting anything?
Message-Id: <cn4pl5$55p$1@reader1.panix.com>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.
--------------------------------------------------------------------
4.23: How do I find matching/nesting anything?
This isn't something that can be done in one regular expression, no
matter how complicated. To find something between two single characters,
a pattern like "/x([^x]*)x/" will get the intervening bits in $1. For
multiple ones, then something more like "/alpha(.*?)omega/" would be
needed. But none of these deals with nested patterns. For balanced
expressions using "(", "{", "[" or "<" as delimiters, use the CPAN
module Regexp::Common, or see "(??{ code })" in perlre. For other cases,
you'll have to write a parser.
If you are serious about writing a parser, there are a number of modules
or oddities that will make your life a lot easier. There are the CPAN
modules Parse::RecDescent, Parse::Yapp, and Text::Balanced; and the
byacc program. Starting from perl 5.8 the Text::Balanced is part of the
standard distribution.
One simple destructive, inside-out approach that you might try is to
pull out the smallest nesting parts one at a time:
while (s/BEGIN((?:(?!BEGIN)(?!END).)*)END//gs) {
# do something with $1
}
A more complicated and sneaky approach is to make Perl's regular
expression engine do it for you. This is courtesy Dean Inada, and rather
has the nature of an Obfuscated Perl Contest entry, but it really does
work:
# $_ contains the string to parse
# BEGIN and END are the opening and closing markers for the
# nested text.
@( = ('(','');
@) = (')','');
($re=$_)=~s/((BEGIN)|(END)|.)/$)[!$3]\Q$1\E$([!$2]/gs;
@$ = (eval{/$re/},$@!~/unmatched/i);
print join("\n",@$[0..$#$]) if( $$[-1] );
--------------------------------------------------------------------
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-2002 Tom Christiansen and Nathan
Torkington, and other contributors as noted. All rights
reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
------------------------------
Date: 13 Nov 2004 00:49:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Fun problem: Overlapping words
Message-Id: <cn3lmv$lki$1@mamenchi.zrz.TU-Berlin.DE>
Stuart Moore <usenet_05_08_2004@stuartmoore.org.uk> wrote in comp.lang.perl.misc:
> A bit of a poser for anyone bored:
>
> I was chatting with some friends, and we were trying to work out
> suitable strings of letters which could have spaces and punctuation in
> different places to produce different sentences
>
> e.g.
>
> Therestopenlarge
>
> parses to
>
> There stop enlarge
> or
> The rest open large
>
> Anyone have an idea of a good perl program to work these out? My
> thoughts so far involved grabbing words from /usr/share/dict/words (or
> whatever the equivalent is on your system) and loading them into a hash
> so it's quick to see if foo is a word; choosing one at random (e.g.
> there); trying to find a subword (e.g. the), then looking for a word
> starting with the difference (e.g. re.*) until you end up with a
> suitable string. Then repeat.
>
> My hope is to find some that make sense, but I'm not optimistic.
I think the basic problem is to find, in a large word list, all
words that begin with a given string (whether itself a word or not).
If that is taken as a basic operation, an algorithm shouldn't be
too hard to work out (though I haven't done it).
That would suggest a trie (no typo) structure, which supports
exactly this retrieval by prefix. There are a few modules on
CPAN that implement tries. Could be interesting how they hold
up against /usr/dict/words.
Anno
------------------------------
Date: Sat, 13 Nov 2004 03:47:33 GMT
From: "Peter Wyzl" <wyzelli@yahoo.com>
Subject: Re: Fun problem: Overlapping words
Message-Id: <ptfld.34315$K7.33861@news-server.bigpond.net.au>
----- Original Message -----
From: "Stuart Moore" <usenet_05_08_2004@stuartmoore.org.uk>
Newsgroups: comp.lang.perl.misc
Sent: Saturday, November 13, 2004 2:42 AM
Subject: Fun problem: Overlapping words
>A bit of a poser for anyone bored:
>
> I was chatting with some friends, and we were trying to work out suitable
> strings of letters which could have spaces and punctuation in different
> places to produce different sentences
>
> e.g.
>
> Therestopenlarge
>
> parses to
>
> There stop enlarge
> or
> The rest open large
Also
Theres to pen large
I wrote a program once (a couple of years ago) to solve the '9 letter
square' problem where you are given 9 letters in a 3 x 3 square and tasked
with making all possible words from the combinations. Also to find the 9
letter 'root' word.
The requirements are : each letter can be used only once, The centre letter
must be used in each word, all words must be 4 letters or more long. There
is also an added requirement that no pronouns are valid and all words must
be found in a standard dictionary (in this case the compton was defined as
the standard).
I post the code below out of interest. Maybe it will give you some starting
ideas, comments welcome. (Some 'prettying' functions have been removed from
the actual program in the interests of brevity)
#!/usr/bin/perl -w
use strict;
usage();
my ($min, $max,) = (4, 9, ); # set defaults
my @letters = getletters();
unless ((scalar @letters) == $max){
error('Incorrect number of letters!');
print scalar @letters, $max;
getletters();
}
my @words = words();
my @results;
for (@words){
next unless m/$letters[4]/;
my @test = @letters;
my @word = split //,$_;
my $length = scalar @word;
my $match = 0;
foreach my $letter (@word){
my $testpos = 0;
foreach my $test (@test){
if ($letter eq $test){
$match += 1;
splice @test, $testpos, 1;
last;
}
$testpos++;
}
}
if ($match == $length){
push @results, $_;
}
}
@results = sort @results;
my $i = 0;
print "\nNumber of words is ", scalar @results, "\n";
foreach my $word (@results){
print "$word\n";
$i++;
if ($i == 20){
print "Press Enter to display more\n";
<STDIN>;
$i = 0;
}
}
print "Press Enter to close\n";
<STDIN>;
exit 1;
#######
# subs
sub getletters{
print "Input the source letters :\n";
chomp ($_ = <STDIN>);
return (split //);
}
sub words { # puzzwords.txt contains my dictionary
open (IN, '<puzzwords.txt') or die "Can't read word file $!\n";
my @words;
while (<IN>){
chomp;
if ((length $_) < $min){
next;
}
if ((length $_) > $max){
next;
}
push @words, $_;
}
return @words;
}
sub error{
my $error = shift;
print "\n$error\n\n";
usage();
}
sub usage{
print <<USAGE;
Puzzwords V 1.0 by Peter Green\npeter\@arafura.net.au
puzzwords.exe [-s, -g]
No option default is Solve min length 4 max length 9
Input number of letters must be the same as the maximum word size (default
9)
Option -s to specify a different minimum and maximum word size when solving
Default is min 4 and max 9
USAGE
}
--
Wyzelli
print 'qwerty is a word???';
------------------------------
Date: Sat, 13 Nov 2004 08:55:10 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: how greedy is nongreedy in regexp ?
Message-Id: <cn4hth$dj5$1@sun3.bham.ac.uk>
Ben Morrow wrote:
> Quoth Brian McCauley <nobull@mail.com>:
>
>>
>>Anno Siegel wrote:
>>
>>>peter pilsl <pilsl@goldfisch.at> wrote in comp.lang.perl.misc:
>>>
>>>
>>>>the following substitution does not what I want. So I ask myself where
>>>>the knot in my brain is this time.
>>>>
>>>>I want to clean up urls and make => a/b/e/f
>>>
>>>
>>>The standard module File::Spec has canonpath() to do this.
>>
>>But since this is a question about canonicalising URLs it would seem
>>more appropriate to use the URI module. However the canonical() method
>>of URI doesn't do this. Is this right or should it be considered a bug
>>in URI?
>
>
> This is right. The only time .. and . are significant in a URI is when
> they are on the left-hand end of a relative URI which is being made
> absolute, when they are specified to mean what you'd expect.
>
> I would consider this a bug in the URI spec, myself; as it means that,
> say,
>
> http://foo/a/./b
>
> is a valid URI distinct from
>
> http://foo/a/b
That's what the RFC says but I think I found another (later?) document
on W3C that says that /./ or /../ are invalid in absolute URLs and must
be written using %2E.
------------------------------
Date: Sat, 13 Nov 2004 09:35:30 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: how greedy is nongreedy in regexp ?
Message-Id: <cn4k96$evt$1@sun3.bham.ac.uk>
Brian McCauley wrote:
> That's what the RFC says but I think I found another (later?) document
> on W3C that says that /./ or /../ are invalid in absolute URLs and must
> be written using %2E.
Found it. It's still a draft but it's also widespread current practice.
http://www.gbiv.com/protocols/uri/rev-2002/draft-fielding-uri-rfc2396bis-07.html#path
and
http://www.gbiv.com/protocols/uri/rev-2002/draft-fielding-uri-rfc2396bis-07.html#relative-dot-segments
"[...] removing the special "." and ".." complete path
segments from referenced path. This is done [...] whether
or not the path was relative, [...]"
Discussion leading to this change can be found here:
http://www.gbiv.com/protocols/uri/rev-2002/issues.html#033-dot-segments
------------------------------
Date: Sat, 13 Nov 2004 10:17:33 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: how greedy is nongreedy in regexp ?
Message-Id: <cn4mo1$g7i$1@sun3.bham.ac.uk>
Joe Schaefer wrote:
> Brian McCauley <nobull@mail.com> writes:
>
>
>>But since this is a question about canonicalising URLs it would seem more
>>appropriate to use the URI module. However the canonical() method of URI
>>doesn't do this. Is this right or should it be considered a bug in URI?
>
>
> I think it mostly depends on whether or not the URI is relative
> or absolute. According to rfc 2396
Yes, I was getting ahead of myself. You are, of course, right about
RFC2396, I was looking at the draft of it's successor.
I think it would be helpful if the URI module had an option to implement
the new semantics since they are already widespread in other software.
Maybe I'll submit a patch.
------------------------------
Date: Fri, 12 Nov 2004 22:33:26 -0600
From: l v <lv@aol.com>
Subject: Re: Perl golf: lowercasing all path names
Message-Id: <41958c3e$1_1@127.0.0.1>
A. Farber wrote:
> Hi,
>
> I need to lowercase all files and directories in the current
> directory on Linux and have come up with the following script:
>
> bolinux72:bin {74} cat lowercase.sh
> #!/bin/sh
>
> # Lowercase the files and sub-directores in the current directory
> # BUGS: does not escape quotes, backslashes and dollars in path names
> # Note: for Unix change -print0 to -print, -n0e to -ne, mv -v to mv
>
> find . -depth -print0 | perl -n0e '
> $old = $_;
> s,([^/]+)$,\L$1,;
> next if $old eq $_;
> die qq{Can not move "$old" to "$_"\n} if -e;
> print qq{mv -v "$old" "$_"\n}' | sh
>
> And 1 line more for the same task, but with uppercased first letter:
>
> bolinux72:bin {75} cat upfirst.sh
> #!/bin/sh
>
> # Uppercase the first letter and lowercase the rest for
> # all files and sub-directores in the current directory
>
> find . -depth -print0 | perl -n0e '
> $old = $_;
> s,([^/]+)$,\L$1,;
> s,([^/]+)$,\u$1,;
> next if $old eq $_;
> die qq{Can not move "$old" to "$_"\n} if -e;
> print qq{mv -v "$old" "$_"\n}' | sh
>
> I wonder, if someone has a nicer solution and what
> would be the best way to handle funny path names?
>
> Regards
> Alex
I had a quick need recently to uppercase installation CD's ftp'd to an
AIX server and quickly hacked out the following. I was in a pinch, 30
minutes from the server room and it was a saturday. Didn't care how
inefficient it was. The unix admins I've worked with always stressed
redirecting the commands to a file to edit/verify what the perl script
created before executing the commands.
It's not nicer, just TIMTOWTDI:
find . -depth | perl -nle '@a = split(/\//, $_); $a[$#a] = lc $a[$#a];
$a[$#a] = ucfirst $a[$#a]; $A = join("/", @a); print "mv $_ $A";' > file.sh
Len
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
------------------------------
Date: Sat, 13 Nov 2004 00:21:22 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: syntax problem
Message-Id: <2vkv2mF2muo2aU1@uni-berlin.de>
Mostafa wrote:
> my($iwperl) = ($^O ne "MSWin32") ? "" : "$iwhome/iw-perl/bin/iwperl ";
>
> here what does thia $^O means ?
Can be looked up in
perldoc perlvar
> and then how "?" is related to this statement?
See the "conditional operator" in
perldoc perlop
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 12 Nov 2004 23:33:02 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: syntax problem
Message-Id: <OKbld.141$J55.39@trnddc06>
Mostafa wrote:
> my($iwperl) = ($^O ne "MSWin32") ? "" : "$iwhome/iw-perl/bin/iwperl ";
>
> here what does thia $^O means ?
See "perldoc perlvar":
$^O The name of the operating system under which this copy of
Perl...
> and then how "?" is related to this statement?
See "perldoc perlop", section "Conditional Operator"
jue
------------------------------
Date: 13 Nov 2004 05:12:51 GMT
From: Thelma Lubkin <thelma@alpha2.csd.uwm.edu>
Subject: Using DBI for Remote myql connection
Message-Id: <cn454j$pkc$1@uwm.edu>
I have only Perl on my home system. I would like to connect to a mysql
database at a system that doesn't have Perl. I thought I could do this
by installing the DBI module. But my attempt to connect apparently
failed because I didn't have DBD for mysql installed. When I tried to
install that I got error messages that seem to indicate that I need to
have mysql installed on my system before I can install that.
Obviously, I'm confused. Can I use DBI to connect to a remote mysql
database without having mysql on my system? If so, how do I install
enough stuff to do that?
thanks,
--thelma
------------------------------
Date: Sat, 13 Nov 2004 01:04:41 -0500
From: James Willmore <jwillmore@fastmail.us>
Subject: Re: Using DBI for Remote myql connection
Message-Id: <pan.2004.11.13.06.04.40.759666@fastmail.us>
On Sat, 13 Nov 2004 05:12:51 +0000, Thelma Lubkin wrote:
> I have only Perl on my home system. I would like to connect to a mysql
> database at a system that doesn't have Perl. I thought I could do this
> by installing the DBI module. But my attempt to connect apparently
> failed because I didn't have DBD for mysql installed. When I tried to
> install that I got error messages that seem to indicate that I need to
> have mysql installed on my system before I can install that.
>
> Obviously, I'm confused. Can I use DBI to connect to a remote mysql
> database without having mysql on my system? If so, how do I install
> enough stuff to do that?
One way to connect is to use DBD::ODBC - if the remote mysql database has
ODBC support built in. You *might* have to download the proper ODBC
driver from the MySQL site and install it on your system in order to make
this work. Trivial if you're on a Windows box - more difficult if you're
on a *nix box.
Visit http://dbi.perl.org/ for more information on how to do this. The
documentation on DBD::ODBC
(http://search.cpan.org/~jurl/DBD-ODBC-1.13/ODBC.pm) also provides useful
information on using ODBC to connect to databases.
HTH
Jim
------------------------------
Date: Sat, 13 Nov 2004 02:27:53 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Using DBI for Remote myql connection
Message-Id: <bLKdneaWJNj3KgjcRVn-3A@adelphia.com>
Thelma Lubkin wrote:
> I have only Perl on my home system. I would like to connect to a mysql
> database at a system that doesn't have Perl. I thought I could do this
> by installing the DBI module. But my attempt to connect apparently
> failed because I didn't have DBD for mysql installed. When I tried to
> install that I got error messages that seem to indicate that I need to
> have mysql installed on my system before I can install that.
>
> Obviously, I'm confused. Can I use DBI to connect to a remote mysql
> database without having mysql on my system? If so, how do I install
> enough stuff to do that?
DBD::mysql uses the MySQL C interface internally, so you need the client
libraries & headers to build it.
Have a look at the DBD::mysqlPP module on CPAN. I haven't used it
myself, but it looks like it might be useful. From its docs: "This
module implements network protool between server and client of MySQL,
thus you don't need external MySQL client library like libmysqlclient
for this module to work."
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sat, 13 Nov 2004 18:49:41 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Using DBI for Remote myql connection
Message-Id: <2vm058F2l8c2bU1@uni-berlin.de>
Thelma Lubkin wrote:
> I have only Perl on my home system. I would like to connect to a mysql
> database at a system that doesn't have Perl. I thought I could do this
> by installing the DBI module. But my attempt to connect apparently
> failed because I didn't have DBD for mysql installed. When I tried to
> install that I got error messages that seem to indicate that I need to
> have mysql installed on my system before I can install that.
>
> Obviously, I'm confused. Can I use DBI to connect to a remote mysql
> database without having mysql on my system? If so, how do I install
> enough stuff to do that?
> thanks,
> --thelma
Mysql supports remoet access via port 3306. I'd do this in stages
1. check to see that the mysql port 3306 is open of the remote host
telnet remotehost.com 3306
2.get a copy of the mysql client, & use it it to access the remote host
mysql --user=user_name --password=your_password --host=remotehost.com
db_name
See http://dev.mysql.com/doc/mysql/en/mysql.html
3. now that we have established connectivity, the standard mysql dbi that
comes with modern operating systems should be fine. Its very strange if you
have Perl but not dbi.
Your dbi connect styring will be
my $dbh = DBI->connect("dbi:mysql:$db:remotehost.com", "$db_user",
"$db_password");.
as per
http://perl.about.com/library/weekly/aa090803b.htm
gtoomey
------------------------------
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 7400
***************************************