[13979] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1389 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 15 21:11:32 1999

Date: Mon, 15 Nov 1999 18:10:23 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942718223-v9-i1389@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 15 Nov 1999     Volume: 9 Number: 1389

Today's topics:
    Re: how to step through list <cassell@mail.cor.epa.gov>
    Re: Is $$variable allowed like in PHP ? <cassell@mail.cor.epa.gov>
    Re: Java faster than perl ?!?!? <cassell@mail.cor.epa.gov>
    Re: Java faster than perl ?!?!? <mhc@Eng.Sun.COM>
    Re: Making a Perl/Tk standalone executable <cassell@mail.cor.epa.gov>
    Re: Multiple scripts (Martien Verbruggen)
        Need help with perl <suganesh@americasm01.nt.com>
    Re: Netscape messenger or other mail client accessable, <cassell@mail.cor.epa.gov>
    Re: Output from exec "file"; <cassell@mail.cor.epa.gov>
    Re: pattern matching packages <cassell@mail.cor.epa.gov>
    Re: perl as first language? <cassell@mail.cor.epa.gov>
        PERL script with JScript embedded <markh@argolink.net>
    Re: Perl Scripts for NT <cassell@mail.cor.epa.gov>
        Perl Web Resource seantong8696@my-deja.com
    Re: Please help me create a file with perl (Simon Cozens)
    Re: Please help me create a file with perl <flavell@mail.cern.ch>
    Re: Please help me create a file with perl <cassell@mail.cor.epa.gov>
    Re: Please help me create a file with perl <cassell@mail.cor.epa.gov>
    Re: Please help me create a file with perl <lr@hpl.hp.com>
        Problem Encountered in running DBI::DBD for Perl 5.0 <lhengc1@pd.jaring.my>
        Problem Encountered in running DBI::DBD for Perl 5.0 <lhengc1@pd.jaring.my>
        Problem Encountered in running DBI::DBD for Perl 5.0 <lhengc1@pd.jaring.my>
    Re: Q: how to get tied variable within FETCH <rootbeer@redcat.com>
    Re: Removing all combinations of spaces/tabs at end of  <cassell@mail.cor.epa.gov>
        Rounding a number with decimal places? (Burt Lewis)
    Re: Rounding a number with decimal places? <cassell@mail.cor.epa.gov>
    Re: Running shell commands via CGI script <cassell@mail.cor.epa.gov>
    Re: simulating buffer file with variable <rootbeer@redcat.com>
    Re: Slurping output form system(runme.exe) <hattons@cpkwebser5.ncr.disa.mil>
    Re: Slurping output form system(runme.exe) <slanning@bu.edu>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 15 Nov 1999 16:36:47 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: how to step through list
Message-Id: <3830A71F.2881FDC4@mail.cor.epa.gov>

Kevin J. Davis wrote:
> 
> Hello,

Howdy,
 
> I have used the readdir() operator to suck some filenames into a list. The

Sounds good so far...

> files are all plain text but then I am using another simple routine to
> generate header and footer HTML so that the pages can be viewed on a web
> browser. (This is cryptic but necessary under the circumstance.)

 ...and I'll take your word for this...
 
> I have stripped the "." and ".." files using grep and have populated the
> list as I expect. What I would like to do is be able to use form elements
> (back, forward) to step through the list.

The easiest way to do this is to use the CGI.pm module.  It comes
with extensive docs, and one of the examples sounds very much
like what you're after.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 15 Nov 1999 16:12:36 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Is $$variable allowed like in PHP ?
Message-Id: <3830A174.AD967FB9@mail.cor.epa.gov>

Ben Evans wrote:
[snip]
> So for quick and dirty scripts of up to a few hundred lines
> where I pretty much know exactly what I want to be doing,
> and I'm not depending on user input in any but the most
> restricted way, there's no real problem[1] with soft references?
> 
> Kitty
> [1] A real problem being something along the lines of "it'll
> thrash performance really badly" or "the syntax is icky and
> contains gotchas that still trip up even relatively experienced
> programmers"

Number 2 there.  Maybe you need to read Mark-Jsaon's webpages
again.  Because one of the major points is that symrefs
introduce "gotchas that still trip up even relatively experienced
programmers" to use your own words.  AND those gotchas are
hard as h*!! to find, and you cannot use the Perl debugging
tools to track them down.  So you're screwed.  And they can
get introduced just because some user someday types some
odd characters at the input prompt, which produces really
hard-to-debug intermittent failures.

So don't go there.

PHP *has* to have symrefs, because it doesn't have the data
structures to avoid such kludges.  But that doesn't make it
A Good Thing (tm, Martha Stewart).

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 15 Nov 1999 16:50:55 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Java faster than perl ?!?!?
Message-Id: <3830AA6F.6F655878@mail.cor.epa.gov>

Ricardo Malta wrote:
> 
> Hi,
> 
> can some one tell me why this java script is so much faster than the
> perl one ??

You haven't shown the Java code, but the Perl code is really
inefficient.  Is that why?  Or is it because of the environment
you're running these under?  My guess is that the inefficiencies
of the code have been optimized away under your Java compiler in
this case.  Because this looks like a compiler-optimization test.

Kernighan and Pike's test programs ran a heck of a lot faster
in Perl than in Java.  But they wrote real code for a real problem.

> Could it come from the variable type ?? In java you difine it as integer
> and under perl it can be an integer, float, string, etc... ??

You can get integer type through the 'use integer' pragma,
you know.  It doesn't make much difference on machines with
floating-point hardware - at least not in general.

[snip of non-acii inclusion which should not be in Usenet
messages] 

[BTW, the code itself was only about a dozen lines long.]

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: 15 Nov 1999 16:37:02 -0800
From: Mike Coffin <mhc@Eng.Sun.COM>
Subject: Re: Java faster than perl ?!?!?
Message-Id: <8p6bt8vqnkh.fsf@Eng.Sun.COM>

Ricardo Malta <RMalta@bigfoot.com> writes:
> can some one tell me why this java script is so much faster than the
> perl one ??

Perl's byte-code interpreter doesn't have a just-in-time compiler, and
the Java VM you are using probably does.  If your program spends most
of its time doing elementary operations (counting, branching, etc.),
Java will be a lot faster---probably at least a factor of 15.  On the
other hand, if your program spends most of its time executing
high-level Perl built-ins (pattern matching, etc.) then Perl could
easily be faster.

Both languages also have ways to integrate libraries written in C or
C++, which can be used to get low-level functionality not provided in
the language and to speed up time-critical code, so don't base your
choice on which runs a benchmark faster.

-mike

(Not speaking for Sun Microsystems.)


------------------------------

Date: Mon, 15 Nov 1999 16:05:36 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Making a Perl/Tk standalone executable
Message-Id: <38309FD0.3F01954D@mail.cor.epa.gov>

Nigel W wrote:
> 
> Does anyone know if it's possible to make a wrapper for a Perl/Tk
> script so that it can run on a system which doesn't have Perl/Tk
> installed.

In theory.  I've found it more useful to write a simple script
which just installs Perl and Tk on the machine I want to use.

> The reason for this is to generate software/Oracle DB installation
> scripts with a nice GUI which I can use on any Solaris box without
> having to install Perl/Tk.

Or, for real convenience, if Oracle is on your NFS network,
just put Perl & TK on the same network.  We use Perl over our
NFS network with no trouble [well, not any more than NFS
produces ordinarily].

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Tue, 16 Nov 1999 01:57:54 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Multiple scripts
Message-Id: <CS2Y3.192$Va.5337@nsw.nnrp.telstra.net>

On Sun, 14 Nov 1999 18:49:24 +0300,
	Alexei Novikov <anovikov@heron.itep.ru> wrote:
> Dear All,

Flattery will get you anywhere.

> I have a multiple perl scripts within my program. All of them share some
> information, like the path to the files to process, passwords to access
> db, etc. I was wondering if there is a tool that will be able to read
> this information from one file and then write it to all script files ? I
> think that MakeMaker can do this but I have no clue how. Any
> suggestions, pointers ?

If I understand you correctly, you want to run something over your
scripts before deploying them? 

Why don't you just put that information in a library file/module, and
just have all scripts require that? That saves you the trouble of
having to redeploy n scripts, when only one piece of information
changes.

Alternatively, you could create a configuration file, which then gets
parsed by each script. Depending on the complexity, either of these
suggestions could be the best one.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd.   | you come to the end; then stop.
NSW, Australia                  | 


------------------------------

Date: Mon, 15 Nov 1999 19:54:16 -0500
From: "Ganeshan, Suresh [CAR:7H14:EXCH]" <suganesh@americasm01.nt.com>
Subject: Need help with perl
Message-Id: <3830AB38.2034F22D@americasm01.nt.com>

Hello,

        I am planning to setup a web base interface to my database. 
Since I am
highly concerned about the security issues associated with it, I am
thinking to hire some professional to write a code for me. 

I want to keep record of some kind of personal informations about 
subscribers so that they can login and access their file. 
I want to give access to only the subscribers, give a user name and
password.  Like hotmail. 
 
Is there any people where I can get help or any web sites you
recommended?

Or would it be better for me to write my own code?

Beside, I still not clear which language is best suited?

I will appreciate your help?

Thanks,
Suresh


------------------------------

Date: Mon, 15 Nov 1999 15:50:38 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Netscape messenger or other mail client accessable, Win 32?
Message-Id: <38309C4E.24EC9FF2@mail.cor.epa.gov>

Tim Richardson wrote:
> 
> I'd like to have Perl do some processing of email messages in my POP
> client; this would include moving messages between folders and sending
> mail (which I can do with other modules already, I know).

You do know about the modules for POP3, right?  Like 
Mail::POP3Client ?  Just checking...

> I like to use Netscape on Win 32.
> Is there a module that allows Perl to access the Netscape mail database?

There are a host of Perl modules to address a variety of APIs.
Do you know if Nyetscape mail does MAPI, for example?

> Netscape 4.x doesn't seem to allow OLE or whatever it's called these
> days to manipulate messages in the Messenger mail client.
> I suppose MS Outlook does, but I'm not very keen to swap to Outlook.

Good.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 15 Nov 1999 15:38:46 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Output from exec "file";
Message-Id: <38309986.BF39B8EF@mail.cor.epa.gov>

rach55@my-deja.com wrote:
> 
> I have a specific, but basic, problem.
> 
> I have a parent program that is called via web and that, depending on
> inputs, runs an 'exec' on another file.  But, everything that I output
> with a 'print "info"' does not come out on the browser, even though it
> does come out when I access it via command prompt.  So, I'm guessing
> that when I call a subprogram, it doesn't know where to output the
> 'print' statements.

Note: this is not really a Perl question, but a CGI problem
that would be the same regardless of the programming language used.
So comp.infosystems.www.authoring.cgi would really be a better
place to ask questions like this.

Now, as to your problem:

Maybe not.  Programs on webservers run under a different environment
than 'you'.  Different home directory, different environment
variables, different path, different privileges, etc are likely.
So any of these things could cause your external program to fail.
Does this work when you run the Perl parent program from the
command line?  If so, it's the webserver config you have to
figure out.  If not, then you're not calling your external
program correctly from your Perl program.

By the way, a little bit of code can be a big help in figuring
out the exact problem...

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 15 Nov 1999 15:22:07 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: pattern matching packages
Message-Id: <3830959F.1EF8724A@mail.cor.epa.gov>

Kragen Sitaker wrote:
> 
> In article <382C9ABF.2B65C6A4@mail.cor.epa.gov>,
> David Cassell  <cassell@mail.cor.epa.gov> wrote:
> >Perl has all the regex features you'll need already built in.
> >Read the perlre and perlop pages to learn more.
> 
> I don't think so.  Here are some features Perl's REs don't have, which
> might be thought desirable.  I would be pleasantly surprised if any
> significant number of these actually get implemented.

Ummm, first of all, let me clarify.  I said _to_the_poster_
(who had a simple problem) that Perl has all the regex features
*he* would need.  Not that *anyone* would need.

Darn natural languages.  Where's a BNF for Englsih when you
need one?  :-)

Now then:

[snip]
>         - Someone asked recently on this newsgroup how to compute all
>           the possible ways an RE like ([a-z]*)(.*) could match a
>           particular string.

I thought that what was asked was to generate all the strings
which could match a given RE.  A very different proposition..
and one which clearly cannot be done in a finite time period
for the general case [like your example].

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 15 Nov 1999 15:31:53 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
To: "David J. Ritchie" <ritchie@fnal.gov>
Subject: Re: perl as first language?
Message-Id: <383097E9.886A370B@mail.cor.epa.gov>

[email copy cc'ed to poster]

David J. Ritchie wrote:
> 
> >  All the songs were G&S.  That one
> > was "I am the very model of a modern anti-Bayesian".  It
> > even scanned better than yours.
> 
> I'd love to see that song--there are a few anti-B's that would benefit
> from it.
> 
> Could you post it?

If you really want it, e-mail me and I'll see if I can dig it
out of my ancient archives.  I wrote it back when I was in
grad school.. back when clay tablets were the hot new thing.

But posting the entire thing here seems a little too OT, even
for me.  :-)

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 15 Nov 1999 18:36:51 -0600
From: Mark Henderson <markh@argolink.net>
Subject: PERL script with JScript embedded
Message-Id: <3830A723.7ABC3D8E@argolink.net>

I am fairly new to Javascript .  I have a PERL script (written by
someone else) that acts both as a form handler and database connection
interface.  I need to modify this PERL script.  THE HTML form that calls
the script is fine, and the script currently just returns the $Msg
listed below if a field is left blank.  I want to insert a JavaScript
alert in place of the $Msg statement below.  I tried something like

<SCRIPT LANGUAGE = "JAVASCRIPT">
   alert("You left a field blank");
</SCRIPT>

in place of the $Msg line below, but the server spit up on it.


if ($var_name{'field_name'} eq "") {
   $Msg = "<FONT COLOR=RED><BLINK>Missing Last name.  Please Enter data
again.</BLINK></FONT>"
 }

Any ideas are greatly appreciated.  Please reply directly as well as to
the list.

Thanks,

Mark





------------------------------

Date: Mon, 15 Nov 1999 16:20:46 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl Scripts for NT
Message-Id: <3830A35E.5C10AEAB@mail.cor.epa.gov>

test test wrote:
> 
> Hi,
> 
> I'm looking for some free perl scripts that are already ported to NT.  If
> you could refer me to some good sources it would be greatly appreciated.

I'm sorry, but this newsgroup is for the discussion of 
*programming* in Perl.  If you want someone else's program
rather than wanting to write it yourself, then you'll do better
to ask in other newsgroups, or to use a search engine like
Yahoo to track down one of the many websites which have Perl
scripts for free.

BTW, many Perl programs run unchanged on NT.  Perl is just 
like that.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 15 Nov 1999 23:03:20 GMT
From: seantong8696@my-deja.com
Subject: Perl Web Resource
Message-Id: <80q3fl$qab$1@nnrp1.deja.com>

http://www.hubat.com/servlets/search?cmd=b&db=hubat&concept=3.14.19


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: 15 Nov 1999 23:17:03 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Please help me create a file with perl
Message-Id: <slrn83153f.b8u.simon@othersideofthe.earth.li>

avivA Starkman (comp.lang.perl.misc):
>The second line should read:
>	open(FILE,">>jonas");

Didn't you forget something?

-- 
"May the forces of evil become confused on the way to your house."
-- George Carlin


------------------------------

Date: Tue, 16 Nov 1999 00:47:14 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Please help me create a file with perl
Message-Id: <Pine.HPP.3.95a.991116004556.15434P-100000@hpplus01.cern.ch>

On 15 Nov 1999, Simon Cozens wrote:

> avivA Starkman (comp.lang.perl.misc):
> >The second line should read:
> >	open(FILE,">>jonas");
> 
> Didn't you forget something?

Quite a lot, looking at the original.  But yes, certainly on this line
there is something important missing, as all the regular readers noticed
;-}

-- 

  * Progress (n.): The process through which Usenet has evolved from
   smart people in front of dumb terminals to dumb people in front of
   smart terminals.  -- obs@burnout.demon.co.uk 



------------------------------

Date: Mon, 15 Nov 1999 16:25:25 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Please help me create a file with perl
Message-Id: <3830A475.8DA87DA6@mail.cor.epa.gov>

Christian Wix wrote:
> Jonas Nilsson wrote:

[this line moved up so that others can follow this discussion -
responders should post after the given text, as per Usenet
etiquette]

> > I don't know so much perl. I think a script that create a file 
                                                     ^^^^^^
Note:                        

> I know this will work:
> 
> #!/usr/bin/perl -w

Good!  But no 'use strict' pragma.

> open (FILE,">>Jonas") or die "can't append to filename: $!";

Ermm, the poster wanted to *create* a file.  You are trying
to append to a previously-created file.  If the file doesn't
exist, this doesn't work.

But good work on the die(), especially with $! .

> print FILE "Test \n";
> close (FILE);

And checking the return on that close() can be a good idea
too.
[snip]

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 15 Nov 1999 16:29:30 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Please help me create a file with perl
Message-Id: <3830A56A.846BE778@mail.cor.epa.gov>

avivA Starkman wrote:
> >
> > #!/usr/bin/perl
> > open(FILE,">>jonas") \n";
> > print FILE"Test\n";
> > close(FILE);
> > `chmod 666 jonas`;
> 
> The second line should read:
>         open(FILE,">>jonas");

Actually, the 2nd line should read:

open(FILE,'>jonas') or die "couldn't open file for write: $!\n";

Always do the error-checking, *especially* when answering
questions in a forum like c.l.p.misc .  

And the poster wanted to *create* a file, not append to an old file.

And the double quotes are unneeded when the string inside is
a constant.  [Larry, don't bother, I know what you're about to
say.]

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 15 Nov 1999 16:59:09 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Please help me create a file with perl
Message-Id: <MPG.129a4c3726bfbee498a210@nntp.hpl.hp.com>

In article <3830A475.8DA87DA6@mail.cor.epa.gov> on Mon, 15 Nov 1999 
16:25:25 -0800, David Cassell <cassell@mail.cor.epa.gov> says...

 ...

> > open (FILE,">>Jonas") or die "can't append to filename: $!";
> 
> Ermm, the poster wanted to *create* a file.  You are trying
> to append to a previously-created file.  If the file doesn't
> exist, this doesn't work.

It sure ought to (create the file if it doesn't exist; then append to 
it).

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Tue, 16 Nov 1999 09:44:15 +0800
From: "Ong" <lhengc1@pd.jaring.my>
Subject: Problem Encountered in running DBI::DBD for Perl 5.0
Message-Id: <80qcf7$me4$1@news4.jaring.my>

I am fresh in developing DBI::DBD web database application. I used MySql
(Windows Platform) as the database of the web application. I have also
downloaded the Perl which is able to run DBI from
http://www.mysql.com/download.html and unzipped it into my Perl directory.

I had tested a script as below:
#!/usr/bin/perl -w
use DBI;
use strict;
my $database = "MyNet";
my $data_source = "DBI:mysql:$database";
my $dbh = DBI->connect($data_source) or die "Can't connect to $data_source:
$dbh->errstr\n";
$dbh->disconnect;
exit(0);

When it runs, the error message as below shown:
Can't locate loadable object for module DBI in @INC (@INC contains:
D:\PERL\lib D:\PERL\site\lib .) at D:\PERL\site\lib/DBI.pm line 164
BEGIN failed -- compilation aborted at D:\PERL\site\lib/DBI.pm line 164.
BEGIN failed -- compilation aborted at test.cgi line 2.

Can anyone of you guys help me to solve the problem?

Thank you.












------------------------------

Date: Tue, 16 Nov 1999 09:44:25 +0800
From: "Ong" <lhengc1@pd.jaring.my>
Subject: Problem Encountered in running DBI::DBD for Perl 5.0
Message-Id: <80qcff$me5$1@news4.jaring.my>

I am fresh in developing DBI::DBD web database application. I used MySql
(Windows Platform) as the database of the web application. I have also
downloaded the Perl which is able to run DBI from
http://www.mysql.com/download.html and unzipped it into my Perl directory.

I had tested a script as below:
#!/usr/bin/perl -w
use DBI;
use strict;
my $database = "MyNet";
my $data_source = "DBI:mysql:$database";
my $dbh = DBI->connect($data_source) or die "Can't connect to $data_source:
$dbh->errstr\n";
$dbh->disconnect;
exit(0);

When it runs, the error message as below shown:
Can't locate loadable object for module DBI in @INC (@INC contains:
D:\PERL\lib D:\PERL\site\lib .) at D:\PERL\site\lib/DBI.pm line 164
BEGIN failed -- compilation aborted at D:\PERL\site\lib/DBI.pm line 164.
BEGIN failed -- compilation aborted at test.cgi line 2.

Can anyone of you guys help me to solve the problem?

Thank you.














------------------------------

Date: Tue, 16 Nov 1999 09:44:29 +0800
From: "Ong" <lhengc1@pd.jaring.my>
Subject: Problem Encountered in running DBI::DBD for Perl 5.0
Message-Id: <80qcic$me8$1@news4.jaring.my>

I am fresh in developing DBI::DBD web database application. I used MySql
(Windows Platform) as the database of the web application. I have also
downloaded the Perl which is able to run DBI from
http://www.mysql.com/download.html and unzipped it into my Perl directory.

I had tested a script as below:
#!/usr/bin/perl -w
use DBI;
use strict;
my $database = "MyNet";
my $data_source = "DBI:mysql:$database";
my $dbh = DBI->connect($data_source) or die "Can't connect to $data_source:
$dbh->errstr\n";
$dbh->disconnect;
exit(0);

When it runs, the error message as below shown:
Can't locate loadable object for module DBI in @INC (@INC contains:
D:\PERL\lib D:\PERL\site\lib .) at D:\PERL\site\lib/DBI.pm line 164
BEGIN failed -- compilation aborted at D:\PERL\site\lib/DBI.pm line 164.
BEGIN failed -- compilation aborted at test.cgi line 2.

Can anyone of you guys help me to solve the problem?

Thank you.














------------------------------

Date: Mon, 15 Nov 1999 17:47:06 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Q: how to get tied variable within FETCH
Message-Id: <Pine.GSO.4.10.9911151740560.15797-100000@user2.teleport.com>

On Fri, 12 Nov 1999, Ken MacLeod wrote:

>   I have a package that implements a tied hash.  When FETCH is called,
>   I need to pass back the tied variable as part of the structure I
>   return (not the underlying object $self passed to FETCH).  I need
>   the opposite of tied().

At least one of us is confused. Let me give a concrete example.

Let's say that %wilma is tied to package Fred. And let's say that I use
this line of code:

    my $dino = $wilma{'some key'};

Now, Fred::FETCH (or some ancestor) is being called with the following
parameters: a ref to the underlying object thingie (as tied(%wilma) would
give), and 'some key'. The task of this sub is to return some value which
will land in $dino.

Now, you seem to be saying that you want %wilma to be the value which will
land in $dino. No? 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Mon, 15 Nov 1999 15:46:32 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
To: tony_123@my-deja.com
Subject: Re: Removing all combinations of spaces/tabs at end of string
Message-Id: <38309B58.87E7C50D@mail.cor.epa.gov>

[courtesy email cc also]

tony_123@my-deja.com wrote:
> 
> Hi Folks
> 
> I have a string that may contain any combination of spaces or tabs
> after the last character(non space or tab character).  How can I remove
[snip]

Tony, you've been asking a *lot* of very basic questions the
last few days.  May I make a suggestion?  Do three things:

[1] make sure you have your own personal copy of the docs which
come with Perl [including the FAQ] - if it isn't on your hard
drive already, grab a copy from CPAN [www.cpan.org]

[2] walk through the tutorial:
http://www.netcat.co.uk/rob/perl/win32perltut.html

[3] buy the book "Elements of Programming with Perl" by
Andrew Johnson, which doesn't assume programming background
to use it.

These will get you a lot farther in the long run than asking 
specific questions will.

Good luck,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Tue, 16 Nov 1999 00:35:41 GMT
From: burt@ici.net (Burt Lewis)
Subject: Rounding a number with decimal places?
Message-Id: <xF1Y3.810$zt1.69829@news.goodnet.com>

Hello,

Once again I find myself up against a brick wall and hoping for some help.

I think I need to use the  printf function but can't find a good example.

I have some numbers that look something like this:
39700
28300
7900
1500
1610
1617
1250


I need them to look like:
39.700
28.300
7.900
1.500
1.610
1.617
1.250

I tried unsuccesfuly things like:

$answer= ($number * .001)
$answer= ($number * 1.00)


I would appreciate any ideas on this.

Thank you!

Burt Lewis
burt@ici.net



------------------------------

Date: Mon, 15 Nov 1999 17:29:15 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Rounding a number with decimal places?
Message-Id: <3830B36B.293328D4@mail.cor.epa.gov>

Burt Lewis wrote:
> 
> Hello,

Howdy,

> Once again I find myself up against a brick wall and hoping for some help.
> 
> I think I need to use the  printf function but can't find a good example.

Yes!  printf() and sprintf() are the things you're looking for.
Well done.

But you will find better info if you look up the function sprintf
instead:

perldoc -f sprintf

That shows a number of the conversions and flags.

Then use perldoc to find your info in the FAQ, like this:

perldoc -q \bround

The \b in front ensures that words like 'background' won't match.
The first example in the FAQ even rounds to 3 decimal places,
just like you want.  Just remember to divide your numbers by
1000 first.

printf("%.3f", $number/1000);

> I have some numbers that look something like this:
> 39700

If you don't divide by 1000 first, you'll get formatted output
that looks like this:
39700.000
instead of like this:
39.700

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 15 Nov 1999 15:26:05 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Running shell commands via CGI script
Message-Id: <3830968D.6FBF8104@mail.cor.epa.gov>

[This would be easier to answer if you would place your text
*after* the parts you resond to - as it is, I'll just hack off
the bottom part and give something really brief.]

--==[bolMyn]==-- wrote:
> 
> I looked into it but if I am reading it correctly, doing net::ping will also
> going to give me the end result.  The example I was looing at is from
> "Programming PERL" and this is an excerpt:
[snip]
> I don't want the final result (I mean, yes I do but not only that).  What I
> want is a line by line dispaly in the browser of the ping process (Usually,
> I set it to three pings)  I could do it easly using BASH script but as
> I mentioned, I got stuck on passing a form input value to the script. 

So look at the examples in the *documentation* for Net::Ping .
The docs come with the module, and have a lot more examples.
It's not that hard to write the one line I see coming back from
ping, using the output from Net::Ping.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Mon, 15 Nov 1999 17:53:06 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: simulating buffer file with variable
Message-Id: <Pine.GSO.4.10.9911151752280.15797-100000@user2.teleport.com>

On Sat, 13 Nov 1999, Phil wrote:

> So, the question is, 'how can I transparently have a variable act as a
> filehandle without an associated file?'

With tie(), if I understand your question. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Mon, 15 Nov 1999 19:06:40 -0500
From: "Steven T. Hatton" <hattons@cpkwebser5.ncr.disa.mil>
Subject: Re: Slurping output form system(runme.exe)
Message-Id: <3830A010.28E67817@cpkwebser5.ncr.disa.mil>

Tom,

That works for half the problem.  I still can't figure out how to stream
the contents of $variable to the invoked system process.  This is what I
have:

$result=`commandname.exe`;

I still need to send the contents of $variable to the command.  Suppose I
dump the contents of $variable to an output file called dump.txt.  I can do
the following at the command line:

type dump.txt | commandneame.exe

Which processes the dump.txt and prints the results to the screen. I want
to do the same thing without dumping to a temporary data file.  Do you know
how to do that?

Thanks,

Steve

Tom Briles wrote:

> "Steven T. Hatton" wrote:
> >
> > We have been trying to figure out it there is a way to run a command
> > line executable in NT and slurp the output back into a perl variable.
>
> From perldoc -f system:
>
> "This is NOT what you want to use to capture the output from a command,
> for that you should use merely..."
>
> Oh darn, the rest scrolled by too quickly to read.  You'll have to read
> it yourself, I guess.
>
> - Tom




------------------------------

Date: 15 Nov 1999 19:51:17 -0500
From: Scott Lanning <slanning@bu.edu>
Subject: Re: Slurping output form system(runme.exe)
Message-Id: <kusg0y7tg1m.fsf@strange.bu.edu>

"Steven T. Hatton" <hattons@cpkwebser5.ncr.disa.mil> writes:
> $result=`commandname.exe`;
> 
> I still need to send the contents of $variable to the command.  Suppose
> I dump the contents of $variable to an output file called dump.txt.  I
> can do the following at the command line:
> 
> type dump.txt | commandneame.exe

If you can do that, surely could just

    $result = `commandname.exe < dump.txt`;

-- 
qualification: I'm a dimwit according to someone who emailed me


------------------------------

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 1389
**************************************


home help back first fref pref prev next nref lref last post