[ADMIN - REDIRECT] Re: CGI script problem

2002-08-19 Thread Kevin Meltzer

This message is being redirected to the beginners-cgi list. Please
answer on that list, and to the original poster. Thanks.

Cheers,
Kevin

On Mon, Aug 19, 2002 at 04:11:14PM +0100, Matt Wetherill ([EMAIL PROTECTED]) 
said something similar to:
 Hi list,
 
 I'm just trying to get started with cgi (w2k, Apache 2.0.40), and have been
 using the sample script printenv.pl which is included with Apache:
 
 #!c:/Perl/bin/Perl.exe
 ##
 ##  printenv -- demo CGI program which just prints its environment
 ##
 
 print Content-type: text/plain\n\n;
 foreach $var (sort(keys(%ENV))) {
 $val = $ENV{$var};
 $val =~ s|\n|\\n|g;
 $val =~ s||\\|g;
 print ${var}=\${val}\\n;
 }
 
 However, if I try to run this script from a browser using the url:
 
 http://localhost/cgi-bin/printenv.pl
 
 Netscape6 works fine and displays the environment in the browser window, but
 IE 6 tries to download the script and it looks like the server isn't being
 allowed to run it.
 
 I appreciate that this is probably a bit off-topic, but any advice or
 pointers to other resources would be greatly appreciated.
 
 many thanks
 
 Matt
 
 -
 **
 Matt Wetherill
 University of Salford
 [EMAIL PROTECTED]
 mobile: +44 7812 016059
 office: +44 161 295 5853
 **
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
All people have the right to be stupid, some people just abuse it!
-- Frank Zappa

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CGI script problem

2002-08-19 Thread Connie Chan

[...]
 
 print Content-type: text/plain\n\n;
[...]

Try

print Content-type: text/html\n\n 
instead of text/plain\n\n;

Rgds,
Connie




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can't locate loadable object DBD::mysql in @INC

2002-08-19 Thread root

to force @INC to look at the directory of your DBI library, use:

use lib your DBI directory

along the top of your script

david


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can't locate loadable object DBD::mysql in @INC

2002-08-19 Thread Connie Chan

or can try 

push @INC, 'the/path/you/want';

Rgds,
Connie

- Original Message - 
From: root [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 20, 2002 2:19 AM
Subject: Re: Can't locate loadable object DBD::mysql in @INC


 to force @INC to look at the directory of your DBI library, use:
 
 use lib your DBI directory
 
 along the top of your script
 
 david
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can't locate loadable object DBD::mysql in @INC

2002-08-19 Thread David Zhuo

push @INC, 'the/path/you/want'

is different than:

use lib 'the/path/you/want'

from a user's perspective, they are the same but they are not under the
hood. what happen is that that push statement is a run time statement.
the use lib statement is a compile time statement. don't confuse the 2. 
to avoid run-time error, use lib is best. otherwise, the push statement
can be used.

david

On Mon, 2002-08-19 at 12:18, Connie Chan wrote:
 or can try 
 
 push @INC, 'the/path/you/want';
 
 Rgds,
 Connie
 
 - Original Message - 
 From: root [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, August 20, 2002 2:19 AM
 Subject: Re: Can't locate loadable object DBD::mysql in @INC
 
 
  to force @INC to look at the directory of your DBI library, use:
  
  use lib your DBI directory
  
  along the top of your script
  
  david
  
  
  -- 
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can't locate loadable object DBD::mysql in @INC

2002-08-19 Thread Wiggins d'Anconia

aka, use lib is like placing the push in a BEGIN blockwhich I think 
was the old way of doing things...



David Zhuo wrote:
 push @INC, 'the/path/you/want'
 
 is different than:
 
 use lib 'the/path/you/want'
 
 from a user's perspective, they are the same but they are not under the
 hood. what happen is that that push statement is a run time statement.
 the use lib statement is a compile time statement. don't confuse the 2. 
 to avoid run-time error, use lib is best. otherwise, the push statement
 can be used.
 
 david
 
 On Mon, 2002-08-19 at 12:18, Connie Chan wrote:
 
or can try 

push @INC, 'the/path/you/want';

Rgds,
Connie

- Original Message - 
From: root [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 20, 2002 2:19 AM
Subject: Re: Can't locate loadable object DBD::mysql in @INC



to force @INC to look at the directory of your DBI library, use:

use lib your DBI directory

along the top of your script

david


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can't locate loadable object DBD::mysql in @INC

2002-08-19 Thread David Zhuo

yeah. not sure what you mean by old way thought?

use lib is safer and is the preferred method most of the time because
you don't want your script to die mid-way during run time. you want to
catch the error as soon as possible before your script even start.

by the way, when i reply, how come i don't see my replied message showed
up in the mailing list? i am new to this mailing list :-)

david

On Mon, 2002-08-19 at 14:38, Wiggins d'Anconia wrote:
 aka, use lib is like placing the push in a BEGIN blockwhich I think 
 was the old way of doing things...
 
 
 
 David Zhuo wrote:
  push @INC, 'the/path/you/want'
  
  is different than:
  
  use lib 'the/path/you/want'
  
  from a user's perspective, they are the same but they are not under the
  hood. what happen is that that push statement is a run time statement.
  the use lib statement is a compile time statement. don't confuse the 2. 
  to avoid run-time error, use lib is best. otherwise, the push statement
  can be used.
  
  david
  
  On Mon, 2002-08-19 at 12:18, Connie Chan wrote:
  
 or can try 
 
 push @INC, 'the/path/you/want';
 
 Rgds,
 Connie
 
 - Original Message - 
 From: root [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, August 20, 2002 2:19 AM
 Subject: Re: Can't locate loadable object DBD::mysql in @INC
 
 
 
 to force @INC to look at the directory of your DBI library, use:
 
 use lib your DBI directory
 
 along the top of your script
 
 david
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can't locate loadable object DBD::mysql in @INC

2002-08-19 Thread Wiggins d'Anconia

SOrry...I was referring to the BEGIN around the push as being the old 
way, which is now less favored to the use lib way.

Don't understand the question, though I think it probably has something 
to do with having to group reply??

http://danconia.org


David Zhuo wrote:
 yeah. not sure what you mean by old way thought?
 
 use lib is safer and is the preferred method most of the time because
 you don't want your script to die mid-way during run time. you want to
 catch the error as soon as possible before your script even start.
 
 by the way, when i reply, how come i don't see my replied message showed
 up in the mailing list? i am new to this mailing list :-)
 
 david
 
 On Mon, 2002-08-19 at 14:38, Wiggins d'Anconia wrote:
 
aka, use lib is like placing the push in a BEGIN blockwhich I think 
was the old way of doing things...



David Zhuo wrote:

push @INC, 'the/path/you/want'

is different than:

use lib 'the/path/you/want'

from a user's perspective, they are the same but they are not under the
hood. what happen is that that push statement is a run time statement.
the use lib statement is a compile time statement. don't confuse the 2. 
to avoid run-time error, use lib is best. otherwise, the push statement
can be used.

david

On Mon, 2002-08-19 at 12:18, Connie Chan wrote:


or can try 

push @INC, 'the/path/you/want';

Rgds,
Connie

- Original Message - 
From: root [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 20, 2002 2:19 AM
Subject: Re: Can't locate loadable object DBD::mysql in @INC




to force @INC to look at the directory of your DBI library, use:

use lib your DBI directory

along the top of your script

david


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can't locate loadable object DBD::mysql in @INC

2002-08-19 Thread David Zhuo

when i hit the Reply To All button, my message is sent but it never
appear in the news reader and i don't know why? i can see everyone
else's message but my own posted/replied message never appear in the
mailing list...

david

On Mon, 2002-08-19 at 15:40, Wiggins d'Anconia wrote:
 SOrry...I was referring to the BEGIN around the push as being the old 
 way, which is now less favored to the use lib way.
 
 Don't understand the question, though I think it probably has something 
 to do with having to group reply??
 
 http://danconia.org
 
 
 David Zhuo wrote:
  yeah. not sure what you mean by old way thought?
  
  use lib is safer and is the preferred method most of the time because
  you don't want your script to die mid-way during run time. you want to
  catch the error as soon as possible before your script even start.
  
  by the way, when i reply, how come i don't see my replied message showed
  up in the mailing list? i am new to this mailing list :-)
  
  david
  
  On Mon, 2002-08-19 at 14:38, Wiggins d'Anconia wrote:
  
 aka, use lib is like placing the push in a BEGIN blockwhich I think 
 was the old way of doing things...
 
 
 
 David Zhuo wrote:
 
 push @INC, 'the/path/you/want'
 
 is different than:
 
 use lib 'the/path/you/want'
 
 from a user's perspective, they are the same but they are not under the
 hood. what happen is that that push statement is a run time statement.
 the use lib statement is a compile time statement. don't confuse the 2. 
 to avoid run-time error, use lib is best. otherwise, the push statement
 can be used.
 
 david
 
 On Mon, 2002-08-19 at 12:18, Connie Chan wrote:
 
 
 or can try 
 
 push @INC, 'the/path/you/want';
 
 Rgds,
 Connie
 
 - Original Message - 
 From: root [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, August 20, 2002 2:19 AM
 Subject: Re: Can't locate loadable object DBD::mysql in @INC
 
 
 
 
 to force @INC to look at the directory of your DBI library, use:
 
 use lib your DBI directory
 
 along the top of your script
 
 david
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




How to set cookies for an SHTML document?

2002-08-19 Thread Octavian Rasnita

Hi all,

I have an SHTML  file and I want to set cookies for it.

Is this possible?

I've tried to use server side includes to set a cookie using that script
used as SSI but it doesn't set the cookie.
The script sets the cookie if it is not included in an html file, but if it
is, it doesn't want to collaborate with me.

The cookie should be generated dynamicly, so I can't use Javascript to
generate cookies.

Have you any idea how to generate and read cookies from an SSI?


Thank you.

Teddy's Center: http://teddy.fcc.ro/
Mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to set cookies for an SHTML document?

2002-08-19 Thread Wiggins d'Anconia

The way I understand things, cookies must be printed before the header 
is returned (though this may have changed in HTTP/1.1, anyone?) In which 
case setting a cookie from within an SSI non-javascript is not possible.

A cookie is just specifically formatted text being printed before the 
Content-type: text/html header in which case if you run it like a CGI 
then you can control when the header is printed (aka after your cookie 
print) however, with an SSI I don't believe you can control the header 
being printed, and therefore your cookie will always be printed post 
header...which won't work.

You could probably control this sequence of events in mod_perl, but that 
is beyond my mod_perl experience...

IIS handles this by buffering the response until essentially an EOF 
which is why it *might* work on windows in IIS, but this buffering 
causes other problems..

http://danconia.org



Octavian Rasnita wrote:
 Hi all,
 
 I have an SHTML  file and I want to set cookies for it.
 
 Is this possible?
 
 I've tried to use server side includes to set a cookie using that script
 used as SSI but it doesn't set the cookie.
 The script sets the cookie if it is not included in an html file, but if it
 is, it doesn't want to collaborate with me.
 
 The cookie should be generated dynamicly, so I can't use Javascript to
 generate cookies.
 
 Have you any idea how to generate and read cookies from an SSI?
 
 
 Thank you.
 
 Teddy's Center: http://teddy.fcc.ro/
 Mail: [EMAIL PROTECTED]
 
 
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Can't locate loadable object DBD::mysql in @INC

2002-08-19 Thread Wiggins d'Anconia

Sounds interesting, alas don't think I can help on this one, I am using 
the list through normal e-mail as my ISP is disallowing news group usage 
  temporarily.

http://danconia.org



David Zhuo wrote:
 when i hit the Reply To All button, my message is sent but it never
 appear in the news reader and i don't know why? i can see everyone
 else's message but my own posted/replied message never appear in the
 mailing list...
 
 david
 
 On Mon, 2002-08-19 at 15:40, Wiggins d'Anconia wrote:
 
SOrry...I was referring to the BEGIN around the push as being the old 
way, which is now less favored to the use lib way.

Don't understand the question, though I think it probably has something 
to do with having to group reply??

http://danconia.org


David Zhuo wrote:

yeah. not sure what you mean by old way thought?

use lib is safer and is the preferred method most of the time because
you don't want your script to die mid-way during run time. you want to
catch the error as soon as possible before your script even start.

by the way, when i reply, how come i don't see my replied message showed
up in the mailing list? i am new to this mailing list :-)

david

On Mon, 2002-08-19 at 14:38, Wiggins d'Anconia wrote:


aka, use lib is like placing the push in a BEGIN blockwhich I think 
was the old way of doing things...



David Zhuo wrote:


push @INC, 'the/path/you/want'

is different than:

use lib 'the/path/you/want'


from a user's perspective, they are the same but they are not under the

hood. what happen is that that push statement is a run time statement.
the use lib statement is a compile time statement. don't confuse the 2. 
to avoid run-time error, use lib is best. otherwise, the push statement
can be used.

david

On Mon, 2002-08-19 at 12:18, Connie Chan wrote:



or can try 

push @INC, 'the/path/you/want';

Rgds,
Connie

- Original Message - 
From: root [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 20, 2002 2:19 AM
Subject: Re: Can't locate loadable object DBD::mysql in @INC





to force @INC to look at the directory of your DBI library, use:

use lib your DBI directory

along the top of your script

david


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Online installer

2002-08-19 Thread Todd Wade

Soheil Shaghaghi [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Dear Connie,
Hello and thanks again :)

I just wanted to show you and everyone else who is interested in this
subject a much better example:
http://www.iwebsupport.com/cgi-bin/dsx.cgi?app=Installer

Theres also a discussion list program that has an installer like this.
Worked very well for me:

http://www.discusware.com/discus/index.php

Todd W.




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Using a external Config file

2002-08-19 Thread Andrew BOGECHO

Sun Aug 18 20:24:03 EDT 2002

Hello fellow Perl users,

I would like to know how I can setup an external config file whose
variables I can then use in a perl script.

For example:

File Config:
**
MAXLENGTH=56
USER_LIST=user1,user2,user3
**

Then access the variables in a Perl program:

File sample.pl
**
#!/usr/bin/perl -w

use strict;
# Somehow source values from file Config

my $a = 50;

if ( $a = $MAXLENGTH )
{
$a = $MAXLENGTH + 1;
}

print @USER_LIST\n;
**

I know that this can be done by setting up Config as Config.pm and get
the variables with a use Config; in my sample.pl script.

File Config.pm
**
package Config;
use strict;
 
require Exporter;
our (@ISA,@EXPORT,@EXPORT_OK,$MAXLENGTH,@USER_LIST);
 
@ISA = qw(Exporter);
@EXPORT = qw($MAXLENGTH @USER_LIST);
@EXPORT_OK = qw($MAXLENGTH @USER_LIST);
 
$MAXLENGTH = 56;
@USER_LIST = qw(user1 user2 user3);
**

I however want to use a  non Perl file. Please let me know if this is
possible, or do I have to set up the separate package to do this.

Thank you all for your time.

Andrew.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Using a external Config file

2002-08-19 Thread John W. Krahn

Andrew Bogecho wrote:
 
 Hello fellow Perl users,

Hello,

 I would like to know how I can setup an external config file whose
 variables I can then use in a perl script.
 
 For example:
 
 File Config:
 **
 MAXLENGTH=56
 USER_LIST=user1,user2,user3
 **
 
 Then access the variables in a Perl program:
 
 [snip]
 
 I however want to use a  non Perl file. Please let me know if this is
 possible, or do I have to set up the separate package to do this.


http://search.cpan.org/author/WADG/Config-IniFiles-2.29/IniFiles.pm

http://search.cpan.org/author/TLINDEN/Config-General-2.07/General.pm

http://search.cpan.org/author/SIMON/Config-Auto-0.03/Auto.pm



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Using a external Config file

2002-08-19 Thread Felix Geerinckx

on Mon, 19 Aug 2002 00:47:49 GMT, [EMAIL PROTECTED] (Andrew
Bogecho) wrote: 

 I would like to know how I can setup an external config file whose
 variables I can then use in a perl script.

[...]

 I know that this can be done by setting up Config as Config.pm and
 get the variables with a use Config; in my sample.pl script.
 
 File Config.pm

You may want to use another name than this, since there is already a 
Config.pm in the standard Perl distribution:

perldoc Config

 I however want to use a  non Perl file. Please let me know if this
 is possible, or do I have to set up the separate package to do
 this. 

There are a lot of modules on CPAN that are related to config and/or 
inifiles, as

http://search.cpan.org/search?mode=allquery=config

will show.

You also may want to read

http://groups.google.com/groups?selm=3d5db9ae%240%24184%2475868355%
40news.frii.net

and ensuing thread from clpmisc on a related topic.

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Perl and Berkley DB - troubles

2002-08-19 Thread Mariusz

Hello,

1. I have installed perl (perl-5.6.1.tar.gz)
2. I have installed Berkley DB (db-4.0.14.tar.gz)
3. now, when I try to run a Perl script, it says:


Checking for installation of Berkely DB or GNU DB capability...
No DBM package was successfully found or installed at
/usr/local/lib/perl5/5.6.1/AnyDBM_File.pm line 14.
Compilation failed in require at ./setup.pl line 40.


What's wrong? AnyDBM_File.pm is present in the proper directory, but the
script keeps moniting... Should I recompile Perl with some options or
install DBM first?
I also tried to install DB from .rpm and as perl modules (cpan) as well but
it didn't change anything.
Could you please help me with that?

Thank you
Mariusz



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Problems using glob()

2002-08-19 Thread Jochen Berger

Hi, y'all!

I've got a problem with a Perl Script I wrote to find files matching a special 
pattern. It worked fine until I commented it. From that time on the program has got 
problems with that WIN32 feature called You want spaces in your file name? Then do 
it!. If the program finds a directory containing a space, it returns the path without 
spaces and backslashes. This doesn't make sense to me (especially because it worked 
before). Following is the snipplet from the source that causes the troubles:

sub searchFiles {
  # get the arguments
  (my $currDir) = @_;
  # get all files in the directory matching the file filter
  my @allFiles = glob($currDir\\$filter);

The glob function (I found that one out with debugging) causes the problems. The $file 
variable contains the complete path to check next, and $filter contains the file 
filter (e.g. *.java).

BTW: This program was supposed to work either under Unix AND Windows. Is there a 
chance to get the path separator for the current operating system like in Java 
(File.pathSeparator)?

Thanks in advance

Jochen Berger

-
Der Verstand und die Fähigkeit, ihn zu gebrauchen, sind zwei verschiedene Gaben.
Franz Grillparzer (österr. Dichter, 1791 - 1872) 

__
Keine Chance fur Viren! Mit WEB.DE FreeMail sind Sie auf der
sicheren Seite - Virenschutz inklusive! http://freemail.web.de/?mc=021129


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: How does ZOMBIE/defunct affect the system?

2002-08-19 Thread Sudarshan Raghavan

On Wed, 14 Aug 2002, Bob Showalter wrote:

   
   use POSIX :sys_wait_h;
   #...
   do {
   $kid = waitpid(-1,WNOHANG);
   } until $kid == -1;


  Yes WNOHANG makes waitpid return immediately the -1 means wait for any
  child process. This code will do a non-blocking wait for all child 
  processes.
  
  It will be in the do-until loop until all of it's children are dead.
  perldoc -f waitpid
 
 This example is straight out of perldoc -f waitpid, but if it's
 used as-is, I don't see the point. Why do a non-blocking wait,
 when the do loop effectively blocks the program anyway. You only
 want non-blocking when you have something else to do.
 
 I would write the above as:
 
1 while wait != -1;# wait for all children
 
 Or am I missing something?

I was not following this thread and was not aware exactly what the OP 
wanted. Yes this is straight out of perldoc -f waitpid. I just gave
an explanation for what the code in the post does not a suggestion to the 
OP's problem. Also I did not post this code, I guess the OP did it 
himself and asked for an explanation.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Problems using glob()

2002-08-19 Thread Felix Geerinckx

on Mon, 19 Aug 2002 10:09:16 GMT, [EMAIL PROTECTED] (Jochen Berger)
wrote: 

 I've got a problem with a Perl Script I wrote to find files
 matching a special pattern. It worked fine until I commented it.
 From that time on the program has got problems with that WIN32
 feature called You want spaces in your file name? Then do it!.
 If the program finds a directory containing a space, it returns
 the path without spaces and backslashes. This doesn't make sense
 to me (especially because it worked before). 

The following code works for me (note the forward slash):

#! perl -w
use strict;

my $dir= 'c:/My Documents/';
my $filter = '*.doc';
my $path   = qq{$dir$filter};
my @files  = glob($path);

 BTW: This program was supposed to work either under Unix AND
 Windows. Is there a chance to get the path separator for the
 current operating system like in Java (File.pathSeparator)? 

See

perldoc File::Spec

for portable operations on filenames.

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: what's wrong

2002-08-19 Thread Sudarshan Raghavan

On Thu, 15 Aug 2002, Priss wrote:

 I have amended the first few lines, this works but I
 wonder if this bad...
 
 Priss
 
 while ()
 {
 /(\S+)/
 and $seen_in_file1{$1} += 1;

If the line that is being read is of the form
word1 word2
$1 will only contain 'word1'. \S matches a non-whitespace character.

   push @tmp, $_;
 }
 open (FILE, @tmp);

This is not the correct way to open a file

 
 while (FILE)

If you had enabled warnings in your program this will give a message like 
this
readline() on closed filehandle FILE ...

You might also want to take a look at File::Compare and Text::Diff.
File::Compare is available with the standar distro, Text::Diff will have 
to be downloaded from cpan. 
http://search.cpan.org/author/RBS/Text-Diff-0.34/

A crude soln for your problem
This will print lines in file2 not present in file1

#!/usr/bin/perl -w
use strict;

my %seen_in_file1;
open (FILE1, file1) or die Cannot open file1: $!\n;
while (FILE1) {
  chomp;
  $seen_in_file1{$_}++;
}
close (FILE1);

open (FILE2, file2) or die Cannot open file2: $!\n;
while (FILE2) {
  chomp;
  next if ($seen_in_file1{$_});
  print $_\n;
}
close (FILE2);


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




CGI script problem

2002-08-19 Thread Matt Wetherill

Hi list,

I'm just trying to get started with cgi (w2k, Apache 2.0.40), and have been
using the sample script printenv.pl which is included with Apache:

#!c:/Perl/bin/Perl.exe
##
##  printenv -- demo CGI program which just prints its environment
##

print Content-type: text/plain\n\n;
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s||\\|g;
print ${var}=\${val}\\n;
}

However, if I try to run this script from a browser using the url:

http://localhost/cgi-bin/printenv.pl

Netscape6 works fine and displays the environment in the browser window, but
IE 6 tries to download the script and it looks like the server isn't being
allowed to run it.

I appreciate that this is probably a bit off-topic, but any advice or
pointers to other resources would be greatly appreciated.

many thanks

Matt

-
**
Matt Wetherill
University of Salford
[EMAIL PROTECTED]
mobile: +44 7812 016059
office: +44 161 295 5853
**
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




newbie question

2002-08-19 Thread Chad Kellerman

  Hello,

   I have only been writing perl for a few months, so forgive me if this
sounds stupid.

what is the difference between:

$| = 1;
and
$|++;

   Or can you point me in the right direction on where I can read
boutit?

Thanks,
Chad

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




inserting a single word in every file

2002-08-19 Thread Nandita

Hello all,
I have a list of files, and need to insert a word somewhere in the middle-
the files begin with a list of sequence names followed by alignments for
each sequence, and i'd like to insert the header ALIGNMENTS before they
begin..
Any starting ideas /  pointers for me?
many thanks
and have a nice day...
-nandita


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Using a external Config file

2002-08-19 Thread Andrew BOGECHO

Mon Aug 19 09:39:37 EDT 2002

On Mon, Aug 19, 2002 at 03:01:13AM -0700, John W. Krahn wrote:
 Andrew Bogecho wrote:
  
  Hello fellow Perl users,
 
 Hello,
 
  I would like to know how I can setup an external config file whose
  variables I can then use in a perl script.
  

[snip]

 
 
 http://search.cpan.org/author/WADG/Config-IniFiles-2.29/IniFiles.pm
 
 http://search.cpan.org/author/TLINDEN/Config-General-2.07/General.pm
 
 http://search.cpan.org/author/SIMON/Config-Auto-0.03/Auto.pm
 

Thank you,

That is exactly what I needed.

Have a great week.

Andrew.

 
 
 John
 -- 
 use Perl;
 program
 fulfillment
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: CGI script problem

2002-08-19 Thread Bob Showalter

 -Original Message-
 From: Matt Wetherill [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 19, 2002 11:11 AM
 To: Perl beginners
 Subject: CGI script problem
 
 
 Hi list,
 
 I'm just trying to get started with cgi (w2k, Apache 2.0.40), 
 and have been
 using the sample script printenv.pl which is included with Apache:
 
 #!c:/Perl/bin/Perl.exe
 ##
 ##  printenv -- demo CGI program which just prints its environment
 ##
 
 print Content-type: text/plain\n\n;
 foreach $var (sort(keys(%ENV))) {
 $val = $ENV{$var};
 $val =~ s|\n|\\n|g;
 $val =~ s||\\|g;
 print ${var}=\${val}\\n;
 }
 
 However, if I try to run this script from a browser using the url:
 
 http://localhost/cgi-bin/printenv.pl
 
 Netscape6 works fine and displays the environment in the 
 browser window, but
 IE 6 tries to download the script and it looks like the 
 server isn't being
 allowed to run it.

No, I think the server is running it.

 
 I appreciate that this is probably a bit off-topic, but any advice or
 pointers to other resources would be greatly appreciated.

Try renaming the script to printenv.cgi or just printenv and see if that
fixes it.

IE is bad about not following standards, and in this case I think the .pl
extension is causing IE to treat the file as something that needs to be
downloaded or run.

(This question should have been posted to the CGI list:
[EMAIL PROTECTED])

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CGI script problem

2002-08-19 Thread WyvernGod

In a message dated 8/19/2002 10:13:16 AM US Eastern Standard Time, 
[EMAIL PROTECTED] writes:


 http://localhost/cgi-bin/printenv.pl
 

oh this is a stupid problem i had aswell... an easy solution is to rename the 
..pl as .cgi and then it worked fine for me.. I know.. sounds dumb but IE 
see's the file name as an excecutable file and atempts to save it... there 
might be a better solution that will keep it as a pl but i just took the easy 
way out..

Dra'Kon



[ADMIN - REDIRECT] Re: CGI script problem

2002-08-19 Thread Kevin Meltzer

This message is being redirected to the beginners-cgi list. Please
answer on that list, and to the original poster. Thanks.

Cheers,
Kevin

On Mon, Aug 19, 2002 at 04:11:14PM +0100, Matt Wetherill ([EMAIL PROTECTED]) 
said something similar to:
 Hi list,
 
 I'm just trying to get started with cgi (w2k, Apache 2.0.40), and have been
 using the sample script printenv.pl which is included with Apache:
 
 #!c:/Perl/bin/Perl.exe
 ##
 ##  printenv -- demo CGI program which just prints its environment
 ##
 
 print Content-type: text/plain\n\n;
 foreach $var (sort(keys(%ENV))) {
 $val = $ENV{$var};
 $val =~ s|\n|\\n|g;
 $val =~ s||\\|g;
 print ${var}=\${val}\\n;
 }
 
 However, if I try to run this script from a browser using the url:
 
 http://localhost/cgi-bin/printenv.pl
 
 Netscape6 works fine and displays the environment in the browser window, but
 IE 6 tries to download the script and it looks like the server isn't being
 allowed to run it.
 
 I appreciate that this is probably a bit off-topic, but any advice or
 pointers to other resources would be greatly appreciated.
 
 many thanks
 
 Matt
 
 -
 **
 Matt Wetherill
 University of Salford
 [EMAIL PROTECTED]
 mobile: +44 7812 016059
 office: +44 161 295 5853
 **
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
All people have the right to be stupid, some people just abuse it!
-- Frank Zappa

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl and Berkley DB - troubles

2002-08-19 Thread Elaine -HFB- Ashton

Mariusz [[EMAIL PROTECTED]] quoth:
*Hello,
*
*1. I have installed perl (perl-5.6.1.tar.gz)
*2. I have installed Berkley DB (db-4.0.14.tar.gz)
*3. now, when I try to run a Perl script, it says:
*
*
*Checking for installation of Berkely DB or GNU DB capability...
*No DBM package was successfully found or installed at
*/usr/local/lib/perl5/5.6.1/AnyDBM_File.pm line 14.
*Compilation failed in require at ./setup.pl line 40.
*
*
*What's wrong? AnyDBM_File.pm is present in the proper directory, but the
*script keeps moniting... Should I recompile Perl with some options or
*install DBM first?
*I also tried to install DB from .rpm and as perl modules (cpan) as well but
*it didn't change anything.

http://www.cpan.org/misc/cpan-faq.html#Where_find_GDBM_file

e.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Weekly posting ststistics - 33/2002

2002-08-19 Thread Felix Geerinckx

Weekly posting statistics for perl.beginners - week 33 of 2002.

From Monday 2002-08-12 to Sunday 2002-08-18 there were 
367 articles posted (15989 lines) by 121 authors, giving an average 
3.03 articles per author, and an average article length of 44 lpa.
The average number of articles per day was 52.

There were 98 (27%) original articles, and 269 (73%) replies
(articles that started with 'RE:' in their subject line).

59 (49%) authors posted only one article.

The authors top-10 by number of articles is as follows:

 All/Ori Lines  lpa  Author

  38/61929   50  [EMAIL PROTECTED] (Drieux)
  20/4 912   45  [EMAIL PROTECTED] (Connie Chan)
  16/7 795   49  [EMAIL PROTECTED] (Nikola Janceski)
  15/2 495   33  [EMAIL PROTECTED] (Felix Geerinckx)
  14/0 430   30  [EMAIL PROTECTED] (Sudarshan Raghavan)
  13/0 447   34  [EMAIL PROTECTED] (Bob Showalter)
  11/0 491   44  [EMAIL PROTECTED] (John W. Krahn)
   8/1 212   26  [EMAIL PROTECTED] (Ahmed Moustafa)
   7/0 300   42  [EMAIL PROTECTED] (James Kipp)
   7/0 156   22  [EMAIL PROTECTED] (Janek Schleicher)

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Problems with rsh command

2002-08-19 Thread Nikola Janceski

I have posted this to XML and no response there. so maybe it's simpler than
that...

I have script that uses XML::Simple, which works when run via command line:
/yyy/TreeInfo/tmp/gather_os_info.pl

but if run it via an rsh command (on the same host for now):
/bin/rsh host1 /yyy/TreeInfo/tmp/gather_os_info.pl

I get the following error:
Can't locate object method new via package XML::SAX::PurePerl (perhaps
you forgot to load XML::SAX::PurePerl?) at
/yyy/perl-5.6.1-unix/lib/perl5/site_perl/5.6.1/XML/SAX/ParserFactory.pm line
37.

** NOTE **: Specifically it fails on the XMLin() function call supplied by
XML::Simple.

Strange huh? host1 is the same host where I tested it via command line
alone.

Please I can't figure this one out for the life of me.

Thanx in advance,

Nikola Janceski

When I am working on a problem I never think about beauty. I only think
about how to solve the problem. But when I have finished, if the solution is
not beautiful, I know it is wrong.
-- Buckminster Fuller (1895-1983) 




The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Problems with rsh command

2002-08-19 Thread Tanton Gibbs

One thing you might check is your PERL5LIB environment variable when you rsh
vs when you login.  It could be that rsh does not run your .profile and
therefore does not set up your environment variables thereby prohibiting
perl from seeing the appropriate libraries.
- Original Message -
From: Nikola Janceski [EMAIL PROTECTED]
To: Beginners (E-mail) [EMAIL PROTECTED]
Sent: Monday, August 19, 2002 3:42 PM
Subject: Problems with rsh command


 I have posted this to XML and no response there. so maybe it's simpler
than
 that...

 I have script that uses XML::Simple, which works when run via command
line:
 /yyy/TreeInfo/tmp/gather_os_info.pl

 but if run it via an rsh command (on the same host for now):
 /bin/rsh host1 /yyy/TreeInfo/tmp/gather_os_info.pl

 I get the following error:
 Can't locate object method new via package XML::SAX::PurePerl (perhaps
 you forgot to load XML::SAX::PurePerl?) at
 /yyy/perl-5.6.1-unix/lib/perl5/site_perl/5.6.1/XML/SAX/ParserFactory.pm
line
 37.

 ** NOTE **: Specifically it fails on the XMLin() function call supplied by
 XML::Simple.

 Strange huh? host1 is the same host where I tested it via command line
 alone.

 Please I can't figure this one out for the life of me.

 Thanx in advance,

 Nikola Janceski

 When I am working on a problem I never think about beauty. I only think
 about how to solve the problem. But when I have finished, if the solution
is
 not beautiful, I know it is wrong.
 -- Buckminster Fuller (1895-1983)


 --
--
 
 The views and opinions expressed in this email message are the sender's
 own, and do not necessarily represent the views and opinions of Summit
 Systems Inc.


 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Problems with rsh command

2002-08-19 Thread Nikola Janceski

nope.. then it would be able to get that far.

Remember I have:
use XML::Simple;

Which calls other modules (XML::SAX etc.)
but stranger is that PurePerl.pm is in the same dir as the ParserFactory.pm.

plus the onlything I have in my PERL5LIB env var is my private module dirs.
I use 'use lib' all the time anyway.

 -Original Message-
 From: Tanton Gibbs [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 19, 2002 3:44 PM
 To: Nikola Janceski; Beginners (E-mail)
 Subject: Re: Problems with rsh command
 
 
 One thing you might check is your PERL5LIB environment 
 variable when you rsh
 vs when you login.  It could be that rsh does not run your 
 .profile and
 therefore does not set up your environment variables thereby 
 prohibiting
 perl from seeing the appropriate libraries.




The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: newbie question

2002-08-19 Thread Kevin Meltzer


This is actually a bug. It just seems that nobody seems to care :) It
would break too many JAPHs which use this.

So, don't depend on it, in case it is ever fixed. 
On Mon, Aug 19, 2002 at 01:17:15PM -0700, John W. Krahn ([EMAIL PROTECTED]) said 
something similar to:
 Bob Showalter wrote:
 Also, $| has an interesting property when you decrement it.
 
 $ perl -le'for (1 .. 6) {$|--; print $|}'
 1
 0
 1
 0
 1
 0
 


The following makes sense, since $| only has a range of [0,1], it
should stay at 1.. unlike the $-- bug.

 $ perl -le'for (1 .. 6) {$|++; print $|}'
 1
 1
 1
 1
 1
 1

Cheers,
Kevin

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
Number one ain't you... You ain't even number two.
-- Frank Zappa

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Is it legal ???

2002-08-19 Thread Timothy Johnson


You can do that, but if you're planning on assigning the variables any value
other than (), then you will want to put the array LAST.  Otherwise I don't
know if Perl will let the array suck up all of the values you try to assign.
This way you can be sure that your scalars receive a value.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 10:29 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Is it legal ???


In a message dated 8/19/2002 3:25:35 PM US Eastern Standard Time, 
[EMAIL PROTECTED] writes:


 Hi all, I am trying to declare some variables and was wondering what the 
 best way to do this was. Is it legal to do something like this:
 my (@pairs, $ENV, $buffer);
 The reason I ask is that I am not sure if its cool to have Arrays and 
 Scalar 
 vars within the same brackets.
 Thanks for your help
 
 Anadi
 

No, I'm sorry but doing something of that nature is punishable by 10 years
in 
prison and/or $20,000 in fines.


Dra'Kon [King of bored out of his mind wise butt remarks]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Is it legal ???

2002-08-19 Thread Connie Chan

Maybe you can refer to use vars ( perldoc -m vars).

Rgds,
Connie


- Original Message - 
From: A Taylor [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 20, 2002 4:23 AM
Subject: Is it legal ???


 Hi all, I am trying to declare some variables and was wondering what the 
 best way to do this was. Is it legal to do something like this:
 my (@pairs, $ENV, $buffer);
 The reason I ask is that I am not sure if its cool to have Arrays and Scalar 
 vars within the same brackets.
 Thanks for your help
 
 Anadi



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE - is it legal

2002-08-19 Thread A Taylor

Thanks all
your help has been much appreciated

Anadi ^_^



You are just a dewdrop, and as you meditate the dewdrop starts slipping from 
the petals of the Lotus towards the ocean. When the meditation is complete, 
the dewdrop has disappeared into the ocean. Or you can say, the ocean has 
disappeared into the dewdrop.

Bhagwan Shree Rajneesh.


_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




time and date

2002-08-19 Thread A Taylor

I am trying to get the time and date that some one sends me an email.
can anyone help me or point me in the right direction as how to get these in 
perl ???

Thanks in advance for your help - its much appreciated
Anadi



You are just a dewdrop, and as you meditate the dewdrop starts slipping from 
the petals of the Lotus towards the ocean. When the meditation is complete, 
the dewdrop has disappeared into the ocean. Or you can say, the ocean has 
disappeared into the dewdrop.

Bhagwan Shree Rajneesh.


_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Problems with rsh command

2002-08-19 Thread Nikola Janceski

host1 is one host. the only host that I have been testing this on.
via command line it works.
via rsh command line it doesn't.
via rsh to command prompt, then command lining it, it works.

It looks like it is differences in the env. vars.
essentially when I use rsh and run a command (ie rsh host1 env) the env is
pretty damn empty.
but when I just rsh to the host the env comes back full (ie rsh host [wait
for prompt] env).

now to think of a way to fix this... better to know what env to set so I can
set it in the script.

Thanx for your help!

 -Original Message-
 From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 19, 2002 3:50 PM
 To: 'Tanton Gibbs'; Beginners (E-mail)
 Subject: RE: Problems with rsh command
 
 
 nope.. then it would be able to get that far.
 
 Remember I have:
 use XML::Simple;
 
 Which calls other modules (XML::SAX etc.)
 but stranger is that PurePerl.pm is in the same dir as the 
 ParserFactory.pm.
 
 plus the onlything I have in my PERL5LIB env var is my 
 private module dirs.
 I use 'use lib' all the time anyway.
 
  -Original Message-
  From: Tanton Gibbs [mailto:[EMAIL PROTECTED]]
  Sent: Monday, August 19, 2002 3:44 PM
  To: Nikola Janceski; Beginners (E-mail)
  Subject: Re: Problems with rsh command
  
  
  One thing you might check is your PERL5LIB environment 
  variable when you rsh
  vs when you login.  It could be that rsh does not run your 
  .profile and
  therefore does not set up your environment variables thereby 
  prohibiting
  perl from seeing the appropriate libraries.
 
 
 --
 --
 
 The views and opinions expressed in this email message are 
 the sender's
 own, and do not necessarily represent the views and opinions of Summit
 Systems Inc.
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Problems with rsh command

2002-08-19 Thread drieux


On Monday, August 19, 2002, at 12:42 , Nikola Janceski wrote:
[..]
 but if run it via an rsh command (on the same host for now):
 /bin/rsh host1 /yyy/TreeInfo/tmp/gather_os_info.pl

 I get the following error:
 Can't locate object method new via package XML::SAX::PurePerl (perhaps
 you forgot to load XML::SAX::PurePerl?) at
 /yyy/perl-5.6.1-unix/lib/perl5/site_perl/5.6.1/XML/SAX/ParserFactory.pm 
 line
 37.
[..]

you have ruled out the usual 'more than one perl' problem with

/bin/rsh host1 perl -V

and that it is the perl that you expect Since it
is possible - IF you have more than one version of
perl running on the host, AND the ordering of the
PATH is different - then you may be invoking a version
who's notion of what the @INC should be is NOT the
one that you expect

also tell me you are not running into the less
well known problem of the '-n' problem with rsh.

sometimes what you neeed to do is

/bin/rsh -n host1 cmd

so that it does not try to read STDIN from
your current shell into it

I can't imagine why that might be an issue,
but at times that has been the 'irrational fix'

HTH.



ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Problems with rsh command

2002-08-19 Thread drieux


On Monday, August 19, 2002, at 02:40 , Nikola Janceski wrote:

 host1 is one host. the only host that I have been testing this on.
 via command line it works.
 via rsh command line it doesn't.
 via rsh to command prompt, then command lining it, it works.

if you do an

rsh farhost

you force a 'login event sequence'.

as such

rsh farhost
telnet farhost
rlogin farhost

are essentially the same


what you may want to think about is making sure
that your perl script 'imports' all the env foo

or you will need a shell wrapper script to make sure
that you have that environment sorted out PRIOR to
actually invoking the perl code itself

the ugly here of course is that if you have installed
objects such as the libfoo.so in non-standard places
and/or need to access environmental variables


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Best way to split log

2002-08-19 Thread Matt Simonsen

I'm wondering what people would suggest as the best way to split this so
it respects the  and [] as fields yet doesn't kill performance?


1.2.3.4 - - [15/Aug/2002:06:43:39 -0700] GET /usr/123 HTTP/1.0 200
38586 http://www.careercast.com/js.php; Mozilla/4.0 (compatible; MSIE
5.5; Windows 98) - www.careercast.com



In other words I want 

hash[0] = 1.2.3.4
hash[1] = -
hash[2] = -
hash[3] = 15/Aug/2002:06:43:39 -0700
hash[4] = 200
hash[...]
hash[10] = www.careercast.com


Thanks
Matt






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Passing Hashes into a function

2002-08-19 Thread John Ross

I am trying to pass an already existing hash into a subroutine, modify 
that hash, and have the modifications take when I leave the subroutine. 
I have looked through a number of perl books, but I either don't know what 
I am looking for, or I just don't understand how this works.  I am 
assuming that you pass the hash into the sub by reference, but from there, 
what?
When I modify the hash, the changes don't take.  I don't want to return 
the hash, as I don't wan't another copy.  Help!

John

-- 
John Ross 
Systems Management Integration Professional - Adv 
Data Management Solutions 
IBM
16011 College Blvd. 
Lenexa, KS  66219 
IBM Tie Line:  337-8611
Tel:  (913) 599-8611Fax:  (913) 599-8565 


RE: Passing Hashes into a function

2002-08-19 Thread David . Wagner

A code snippet would be very helpful.  To pass a hash and update it,
then 
func(\%hash);

sub func {
my ( $hash ) = @_;
$hash-{key} = 1;
# this should be reflected back in the calling program when you return
 }

Wags ;)
-Original Message-
From: John Ross [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 15:09
To: [EMAIL PROTECTED]
Subject: Passing Hashes into a function


I am trying to pass an already existing hash into a subroutine, modify 
that hash, and have the modifications take when I leave the subroutine. 
I have looked through a number of perl books, but I either don't know what 
I am looking for, or I just don't understand how this works.  I am 
assuming that you pass the hash into the sub by reference, but from there, 
what?
When I modify the hash, the changes don't take.  I don't want to return 
the hash, as I don't wan't another copy.  Help!

John

-- 
John Ross 
Systems Management Integration Professional - Adv 
Data Management Solutions 
IBM
16011 College Blvd. 
Lenexa, KS  66219 
IBM Tie Line:  337-8611
Tel:  (913) 599-8611Fax:  (913) 599-8565 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: time and date

2002-08-19 Thread Kevin Meltzer

Hi Anadi,

You want to take a look at the MIME-tools, specifically MIME::Parser
and MIME::Head (look for MIME::Tools on http://search.cpan.org). If
that seems too heavy duty for your needs, take a look at the Mail::*
modules on the CPAN. 

Also look there for ways to access the mail, if you haven't gotten that
far yet (Mail::POP3Client, Mail::IMAPClient, etc...).

Of course, you are then going to want to muck about with the actual
time you get, since it may not be in your timezone :)

Cheers,
Kevin

On Mon, Aug 19, 2002 at 09:34:08PM +, A Taylor ([EMAIL PROTECTED]) said 
something similar to:
 I am trying to get the time and date that some one sends me an email.
 can anyone help me or point me in the right direction as how to get these in 
 perl ???
 
 Thanks in advance for your help - its much appreciated
 Anadi
 
 
 
 You are just a dewdrop, and as you meditate the dewdrop starts slipping from 
 the petals of the Lotus towards the ocean. When the meditation is complete, 
 the dewdrop has disappeared into the ocean. Or you can say, the ocean has 
 disappeared into the dewdrop.
 
 Bhagwan Shree Rajneesh.
 
 
 _
 Join the world’s largest e-mail service with MSN Hotmail. 
 http://www.hotmail.com
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
This Too Shall Pass
-- inscription on the inside of King Solomon's Ring.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: open file into hash

2002-08-19 Thread Wagner Jeff Civ Northrop Grumman/TTMS

Hi,

Though this thread is now almost a week old, I thought I'd offer one more
suggestion.  How about using this

 %people = map { chomp; split } INPUT;

in place of 

 %people =  INPUT;


To my eyes, it is cleaner than adding an explicit loop.

TMTOWTDI,
Jeff


-Original Message-
From: Jose Malacara [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 14, 2002 2:35 AM
To: Perl beginners
Subject: open file into hash


Hello. I was wondering if there was a way to open a file into a hash? I know

this works for arrays, but was wondering if I this could be done for a hash 
also.

I have a file called people.data, which contains two colums:
jose2
karen   8
jason   9
tracey  1


Can someone tell me what I am doing wrong here:
=
#! /usr/bin/perl -w

open (INPUT, people.data);
%people = INPUT;
close (INPUT);

#%people = (
#jose = '2',
#karen = '8',
#jason = '9',
#tracey = '1'
#);

print The value for jose is $people{jose}\n;
=

I expect to return the value of 2, but see the following error instead:

Use of uninitialized value in concatenation (.) or string at ./new.pl line 
14.
The value for jose is


I am guessing that this is related to opening the filehandle as it works if
I 
declare the hash within the script (commented out above).

Any help would be greatly appreciated.

Jose

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Is it legal ???

2002-08-19 Thread John W. Krahn

A Taylor wrote:
 
 Hi all, I am trying to declare some variables and was wondering what the
 best way to do this was. Is it legal to do something like this:
 my (@pairs, $ENV, $buffer);

Yes.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Time and Date

2002-08-19 Thread A Taylor

Hi all,
Thanks for your help so far - I have managed to sort out my time and date 
problem but there are a few points that I dont understand.
The code I have used is as follows:

# get the hours, mins, weekday, day, month  and year
$hour  = (gmtime)[2];
$min   = (gmtime)[1];
$wday  = (qw(Sun Mon Tue Wed Thu Fri Sat)) [(gmtime) [6]];
$day   = (gmtime)[3];
$month = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)) [(gmtime) 
[4]];
$year  = (gmtime)[5] + 1900;

# test the length of $min - if length = 1 then add a '0' at the begining.

$minlen = length $min;
if ($minlen  2)
{
$min = 0.$min;
}
$hour ++;

I have had to do a test to see if the $min var is 1 or 2 in length:

$minlen = length $min;
if ($minlen  2)
{
$min = 0.$min;
}

this is because 22:07 (for example) would otherwise come out as 22:7 - which 
is a bit confusing. Is there a better way to do this 

Also I have had to add 1 to the hour var: $hour ++; even though my web space 
providers are in the same country as me - does anyone know why this is - I 
am probably being a bit daft - well it is 1am, and I have been perling for 
about 16 hours now !!! Gulp ^_^

Thanks for any help
Anadi


You are just a dewdrop, and as you meditate the dewdrop starts slipping from 
the petals of the Lotus towards the ocean. When the meditation is complete, 
the dewdrop has disappeared into the ocean. Or you can say, the ocean has 
disappeared into the dewdrop.

Bhagwan Shree Rajneesh.


_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Manipulating files in a directory

2002-08-19 Thread John W. Krahn

Yanet I wrote:
 
 Hello all,

Hello,

 I have been having a bit of trouble with a script that is very easy to
 develop in ksh.  I am just trying to rotate logs.
 
 some of the variables I declare are:
 my $LOGDIR=/some/where/in/my/file/system/logdir;
 my $LOG=/some/where/in/my/file/system/logdir/logtorotate;

You need to enclose strings in quotes:

my $logdir = '/some/where/in/my/file/system/logdir';
my $log= '/some/where/in/my/file/system/logdir/logtorotate';


 I have an array containing the name of the logs I want to rotate:
 my @alllogs=qw(log.0 log.1 log.2 log.3);
 
 I want to accomplish the following:
 I want to go to $LOGDIR (HOW DO I GO TO THAT DIRECTORY FROM MY SCRIPT W/OUT
 USING A system(.) call?)

chdir $logdir or die Cannot chdir to $logdir: $!;


 and make sure that those files exist.

perldoc -f -e


 After that I want to   mv $log.2 $log.3
mv $log.1 $log.2
mv $log.0 $log.1

rename 'log.2', 'log.3' or die Cannot rename 'log.2': $!;


 once again, how do I do this without using a system call (iff possible?).
 then,  I want to mv $LOG $log.0  and lastly I want to clear the
 contents of $LOG, (I would normally do cp /dev/null $LOG or $LOG)

truncate $log, 0 or warn Cannot truncate $log: $!;


perldoc -f chdir
perldoc -f -X
perldoc -f rename
perldoc -f truncate


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: newbie question

2002-08-19 Thread John W. Krahn

Kevin Meltzer wrote:
 
 On Mon, Aug 19, 2002 at 04:35:53PM -0700, John W. Krahn ([EMAIL PROTECTED]) said 
something similar to:
  Kevin Meltzer wrote:
  
   This is actually a bug. It just seems that nobody seems to care :) It
   would break too many JAPHs which use this.
  
   So, don't depend on it, in case it is ever fixed.
 
  Can you cite a reference to this behavior described as a bug?
 
 Does that behavior not seem like a bug to you?

Not necessarily.  :-)

 My reference is
 discussions on #perl about it. I'll dig up the logs if you wish (when I
 can get to that).

That's Ok, it's no big deal.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Time and Date

2002-08-19 Thread John W. Krahn

A Taylor wrote:
 
 Hi all,

Hello,

 Thanks for your help so far - I have managed to sort out my time and date
 problem but there are a few points that I dont understand.
 The code I have used is as follows:
 
 # get the hours, mins, weekday, day, month  and year
 $hour  = (gmtime)[2];
 $min   = (gmtime)[1];
 $wday  = (qw(Sun Mon Tue Wed Thu Fri Sat)) [(gmtime) [6]];
 $day   = (gmtime)[3];
 $month = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)) [(gmtime)
 [4]];
 $year  = (gmtime)[5] + 1900;
 
 # test the length of $min - if length = 1 then add a '0' at the begining.
 
 $minlen = length $min;
 if ($minlen  2)
 {
 $min = 0.$min;
 }
 $hour ++;
 
 I have had to do a test to see if the $min var is 1 or 2 in length:
 
 $minlen = length $min;
 if ($minlen  2)
 {
 $min = 0.$min;
 }
 
 this is because 22:07 (for example) would otherwise come out as 22:7 - which
 is a bit confusing. Is there a better way to do this 

Yes, use sprintf.

my $hour  = sprintf '%02d', (gmtime)[2];
my $min   = sprintf '%02d', (gmtime)[1];
etc...


 Also I have had to add 1 to the hour var: $hour ++; even though my web space
 providers are in the same country as me - does anyone know why this is - I
 am probably being a bit daft - well it is 1am, and I have been perling for
 about 16 hours now !!! Gulp ^_^

They are probably using a different time zone then you.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Manipulating files in a directory

2002-08-19 Thread drieux


On Monday, August 19, 2002, at 03:53 , Leon, Yanet I,,DMDCWEST wrote:

 Hello all,
[..]

If I get your question - it is

how do I implement the standard syslog log roller in perl

you will want to do

perldoc -f rename

you may want to check out

http://www.wetware.com/drieux/pbl/Sys/Admin/sysLogRoller.txt

oh dear I just found a bug in it...
well that is cleared up

forgive the fact that we also play with the whole of the
usual set of doing the OO style... actually a cooler
idea if you need to go with a bunch of them that you
will need to do configuration and rolling and stuff

HTH

[..]


ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Passing Hashes into a function

2002-08-19 Thread drieux


On Monday, August 19, 2002, at 03:08 , John Ross wrote:

 I am trying to pass an already existing hash into a subroutine, modify
 that hash, and have the modifications take when I leave the subroutine.
 I have looked through a number of perl books, but I either don't know what
 I am looking for, or I just don't understand how this works.  I am
 assuming that you pass the hash into the sub by reference, but from there,
 what?

you will want to go over the

perldoc perlref

then go back over:


 On Monday, August 19, 2002, at 03:16 , [EMAIL PROTECTED] 
 wrote:

   A code snippet would be very helpful.  To pass a hash and update it,
 then
   func(\%hash);

 sub func {
 my ( $hash ) = @_;
 $hash-{key} = 1;
 # this should be reflected back in the calling program when you return
  }

 Wags ;)


since the trick there is to 'get' that we move from using the

%hash -
to

$ref_oh_hash

notation...


ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Time and Date

2002-08-19 Thread Elaine -HFB- Ashton

A Taylor [[EMAIL PROTECTED]] quoth:
*
*Also I have had to add 1 to the hour var: $hour ++; even though my web 
*space providers are in the same country as me - does anyone know why this 
*is - I am probably being a bit daft - well it is 1am, and I have been 
*perling for about 16 hours now !!! Gulp ^_^

As far as I know, gmtime() returns hours in the range of 0..23 :)

You might want to check out the core module Time::Local too.

e.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




year as variable

2002-08-19 Thread Steve

Hello everyone,

I'm just trying to use the simplest of examples to learn how to use
different functions and just get an understanding of how things are
processed, and the syntax of Perl commands.

I just want to get the year as a variable.  Here's the rediculously
simple script I've started but I don't know why it wants to return 0
before the year. Here's my code:

#!/usr/bin/perl
print What year were you born in?\n;
$a = STDIN;
chop($a);
$b = system date +%Y;
#when date +%Y is typed into the console it says 2002
$age = $b - $a
print You are $age years old!\n;

when I execute this I get the following:

What year were you born in?
1986~~I typed this then pushed enter
2002
You are -1986 years old!

I'm a total newbie to Perl, someone please help! I'm running Mandrake
and my shell is bash if that helps in any way, thanks.

Steve


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: year as variable

2002-08-19 Thread Jeff 'japhy' Pinyan

On Aug 19, Steve said:

#!/usr/bin/perl

You should turn on warnings and use strict.

  #!/usr/bin/perl -w

  use strict;

If you're using Perl 5.6+, you can remove the -w and replace it with

  use warnings;

print What year were you born in?\n;
$a = STDIN;
chop($a);

  chomp(my $birth = STDIN);

$b = system date +%Y;

First, system() executes a command, it doesn't return its output.

  my $ok = system date +%Y;  # prints the output of 'date +%Y'
   # stores return status (0 == ok) in $ok

  chomp(my $curr_year = `date +%Y`);  # stores the output of 'date +%Y'
  # in $curr_year, and removes newline

Second, there's no need to spawn a program to get the year!

  my $curr_year = (localtime)[5] + 1900;  # 6th element returned is year
  # with 1900 subtracted from it

$age = $b - $a

You're missing a semicolon here!

  my $age = $curr_year - $birth;

print You are $age years old!\n;

That's ok.

when I execute this I get the following:

What year were you born in?
1986   ~~I typed this then pushed enter
2002
You are -1986 years old!

You'll notice '2002' was printed to the screen.  Why?  Because system()
merely executes the command (which, in 'date's, case, prints some
information to the terminal).  It RETURNS 0 (because 'date' executed
successfully), and 0 - 1986 = -1986.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **
stu what does y/// stand for?  tenderpuss why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: year as variable

2002-08-19 Thread dizzy74

 use Time::localtime;

 $b = localtime-year() +1900 ;

print What year were you born in?\n;
$a = STDIN;
chop($a);

$age = ($b - $a) ;
print You are $age years old!\n;


-- 
Date: August(VIII) 12th(XII),2002(MMII)

!!
!!
!  Catacomb (n.) - used for brushing cat !
!  hair. !
!!




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]