[18181] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 349 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 24 14:07:24 2001

Date: Sat, 24 Feb 2001 11:05:08 -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: <983041508-v10-i349@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 24 Feb 2001     Volume: 10 Number: 349

Today's topics:
    Re: Can I use Excel as a data source <mbudash@sonic.net>
    Re: Difficult Split Question <bart.lateur@skynet.be>
    Re: Difficult Split Question <bertilow@chello.se>
        grepmail 4.46 released <nospam@coppit.org>
        HTML::Table 1.07 <a.peacock@chime.ucl.ac.uk>
        Msg and RPC modules - installing them <stuart@zerostate.co.uk>
        Newbie question <gop@gop.gop>
    Re: Newbie question <mbudash@sonic.net>
    Re: Newbie question <c_clarkson@hotmail.com>
    Re: Perl Threads -- advice needed <dan@tuatha.sidhe.org>
    Re: Problem: Perl cgi calling Excel via OLE on Win2000 (Dave Fisher)
    Re: Question.about s/// <iltzu@sci.invalid>
    Re: regex help needed <cryofan@msn.com>
    Re: Send HTML with mail? (F. Xavier Noria)
    Re: Send HTML with mail? <mbudash@sonic.net>
        Should this work?.  Beginners db question. Please help <pi@mty.com>
    Re: Should this work?.  Beginners db question. Please h <mbudash@sonic.net>
    Re: Should this work?.  Beginners db question. Please h (Tim Hammerquist)
    Re: Should this work?.  Beginners db question. Please h <pi@mty.com>
    Re: Should this work?.  Beginners db question. Please h <mbudash@sonic.net>
    Re: SMTP server (Chris Fedde)
    Re: SMTP server <bart.lateur@skynet.be>
    Re: SMTP server (The Mosquito ScriptKiddiot)
        XS has broken my brain <david@freemm.org>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 24 Feb 2001 09:28:31 -0800
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Can I use Excel as a data source
Message-Id: <mbudash-331CE9.09283124022001@news.pacbell.net>

In article <dxLl6.19798$5n4.397129@news6-win.server.ntlworld.com>, 
"Virgin News" <c.darlington@virgin.net> wrote:

> I have a list of stockists written in an Excel spreadsheet which is
> basically an address book.
> 
> I want someone to be able to query the spreadsheet via a webpage and then
> produce a list which matches the query.
> 
> Can I use the spreadsheet as it stands, or will i have to convert it to a
> flat file?
> 
> Any suggestions?
> 
> Many Thanks
> Chris Darlington
> 
> 

cpan has a Spreadsheet::ParseExcel module... try that...
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Sat, 24 Feb 2001 14:20:26 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Difficult Split Question
Message-Id: <vogf9toikn96t7358ql2ubdlrb3c7dtred@4ax.com>

Bertilo Wennergren wrote:

>> @matches = /(\w+(?:\(\w+(?,\w+)*\))?)/g;
>
>> It's that easy.
>
>Except that your code gives an error when I try to run it:

Oh damned, I forgot to correct both versions of the regex. Here, there's
a colon missing between the question mark and the comma.

	@matches = /(\w+(?:\(\w+(?:,\w+)*\))?)/g;


-- 
	Bart.


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

Date: Sat, 24 Feb 2001 15:09:24 GMT
From: "Bertilo Wennergren" <bertilow@chello.se>
Subject: Re: Difficult Split Question
Message-Id: <E8Ql6.943$bX.11802@nntp1.chello.se>


Bart Lateur:

> Oh damned, I forgot to correct both versions of the regex. Here, there's
> a colon missing between the question mark and the comma.

> @matches = /(\w+(?:\(\w+(?:,\w+)*\))?)/g;

----------------------------------------------------------------------
#!perl
use strict;
$_ = q!a,b,c,def(g,h,i)xx(x,x),j,k,lmn(o,p,q),r,stu(v,w),xyz!;
my @matches = /(\w+(?:\(\w+(?:,\w+)*\))?)/g;
for (@matches) { print "$_\n"}
----------------------------------------------------------------------
This prints:

a
b
c
def(g,h,i)
xx(x,x)
j
k
lmn(o,p,q)
r
stu(v,w)
xyz

I think the fourth and fifth lines should be combined.
(Yes, I know, my own version had the same problem.)

-- 
#####################################################################
                         Bertilo Wennergren
                 <http://purl.oclc.org/net/bertilo>
                        <bertilow@chello.se>
#####################################################################







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

Date: Wed, 21 Feb 2001 15:31:53 -0500
From: David Coppit <nospam@coppit.org>
Subject: grepmail 4.46 released
Message-Id: <t9fkuemj7248d5@corp.supernews.com>

Description:
- grepmail is a Perl program that searches a normal or compressed mailbox
  (gzip, bzip2, or tzip) for a given regular expression and returns those
  emails that match the query. It also supports searches constrained by date
  and size.

Download:
- You can download grepmail 4.46 from CPAN:
  http://www.cpan.org/authors/id/D/DC/DCOPPIT/grepmail-4.46.tar.gz
- Until the file propagates to the mirrors, you can use the following URL:
  http://download.sourceforge.net/grepmail/grepmail-4.46.tar.gz

New in version 4.46:
- Fixed a bug in -u message id processing. (Thanks go to an anonymous bug
  reporter on SourceForge.)
- Added more workarounds to prevent warnings resulting from a bug in Perl 5.6
  (Thanks to Joey Hess <joey@kitenet.net>)
- Added -Z flag to tell grepmail not to use Mail::Folder::FastReader even if
  it is installed.
- Fixed a bug introduced in version 4.44 where -m would not work unless used
  with -n. (Thanks to Imre Simon <is@ime.usp.br> for catching this.)
- --help anywhere on the command line now causes the help to be printed,
  instead of only when used as the first argument.
- Test script now exercises both the Mail::Folder::FastReader and perl mailbox
  implementations as appropriate.
- Restructured code to separate out Perl mailbox implementation as
  Mail::Folder::SlowReader. (This module is embedded in the grepmail script.)

A complete change log is at:
- ftp://grepmail.sourceforge.net/pub/grepmail/CHANGES

--
David

That's my real email




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

Date: Fri, 23 Feb 2001 18:50:47 +0000
From: Anthony Peacock <a.peacock@chime.ucl.ac.uk>
Subject: HTML::Table 1.07
Message-Id: <t9fku5ocib60c7@corp.supernews.com>

A revised version of the HTML::Table module has been placed on CPAN.

This release adds some new methods to the module, check the CHANGES file
for
details.

DESCRIPTION
    HTML::Table is used to generate HTML tables for
    CGI scripts.  By using the methods provided fairly
    complex tables can be created, manipulated, then printed
    from Perl scripts.  The module also greatly simplifies
    creating tables within tables from Perl.  It is possible
    to create an entire table using the methods provided and
    never use an HTML tag.

    HTML::Table also allows for creating dynamically sized
    tables via its addRow and addCol methods.  These methods
    automatically resize the table if passed more cell values
    than will fit in the current table grid.

    Methods are provided for nearly all valid table, row, and
    cell tags specified for HTML 3.0.




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

Date: Sat, 24 Feb 2001 14:18:57 -0000
From: "Stuart Lowes" <stuart@zerostate.co.uk>
Subject: Msg and RPC modules - installing them
Message-Id: <hmPl6.20261$5n4.415264@news6-win.server.ntlworld.com>

Hi I am trying to learn how to do client/server and RPC programming in Perl
using the Oreilly book - Advanced Programming Perl. I have downloaded the
examples but I'm not sure how to install the Msg and Rpc modules as there
doesn't appear to be a MakeFile for them. I have installed a few modules
before and they always had MakeFiles. I'm sure some people on here have
installed them successfully. If you can tell me how I'd be grateful.

Regards,

Stu




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

Date: Sat, 24 Feb 2001 17:03:46 +0200
From: "gop" <gop@gop.gop>
Subject: Newbie question
Message-Id: <978ibc$jrt$1@news.kolumbus.fi>

The FAQ really doesn't make that much sence (yet) as I'm not that good at
perl. I have a simple script that prints out a text file on the screen and
wonder how you can replace a part of the string with something else? For
example replacing the "world" in "Hello world!" with "house"... Hmm ;)
Thanks for any help... -gop




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

Date: Sat, 24 Feb 2001 09:23:32 -0800
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Newbie question
Message-Id: <mbudash-6DAE9E.09233224022001@news.pacbell.net>

In article <978ibc$jrt$1@news.kolumbus.fi>, "gop" <gop@gop.gop> wrote:

> The FAQ really doesn't make that much sence (yet) as I'm not that good at
> perl. I have a simple script that prints out a text file on the screen and
> wonder how you can replace a part of the string with something else? For
> example replacing the "world" in "Hello world!" with "house"... Hmm ;)
> Thanks for any help... -gop
> 
> 

one way: use regular expression replacement. what documentation are you 
using? the camel book (oreilly's 'programming perl') gives plenty of 
information on regular expressions and their use.

hate to give you a fish, but just to show how simple it is in your 
simple example:

$string = 'Hello world!';
$string =~ s/world/home/;

now, get the book and learn to fish!

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Sat, 24 Feb 2001 10:40:01 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: Newbie question
Message-Id: <0D4FB477B1BE289E.A7BCDC4A46B700EE.57C414B13168CEEE@lp.airnews.net>

gop <gop@gop.gop> wrote:
: The FAQ really doesn't make that much sence (yet) as I'm not that good at
: perl. I have a simple script that prints out a text file on the screen and
: wonder how you can replace a part of the string with something else? For
: example replacing the "world" in "Hello world!" with "house"... Hmm ;)
: Thanks for any help... -gop

Look at s/// and substr in perlfunc:

    s/world/house/;
    Would replace the first occurrence of world with house.

HTH,
Charles K. Clarkson






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

Date: Sat, 24 Feb 2001 15:24:15 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl Threads -- advice needed
Message-Id: <zmQl6.6041$M_1.575493@news1.rdc1.ct.home.com>

Victor Danilchenko <danilche@cs.umass.edu> wrote:
> 	Hi,
> 	I need to write a multithreaded project, and my language of choice is
> Perl (5.6.0). I have done the first part using Perl 5.005 threads, and
> discovered that they are apparently implemented via processes, which in
> turn incurs significant thread management overhead.

Nope, perl threads aren't implemented using processes. Generally they're
implemented on top of a POSIX-compatible thread library. Win32, OS/2, and
NeXT use platform-native threading libs, but no processes anywhere.

Now, some OSes will show threads like they were processes, and Linux in
particular uses a scheme where threads are almost processes (and almost
POSIX compatible, but that's a separate issue) but it's an OS or thread
library thing, not perl.

> Specifically, the
> multithreaded server (it waits on network requests and then spawns off a
> new thread to handle it) starts buckling gracelessly under heavy load --
> once too many clients place too many requests, the boss thread freezes
> on "accept" function. This does not happen if I allocate a pool of
> worker threads and hand the incoming connections to them (i.e. if I
> reuse worker threads instead having one thread per request), instead of
> spawning new threads for each connection, so the pro0blem is clearly
> with the thread creation and management.

Creating a new thread per request is a good way to overload your box on
any OS. Thread spawning's not free, and if you don't limit the number of
concurent connections you'll blow through some resource pretty quickly,
probably either memory or filehandles. The language used is irrelevant
really, though if you use one with lighter resource demands than perl
you might get another half-dozen simultaneous connections or so.

Thread pools are definitely a better way to handle this sort of issue,
regardless of the language used.

> 	Sooooo....
> 	My question is:

> 1) Are "interpreter threads" better that Perl 5.005 threads in terms of
> run-time performance and book-keeping overhead?

Interpreter threads aren't available to perl programs. It's 5.005 style
threads or nothing.

					Dan


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

Date: Sat, 24 Feb 2001 15:34:17 GMT
From: dave@jadco.com (Dave Fisher)
Subject: Re: Problem: Perl cgi calling Excel via OLE on Win2000
Message-Id: <3a97d1bc.89839372@news.ptd.net>

On Sat, 24 Feb 2001 12:46:48 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:

>Dave Fisher wrote:
>
>>I'm porting a set of PERL scripts from Win98 (where they work fine) to
>>Win2k IIS, and I'm having a problem getting a PERL script, running as
>>a cgi, to start Excel and have it appear on the display. 
>
>*boggle*
>
>You want a CGI script to open Excel and display a document on the
>*server*? What on earth is that good for?
>
>Besides, it would be dead easy to bring a server on its knees this way,
>because you're starting a new copy of Excel every time the script is
>run, and you leave it open when the script closes. A few tens of
>visitors, and your server is out of memory.
>
>-- 
>	Bart.

I've been doing this for serveral years on a Win98 platform, and I
just want to port the function to a new computer.  Any chance you know
how to help me?



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

Date: 24 Feb 2001 18:36:46 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Question.about s///
Message-Id: <983039607.12057@itz.pp.sci.fi>

In article <slrn99ejk3.bu.ben-fuzzybear@Odin.Thor>, Ben Okopnik wrote:
>
>tr/[\302-\306]/o/;

Why do you want to translate '[' and ']' to 'o'?

--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"I've yet to see an advert for an IT gig where a general awareness (let alone
 an ability to discuss sensibly or to even participate in) anal sex would be
 something one would include on one's CV."    -- Matt McLeod in the monastery

Please ignore Godzilla and its pseudonyms - do not feed the troll.


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

Date: Sat, 24 Feb 2001 08:42:38 -0600
From: "cryofan" <cryofan@msn.com>
Subject: Re: regex help needed
Message-Id: <eN7ZXDnnAHA.340@cpmsnbbsa09>



Thanks for replies. I have basically fixed the problem. One thing I was
doing wrong was the split; I changed it all-- got much better results. My
new split obviates the need to smash the characters in front of the "http".
My new string-end-smasher is  $array1[$num_words] =~ s/>.*$/$blank/;
One person commented that the problem is that the asterisk above stands for
zero or more, and that the problem was that it was taking only the zero.
Well, I don't think that is the case (maybe I misunderstood) b/c it is
greedy, and takes as many as possible. The above code does do the job--it
smashes the end of the string---everything inclusive and after the >, till
the end.

I still have a one-off problem somewhere, but that will be easy.

BTW, this code is for my senior project (BS  in CS), a data mining tool/bot
that will access financial news web pages and count words of interest such
as "bull, "bears",  "recession", "rates", "rise", "falling", and so forth,
count the number of occurences and store that info along with the time, and
then parse a web page that gives near-real-time stock market data such as
Dow Jones average, etc, and store that along with the time, and then puts
all this data on a web page so that the viewer can see if the number of
words of interest (how many time bull, bear, recession, etc) has any effect
on the stock market stats.
I am trying to quanitfy and analyse stock market psychology.

This bot runs off a free website, and it doesn't offer the HTTP module that
lets me auto-parse URLS, so I have to parse the URLs of the news stories
myself.


$blank="";
@array1= split(/href=/,$content);
$num_words = 0;$num_links=0;
while($num_words <= @array1)
{
  #if($array1[$num_words]
=~/href\=http\:\/\/biz\.yahoo\.com\/rb\/[0-9]*\/[a-zA-Z0-9_]*\.html\>\<b\>[a
-zA-Z0-9_]*/i)
#href=http://biz.yahoo.com/rb/010222/business_stocks_earnings_dc_2.html><b>T
ech
  if($array1[$num_words] =~/^http\:\/\/biz\.yahoo\.com\/rb\/.*/)
     {
  #      sleep(1);
        #print $array1[$num_words];
        #$array1[$num_words] =~ s/^[a-zA-Z0-9<>_.\.\=\\n]*href=//s;
        $array1[$num_words] =~ s/>.*$/$blank/;
        $somestring= $array1[$num_words];
        $array2[$num_links]=$somestring;$num_links++;


      #  print $array1[$num_words];
    #print $somestring;

     }

   $num_words++;

}
 print "The total number of links is ", $num_links-1;

 while($num_links >0){
  sleep(1);
  print "\n",  "link number", $num_links, "\n";
  print "\n";
   print $array2[$num_links-1];


  $num_links--;



"cryofan" <cryofan@msn.com> wrote in message
news:OLBNHphnAHA.327@cpmsnbbsa09...
> I am trying to kill the end of a string stored in an array.
> This is what the string looks like:
>
http://biz.yahoo.com/rb/010223/business_spieker_merger_dc_5.html><b>Equityma
> rket
> .</small><p><a
>
>
> The string is stored in array1[$num_words].
>
> why doesn't this code work?
>
>  $array1[$num_words] =~ s/\>\<b\>.$//;
> (note that I do have a hard-to-see period after "\>\<b\>" and before the
> "$", which should represent everything after the "><b>." until the
newline.)
> What I want to do is get rid of everything after the "html". But it is not
> working. I have tried many other more complicated substitution regexes
with
> no success. I was able to get rid of everything before the "http" with no
> problem, but something weird is going on at the end.
>
> Also, why won't this work?
>
>  $array1[$num_words] =~ s/\>\<b\>[a-zA-Z0-9]*//;
>
>
>
> TIA
>
>




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

Date: Sat, 24 Feb 2001 15:40:49 GMT
From: fxn@retemail.es (F. Xavier Noria)
Subject: Re: Send HTML with mail?
Message-Id: <3a97d574.399977@news.iddeo.es>

On Sat, 24 Feb 2001 12:16:26 -0800, "Me" <ja@nee.snee> wrote:

: How can I send an HTML mail using perl.

Look for Mail::Sendmail at http://search.cpan.org.

-- fxn


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

Date: Sat, 24 Feb 2001 09:09:29 -0800
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Send HTML with mail?
Message-Id: <mbudash-FF862F.09092924022001@news.pacbell.net>

In article <3a97d574.399977@news.iddeo.es>, fxn@isoco.com wrote:

> On Sat, 24 Feb 2001 12:16:26 -0800, "Me" <ja@nee.snee> wrote:
> 
> : How can I send an HTML mail using perl.
> 
> Look for Mail::Sendmail at http://search.cpan.org.
> 
> -- fxn

here's a prety good FAQ for the module:

http://alma.ch/perl/Mail-Sendmail-FAQ.htm

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Sat, 24 Feb 2001 16:49:57 -0000
From: "TC" <pi@mty.com>
Subject: Should this work?.  Beginners db question. Please help
Message-Id: <_mRl6.20536$5n4.425814@news6-win.server.ntlworld.com>


Hi,

I have, after 4 days managed to install mysql and dbi etc.. and have this
below script running ok on the server by typing in "perl sqltest.pl" and it
displays the db contents.

------
#!/usr/bin/perl

use DBI;

#open connection to Access database
$dbh = DBI->connect('dbi:mysql:maindb');

#prepare and execute SQL statement
$sqlstatement="SELECT * FROM test";
$sth = $dbh->prepare($sqlstatement);
$sth->execute ||
      die "Could not execute SQL statement ... maybe invalid?";

#output database results
while (@row=$sth->fetchrow_array)
                 { print "@row\n" }

---

but when i try and access i via a web brower i just get

Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.


I have the file placed in the cgi-bin and have chmod 755 it.

Any ideas appreciated.
Scot




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

Date: Sat, 24 Feb 2001 09:16:37 -0800
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Should this work?.  Beginners db question. Please help
Message-Id: <mbudash-B14B7D.09163724022001@news.pacbell.net>

In article <_mRl6.20536$5n4.425814@news6-win.server.ntlworld.com>, "TC" 
<pi@mty.com> wrote:

[snip] 'it works from the command line'

> but when i try and access i via a web brower i just get
> 
> Internal Server Error
> The server encountered an internal error or misconfiguration and was 
> unable
> to complete your request.
> 
> 
> I have the file placed in the cgi-bin and have chmod 755 it.

the short story (i'll leave the long one to someone else):

a script being run as a cgi needs to send back proper headers before 
anything else. as a bare minimum, add this after your 'use DBI' 
statement:

print "Content-type: text/html\n\n";

hth -
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Sat, 24 Feb 2001 17:28:01 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Should this work?.  Beginners db question. Please help
Message-Id: <slrn99fs78.d9m.tim@vegeta.ath.cx>

TC <pi@mty.com> wrote:
> 
> I have, after 4 days managed to install mysql and dbi etc.. and have this
> below script running ok on the server by typing in "perl sqltest.pl" and it
> displays the db contents.
> 
> ------
> #!/usr/bin/perl
> 
> use DBI;
> 
> #open connection to Access database
> $dbh = DBI->connect('dbi:mysql:maindb');
> 
> #prepare and execute SQL statement
> $sqlstatement="SELECT * FROM test";
> $sth = $dbh->prepare($sqlstatement);
> $sth->execute ||
>       die "Could not execute SQL statement ... maybe invalid?";
> 
> #output database results
> while (@row=$sth->fetchrow_array)
>                  { print "@row\n" }
> 
> ---
> 
> but when i try and access i via a web brower i just get
> 
> Internal Server Error
> The server encountered an internal error or misconfiguration and was unable
> to complete your request.

Are you sending HTTP headers, since it appears you're running the script
as a CGI?  Try adding:

print "Content-type: text/html\n\n";

before you send any output to stdout.  Consult `perldoc -q server`
for a very appropriate answer to your question.

If this doesn't solve the problem, it may be a mysql configuration
problem.  Make sure that the user under which the web server runs is
allowed to query the db (usually 'nobody' for Apache).  You may also
need to send a username/password in the connect string.

HTH
-- 
-Tim Hammerquist <timmy@cpan.org>

Life is too serious to be taken seriously.
	-- Mike Leonard


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

Date: Sat, 24 Feb 2001 18:48:49 -0000
From: "TC" <pi@mty.com>
Subject: Re: Should this work?.  Beginners db question. Please help
Message-Id: <l6Tl6.20810$5n4.440299@news6-win.server.ntlworld.com>

thanks for replying guys.

i added that to the script so it looks like:
#-------------------------
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "test-string";

use DBI;

#open connection to Access database
$dbh = DBI->connect('dbi:mysql:maindb');

#prepare and execute SQL statement
$sqlstatement="SELECT * FROM test";
$sth = $dbh->prepare($sqlstatement);
$sth->execute ||
      die "Could not execute SQL statement ... maybe invalid?";

#output database results
while (@row=$sth->fetchrow_array)
                 { print "@row\n" }

#------------------------------

and now when i access it through the browser it does not come up with any
errors but it only prints the "test-string" but does not print out the
contents of the db.

strange thing is when i run it like "perl sqltest.pl" it prints out both
"test-string" and the db contents.

Am i missing something here. Is there a diffrent way of doing printing when
using db's


Thanks again,
Scott

"Tim Hammerquist" <tim@vegeta.ath.cx> wrote in message
news:slrn99fs78.d9m.tim@vegeta.ath.cx...
> TC <pi@mty.com> wrote:
> >
> > I have, after 4 days managed to install mysql and dbi etc.. and have
this
> > below script running ok on the server by typing in "perl sqltest.pl" and
it
> > displays the db contents.
> >
> > ------
> > #!/usr/bin/perl
> >
> > use DBI;
> >
> > #open connection to Access database
> > $dbh = DBI->connect('dbi:mysql:maindb');
> >
> > #prepare and execute SQL statement
> > $sqlstatement="SELECT * FROM test";
> > $sth = $dbh->prepare($sqlstatement);
> > $sth->execute ||
> >       die "Could not execute SQL statement ... maybe invalid?";
> >
> > #output database results
> > while (@row=$sth->fetchrow_array)
> >                  { print "@row\n" }
> >
> > ---
> >
> > but when i try and access i via a web brower i just get
> >
> > Internal Server Error
> > The server encountered an internal error or misconfiguration and was
unable
> > to complete your request.
>
> Are you sending HTTP headers, since it appears you're running the script
> as a CGI?  Try adding:
>
> print "Content-type: text/html\n\n";
>
> before you send any output to stdout.  Consult `perldoc -q server`
> for a very appropriate answer to your question.
>
> If this doesn't solve the problem, it may be a mysql configuration
> problem.  Make sure that the user under which the web server runs is
> allowed to query the db (usually 'nobody' for Apache).  You may also
> need to send a username/password in the connect string.
>
> HTH
> --
> -Tim Hammerquist <timmy@cpan.org>
>
> Life is too serious to be taken seriously.
> -- Mike Leonard




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

Date: Sat, 24 Feb 2001 10:56:53 -0800
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Should this work?.  Beginners db question. Please help
Message-Id: <mbudash-41BA55.10565324022001@news.pacbell.net>

In article <l6Tl6.20810$5n4.440299@news6-win.server.ntlworld.com>, "TC" 
<pi@mty.com> wrote:

> #open connection to Access database
> $dbh = DBI->connect('dbi:mysql:maindb');
> 

try this kind of contruct instead:

  if (!($dbh = DBI->connect("DBI:mysql:maindb", $user, $passwrd,
                                { RaiseError => 1 }
                                ))) {
   print "Can't connect to mysql server: $!";
   exit;
  }

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Sat, 24 Feb 2001 14:49:14 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: SMTP server
Message-Id: <KRPl6.414$zN2.189661184@news.frii.net>

In article <20010224020611.03850.00005257@ng-mi1.aol.com>,
The Mosquito ScriptKiddiot <anotherway83@aol.com> wrote:
>lol...lemme clarify
>
>im not a scriptkiddiot, nor a hacker, nor a computer elite...
>
>i picked the name "mosquito scriptkiddiot" cos it sounds funny...mosquitoes at
>a computer trying to hack away...
>
>i still need to find sum smtp servers....
>
>please suggest sum...
>
>thx
>peace
>

At the risk of giving more information than is good for you. Go
over to the www.orbs.org site.  You may be able to abuse what's
published there to get your spamming done.

BTW what does this have to do with perl?

chris
-- 
    This space intentionally left blank


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

Date: Sat, 24 Feb 2001 13:10:30 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: SMTP server
Message-Id: <6ocf9t49f001e35c3r0ps086m8hvmot4bc@4ax.com>

The Mosquito ScriptKiddiot wrote:

>it NEVER sent the email to the intended recipient

Use the one from your ISP.

-- 
	Bart.


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

Date: 24 Feb 2001 18:54:45 GMT
From: anotherway83@aol.com (The Mosquito ScriptKiddiot)
Subject: Re: SMTP server
Message-Id: <20010224135445.05784.00004998@ng-md1.aol.com>

thanks, but i'm no spammer either, i want to use an smtp server cos i've never
used one (directly)...i mean...i keep finding those "smtp tutorials"
everywhere, but till 2day i haven't been able to actually carry out even a
single example in those tutorials...the sever i did find, didn't work (like i
said)

thanks again

peace
The Mosquito ScriptKiddiot
Championing the Cause of Mosquitoes in Technology


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

Date: Sat, 24 Feb 2001 15:58:25 GMT
From: David Lloyd <david@freemm.org>
Subject: XS has broken my brain
Message-Id: <3A97D900.59C563F8@freemm.org>

I am having a very frustrating problem, made more frustrating by the
fact that my problem involves proprietary code so I can't post an exact
example.  Here's a description of the problem:

I'm generating a module, let's say it's called Module.  It has a
sub-package defined in the XS file called Module::SubPackage.  In my
typemap, I have an INPUT and OUTPUT section for a C struct that converts
between a Module::SupPackage Perl object and a C struct, similar to this:

TYPEMAP
module_struct *		MODULE_SUBPACKAGE_OBJ

INPUT
MODULE_SUBPACKAGE_OBJ
    $var = ($type) SvIV((SV *)SvRV($arg));

OUTPUT
MODULE_SUBPACKAGE_OBJ
	sv_setref_pv($arg, "Module::SubPackage", (void *) $var);

The problem is this:  If I define a method in Module::SubPackage like this:

MODULE = Module		PACKAGE = Module::SubPackage	PREFIX = module_subpackage_

(..a couple methods..)

void
module_subpackage_DESTROY(self)
	module_struct *self
	CODE:
		blah blah;

(..a bunch more methods..)

It tells me that this:

Error: No INPUT definition for type 'module_struct *', typekind
'MODULE_SUBPACKAGE_OBJ' found in Module.xs, line xxx

Now I thought this meant it wasn't seeing my INPUT definition, so I took
it out.  But when I 'make' this time, it lists about a zillion of the
same message, once for each time I use that type as an input variable. 
So it sees the INPUT definition, it just chooses to ignore it.

Now here's the wierd part: If I name the method anything *except* for
DESTROY, it works just fine.  Even if I just change the case of
'DESTROY' in any way.

What is going on?  Does perl just hate me?  I seem to recall in dim
memory having this problem before, and it was caused by something I did,
but I sure don't remember what.

Thank you for any help you can give me!

 - D

<david@freemm.org>


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

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 V10 Issue 349
**************************************


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