[16502] in Perl-Users-Digest
Perl-Users Digest, Issue: 3914 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 4 11:10:28 2000
Date: Fri, 4 Aug 2000 08:10:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <965401817-v9-i3914@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 4 Aug 2000 Volume: 9 Number: 3914
Today's topics:
R: Perl and mSQL Database <blacking@tin.it>
Re: R: Perl and mSQL Database (NP)
R: R: Perl and mSQL Database <blacking@tin.it>
Re: R: R: Perl and mSQL Database (NP)
Re: semijoin() - a better way? (Keith Calvert Ivey)
Re: Send Data Received to another Server ???? <gellyfish@gellyfish.com>
Re: split strings by number <gellyfish@gellyfish.com>
Re: stripping - ? html tags aaron@preation.com
Syntax for http request jpalloz@my-deja.com
system() corrupts Hebrew strings <amir_e_a@netvision.net.il>
Re: Uhmm... Errr... <mjcarman@home.com>
Re: Why root can't run perldoc? (Greg Bacon)
Re: WWWBoard.PL <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 4 Aug 2000 15:01:08 +0200
From: "Roberto Gnerre" <blacking@tin.it>
Subject: R: Perl and mSQL Database
Message-Id: <8mef25$l38$1@nslave1.tin.it>
Hello Daniel,
and thanks a lot for your support.
I can't install anything because I'm not the server administrator.
As the administrator says it is a script error I'm trying to show him (..and
myself too) that there's a trouble with the server configuration and not
with my script.
However I coded my script as follow:
My script name is DBI_script.pl:
............................................................................
....................................
#!/usr/local/bin/perl
use DBI;
$dbh=DBI->connect('DBI:Msql:databasename', undef, undef)
or die 'died on connect: ' . DBI::errstr';
............................................................................
....................................
and this is the error message I get:
install_driver(Msql) failed: Can't locate DBD/Msql.pm in @NIC at (eval 1)
line 2.
DBI::install_driver('DBI', 'Msql') called at
/usr/lib/perl5/site_perl/DBI.pm line 348
DBI::connect('DBI', 'DBI:Msql:databasename', undef, undef) called at
./DBI_script.pl line 4
What's the trouble then ?
Thanks again.
Roberto Gnerre
Daniel Foster <daniel@blackomega.com> wrote in message
8me5or$63v$1@news7.svr.pol.co.uk...
> > I coded my Perl script as follow
> > #!/usr/local/bin/perl
> >
> > use Msql;
> >
> > $dbh = Msql->connect;
> > $dbh->selectdb("nomedatabase");
>
> What you need here is DBI the Perl DataBase Interface. Get DBI.pm,
> Msql-Mysql-modules-1.2209.tar.gz (I think that's the latest) and
> install them as per the docs - I think you need some other things to,
> like maybe Data::Dumper and Data::ShowTable. There are plenty of good
> guides to DBI on the web, just do a search from your favourite search
> engine for 'DBI'.
>
> Your code will come out looking more like this...
>
> #!/usr/bin/perl
>
> use DBI;
>
> $dbh=DBI->connect('DBI:Msql:nomedatabase', 'username', 'password')
> or die 'died on connect: ' . DBI::errstr';
> .
> .
> .
>
> And then you can go on to do all you SQL statements etc.
>
> HTH
>
> ---
> A living organism ... feeds upon negative entropy ... Thus the
> device by which an organism maintains itself at a fairly high
> level or orderliness (i.e. a fairly low level of entropy) really
> consists of sucking orderliness from its environment.
> - E. Schrodinger
>
> Daniel Foster - daniel@blackomega.com
>
>
>
------------------------------
Date: Fri, 04 Aug 2000 13:46:46 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: R: Perl and mSQL Database
Message-Id: <aPzi5.203899$t91.1772098@news4.giganews.com>
On Fri, 4 Aug 2000 15:01:08 +0200, Roberto Gnerre <blacking@tin.it> wrote:
:
: I can't install anything because I'm not the server administrator.
That's not necessarily true. You can do a local installation of the
mSQL modules if you have permissions to write to the database -- and
perhaps even do things like creating new databases or setting up ACLs.
If you have such permissions, then you should be all set. If you
don't, then you should talk to your system administrator.
You should also read up on the ExtUtils::MakeMaker documentation for
information about performing local installations of modules.
: As the administrator says it is a script error I'm trying to show him (..and
: myself too) that there's a trouble with the server configuration and not
: with my script.
Judging from the error, it looks to be a problem with your DBD::mSQL
installation.
--
Nate II
------------------------------
Date: Fri, 4 Aug 2000 16:03:28 +0200
From: "Roberto Gnerre" <blacking@tin.it>
Subject: R: R: Perl and mSQL Database
Message-Id: <8meish$dfb$1@nslave2.tin.it>
Hello NP,
Thanks to you for helping me.
Here's some more stuff:
I ran this script on the server:
............................................................................
................................................
#!/usr/local/bin/perl -w
#
# ch04/listdsns: Enumerates all data sources and all installed drivers
#
use DBI;
### Probe DBI for the installed drivers
my @drivers = DBI->available_drivers();
die "No drivers found!\n" unless @drivers; # should never happen
### Iterate through the drivers and list the data sources for each one
foreach my $driver ( @drivers ) {
print "Driver: $driver\n";
my @dataSources = DBI->data_sources( $driver );
foreach my $dataSource ( @dataSources ) {
print "\tData Source is $dataSource\n";
}
print "\n";
}
exit;
............................................................................
.........................................................
And here's what I got:
Driver: ExampleP
Data Source is DBI::dr=HASH(0x815ddec)
Driver: NullP
Data Source is DBI::dr=HASH(0x8166778)
Driver: Sponge
Data Source is DBI::dr=HASH(0x80cc878)
Driver: mSQL
install_driver(Msql) failed: Can't locate DBD/Msql.pm in @NIC at (eval 1)
line 2.
DBI::install_driver('DBI', 'Msql') called at
/usr/lib/perl5/site_perl/DBI.pm line 348
DBI::connect('DBI', 'DBI:Msql:databasename', undef, undef) called at
./DBI_script.pl line 4
Do you finally think my script is wrong ?!
Thanks everybody for all your support.
Roberto Gnerre.
NP <nvp@spamnothanks.speakeasy.org> wrote in message
aPzi5.203899$t91.1772098@news4.giganews.com...
> On Fri, 4 Aug 2000 15:01:08 +0200, Roberto Gnerre <blacking@tin.it> wrote:
> :
> : I can't install anything because I'm not the server administrator.
>
> That's not necessarily true. You can do a local installation of the
> mSQL modules if you have permissions to write to the database -- and
> perhaps even do things like creating new databases or setting up ACLs.
> If you have such permissions, then you should be all set. If you
> don't, then you should talk to your system administrator.
>
> You should also read up on the ExtUtils::MakeMaker documentation for
> information about performing local installations of modules.
>
> : As the administrator says it is a script error I'm trying to show him
(..and
> : myself too) that there's a trouble with the server configuration and not
> : with my script.
>
> Judging from the error, it looks to be a problem with your DBD::mSQL
> installation.
>
> --
> Nate II
------------------------------
Date: Fri, 04 Aug 2000 14:33:02 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: R: R: Perl and mSQL Database
Message-Id: <yuAi5.432316$MB.6539993@news6.giganews.com>
On Fri, 4 Aug 2000 16:03:28 +0200, Roberto Gnerre <blacking@tin.it> wrote:
:
: Do you finally think my script is wrong ?!
: Thanks everybody for all your support.
You're doing a good job trying to figure out the problem. I'm glad
that you're writing test code with DBI to figure out what drivers are
installed and what else might be wrong.
Anyways, from the output of your own code -- it's safe to infer that
your DBD::mSQL driver *has not* been installed correctly, if at all!
You should have your system administrator pay *careful* attention to
the DBD::mSQL installation notes and/or README to ensure that DBD::mSQL
gets installed properly. *Make sure* that your system administrator
runs 'make test' and that all of the tests pass before they install
the module.
--
Nate II
------------------------------
Date: Fri, 04 Aug 2000 13:54:15 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: semijoin() - a better way?
Message-Id: <3994ca9d.50683435@news.newsguy.com>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
>Well without the frills about negative $itemcount, the basic function
>is
>
>push @newlist, join $jstr, splice( @oldlist, 0, $itemcount) while @oldlist;
And with a negative $itemcount, it's
unshift @newlist, join $jstr, splice( @oldlist,
(-$itemcount > @oldlist ? 0 : $itemcount ), -$itemcount)
while @oldlist;
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: 4 Aug 2000 09:03:02 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Send Data Received to another Server ????
Message-Id: <8mdtbm$2da$1@orpheus.gellyfish.com>
On Thu, 03 Aug 2000 16:29:30 GMT hugo.b@derivs.com wrote:
> How do I send data received from html form to another server using PERL
> ???
>
I dont know about PERL but in Perl ( see perlfaq1 ) one would need to know
what protocols are available for communication between the two servers. If
I assume correctly and you are talking about HTTP then you will want to
use LWP::UserAgent, but of course you might use NFS,rcp,ssh,SMTP, FTP, UUCP,
RPC, RMI, CORBA or any number of the other thousands of protocols that
enable you to send data from one machine to another.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 4 Aug 2000 09:30:07 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: split strings by number
Message-Id: <8mduuf$7k3$1@orpheus.gellyfish.com>
On Thu, 03 Aug 2000 15:59:04 GMT oderus54@my-deja.com wrote:
> How would i split strings by number, like for example;
>
>
> $blah = "abcdefghijklmn";
> #now i want $string1 = "abc", $string2 = "defgh", $string3 = "ijk",
> $string4 = "lmn"
>
TIMTOWTDI (though some ways are more sensible than others ):
my $string = 'abcdefghijklmn';
{
my ( $string1,
$string2,
$string3,
$string4) = unpack "A3A5A3A3",$string;
print "$string1,$string2,$string3,$string4\n";
}
{
my ( $string1,
$string2,
$string3,
$string4) = $string =~ /(.{3})(.{5})(.{3})(.{3})/;
print "$string1,$string2,$string3,$string4\n";
}
{
my ( $string1,
$string2,
$string3,
$string4) = (substr($string,0,3),
substr($string,3,5),
substr($string,8,3),
substr($string,11,3));
print "$string1,$string2,$string3,$string4\n";
}
{
my $i = 0;
my ( $string1,
$string2,
$string3,
$string4);
foreach ( split //, $string )
{
${
$i < 3 ? \$string1 :
$i < 8 ? \$string2 :
$i < 11 ? \$string3 :
\$string4
} .= $_;
$i++
}
print "$string1,$string2,$string3,$string4\n";
}
Almost certainly in order of decreasing ease of maintenance.
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Fri, 04 Aug 2000 14:41:39 GMT
From: aaron@preation.com
Subject: Re: stripping - ? html tags
Message-Id: <8mekn4$q0d$1@nnrp1.deja.com>
In article <398AACFA.2DC6DA21@drink.bt.co.uk>,
john kelly <kellym36@drink.bt.co.uk> wrote:
> thanks to everyone who helped
>
> - it works now
>
> j
>
>
john, ok now you got it working. I have the exact same question as you
did before. What did you do? I read the responces above, and did you
download a html parser module, and if so, which one did you end up
using, and how? thanks a lot.
Aaron H.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 04 Aug 2000 14:37:42 GMT
From: jpalloz@my-deja.com
Subject: Syntax for http request
Message-Id: <8mekfl$psf$1@nnrp1.deja.com>
What would be the proper syntax for an http request in a perl script?
Also, is it possible to pass variables to the url being requested by
the http request?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 4 Aug 2000 16:18:01 +0200
From: "Amir E. Aharoni" <amir_e_a@netvision.net.il>
Subject: system() corrupts Hebrew strings
Message-Id: <8meflm$isp$1@news.netvision.net.il>
Hi there
first of all - i'm using ActivePerl 5.003 on Windows NT 4 SP 5
Hebrew-enabled
Now here's the problem -- i'm writing a simple script and at some point i
want to call
system "foo abc";
where foo is a dos command and abc is an argument. The argument is usually
latin, but occasionally i need to send Hebrew words. When i try that, a
funny thing happens -- some Hebrew letters become spaces instead. If the
argument is made of these letters only, the program prints an error
message -- the argument is obligatory for the command i want to run. The
letters are:
dalet (ansi - e3, unicode - U05d3)
tet (ansi - e8, unicode - U05d8)
yod (ansi - e9, unicode - U05d9)
pe (ansi - f4, unicode - U05e4)
qof (ansi - e7, unicode - U05d7)
Questions:
1. As far i understand Perl 5.6 has better unicode, but will an upgrade
really help?
2. Can it be solved without an upgrade?
big thanks in advance
___________________________________________
Amir Elisha Aharoni, the original Israelite
"Bartender! Put all my meals in one plate.
Don't ask me what kind of music I play.
I play the good kind." - Oliver Lake
------------------------------
Date: Fri, 04 Aug 2000 08:22:42 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Uhmm... Errr...
Message-Id: <398AC3A2.A43B62B9@home.com>
On 04 Aug, 2000, bean <bean@agentkhaki.com> wrote in
comp.lang.perl.misc:
>
> I have a rather (I think) unusual request. I'm looking for a Perl
> mentor. Someone who can take a look at what I've created [...]
> and say "Well, that was pretty dumb... you might want to try
> this..."
Mark-Jason Dominus has been doing a series of articles like this for
perl.com, and has recently been looking for "genuine newbies" to supply
source material. Maybe he's swamped with stuff by now, I don't know.
I'll forward him a copy of this posting in case he still needs material.
> If anyone is interested in doing this (for free... yes, those dreaded
> words, I know) please drop me an email.
If he's willing, the price would only be having your work publicly (but
anonymously) picked apart.
-mjc
------------------------------
Date: Fri, 04 Aug 2000 13:25:06 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Why root can't run perldoc?
Message-Id: <solh1iffdbm99@corp.supernews.com>
In article <398A2A33.9400DB96@graduate.hku.hk>,
Edmond Cheng <edmcheng@graduate.hku.hk> wrote:
: I login in as root and try to read some perl document using the
: perldoc. But I get the message:
:
: Superuser must not run /usr/local/bin/perldoc without security audit and
: taint checks.
:
: My questions are:
: 1. Why user root cannot run perldoc?
There hasn't been a security audit of perldoc.
: 2. How can I get around of it without logout of root.
:
: I am usring Perl 5.6 on Redhat 6.2
You're not using a crippled system, so you have the luxury of using
man(1).
: I know there is security problem to login as root. But it is my home
: machine and I need to do some system administration, so most of the time
: I use root.
You do have an unprivileged account on that machine, don't you? You'll
continue to develop as root until you learn the painful lesson for
yourself.
Greg
--
A firewall protects me from the harmful and licentious World Wide Web.
-- option on Dr. Dobb's technetcast
------------------------------
Date: 3 Aug 2000 23:46:36 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: WWWBoard.PL
Message-Id: <8mcsoc$v1u$1@orpheus.gellyfish.com>
On Thu, 3 Aug 2000 00:27:52 +0200 Alan J. Flavell wrote:
>
> On Wed, 2 Aug 2000, Sara Jane Martin wrote:
>
>> I recently went to www.worldwidemart.com/scripts to look at Matt's
>> scripts simply because I was curious as to how they could be so
>> bad that they have earned such a widespread reputation.
>
> But amongst all those details - there seems to be nothing at all to
> lock the files which it is updating. So it's a matter of chance and
> statistics whether two updates attempted concurrently would trample
> over each other. I COULD NOT FIND THE WORD 'lock' ANYWHERE IN THE
> PACKAGE, not in the code, not in the readme, not in the FAQ. For any
> CGI implementation that's going to open common files, this is simply
> absurd.
>
Of course even if the program did implement correct locking to prevent
two instances from messing with the data simultaneously, because it
writes directly to a file that will be used by another program, the web
server, that is unlikely to partake in any locking scheme it is probable
that a user will get presented with a partially written file. Yeah,
you're right I cant be arsed to worry about it too much ;-}
/J\
--
yapc::Europe in assocation with the Institute Of Contemporary Arts
<http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3914
**************************************