[19345] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1540 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 16 11:05:39 2001

Date: Thu, 16 Aug 2001 08:05:09 -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: <997974309-v10-i1540@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 16 Aug 2001     Volume: 10 Number: 1540

Today's topics:
    Re: "shifting" values of the @_ array?? (Yves Orton)
    Re: Comma's at end of list can break program?? <david.bouman@nl.xo.com>
    Re: DBI:CSV SQL 'order by' problem <bart.lateur@skynet.be>
        downloading files from the web <skpurcell@hotmail.com>
    Re: Evaluation order of object methods <djberge@uswest.com>
        File Locations <john@trumpetweb.co.uk>
    Re: Grep Question (Tad McClellan)
        how do I FTP using MS-DOS box? (john)
    Re: how do I FTP using MS-DOS box? <wsegrave@mindspring.com>
    Re: How replace <sda999@mail.ru>
    Re: How replace (Tad McClellan)
        Locating Files <john@trumpetweb.co.uk>
    Re: Locating Files (Tad McClellan)
    Re: OT: Why is there so much white space in perl docume <mjcarman@home.com>
        perl end-of-line - Unix does not like DOS perl programs (B Wooster)
    Re: perl end-of-line - Unix does not like DOS perl prog (Tad McClellan)
    Re: perl end-of-line - Unix does not like DOS perl prog <d.wetzler@dawe-computer.de>
        Problems starting a child-process using "system" <d.wetzler@dawe-computer.de>
    Re: SQL (MySQL) Windows <cpryce@pryce.net>
    Re: SQL (MySQL) Windows (Tad McClellan)
    Re: SQL (MySQL) Windows <bart.lateur@skynet.be>
    Re: SQL (MySQL) Windows <paul@net366.com>
        Win32 Limit on Number of Open File Handles per Process? (Michael S. Muegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 16 Aug 2001 07:38:10 -0700
From: demerphq@hotmail.com (Yves Orton)
Subject: Re: "shifting" values of the @_ array??
Message-Id: <74f348f7.0108160638.51f49a25@posting.google.com>

Carlos C. Gonzalez <miscellaneousemail@yahoo.com> wrote in message news:<MPG.15e4bf0bb5a0b96f98975f@news.edmonton.telusplanet.net>...
> The following methodX subs all output the same thing.  Is there any 
> reason to use one method as opposed to another other than personal 
> preference or that one method is used more often than another just 
> because?  

Partially TMTOWTDI, and partially because they are different.
<SNIP>

> my @a = qw(Tom Mary Jack);
<SNIP>

> 
> sub method1
> {
>   my $a = shift;
>   print " Method - shift: $a\n";
> }  

This means that you are removing the first value of a copy of the
array.
You see it a lot in situations where more complex parameters are being
passed.
Consider:

sub foo {
    my $self=shift;
    my %hash=@_;
}

which might be called like

$obj->foo(key1=>1,key2=>2,key3=>3);

The values that come from the list must be in pairs to get loaded into
a hash so it is convenient to remove the object reference using shift.

I personally like it because even though it is longer to type it
allows comments and defaults to be easily added.

sub foobar {
    my $self=shift; #self pointer
    my $param1=shift; #a parameter;
    my $string=shift || "default";  #a default param
}

> 
> sub method2
> {
>   my $a = $_[0];
>   print " Method - \$_[0]: $a\n";
> }  

This one is used because of two reasons, first because it is slightly
faster as there is no intermediate variable, second because it allows
the original variable to be changed.  Remember that @_ is ALIASED to
the input, NOT copied.
so you can do this

sub bar {
  $_="Hello!";
}

my $s="Dude!";
bar($s);
print $s; #prints Hello!

sub speedymethod {
  $_[0]->foo($_[1],$_[2]);
}

> sub method3
> {
>   my ($a) = @_;
>   print "    Method - \@_: $a\n";
> }  

Used because it is simple to write, and most of us are lazy.  Also it
makes a COPY (as does shift) so it can be used in situations like this

sub change {
   my ($s)=@_;
   $s=~s/(\w)/ord($1)/eg;
   return $s;
}
print change("Hello Carlos"); #prints 72101108108111 6797114108111115


Im pretty sure all of this is covered in PerlSub.  You might want to
have a gander there.

Yves
Ps (By now im sure a guru has replied with a better description than
mine, but what the hell.)


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

Date: Thu, 16 Aug 2001 16:57:05 +0200
From: David Bouman <david.bouman@nl.xo.com>
Subject: Re: Comma's at end of list can break program??
Message-Id: <3B7BDF41.D8DF362C@nl.xo.com>

Abigail wrote:

> Another reason is 
> 
>     @list = (
>         "We have one string here",
>         "and one here"           ,
>         "and another string"     ,
>         "this is also a string"  ,
>         "final string is here"   ,
>     );
> 
> looks better than:
> 
>     @list = (
>         "We have one string here",
>         "and one here"           ,
>         "and another string"     ,
>         "this is also a string"  ,
>         "final string is here"
>     );
> 
> which has something "missing".

As for aesthetics, personally I find

    @list = (
            ,  "We have one string here"
            ,  "and one here"
            ,  "and another string"
            ,  "this is also a string"
            ,  "final string is here"
            )
    ;

to look even more pleasing (also, it saves having to re-align when adding still wider strings). 

Obviously, as written this won't work as this has something "too much". So usually I end up 
writing:

    @list = (  "We have one string here"
            ,  "and one here"
            ,  "and another string"
            ,  "this is also a string"
            ,  "final string is here"
            )
    ;

This will suffer from the same "problems" mentioned earlier, but now they occur when adding 
items to the front of the list, which I fortunately rarely find a real need for.

--
David.


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

Date: Thu, 16 Aug 2001 13:30:50 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: DBI:CSV SQL 'order by' problem
Message-Id: <3kinnt0c6l4gplmgujcd8eu9r96r5f0kuk@4ax.com>

Bill Neisius wrote:

>I've got a CSV file with a field containing 'paragraph' numbers which look
>something like this:
>
>    para,descr...
>    5.13.1,"C description"...
>    5.13.2,"A description"...
>    5.13.3,"B description"...
>
>The SQL select from this table:
>
>    select para, descr from paragraph order by para, descr
>
>return the rows in this order:
>    5.13.2,"A description"
>    5.13.3,"B description"
>    5.13.1,"C description"
>
>If I prefix the paragraph numbers with a letter, the 'order by' works and
>return the rows in this order:
>    5.13.2,"A description"
>    5.13.3,"B description"
>    5.13.1,"C description"

>If I prefix the paragraph numbers with a letter, the 'order by' works and
>returns the paragraphs in the proper order...

You're wrong. It doesn't work. Sorting as text would put "5.13.2" before
"5.2.1". I don't think that is what you want.

Unless you were clever enough to code that as "5.02.1"?

But you're right that the sorting heuristics in DBD::CSV appear to be
breaking down.

-- 
	Bart.


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

Date: Thu, 16 Aug 2001 08:01:24 -0500
From: "spurcell" <skpurcell@hotmail.com>
Subject: downloading files from the web
Message-Id: <3b7bc525$0$18725@wodc7nh0.news.uu.net>

Hello,
I want to allow users to download some binary images (TIFF and EPS) images
from the web. I  have code posted below that reads the image into a
filehandle, and then tries to print the data to the browser. The problem is,
that I do not know what mime type to use. I have tried:
application/tiff
application/octet-stream
and about every mime type I can find in all my books.

Everytime I print the data to the broswer, it tries to display either the
asset to the screen, or as a quick time image. I need it to show the
download prompt (so they can save it to disk).

I have searched google, cpan, and perl.com. This has to be something common?

My web server is NT running Apache, also have one running IIS (for testing).
I cannot get either to work. Also the images DO NOT live in the document
root, or anywhere on the webserver. They live on on some RAID drives that
are connected via Samba to my webserver, but I have full access to them
through the web server.

Thanks,
Scott

PS, is there anywhere else I can search to try and find information on
issues like this?





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

Date: Thu, 16 Aug 2001 08:43:33 -0500
From: Mr Sunblade <djberge@uswest.com>
Subject: Re: Evaluation order of object methods
Message-Id: <3B7BCE05.6C292D10@uswest.com>

Uri Guttman wrote:

> >>>>> "S" == Sunblade  <djberge@uswest.com> writes:
>
>   S> I didn't mean for this to become the focus of the critique.  The
>   S> point is to eventually create Ruby-like arrays - i.e. arrays as
>   S> objects so that I can do something like:
>
>   S> my $sa = Some::Object->new(1,2,3,4,5,2,3,4);
>   S> print $sa->unique()->length();
>
> you can still do that. just always return the object from the call to
> unique. it then becomes a side effect method and all it does is uniquify
> @array.
>
> but even so, using a single global @array for the object's data is not a
> good idea either. you can make the object itself the array that holds
> the data and that makes life much cleaner:

<snip>

Ah, but I was trying to emulate Ruby and give the programmer a little more
versatility.  The goal was to give the programmer an option: if an assignment
is made, then only return the results of the method call but *don't* actually
modify the object itself.  Modify the object itself if, and only if, an
assignment is not made.  I had also considered allowing an 'inline' hash style
argument that would give the option to modify the object
itself or not.

i.e.
my @uniq = $so->unique();                    # '@uniq' now contains 5 elements
(using our example above), $so unchanged (still contains 8 elements)
$so->unique();                                            # $so object itself
now contains 5 elements
my @uniq = $so->unique(inline=>1);  # '@uniq' now contains 5 elements *and*
$so contains 5 elements
print $so->unique(inline=>0);                # print the unique elements of
$so, but don't modify the object

Thoughts?  I'm I trying to be too accomodating?

Regards,

Dan


--
"Evil will always triumph because Good is *dumb*."
-- Dark Helmet, 'Spaceballs: The Movie'





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

Date: Thu, 16 Aug 2001 14:48:11 GMT
From: "John P" <john@trumpetweb.co.uk>
Subject: File Locations
Message-Id: <L2Re7.2138$ms2.176338@news1.cableinet.net>

Hi there All

I am distributing scripts which have the line.
use Digest::MD5 qw (md5_base64);

Most of the time the scripts are fine but on some systems the users are
getting the error message

Can't locate Digest/MD5.pm in @INC (@INC contains:
/usr/local/lib/perl5/5.6.0/i686-linux /usr/local/lib/perl5/5.6.0
/usr/local/lib/perl5/site_perl/5.6.0/i686-linux
/usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl .)

I thought that this was a standard module. found in a standard location.
Does anyone have any ideas please. I have asked them to check their Shebang
lines are correct but they still get the error. I have some rather irrate
customers!

Thanks in advance
John P






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

Date: Thu, 16 Aug 2001 08:31:49 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Grep Question
Message-Id: <slrn9nnf9l.4if.tadmc@tadmc26.august.net>

meadows_p <meadows_p@yahoo.com> wrote:

>   	my @foundfiles = grep($bmCode, @$files);

>I'm passing a directory listing and trying to filter out the files
>who's names contain the what's in $bmCode.
                         ^^^^^^^^^^^^^^^^^

Well, we need to know what is in $bmCode then.


>It displays the list of files correctly, but after my grep,
>@foundfiles seems to contain exactly the same as @files.


Then evaluating "$bmCode" must be coming up "true" for every 
list element.


>Can anyone help me as to why my grep isn't working?


   perldoc -f grep


Shows the first argument is an EXPR. If, for instance, $bmCode = 'foo',
then Perl sees

   my @foundfiles = grep('foo', @$files);

The EXPR 'foo' (a string) always evaluates to "true" so grep()
always selects it for the output list.

You need to make it be a real EXPR, but what kind of EXPR we
cannot tell because you have not given us enough information.

Maybe one of these:

   grep /$bmCode/, ...       # EXPR is a pattern match

   grep /\Q$bmCode/, ...     # might contain regex metachars

   grep /\.$bmCode$/, ...    # $bmCode is a filename extension


You want $_ involved in the EXPR somehow, 'cause that is where
grep() puts each list element.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 16 Aug 2001 06:48:16 -0700
From: cutlass94@hotmail.com (john)
Subject: how do I FTP using MS-DOS box?
Message-Id: <5dcf6209.0108160548.5f3c7ac8@posting.google.com>

how do I FTP using MS-DOS box?

in simple terms


cheers


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

Date: Thu, 16 Aug 2001 09:28:10 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: how do I FTP using MS-DOS box?
Message-Id: <9lgmbu$5n8$1@slb6.atl.mindspring.net>

"john" <cutlass94@hotmail.com> wrote in message
news:5dcf6209.0108160548.5f3c7ac8@posting.google.com...
> how do I FTP using MS-DOS box?
>
> in simple terms

In the MS-DOS Prompt window of Win95:

1. Type "ftp" at the command line.

2. You should now see "ftp>" as the command prompt.

3. Type the FTP command you wish to be executed.

4. If you can't do 3, type "help" at the FTP command prompt.

5. If you can't understand 4, type "quit" at the FTP command prompt and RTM.

I hope you want this information so you can FTP a Perl script to/from
somewhere. Otherwise, your query is off-topic.

Cheers,

Bill Segraves
Auburn, AL




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

Date: Thu, 16 Aug 2001 17:08:08 +0400
From: "Dmitry" <sda999@mail.ru>
Subject: Re: How replace
Message-Id: <9lggjq$dbd$1@dragon.infopro.spb.su>

Tankx.

Real strange situation :|
I send .uue file at Unix host mailbox (created win32 application)
there it uudecoded and put in dir. All good, but...
Rarely, but uudecoded with errors - defacement 2 symbols ("`" and "." )
in last string uue-code ("."->"..", "`"->"``") in ONE places!
Here i investigate in this bugs ;(
If you known with this things - advise me pls.



"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:9lgeun$kle$3@mamenchi.zrz.TU-Berlin.DE...
> According to Dmitry <sda999@mail.ru>:
> > Source string: "abcebsasaanrart"
> > I want transform in "abcebsasaanraart"
> >  i.e. replace last "a" in "aa" (count "a" - arbitrary)
>
> Replace the last "a" in a string with "aa"?
>
>     s/a([^a]*)$/aa$1/;
>
> Anno, wondering what that operation might be good for




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

Date: Thu, 16 Aug 2001 08:39:20 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How replace
Message-Id: <slrn9nnfno.4if.tadmc@tadmc26.august.net>

Dmitry <sda999@mail.ru> wrote:

>Source string: "abcebsasaanrart"
>I want transform in "abcebsasaanraart"
> i.e. replace last "a" in "aa" (count "a" - arbitrary)


   s/(.*a)/$1a/s;

or

   substr($_, rindex($_, 'a'), 1) = 'aa';


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 16 Aug 2001 12:48:13 GMT
From: "John P" <john@trumpetweb.co.uk>
Subject: Locating Files
Message-Id: <hiPe7.1211$ms2.115685@news1.cableinet.net>

Hi there All

I am distributing scripts which have the line.
use Digest::MD5 qw (md5_base64);

Most of the time the scripts are fine but on some systems the users are
getting the error message

Can't locate Digest/MD5.pm in @INC (@INC contains:
/usr/local/lib/perl5/5.6.0/i686-linux /usr/local/lib/perl5/5.6.0
/usr/local/lib/perl5/site_perl/5.6.0/i686-linux
/usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl .)

I thought that this was a standard module. found in a standard location.
Does anyone have any ideas please. I have asked them to check their Shebang
lines are correct but they still get the error. I have some rather irrate
customers!

Thanks in advance
John P




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

Date: Thu, 16 Aug 2001 09:19:56 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Locating Files
Message-Id: <slrn9nni3s.4of.tadmc@tadmc26.august.net>

John P <john@trumpetweb.co.uk> wrote:
>
>I am distributing scripts which have the line.
>use Digest::MD5 qw (md5_base64);
>
>Most of the time the scripts are fine but on some systems the users are
>getting the error message
>
>Can't locate Digest/MD5.pm in @INC (@INC contains:
>/usr/local/lib/perl5/5.6.0/i686-linux /usr/local/lib/perl5/5.6.0
>/usr/local/lib/perl5/site_perl/5.6.0/i686-linux
>/usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl .)

>I thought 


What did you see that made you think that? (it should be "fixed")

Or did you mean to say "I guessed" instead?


>that this was a standard module. 
                 ^^^^^^^^^^^^^^^

I think you meant "core module", that is, a module shipped
with the perl distribution.

Core modules should be listed in the MANIFEST file in the distribution.
I don't see Digest::MD5 in 5.6.[01] MANIFEST files...


>Does anyone have any ideas please. 


Install Digest::MD5 on those systems :-)


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 16 Aug 2001 08:04:50 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: OT: Why is there so much white space in perl documentation??
Message-Id: <3B7BC4F2.2D724677@home.com>

Yves Orton wrote:
> 
> Michael Carman <mjcarman@home.com> wrote in message > news:<3B7A7894.E230EC20@home.com>...
> >
> > [...] NS 6.1 and IE 5.5 are pretty even.
>
> Well, I have to say that my experience of failing to DL 6.0 when it
> first came out lead me to investigate other things, and quite frankly
> I never went back.

Yes, 6.0 was a disaster all around.

> Have you tried Opera?  How does it compare?

No. I've heard good things about it, but haven't been motivated to
install yet another browser.

> But the benefits of IE include other things, such as the tricks
> suggested in the thread about self searchable docs.

True. But since I can't really get rid of IE, I can still use it for
stuff like that. :/

-mjc


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

Date: 16 Aug 2001 06:45:41 -0700
From: bwooster47@hotmail.com (B Wooster)
Subject: perl end-of-line - Unix does not like DOS perl programs?
Message-Id: <75cc51dd.0108160545.b9f986f@posting.google.com>

This got me confused when perl failed - I've to keep jumping
between DOS and Unix platforms, and sometimes
I've to start coding on DOS, and then copy the perl
program over to Unix - and perl fails to run the programs.

On Perl 5.004, Perl on Unix does not like text files in DOS
format - it complains about the \015 character.
[I can fix this by editing the files. But!]

Is there a particular reason for this - why wouldn't
perl be coded to basically understand all line formats
for Mac, Dos, and Unix, and allow perl programs to be
moved from one platform to another without requiring
editing?

Just curious if there is a technical reason behind this,
or if this is just an overlooked feature addition...


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

Date: Thu, 16 Aug 2001 09:37:35 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perl end-of-line - Unix does not like DOS perl programs?
Message-Id: <slrn9nnj4v.4s5.tadmc@tadmc26.august.net>

B Wooster <bwooster47@hotmail.com> wrote:
>This got me confused when perl failed - I've to keep jumping
>between DOS and Unix platforms, and sometimes
>I've to start coding on DOS, and then copy the perl
>program over to Unix 


If you use "text" (or "ASCII") mode when FTPing, the ftp program
will convert the line ending sequences for you.


>- and perl fails to run the programs.


This is not a Perl problem. A csh shell script with the wrong line
endings won't run either (via a shebang line).


>On Perl 5.004, Perl on Unix does not like text files in DOS
>format - it complains about the \015 character.
>[I can fix this by editing the files. But!]


This is not a Perl problem.

It is not Perl that doesn't like them, it is Unix that doesn't 
like them.

(and it is nearly always a problem with the shebang line. It is
 the OS that processes that. Most CR-LF'd Perl program files will 
 run fine if you invoke perl yourself (ie. perl my_prog) as that
 avoids the shebang line.
)


>Is there a particular reason for this 


"file system" stuff is the responsibility of the operating system.

Different OSes have made different decisions about file formats.


>- why wouldn't
>perl be coded to basically understand all line formats


Because "file system" stuff is up to the OS, not the programming language.

And on top of that, I sometimes run programs on Unix where I expect
the final output to go to Windows. In that case, I wouldn't want
Perl mucking about with my line endings. I'll put the Right Ones
there, and I want them left alone).


>for Mac, Dos, and Unix, and allow perl programs to be
>moved from one platform to another without requiring
>editing?


They can be moved without requiring editing. You just need to
move them in the proper manner  :-)


>Just curious if there is a technical reason behind this,
>or if this is just an overlooked feature addition...


It ain't Perl's problem.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 16 Aug 2001 16:31:42 +0200
From: Daniel Wetzler <d.wetzler@dawe-computer.de>
Subject: Re: perl end-of-line - Unix does not like DOS perl programs?
Message-Id: <9lglbk$ia$2@news.rrz.Uni-Koeln.DE>

Hi,

as far as I know the different operating systems use different 
control characters for e.g. carriage return.
If you glance at kwrite for example, yu see, that this editor
can produce control characters for several platforms...

Hope this helps,


Daniel



B Wooster wrote:

> This got me confused when perl failed - I've to keep jumping
> between DOS and Unix platforms, and sometimes
> I've to start coding on DOS, and then copy the perl
> program over to Unix - and perl fails to run the programs.
> 
> On Perl 5.004, Perl on Unix does not like text files in DOS
> format - it complains about the \015 character.
> [I can fix this by editing the files. But!]
> 
> Is there a particular reason for this - why wouldn't
> perl be coded to basically understand all line formats
> for Mac, Dos, and Unix, and allow perl programs to be
> moved from one platform to another without requiring
> editing?
> 
> Just curious if there is a technical reason behind this,
> or if this is just an overlooked feature addition...
> 



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

Date: Thu, 16 Aug 2001 16:28:40 +0200
From: Daniel Wetzler <d.wetzler@dawe-computer.de>
Subject: Problems starting a child-process using "system"
Message-Id: <9lgl5u$ia$1@news.rrz.Uni-Koeln.DE>

Hi,

I want to start a compiled program out of a perl script as a child process
to make it run after the parent process has ended.
This works great with the "system"-command because it forks the called
program into a child process.

My problem is, that my parent-process (the perl-script) seems to wait
for the child process for a particular time, doing nothing.
I don't want it to wait or want to shorten the time while it's waiting to
a unremarkable time.

How can I do this ?

Hope someone can help..


Greetings from hot, sunny Cologne, Germany,


Daniel




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

Date: Thu, 16 Aug 2001 08:12:12 -0500
From: "cp" <cpryce@pryce.net>
Subject: Re: SQL (MySQL) Windows
Message-Id: <rCPe7.6401$x84.2075277@ruti.visi.com>


"Paul Fortescue" <paul@net366.com> wrote in message
news:997963920.28999.0.nnrp-01.d4f094e4@news.demon.co.uk...
> "Bart Lateur" <bart.lateur@skynet.be> wrote in message
> news:h59nntoelus7o9nv6t65rfb24ood8q3qqg@4ax.com...
> > Paul Fortescue wrote:
> >
> > >I think I'm being a donkey. I have installed MySQL on Win2K, and
> downloaded
> > >the modules DBI and DBD which I have put into the /perl/lib directory
> >

[ snip ]
> >
> > <http://www.mysql.com/documentation/>
> >
> > And finally, for help on DBI, check out the dbi-users mailing list.
> > There too there's an archive.
> >
> > <http://lists.perl.org/showlist.cgi?name=dbi-users>
> >
> > --
> > Bart.
>
> I have installed DBI.pm in the /lib, and have used "use DBI::mysql" as you
> suggest. Therefore I have installed mysql.pm in /lib/DBI.
>
> It contains # -*- perl -*-
>
> package Mysql;
>
> use 5.004;
> use strict;
>
> require Carp;
> require DynaLoader;
> require Exporter;
> require DBI;
> require Mysql::Statement;
> require DBD::mysql;
>
> and now I get Compilation failed in require at C:/Perl/lib/DBI/mySQL.pm
line
> 11. whgich appears to be the line "require DBI".
>

DBI is a module. It is more correct to include it in your program with the
line:

"use DBI";

If you read the documentation refered to in the previous reply, you will
find numerous examples of code to connect to a mysql database (all of them,
BTW, 'use' the DBI module). You might try starting with one of those.

If that documentation dosen't help, go to the command line (startmenu ->
run ->cmd on your Win2k machine) and type:

perldoc DBI

It will produce many many pages of excellent documentation.

cp

cp





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

Date: Thu, 16 Aug 2001 08:19:02 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: SQL (MySQL) Windows
Message-Id: <slrn9nnehm.4if.tadmc@tadmc26.august.net>

Paul Fortescue <paul@net366.com> wrote:


[ big snip, please do not quote an entire article ]


>I think I have everything
>I need except some experience of how Perl looks for modules :)


There are 4 Frequently Asked Questions that mention modules:

   perldoc -q module

Maybe the "use lib" mentioned there will help perl find your module.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 16 Aug 2001 13:57:22 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: SQL (MySQL) Windows
Message-Id: <osjnnt4mddqb0u2j14m26c63ilnuu6cel9@4ax.com>

Paul Fortescue wrote:

>I have installed DBI.pm in the /lib, and have used "use DBI::mysql" as you
>suggest.

I did not. The drive module is DBD::mysql (Data Base Driver).

And the common idiom of loading DBD::mysql is through the connect string
for your database.

     use DBI;
     my $dsn = 'mydata';  # very simple example	
     my ($user, $pwd) = ('', '');  # no user name and password needed?
     my $dbh = DBI->connect("DBI:mysql:$dsn", $user, $pwd,
     	{ RaiseError => 1});

BTW I found a DBI+MySQL manual at
<http://mysql.turbolift.com/mysql/DBD_3.21.X.php3>

-- 
	Bart.


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

Date: Thu, 16 Aug 2001 15:29:41 +0100
From: "Paul Fortescue" <paul@net366.com>
Subject: Re: SQL (MySQL) Windows
Message-Id: <997972107.23939.0.nnrp-14.d4f094e4@news.demon.co.uk>


>      use DBI;
>      my $dsn = 'mydata';  # very simple example
>      my ($user, $pwd) = ('', '');  # no user name and password needed?
>      my $dbh = DBI->connect("DBI:mysql:$dsn", $user, $pwd,
>      { RaiseError => 1});
>
> BTW I found a DBI+MySQL manual at
> <http://mysql.turbolift.com/mysql/DBD_3.21.X.php3>
>
> --
> Bart.

Thanks, I have done that, and I have done a PPM install on DBD::mysql and
DBI because I tried to do them manually and that was stupid in the extreme.
Now, though, when the program executes and tries to do anything, I get

install_driver(mysql) failed: Can't locate loadable object for module
SQL::Statement in @INC (@INC contains: C:\Inetpub\scripts C:/Perl/lib
C:/Perl/site/lib .) at C:/Perl/lib/DBD/mysql.pm line 12

which I assume means that I have to install somthing else. I guessed at SQL
and SQL::statement neither of which was a great guess! I do have a
statement.dll file and if I try to install that manually (will I never
learn?) it looks for Perl.dll which I think it shouldn't. I am getting very
stuck.





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

Date: 16 Aug 2001 07:29:40 -0700
From: mike-nospam@muegel.org (Michael S. Muegel)
Subject: Win32 Limit on Number of Open File Handles per Process??
Message-Id: <36e09546.0108160629.39099571@posting.google.com>

Howdy. When using both ActivePerl's 5.6.1 build 628 and a self built
Perl 5.6.1 on Win32 I get an error when trying to create more than 254
*simultaneous* TCP sockets within a single process. The 255th socket
create yields the error "Bad file descriptor."

It seems like this may be due to a limit on the number of file
handles/descriptors a process can create, as a simpler text file
handle test balked on the 510th file handle (perhaps stderr, stdout,
and stdin count for the other 3 to bring the max to 512).

This is on Windows 2000 Professional SP2. Is this a limit on this
"client" version of Win2K or something else? Sample code which shows
this behavior for sockets and files is included below.

This works fine on UN*X.

Thanks,
-Mike

=================== Sockets Test =====================

# Usage: lots-of-sockets number-of-sockets [ starting-port ]

use IO::Socket;

$Num_Sockets = shift || die "$0: bad usage\n";
$Starting_Port = shift || 12000;


for ($I = 1; $I <= $Num_Sockets; ++$I)
{
   $Port = $Starting_Port + $I - 1;
   $Sockets{$Port} = IO::Socket::INET->new(Proto => 'tcp') ||
      die "$0: could not create socket #$I: $!\n";
};

warn "Created all sockets; sleeping ...\n";

while (1)
{
   sleep(100);
};

=================== File Test =====================

# Usage: lots-of-filehandles number-of-filehandles

use IO::File;

$Num_FHs = shift || die "$0: bad usage\n";

for ($I = 1; $I <= $Num_FHs; ++$I)
{
   $FH{$I} = IO::File->new_tmpfile || die "$0: could not create
filehandle #$I: $!\n";
};

warn "Created all filehandles; sleeping ...\n";

while (1)
{
   sleep(100);
};

--
Michael S. Muegel
mike-nospam@muegel.org
Dallas, Texas


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 1540
***************************************


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