[15636] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3049 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 15 09:05:37 2000

Date: Mon, 15 May 2000 06:05:13 -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: <958395912-v9-i3049@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 15 May 2000     Volume: 9 Number: 3049

Today's topics:
        [General] From which script size Perl performance decre <charles.henry@engineer2k.com>
    Re: [General] From which script size Perl performance d <andkaha@my-deja.com>
        [Hash] Is the key always double-quoted? <charles.henry@engineer2k.com>
        [RegExp] Specific or General, which is faster? <charles.henry@engineer2k.com>
    Re: [RegExp] Specific or General, which is faster? <andkaha@my-deja.com>
    Re: [RegExp] Specific or General, which is faster? <charles.henry@engineer2k.com>
    Re: ActivePerl and DBD::MySQL emarkert@my-deja.com
        Creating mail accounts on Linux with Perl (AcCeSsDeNiEd)
    Re: directory okay <gellyfish@gellyfish.com>
    Re: directory okay (Tad McClellan)
    Re: DLL <gellyfish@gellyfish.com>
    Re: Embedding plain text in HTML <andkaha@my-deja.com>
    Re: Forms with Perl <gellyfish@gellyfish.com>
    Re: Help with dates in Perl (Peter J. Acklam)
    Re: Help! Can't find Perl work! <gellyfish@gellyfish.com>
        NEED HELP <webmaster@erotic-x.de>
        Please help <webmaster@erotic-x.de>
    Re: problem with .pm files not in lib dir <gellyfish@gellyfish.com>
    Re: problem with .pm files not in lib dir <andkaha@my-deja.com>
    Re: Programing Question... <gellyfish@gellyfish.com>
        Silly newbie question ? lurking@yifan.net
    Re: Silly newbie question ? <andkaha@my-deja.com>
    Re: Silly newbie question ? <billy@arnis-bsl.com>
    Re: Starting another prog <billy@arnis-bsl.com>
    Re: Starting another prog <tom@thehardcoregamer.com>
        style sheet via perl/CGI Script <michael.mayerhofer@gmx.net>
    Re: style sheet via perl/CGI Script <gellyfish@gellyfish.com>
    Re: style sheet via perl/CGI Script <michael.mayerhofer@gmx.net>
    Re: tar in Perl, system or not <gellyfish@gellyfish.com>
    Re: Update problem with DBI-ODBC and MSAccess geertjan_gorter@my-deja.com
    Re: Update problem with DBI-ODBC and MSAccess geertjan_gorter@my-deja.com
    Re: What's this line which Perl added to AUTOEXEC.BAT? <gellyfish@gellyfish.com>
    Re: What's this line which Perl added to AUTOEXEC.BAT? <waldo700NOwaSPAM@aol.com.invalid>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 15 May 2000 12:54:41 +0100
From: "Charles Henry" <charles.henry@engineer2k.com>
Subject: [General] From which script size Perl performance decreases dramatically?
Message-Id: <8foldk$job$1@reader1.fr.uu.net>

I have a 65kb Perl script (reasonably organized) and I was wondering such a
size would decrease Perl performance a lot. I believe Perl will take a lot
of time parsing my code ...

Also do "use strict" and "perl -w" slow down my code? I'm asking that
because obviously Perl will take the time to check ambiguous consctructs and
correct variable declarations, which may decrease performance ...

Thank you!




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

Date: Mon, 15 May 2000 11:25:23 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: [General] From which script size Perl performance decreases dramatically?
Message-Id: <8fomqn$sgf$1@nnrp1.deja.com>

In article <8foldk$job$1@reader1.fr.uu.net>,
  "Charles Henry" <charles.henry@engineer2k.com> wrote:
> I have a 65kb Perl script (reasonably organized) and I was wondering
such a
> size would decrease Perl performance a lot. I believe Perl will take a
lot
> of time parsing my code ...
>
> Also do "use strict" and "perl -w" slow down my code? I'm asking that
> because obviously Perl will take the time to check ambiguous
consctructs and
> correct variable declarations, which may decrease performance ...
>
> Thank you!
>
>

Use the Benchmark package to time your script with and without '-w' and
with and without 'use strict;'.

/A

--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk email is reported to the appropriate authorities.


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


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

Date: Mon, 15 May 2000 13:43:08 +0100
From: "Charles Henry" <charles.henry@engineer2k.com>
Subject: [Hash] Is the key always double-quoted?
Message-Id: <8foo8f$laq$1@reader1.fr.uu.net>

I read in the Camel Book that the key of a hash was automatically
double-quoted. But I've found out it's not always true. Here is what I did :

my %hash = (
        01=>'foo',
);
print keys %hash;

And it printed '1' (not '01')

but when I tried :

my %hash = (
        "01"=>'foo',
);
print keys %hash;

It printed '01' as expected.

This "bug?" can be very annoying when you want to deferenciate $hash{01} and
$hash{1} if you didn't use double quotes in  the hash construct ... trusting
the Perl Book ...

I am using version 5.005_02 for Intel platforms on Linux RedHat.

Any ideas are welcome ..




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

Date: Mon, 15 May 2000 12:48:11 +0100
From: "Charles Henry" <charles.henry@engineer2k.com>
Subject: [RegExp] Specific or General, which is faster?
Message-Id: <8fol1e$jg3$1@reader1.fr.uu.net>

I have a list of strings which 2 first character belong to the [a-z] class.
I want to match those two character.

I was wondering what would be faster for Perl :

A general :
foreach (@strings) {
        /^(.{2})/
}

or a specific :
foreach (@strings) {
        /^([a-z]+)/
}

Thanks!




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

Date: Mon, 15 May 2000 11:22:22 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: [RegExp] Specific or General, which is faster?
Message-Id: <8foml3$se6$1@nnrp1.deja.com>

In article <8fol1e$jg3$1@reader1.fr.uu.net>,
  "Charles Henry" <charles.henry@engineer2k.com> wrote:
> I have a list of strings which 2 first character belong to the [a-z]
class.
> I want to match those two character.
>
> I was wondering what would be faster for Perl :
>
> A general :
> foreach (@strings) {
>         /^(.{2})/
> }
>
> or a specific :
> foreach (@strings) {
>         /^([a-z]+)/
> }
>
> Thanks!
>
>

I don't know if this is implementation dependant or not, but in either
case you may always benchmark your code using the Benchmark package.

/A

--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk email is reported to the appropriate authorities.


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


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

Date: Mon, 15 May 2000 13:59:16 +0100
From: "Charles Henry" <charles.henry@engineer2k.com>
Subject: Re: [RegExp] Specific or General, which is faster?
Message-Id: <8fop6m$lun$1@reader1.fr.uu.net>

> or a specific :
> foreach (@strings) {
>         /^([a-z]+)/
> }

Sorry I really meant :
/^([a-z]{2})/





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

Date: Mon, 15 May 2000 12:37:27 GMT
From: emarkert@my-deja.com
Subject: Re: ActivePerl and DBD::MySQL
Message-Id: <8for26$t5$1@nnrp1.deja.com>

Good luck!

I tried for two f$%^&* weeks to get this to work.

I think your best bet is going to be the perl binary that is linked off
of mysq.com - it has DBD::mysql installed, just make sure to install it
on your C: drive.

With all the problems I had just getting perl to install and work
properly I'm personally swearing off any perl development on Win32 with
the current version of perl - it needs work.

In article <sho1okdokcp171@corp.supernews.com>,
  "Derrick Hopkins" <dhopkins@itribe.net> wrote:
> I was surprised to find that in ActivePerl (613) for windows, the
MySQL DBD
> no
> longer works The older version (522) had a very nice MySQL driver but
it
> doesnt work with (613). Does anyone know if an update for DBD::MySql
is on
> its way or if one has already been released?
>
> D
>
> --
> Derrick Hopkins[]dhopkins@itribe.net
> Enjoy Your Job - Make Lots of Money - Work Within the Law -
> Pick Any 2
>
>


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


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

Date: Mon, 15 May 2000 10:09:09 GMT
From: ssdillon@rm_mailandnews.com (AcCeSsDeNiEd)
Subject: Creating mail accounts on Linux with Perl
Message-Id: <391fcb92.494402@news.singnet.com.sg>

Hi, 
Does anyone know how to create mail accounts on Linux RedHat6.2 with
Perl?

It's running sendmail. I'm not too familiar with spoiling but should
the accounts be spooled here: /var/spool/mail  ?
Or should I not use spooling and use another method instead? 
Any existing pre-wrriten scripts that I can use?

Thanks a lot folks!



To e-mail me, remove "rm_"


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

Date: Mon, 15 May 2000 11:54:58 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: directory okay
Message-Id: <mART4.1306$Kc1.186179@news.dircon.co.uk>

On Mon, 15 May 2000 09:25:56 GMT, Daniel van den Oord Wrote:
> no not the cgi.pm is the problem.. when I change to another directory where
> the script is not located it will stop displaying the size and time !!

Yes.  Because the filenames returned by readdir are just that they do not
include the path information which you must add yourself before you
try to perform any operations on the file.  It just happens that it works
when you are in the current directory because you dont need to add the path.


/J\


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

Date: Mon, 15 May 2000 07:54:09 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: directory okay
Message-Id: <slrn8hvpb1.v7l.tadmc@magna.metronet.com>

On Mon, 15 May 2000 09:13:13 GMT, Daniel van den Oord <danielxx@bart.nl> wrote:
>okay I got this far nice and functioning I wanted to add the cgi.pm to be
>used for using a parameter if I do that everythin like size and time just
>doesn't work anymore ?!?
>
>#!c:\perl\bin\perl


You should enable warnings and the "use strict" pragma (compiler directive):

#!c:\perl\bin\perl -w
use strict;


>$curdir = "c:\Inetpub";
              ^^
              ^^

Print that out and see what you have put into $curdir.


>$namev = "cgi-bin";
>header();
>
>opendir DH, "$curdir/$namev"  or die "Can't open: $!";
>my @entries = readdir DH;
               ^^^^^^^

   perldoc -f readdir

would have pointed out your problem in *seconds*!

You are expected to check the docs *before* asking thousands
of people to help you.


>closedir DH;
>
>foreach my $entry (map "$_", @entries){
                        ^  ^

1) those quotes serve no purpose other than to make your code hard to read


2) your map() doesn't map anything! Might as well have had:

      foreach my $entry ( @entries ){

   to get the same results.


3) your map() *should* be mapping something. It should paste
   the directory name in front of the file names:

      foreach (  map "$curdir/$namev/$_", @entries ) {



>  if ($size eq 0) {
>    $description = "directory";
>  }

That will do the Wrong Thing for empty _files_.

If you want to test for a directory, then test for a directory,
not zero size.


   if ( -d $entry ) {


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 15 May 2000 11:56:20 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DLL
Message-Id: <EBRT4.1307$Kc1.186179@news.dircon.co.uk>

On Mon, 15 May 2000 06:31:13 GMT, BOSCH Patrick Wrote:
> This is a multi-part message in MIME format.
> --------------AC6F4C330B1AC7BCC86C717A
> Content-Type: text/plain; charset=iso-8859-1; x-mac-type="54455854"; x-mac-creator="4D4F5353"
> Content-Transfer-Encoding: 8bit

Please dont do that.  Usenet is a plain text medium.

> 
> Hello!
> 
> Does anyone know wether it's possible to user a dll with perl?
> 

Yep.  Look at the module Win32::API


/J\


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

Date: Mon, 15 May 2000 11:38:01 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: Embedding plain text in HTML
Message-Id: <8fonio$t4b$1@nnrp1.deja.com>

In article <8foh62$mi4$1@nnrp1.deja.com>,
  chris2037@my-deja.com wrote:
> If I have a plain text file like so:
>
> kkdhjwjnhd
> dfpoiwerfwefriwfdff
> wneqopeeqmv/fvs
> 109rfv////a//a/a/a/
> .
> .
> .
> and I want to put these in an html file, how should I do that?
Actually
> these are lines of output from a for loop. I couldn't get it to work
> with:
>
> open(FH, ">/somefile.html");

What kind of error did you get?

Do you have write permissions on '/'?

Try
open(FH, ">/path/to/the/right/dir/somefile.html");


/A


--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk email is reported to the appropriate authorities.


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


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

Date: Mon, 15 May 2000 11:59:16 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Forms with Perl
Message-Id: <oERT4.1308$Kc1.186179@news.dircon.co.uk>

On 15 May 2000 06:33:15 GMT, David Efflandt Wrote:
> On Sun, 14 May 2000, Ian <duxbury@kentmere23.freeserve.co.uk> wrote:
>>This debugging seems really complicated. Is there no easy way around. I
>>copied the code from a website so you may have got the impression that I
>>know more than I actually do.
>>
>>I skimmed through the pages of debugging but I can't seem to find anything
>>relating to (offline mode: enter name=value pairs on standard input) what
>>ever this is. Any more suggestions. Cheers.
> 
> This allows you to test a Perl script using CGI.pm by entering parameters
> on the commandline if you are not running it on a webserver.  Example:
> 
> (offline mode: enter name=value pairs on standard input)
> name=Bob
> city=London
> 
> Then hit Ctrl-D to run the script with those params.

Ctrl-Z on Windows ....

/J\


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

Date: 15 May 2000 13:13:14 +0200
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: Help with dates in Perl
Message-Id: <cxcog689id1.fsf@dioscuri.uio.no>

CoDoGG <Co_DoGG.NoSPaM@HoMe.CoM> wrote:

> I need to find the current date in perl in the format YYYY-MM-DD in
> order to compare it to another date located in a file!!

Ilja <billy@arnis-bsl.com> writes:

> my ($day, $mon, $year) = (localtime(time))[3,4,5];
> my $date_string = sprintf "%04d-%02d-%02d", $year+1900, $mon+1, $day;

Probably slower, but more fun...

  $date = sprintf "%04d-%02d-%02d",
            sub { $_[5]+1900, $_[4]+1, $_[3] }->(localtime);

Peter

-- 
$\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
//)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];


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

Date: Mon, 15 May 2000 10:20:22 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help! Can't find Perl work!
Message-Id: <GbQT4.1285$Kc1.185807@news.dircon.co.uk>

On 14 May 2000 21:33:39 -0400, kj0 Wrote:
> 
> 
> Hi!  I'm a grad student working a PhD in bioinformatics; I live in
> Boston, MA.  I have 6 years of Perl programming experience, mostly
> doing bioinformatics and system's management applications. (FWIW, I'm
> knowledgeable enough to be the "local Perl guru" in a group of about
> 20 grad students and postdocs).
> 
> For several months now I've been trying to find part-time work
> programming in Perl in the Boston/Cambridge area, with absolutely no
> success (not even close).
> 
> This is surprising to me.  Maybe I'm not looking in the right places.
> Is there a clearing house for job openings for Perl programmers in the
> New England area?  Any other resources (free or not) for Perl job
> hunters (resume critiquing, head hunters, etc.) I should know about?
> 

Have you checked out <http://jobs.perl.org> ?  Also you could do worse
than contacting your local Perl Mongers :

    <http://www.pm.org/groups/north_america.shtml>

who will probably have some suggestions on the matter.

/J\


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

Date: Mon, 15 May 2000 13:41:42 +0200
From: "Joerg Frintrop" <webmaster@erotic-x.de>
Subject: NEED HELP
Message-Id: <8fonip$ghv$14$1@news.t-online.com>

Hey!

I need your help guys!
I have a big prob with perl on my machine.
I am running a searchengine with mysql. everything is working fine, but when
I watch my error_log, I find errors every seconds, which is generated by the
perl scripts every second.
But the scripts seems to work.
The message in the error_log is:
Caught a SIGTERM at /usr/local/apache/cgi-bin/go.cgi line 0

What does line 0 mean ?
We coundn't find ynthing on the servers.
Other scripts on the machine are doing the same, but not so often!
go.cgi is the most used script.


Thanks in advancJF






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

Date: Mon, 15 May 2000 14:30:57 +0200
From: "Joerg Frintrop" <webmaster@erotic-x.de>
Subject: Please help
Message-Id: <8foqf4$h5o$14$1@news.t-online.com>

Hey!

I need your help guys!
I have a big prob with perl on my machine.
I am running a searchengine with mysql. everything is working fine, but when
I watch my error_log, I find errors every seconds, which is generated by the
perl scripts every second.
But the scripts seems to work.
The message in the error_log is:
Caught a SIGTERM at /usr/local/apache/cgi-bin/go.cgi line 0

What does line 0 mean ?
We coundn't find ynthing on the servers.
Other scripts on the machine are doing the same, but not so often!
go.cgi is the most used script.


Thanks in advancJF








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

Date: Mon, 15 May 2000 11:35:13 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: problem with .pm files not in lib dir
Message-Id: <RhRT4.1303$Kc1.186179@news.dircon.co.uk>

On Mon, 15 May 2000 10:03:31 GMT, Jarl Wijman Wrote:
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>

Please dont do that. Usenet is a plain text medium.

> i downloaded a forum, built with perl and mysql.  works perfectly
> on linux, on NT in encounter a problem tho.  the directory with perl
> script files also contain 5 perl modules, and on NT the forum is unable
> to find them. it claims it only searches in perl/lib and perl/site/lib
> is this a problem on NT or can i change some setting so perl will look
> for perl modules in the local dir first?  thanks a lot in advance,
> 

Have you read the section in perlfaq8 entitled :

    How do I keep my own module/library directory?  

/J\


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

Date: Mon, 15 May 2000 11:41:34 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: problem with .pm files not in lib dir
Message-Id: <8fonpd$tke$1@nnrp1.deja.com>

In article <391FCB1B.408B30A7@interplein.nl>,
  jwijman@interplein.nl wrote:
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Hi,
> <p>i downloaded a forum, built with perl and mysql.
> <br>works perfectly on linux, on NT in encounter a problem
> <br>tho.
> <p>the directory with perl script files also contain 5
> <br>perl modules, and on NT the forum is unable to
> <br>find them. it claims it only searches in perl/lib and
> <br>perl/site/lib
> <p>is this a problem on NT or can i change some setting
> <br>so perl will look for perl modules in the local dir first?
> <p>thanks a lot in advance,
> <p>Jarl</html>
>
>

You could change the @INC array or use the '-I' switch or "use lib
'/mypath/libdir/';". See the perlvar manual and look for the entry on
'@INC'.

/A


--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk email is reported to the appropriate authorities.


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


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

Date: Mon, 15 May 2000 10:35:50 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Programing Question...
Message-Id: <aqQT4.1290$Kc1.185807@news.dircon.co.uk>

On Mon, 15 May 2000 08:32:41 GMT, The Evil Beaver Wrote:
> LinkWorm Software, Inc. <webmaster@linkworm.com> wrote...
> ...
>> Yes, CGI can be used, which can be coded in Perl, C/++, Python and
>> other's. They can use combinations (or only) of CGI, PHP, ASP, Java,
>> etc. Many, many things are used, it depends on what you know best, and
>> what works best on said web server's OS/web server, etc. That's a very
>> vague question.
> Do we have ASP for any OS other than Windows yet? If not, why bother even
> mentioning it?

Apache::ASP if you have mod_perl .

/J\


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

Date: 15 May 2000 11:16:39 GMT
From: lurking@yifan.net
Subject: Silly newbie question ?
Message-Id: <8foman$o25$1@rks1.urz.tu-dresden.de>

Hi folks!

Just started with perl several weeks ago.
After some "play" with perl and some neat add-on modules I
got a problem and I am unable to solve that problem.

Using Net::NNTP I tried to fetch the list of all newsgroups on the server.

So making a new Net::NNTP-Object as usual: 

use Net::NNTP;

%nntpoptions=("Timeout",120,"Debug",0,"Reader",0);
$nntp=Net::NNTP->new($newshost,%nntpoptions);

So far there was no problem.

Now receiving the list of newsgroups from the server using list();
perldoc Net::NNTP says that the call of list will give me a reference
to a hash where the key is a group name...perfect, that's what I need.

So doing:

%grouplist=$nntp->list();

The receiving of the list was successful.
Now I try to print the list of all newsgroups using foreach and keys:

foreach $index (keys(%grouplist))
{
  print "Found group: $index\n";
}

But all I get is:

"Found group: HASH(0x825b124)"

So what's the problem? Where are my -correct- key values?
Is it necessary to do a de-referencing?

So long...confused...Andreas.



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

Date: Mon, 15 May 2000 11:55:51 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: Silly newbie question ?
Message-Id: <8fook2$uae$1@nnrp1.deja.com>

In article <8foman$o25$1@rks1.urz.tu-dresden.de>,
  lurking@yifan.net wrote:
[cut]
> Now receiving the list of newsgroups from the server using list();
> perldoc Net::NNTP says that the call of list will give me a reference
> to a hash where the key is a group name...perfect, that's what I need.
>
> So doing:
>
> %grouplist=$nntp->list();

A reference is a scalar:

$group_ref = $nntp -> list();

>
> The receiving of the list was successful.
> Now I try to print the list of all newsgroups using foreach and keys:
>
> foreach $index (keys(%grouplist))

foreach $index (keys(%{$group_ref}))


(I didn't try the above code).

/A

--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk email is reported to the appropriate authorities.


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


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

Date: Mon, 15 May 2000 12:10:18 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: Silly newbie question ?
Message-Id: <8fopf1$v18$1@nnrp1.deja.com>

In article <8foman$o25$1@rks1.urz.tu-dresden.de>,
  lurking@yifan.net wrote:
> Hi folks!
>
> Just started with perl several weeks ago.
> After some "play" with perl and some neat add-on modules I
> got a problem and I am unable to solve that problem.
>
> Using Net::NNTP I tried to fetch the list of all newsgroups on the server.
>
> So making a new Net::NNTP-Object as usual:
>
> use Net::NNTP;
>
> %nntpoptions=("Timeout",120,"Debug",0,"Reader",0);
> $nntp=Net::NNTP->new($newshost,%nntpoptions);
>
> So far there was no problem.
>
> Now receiving the list of newsgroups from the server using list();
> perldoc Net::NNTP says that the call of list will give me a reference
> to a hash where the key is a group name...perfect, that's what I need.
>
> So doing:
>
> %grouplist=$nntp->list();
>
> The receiving of the list was successful.
> Now I try to print the list of all newsgroups using foreach and keys:
>
> foreach $index (keys(%grouplist))
> {
>   print "Found group: $index\n";
> }
>
> But all I get is:
>
> "Found group: HASH(0x825b124)"
>
> So what's the problem? Where are my -correct- key values?
> Is it necessary to do a de-referencing?
>

As you mentioned, you got *a hash reference*, not a hash.
A reference is a scalar:

$grouplist = $nntp->list();

foreach $index (keys %{$grouplist})
{
     print "Found group: $index\n";
}

See perldoc perlref and perldoc perldsc for more details.

Good luck.
Ilja.



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


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

Date: Mon, 15 May 2000 09:56:56 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: Starting another prog
Message-Id: <8fohl3$n4j$1@nnrp1.deja.com>

In article <391FC331.1F7CA592@datapharm.de>,
  Andreas Huber <ah@datapharm.de> wrote:
> Hi,
>
> how can I start another prog out of my perl-script, without keeping
> alive my main-script?
>

perldoc -f exec

(or http://www.cpan.org/doc/manual/html/pod/perlfunc/exec.html)

Ilja.



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


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

Date: Mon, 15 May 2000 13:52:08 +0200
From: DarkRonin <tom@thehardcoregamer.com>
Subject: Re: Starting another prog
Message-Id: <391FE4E8.70FB7F9B@thehardcoregamer.com>

If you are using a script, try the following:

system("/usr/local/bin/perl5 your.cgi </dev/null >/dev/null&");

hope that helps...

--
Thomas C. C. Wright
Editor in Chief
***********************
TheHardCoreGamer
- The Place Gamers call Home
***********************
http://www.thehardcoregamer.com
mailto:tom@thehardcoregamer.com

Andreas Huber wrote:

> Hi,
>
> how can I start another prog out of my perl-script, without keeping
> alive my main-script?
>
> Thanks
>
> --
> Andreas Huber
> Produktion & Entwicklung
> Datapharm Netsystems AG
>
> E-Mail: ah@datapharm.de
> Tel.: (+49) 89 85 68 4 -156
> Fax:  (+49) 89 85 68 4 -100



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

Date: Mon, 15 May 2000 11:50:53 +0200
From: Michael Mayerhofer <michael.mayerhofer@gmx.net>
Subject: style sheet via perl/CGI Script
Message-Id: <391FC87D.46AB9AE1@gmx.net>

I'm getting cracy with my following problem:

I send with an CGI Perl -Script sends an answer back to a request.
Now I  use a Style Sheet for my pages and I also want to use this for my
sendet Request.
BUT: Wenn I use this line in my script:

print "<link rel=stylesheet type=\"text\/css\"
href=\\css\\tivweb.css>\n";

I get this error:

> Standard CGI Launch Error (Error Code 500)
>
> This is a sample customized error message.

It seems, that the Script tries to start the "tivweb.css" file?!

Even the url method doesn't work. (I mean, that I use
href=url(localhost/tivweb.css) to get the file)

Maybe the main-problem is that obviously I'm not able to get files, out
of the "cgi-bin" Folder. The server ever tries to get the file in the
cgi folder.

How can I write the print-line above, that I get the .css file in the
root-folder of the server, like every else html-file?

Michi





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

Date: Mon, 15 May 2000 11:39:35 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: style sheet via perl/CGI Script
Message-Id: <XlRT4.1305$Kc1.186179@news.dircon.co.uk>

On Mon, 15 May 2000 11:50:53 +0200, Michael Mayerhofer Wrote:
> I'm getting cracy with my following problem:
> 
> I send with an CGI Perl -Script sends an answer back to a request.
> Now I  use a Style Sheet for my pages and I also want to use this for my
> sendet Request.
> BUT: Wenn I use this line in my script:
> 
> print "<link rel=stylesheet type=\"text\/css\"
> href=\\css\\tivweb.css>\n";
> 

print qq%<link rel=stylesheet type="text/css" href="/css/tivweb.css">\n%;

Of course questions about *what* you should be printing have nothing to do
with Perl and would better be asked in some comp.infosystems.www.* group

/J\


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

Date: Mon, 15 May 2000 14:34:24 +0200
From: Michael Mayerhofer <michael.mayerhofer@gmx.net>
Subject: Re: style sheet via perl/CGI Script
Message-Id: <391FEED0.D673CFFD@gmx.net>

> print qq%<link rel=stylesheet type="text/css" href="/css/tivweb.css">\n%;
>
> Of course questions about *what* you should be printing have nothing to do
> with Perl and would better be asked in some comp.infosystems.www.* group

Thanks for your hint especially for the very fast answer. Now it's working.
But I have to say, that the questions was not about what I should write I was
a quesition about how I should it do.

I haven't found an explanation about the use of qq and the use of % string %?!

(either in "Perl in a Nutshell" nor in selfhtml/perl)

Should qq be like the double qota (") and q like the literal (')?
% Seems to be a string limiter, isn't it?

Why doesnt work the same line with " "?

Michi



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

Date: Mon, 15 May 2000 10:06:40 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: tar in Perl, system or not
Message-Id: <Q_PT4.1284$Kc1.185807@news.dircon.co.uk>

On Sun, 14 May 2000 08:22:31 -0700, Xah Wrote:
> how to do tar in perl?
> 

Archive::Tar

/J\


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

Date: Mon, 15 May 2000 10:34:11 GMT
From: geertjan_gorter@my-deja.com
Subject: Re: Update problem with DBI-ODBC and MSAccess
Message-Id: <8fojr3$pdo$1@nnrp1.deja.com>

In article <8fo5of$icq$1@orpheus.gellyfish.com>,
  Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On Sun, 14 May 2000 00:55:27 +0200 Geert-Jan
wrote:
> > Everytime I try an "UPDATE... " or
an "INSERT..." SQL command on an Access
> > Database
> > using a Perl program with DBI and DBD-ODBC,
it fails. The SELECT-strings
> > work fine though.
> > The web server returns an error, like:
> >
> > "DBD::ODBC::st fetchall_arrayref failed:
(DBD: no select statement currently
> > executing err=-1)
> >  at C:\sambar41\docs\odigon_1\cgi-
bin\test\update.cgi line 16."
> >
>
> This is because a fetch of any sort is
meaningless with a query that doesnt
> return any rows such as an insert, delete or
update.  The execute() is
> all that you need or alternatively you can use
do().
>
> /J\

Thanks for the responds.
Of course the fetch is meaningless, it was a
leftover from a SELECT test. But it doesn't work
without the fetch either, or with the do(). I
tried it on 2 different PC-s, using an Apache and
a Sambar server. Does anybody have a similar
configuration that does work?

Geert-Jan


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


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

Date: Mon, 15 May 2000 11:34:38 GMT
From: geertjan_gorter@my-deja.com
Subject: Re: Update problem with DBI-ODBC and MSAccess
Message-Id: <8fonce$t28$1@nnrp1.deja.com>

In article <8fklnl$9sc$1@news.cityweb.de>,
  "Geert-Jan" <gortergj@cityweb.de> wrote:
> Everytime I try an "UPDATE... " or an "INSERT..." SQL command on an
Access
> Database
> using a Perl program with DBI and DBD-ODBC, it fails. The SELECT-
strings
> work fine though.
> The web server returns an error, like:
>
> "DBD::ODBC::st fetchall_arrayref failed: (DBD: no select statement
currently
> executing err=-1)
>  at C:\sambar41\docs\odigon_1\cgi-bin\test\update.cgi line 16."
>
> I was also given a reference to an error in the DBI.pm.
> Here's an example of the script, although I don't think there's
something
> wrong with it
> (because the SELECTs work):
>
> #!c:\Perl\bin\perl.exe
> use DBI;
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
>
> $dbName     = "DBI:ODBC:Keywords";
> $dbUserName = "user";
> $dbPassword = "";
>
> $dbh = &connectToDB();
> $dataObject = $dbh->prepare("UPDATE tbl_smg_dat_Class_Synonym_Ger_1
SET
> tbl_smg_dat_Class_Synonym_Ger_1.Name_Class = 'Kräuter' WHERE
> tbl_smg_dat_Class_Synonym_Ger_1.Name_Class='Gewürze'");
>     $dataObject->execute();
>     @dbRows = $dataObject->
>               fetchall_arrayref();
>
> sub connectToDB
>  {
>  # return (DBI->connect($dbName, $dbUserName, $dbPassword));
>         $dbh = DBI->connect($dbName, $dbUserName, $dbPassword ,
>                  { RaiseError=>1 },
>                )
>  }
>
> Can anybody help me with this problem?
>
> Thanks!
>
> Geert-Jan Gorter

Solved: Autocommit must be set to 1, explicitly

Geert-Jan


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


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

Date: Mon, 15 May 2000 10:42:29 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: What's this line which Perl added to AUTOEXEC.BAT?
Message-Id: <pwQT4.1291$Kc1.185807@news.dircon.co.uk>

On Sat, 13 May 2000 07:00:34 -0700, bjanko Wrote:
> After installing Perl from activestate.com on my Windows 98
> platform, the following line was written into my AUTOEXEC.BAT:
> 
> SET PATH=C:\Perl\bin\
> 
> This seemed to make my computer unbootable. 

I very much doubt it.

>                                                Does anyone know
> the purpose of the line?  

Yes. Anyone who has used a computer for more than five minutes.

>                          What it does do?  

It sets the search path for executable programs executed at the command
prompt.

>                                             Do I need it?

Probably.  Although I would probably change it to :

  SET PATH=C:\Perl\bin;%PATH%

So it doesnt lose any previous value of PATH.  If you are uncertain you
ought to ask in some windows group as this isnt really a Perl question.

/J\


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

Date: Mon, 15 May 2000 04:25:33 -0700
From: bjanko <waldo700NOwaSPAM@aol.com.invalid>
Subject: Re: What's this line which Perl added to AUTOEXEC.BAT?
Message-Id: <0f7344e3.b98bda9c@usw-ex0102-084.remarq.com>

In article <pwQT4.1291$Kc1.185807@news.dircon.co.uk>, Jonathan
Stowe <gellyfish@gellyfish.com> wrote:
>On Sat, 13 May 2000 07:00:34 -0700, bjanko Wrote:
>> After installing Perl from activestate.com on my Windows 98
>> platform, the following line was written into my AUTOEXEC.BAT:
>>
>> SET PATH=C:\Perl\bin\
>>
>> This seemed to make my computer unbootable.
>
>I very much doubt it.


Golly gee, I was sittin' right here and it booted fine before
installing Perl, but afterward it didn't boot.  I edited the
line out of the autoexec.bat and it booted again.  I put the
line back and it would not boot again.  But since you say YOU
doubt it, I suppose I'll believe you and I guess it just never
really happened!

Does anyone know
>> the purpose of the line?
>
>Yes. Anyone who has used a computer for more than five minutes.

Oh, you're new?  So that's why you didn't realize it would make
the computer unbootable.


>If you are uncertain you
>ought to ask in some windows group as this isnt really a Perl
>question.

I did.  But it's funny -- there are so few people in the Windows
group who have installed Perl (scratching my head); yet, there
are many more Perl group people who have installed Perl on
Windows.  It seems like more of a Perl question to me.

I appreciate your trying to help, but no one needs your snide
attitude or condescending attitude.  Condescending, by the way,
is when you look down your nose at others.


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

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


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