Adding second radio selcect button

2002-02-19 Thread Patrick

I'm trying to add a second radio select buttong to a web page. Can anyone
suggest how to do this so one does not cancel the other out. I can do the
cgi script to include the second ovject if i can get the form to allow for
two selects,
Thanks
Pat
Check out www.my-pcdoctor4u.com for all kinds of FREE items including FREE
E-Cards. 

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




RE: Adding second radio selcect button

2002-02-19 Thread Darren Simpson


not a perl question but i will answer it anyway :-) if you make sure the
radio buttons you wish to use have the same value in their name field
then they will act as a group and cancel each other out.

Regards

-Original Message-
From: Patrick [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 12:52
To: [EMAIL PROTECTED]
Subject: Adding second radio selcect button


I'm trying to add a second radio select buttong to a web page. Can
anyone
suggest how to do this so one does not cancel the other out. I can do
the
cgi script to include the second ovject if i can get the form to allow
for
two selects,
Thanks
Pat
Check out www.my-pcdoctor4u.com for all kinds of FREE items including
FREE
E-Cards. 

-- 
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: Printing data into a file every time some presses ENTER

2002-02-19 Thread zentara

On Mon, 18 Feb 2002 16:18:27 +0200, [EMAIL PROTECTED] (Bruce Ambraal) wrote:

Hi 

Could someone help?

the following code is not working.

open(INPUT_FILE,+fixed.dat) || die Could not open filename;
while (STDIN) {
print INPUT_FILE bruce\n;
}
close(INPUT_FILE);

Try unquoting bruce:

open(INPUT_FILE,+fixed.dat) || die Could not open filename;
while (STDIN) {
print INPUT_FILE  bruce,\n;
}
close(INPUT_FILE);

you can get your STDIN instead of bruce with

open(INPUT_FILE,+fixed.dat) || die Could not open filename;
while (STDIN) {
print INPUT_FILE  $_,\n;
}
close(INPUT_FILE);


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




selecting a text file for HTML output

2002-02-19 Thread Patrick

I thought had this. I now know how to select two radio buttons at the same
time. I have the first one selecting an image and putting it into a cel in
a table works fine but the other radio button I am using is to select a txt
file. How do I go about putting a selext txt file in an html out put via cgi
this is what i have but it just puts the name of the txt file into the cell
not the actuall file.
 IMG SRC=$BASEURL/$fields{'pic_select'} height=400 width=300 BORDER=0 for
the image and for the txt i have
TD WIDTH=360
 
   $fields{'poam_select'}br
   HR WIDTH=200
anyone have any suggestions. I have the poam_select catagory in the html
page set already but like i said it just puts in the name of the txt file i
have selected not the actual text from the file.
Any suggestions on different ways to do this.
Pat
Check out www.my-pcdoctor4u.com for all kinds of FREE items including FREE
E-Cards. 

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




Time sensative Sub Routine

2002-02-19 Thread Patrick

I am looking for information or a turorial on making a time sensitive sub
routine for developing an html page and sending emails. U want the users to
be able to choose when they want their cards to be made and the date to
have a notice sent to the recipient.
Pat
Check out www.my-pcdoctor4u.com for all kinds of FREE items including FREE
E-Cards. 

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




RE: Time sensative Sub Routine

2002-02-19 Thread Al Hospers

 I am looking for information or a turorial on making a time
 sensitive sub
 routine for developing an html page and sending emails. U
 want the users to
 be able to choose when they want their cards to be made and
 the date to
 have a notice sent to the recipient.

check out the chron function on your web server

Al Hospers
CamberSoft, Inc.
alatcambersoftdotcom
http://www.cambersoft.com

Shockwave and Director development, CD-ROM, HTML,
CGI scripting, and Graphic Design.

A famous linguist once said:
There is no language wherein a double
positive can form a negative.

YEAH, RIGHT



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




Re: selecting a text file for HTML output

2002-02-19 Thread Klaus Mangold

I have the poam_select catagory in the html
page set already but like i said it just puts in the name of the txt file i
have selected not the actual text from the file.
Any suggestions on different ways to do this.

Why don't you simply open and read the file with a file handle:

open TEXT, mytext.txt;
while (TEXT) {
 $text = $text.$_
 }
print $text

or something like this

Klaus


http://www.eye.de  -  Dienste rund um Fotografie und Internet



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




Global Constants in Perl ?

2002-02-19 Thread Stephen.Hurley

Hi,

I was wondering if there was a way of defining global constants in Perl ? I
use strict to keep all my variables tidy. However, there are a number of
#define-like vars that I would like to keep all together at the top of my
files, so that they can be reconfigured by whoever maintains my code
(filenames and such). Since these won't need to be changed by the script...I
wanna make 'em constants. But I also don't want to have to keep passing them
around to subroutines (I want to them to be global). But I also would like
to use strict (which tends not to like global variables). Is there any
#define-like construct in Perl or am I asking for too much ? If so, what's
the next best thing ?

Steve.



/.
Stephen Hurley,
Room CS2-034,
IDC, University Of Limerick.

P. 087-6701459
E. [EMAIL PROTECTED]
A. Apt.10, Charlotte Q, Limerick City.

I'm not a conspiracy theorist, but there are people here who are trying to
make me look like one...

../

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




RE: Global Constants in Perl ?

2002-02-19 Thread John Edwards

Yep. Use the constant function

http://perlhelp.web.cern.ch/PerlHelp/lib/constant.html

-Original Message-
From: Stephen.Hurley [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 17:31
To: '[EMAIL PROTECTED]'
Subject: Global Constants in Perl ?


Hi,

I was wondering if there was a way of defining global constants in Perl ? I
use strict to keep all my variables tidy. However, there are a number of
#define-like vars that I would like to keep all together at the top of my
files, so that they can be reconfigured by whoever maintains my code
(filenames and such). Since these won't need to be changed by the script...I
wanna make 'em constants. But I also don't want to have to keep passing them
around to subroutines (I want to them to be global). But I also would like
to use strict (which tends not to like global variables). Is there any
#define-like construct in Perl or am I asking for too much ? If so, what's
the next best thing ?

Steve.



/.
Stephen Hurley,
Room CS2-034,
IDC, University Of Limerick.

P. 087-6701459
E. [EMAIL PROTECTED]
A. Apt.10, Charlotte Q, Limerick City.

I'm not a conspiracy theorist, but there are people here who are trying to
make me look like one...

.../

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


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




Regex fro email addresses

2002-02-19 Thread Camilo Gonzalez

Does anyone have a regex handy that will extract email adresses and nothing
but? I have a large document with email addresses scattered throughout. The
addresses are preceeded and followed by a space.

#!/usr/local/bin/perl
print ' EOF'
 Camilo Gonzalez
 Web Developer
 Taylor Johnson Associates
  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
  www.taylorjohnson.com http://www.taylorjohnson.com/ 
 EOF


 



Extract data from WWW page

2002-02-19 Thread Daniel Falkenberg

Hey All,

I haven't come to you for a while with a Perl question :)  Just
wondering if you can give me some insight into this one...

Basically I went ahead and started to use HTML::TableExtract.  I must
say I am having a heap of fun with it.  Unfortunatly I am just having a
little bit of trouble with one area and was wondering if you can give me
some thought of what you think...

I have a CGI script that goes ahead and gets users data from my CGI
script with this data it passes it onto another web page and checks to
see if the phone number can get ADSL or not.  This part is working
really well.  So far I can extract some of the data that I want from
their page and display it to the user.

The only problem is that at the moment there is 4 possbible outcomes
that the page can return.  The code below can extract 1 outcome
perfectly (that is if the user can get ADSL) but it wont do anything for
me except display a blank page if the user can't get ADSL.  Any way here
is the code...


$html_string = $tree-as_HTML;

@headers = qw/number coverage location/;
$te = new HTML::TableExtract( headers = [@headers] );
$te-parse($html_string);
foreach $ts ($te-table_states) {
  foreach $row ($ts-rows) {
$mRow = @$row;
$mRow =~ s/.*\//g;
my @webValues = split/\s+/, $mRow;
print join(' ', $mRow), \n;
  }
}
undef @headers;

if the user can't get ADSL the array @headers should only contain
number and coverage that way results will be displayed (Don't really
have to know that).  So what I would essentially want to do is something
like if the headers @headers don't match then try a second set of
headers @headers2 = qw /number coverage/ if these headers don't match
then try a 3rd lot of headers and so on

Does this make any sense to you 'cos it's really confusing me.

Cheers,

Dan

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




Segmentation fault - core dumped

2002-02-19 Thread gross, cedric



Dear 
all,

Sometimes with this 
piece of prog join I obtain a segmentation fault - core 
dumped...
Why ? and How I 
could solve it ?


Thanks for 
help


meta_extract.pl
Description: meta_extract.pl

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


Table Access OR File Manipulation

2002-02-19 Thread Ho, Tony

Hi guys 
I was wondering if you could help me. 
 
I am currently designing Perl DBI code to extract data from tables from
Sybase Database under UNIX. 
There are a dozen of tables I need to extract information from. 
The biggest tables are ACCOUNTS and SUBSCRIBERS. 
ACCOUNT has 10 million rows and SUBSCRIBERS has 20 million rows. 
SUBSCRIBERS is related to the ACCOUNTS table as every account has
subscribers. 
 
At the end of the extraction process, I need to end up with 1 or 2 flat
files that shows rows of SUBSCRIBER data and rows of ACCOUNT data associated
to those subscribers. 
 
Which is the better option in terms of performance and reliability: 
 
Access the sybase tables with SELECT+JOIN sql statements, order and write
the results to the overall flat file file immediately ? 
 
OR 
 
BCP out the results into multiple files and manipulate/rearrange/order them
into a single file under Unix. 
 
I would be most grateful if you could help me out. 
Cheers 
T
 
 



Delete lines in a file

2002-02-19 Thread wim

Hey folks!

I'm gonna ask a question that is asked mayby thousand times, but I can't 
  find out how I delete complete lines in a file without leaving empty 
lines.

-- 
Kind regards,

Wim De Hul
Belgacom Belbone

  Mail   : [EMAIL PROTECTED]
  Mobile : +32 479 952004
  Ripe   : WDH25-RIPE
  Registered Linux User: #260015



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




Re: Perl and apache

2002-02-19 Thread Shaun Sloan

Matthew Harrison wrote:

 [Tue Feb 19 02:23:39 2002] [error] (2)No such file or directory: exec of
 /var/www/cgi-bin/admin.cgi failed
In order to get scripts to run from a web page you have to tell Apache:
 - Where the script file is
 - That is needs to be executed
This is done by the ScriptAlias directive in httpd.conf

The ScriptAlias tells Apache that the alias cgi-bin points to the
/var/www/cgi-bin/ directory (in your case) and that scripts can be run from 
that directory.
So when you browse to http://www.some.address/cgi-bin/admin.cgi Apache has
to have the cgi-bin defined so that it can look for (and find) admin.cgi to 
execute it.
The ScriptAlias directive allows scripts in the cgi-bin directory to be
executed.

If you look in your httpd.conf you will find the ScriptAlias directive for 
the /cgi-bin/ and if it does not point to your /var/www/cgi-bin/ directory, 
then, you need to change it to that directory or move your script into the 
directory cgi-bin points to.

Hth.

Shaun

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




Re: Delete lines in a file

2002-02-19 Thread John W. Krahn

Wim wrote:
 
 Hey folks!

Hello,

 I'm gonna ask a question that is asked mayby thousand times, but I can't
   find out how I delete complete lines in a file without leaving empty
 lines.

What have you tried?  Have you read the solution in the FAQ?

perldoc -q delete a line in a file


John
-- 
use Perl;
program
fulfillment

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




Changing STDERR

2002-02-19 Thread Laycock, Angus

Please,

Can someone tell me how to change STDERR to output to a file then change it
back to its original output.

my $oldout = select STDERR;

print STDERR test1\n;

open STDERR, test.txt or die Can't open file STDERR [OUTPUT];

print STDERR test2\n;# goes to file

select $oldout;

print STDERR test3\n;  # goes to file. Want it to go to monitor.

I have done this but does not put STDERR back again.

Thanks

Gus







--
This message is intended only for the personal and confidential use of the designated 
recipient(s) named above.  If you are not the intended recipient of this message you 
are hereby notified that any review, dissemination, distribution or copying of this 
message is strictly prohibited.  This communication is for information purposes only 
and should not be regarded as an offer to sell or as a solicitation of an offer to buy 
any financial product, an official confirmation of any transaction, or as an official 
statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or 
error-free.  Therefore, we do not represent that this information is complete or 
accurate and it should not be relied upon as such.  All information is subject to 
change without notice.



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




help with html

2002-02-19 Thread Chris Zampese

This question probably belongs in the cgi list, but here goes...
I know that this is going to sound bad, but I want to send an html document via 
email to people that have blocked html (I am doing a form for an insurance broker, and 
it goes to the insurance companies that they deal with.  The insurance companies have 
blocks on html) is there any way around this problem (other than calling each 
insurance company and getting them to change their settings, this is a problem as some 
of them are controlled by a 'head office' arrangement).  The main thing that I want 
this for is the ability to set the subject line of a reply, so if anyone knows how to 
do this another way that would work also,
   thanks for your time,
Chris.



RE: help with html

2002-02-19 Thread John Edwards

I want to send an html document via email to people that have blocked html

Why? Can't you send a text file? What's special about this HTML page? Does
it contain links to web URLs? If so have you considered that they may not
have web access?

The main thing that I want this for is the ability to set the subject line
of a reply

??? Explain this in detail. Does the HTML page include a form which submits
to a remote perl script?

John

-Original Message-
From: Chris Zampese [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 11:48
To: perl list
Subject: help with html


This question probably belongs in the cgi list, but here goes...
I know that this is going to sound bad, but I want to send an html
document via email to people that have blocked html (I am doing a form for
an insurance broker, and it goes to the insurance companies that they deal
with.  The insurance companies have blocks on html) is there any way around
this problem (other than calling each insurance company and getting them to
change their settings, this is a problem as some of them are controlled by a
'head office' arrangement).  The main thing that I want this for is the
ability to set the subject line of a reply, so if anyone knows how to do
this another way that would work also,
   thanks for your time,
Chris.


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




Illegal seek

2002-02-19 Thread Tony McGuinness

Hi there,

I am getting the following:

cannot execute ftpscr Illegal seek at ./getfile.pl line 31.

from a simple Perl script (below). The system command is returning
the error and the pathname points to the current directory. I cannot
seem to find any documentation on this error. Has anyont encountered
the same.

Thanks in advance for any help,

Tony

#!/usr/local/bin/perl -w

use strict;
use Cwd;

my $hostname = barney;
my $username = mimsp;
my $password = mimsp;
my $sourcedir = ../work;
my $destdir = ../work;
my $file = MSF099;
my $command = upload;
my $Basedir = cwd();
my $args;

open FTPSCR,  ftpscr;
print FTPSCR #!/usr/bin/ksh\n;
print FTPSCR ftp -n -v $hostname  EOF  ftplog\n;
print FTPSCR user $username $password\n;
print FTPSCR bin\n;
print FTPSCR cd $sourcedir\n;
print FTPSCR lcd $destdir\n;
print FTPSCR get $file\n;
print FTPSCR bye\n;
print FTPSCR EOF\n;

print $Basedir\n;
system(chmod +x ftpscr);

$args = $Basedir/ftpscr;
system(/usr/users/tony/perl/proj1/ftpscr) or die cannot execute ftpscr
$!;
#unlink ftpscr;

#system($command);
=
DISCLAIMER

1. The information contained in this E-mail is confidential. 
   It is intended only for the stated addressee(s) and access 
   to it by any other person is unauthorised. 
   If you are not an addressee, you must not disclose, copy, 
   circulate or in any other way use or rely on the information 
   contained in this E-mail. Such unauthorised use may be unlawful. 
   If you have received this E-mail in error, please inform us 
   immediately and delete it and all copies from your system.

2. The views expressed in this E-mail are those of the author, 
and do not represent the views of AMT-Sybex Group Ltd., its 
associates or subsidiaries, unless otherwise expressly indicated.
In the avoidance of doubt, the insertion of the name of AMT-Sybex 
Group Ltd., its associate or subsidiary under the name of the sender 
may constitute an express indication that the views stated in the Mail 
are those of the named company.
=
For more information on the AMT Sybex group visit: http://www.amt-sybex.com 



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




RE: help with html

2002-02-19 Thread Darren Simpson


you're right. it does sound bad. someone call spam cop :-)
-Original Message-
From: Chris Zampese [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 11:49
To: perl list
Subject: help with html


This question probably belongs in the cgi list, but here goes...
I know that this is going to sound bad, but I want to send an html
document via email to people that have blocked html (I am doing a form
for an insurance broker, and it goes to the insurance companies that
they deal with.  The insurance companies have blocks on html) is there
any way around this problem (other than calling each insurance company
and getting them to change their settings, this is a problem as some of
them are controlled by a 'head office' arrangement).  The main thing
that I want this for is the ability to set the subject line of a reply,
so if anyone knows how to do this another way that would work also,
   thanks for your time,
Chris.

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




RE: Segmentation fault - core dumped

2002-02-19 Thread gross, cedric

 De : Ken Clark [mailto:[EMAIL PROTECTED]]
 Envoyé : mardi 19 février 2002 12:54

 could you be more precise? you could backtrace it, and send 
 that in as a
 bug, if it is one. and what version are you using? what were you doing
 when it failed? is there consistency with the failure?

I'm running perl v5.6.1 built for i386-freebsd
with libwww-perl-5.63
with msql,Mysql 1.2216
with HTML::TreeBuilder 3.11

I'm running this piece of prog as a cron job every 30 mins. Sometimes is
working fine, sometimes it's craching...Don't understand why ...

I try to find out with the core dumped file but it's not human
readable...(for me)
Cedric
 
 nice vagueness though. i give it a 9.
 
 k
 
 On Tue, Feb 19, 2002 at 09:56:34AM +0100, gross, cedric wrote:
  
 Dear all,
  
  
  
 Sometimes with this piece of prog join I obtain a 
 segmentation fault -
 core dumped...
  
 Why ? and How I could solve it ?
  
  
  
  
  
 Thanks for help
 
 

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




Re: help with html

2002-02-19 Thread Chris Zampese

you're right. it does sound bad. someone call spam cop :-)

-- Honestly, no spam. Just want to automate the office a bit.  Changed a
form that they usually send by paper (fax or snail mail) to an email form.
-Original Message-
From: Chris Zampese [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 11:49
To: perl list
Subject: help with html


This question probably belongs in the cgi list, but here goes...
I know that this is going to sound bad, but I want to send an html
document via email to people that have blocked html (I am doing a form
for an insurance broker, and it goes to the insurance companies that
they deal with.  The insurance companies have blocks on html) is there
any way around this problem (other than calling each insurance company
and getting them to change their settings, this is a problem as some of
them are controlled by a 'head office' arrangement).  The main thing
that I want this for is the ability to set the subject line of a reply,
so if anyone knows how to do this another way that would work also,
   thanks for your time,
Chris.

--
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: Regular exps on files

2002-02-19 Thread zentara

On Mon, 18 Feb 2002 14:40:17 -0900, [EMAIL PROTECTED] (Michael Fowler) wrote:

On Mon, Feb 18, 2002 at 07:20:50AM -0500, zentara wrote:
 You are using nested while loops to iterate
 thru a file, this isn't necessary. Also you don't need to
 open a file just to loop thru it.

Yes, you do.  At some level, you have to open the file if you want to
read its contents.


 my $file  = 'c:/davidcode/perlbeast/*.secret';
 while ($file){
 print $file: $.  :$_\n  if  /$regexp/;
 }

This code doesn't actually work.  Did you test it?  Perl won't automatically
open a file using the file read operator like that.  The  operator is the
only one that's special in that respect.
Ooops, you can tell I'm a beginner.  I was taking it from some code like below.
I forgot about the magical properties of @ARGV to auto-open files.
I just mindlessly stuck $file in there for ARGV.  My apologies.
I know, I know...always test your code.

while (){
 print $file: $.  :$_\n  if  /$regexp/;
 }


#!/usr/bin/perl
use warnings;
use strict;
use File::Find;
my ($search, $ext) = @ARGV;
if (defined $ext) {$ext = .$ext} else {$ext = '.*'};
die Usage : greprz 'search' 'extension' (extension optional)\n if ($search eq
);
@ARGV = ();
find (sub { push @ARGV, $File::Find::name if (-f and -T and  $ext or
/\Q$ext$/)}, .);
while (ARGV) {
close ARGV if eof;
print $ARGV: $. :$_\n if /$search/;
}





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




RE: help with html

2002-02-19 Thread MECKLIN, JOE (ASI)

Instead of trying to force your interpretation of what they should see, you
might consider just sending straight ASCII text; the information is still
delivered, they can do what they wish with it and the network overall will
thank you for your lack of bandwidth use. Obviously they don't require html
or they wouldn't have it blocked.

Just another 2-cents.



-Original Message-
From: Chris Zampese [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 6:45 AM
To: perl list
Subject: Re: help with html


you're right. it does sound bad. someone call spam cop :-)

-- Honestly, no spam. Just want to automate the office a bit.  Changed a
form that they usually send by paper (fax or snail mail) to an email form.
-Original Message-
From: Chris Zampese [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 11:49
To: perl list
Subject: help with html


This question probably belongs in the cgi list, but here goes...
I know that this is going to sound bad, but I want to send an html
document via email to people that have blocked html (I am doing a form
for an insurance broker, and it goes to the insurance companies that
they deal with.  The insurance companies have blocks on html) is there
any way around this problem (other than calling each insurance company
and getting them to change their settings, this is a problem as some of
them are controlled by a 'head office' arrangement).  The main thing
that I want this for is the ability to set the subject line of a reply,
so if anyone knows how to do this another way that would work also,
   thanks for your time,
Chris.

--
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: Illegal seek

2002-02-19 Thread John W. Krahn

Tony McGuinness wrote:
 
 Hi there,

Hello,

 I am getting the following:
 
 cannot execute ftpscr Illegal seek at ./getfile.pl line 31.
 
 from a simple Perl script (below). The system command is returning
 the error and the pathname points to the current directory. I cannot
 seem to find any documentation on this error. Has anyont encountered
 the same.

You do realize that the Net::FTP module that comes with perl would be a
lot easier.


 #!/usr/local/bin/perl -w
 
 use strict;
 use Cwd;
 
 my $hostname = barney;
 my $username = mimsp;
 my $password = mimsp;
 my $sourcedir = ../work;
 my $destdir = ../work;
 my $file = MSF099;
 my $command = upload;
 my $Basedir = cwd();
 my $args;
 
 open FTPSCR,  ftpscr;

You should _always_ test the success or failure of open().

open FTPSCR, ' ftpscr' or die Cannot open ftpscr: $!;


 print FTPSCR #!/usr/bin/ksh\n;
 print FTPSCR ftp -n -v $hostname  EOF  ftplog\n;
 print FTPSCR user $username $password\n;
 print FTPSCR bin\n;
 print FTPSCR cd $sourcedir\n;
 print FTPSCR lcd $destdir\n;
 print FTPSCR get $file\n;
 print FTPSCR bye\n;
 print FTPSCR EOF\n;
 
 print $Basedir\n;
 system(chmod +x ftpscr);

You do realize that perl _has_ a chmod function?

perldoc -f chmod


 $args = $Basedir/ftpscr;
 system(/usr/users/tony/perl/proj1/ftpscr) or die cannot execute ftpscr
 $!;

You should read the documentation on the proper way to use system() and
get relevant error messages from using it.

perldoc -f system


 #unlink ftpscr;
 
 #system($command);
 =
 DISCLAIMER
 
 1. The information contained in this E-mail is confidential.

Then why are you posting it to this mailing list?



#!/usr/local/bin/perl -w
use strict;
use Net::FTP;

my $hostname  = 'barney';
my $username  = 'mimsp';
my $password  = 'mimsp';
my $sourcedir = '../work';
my $destdir   = '../work';
my $file  = 'MSF099';

chdir $destdir or die Cannot cd to $destdir: $!;

my $ftp = Net::FTP-new( $hostname ) or die Couldn't connect to
$hostname: $@\n;

$ftp-login( $username, $password ) or die Cannot log in to
$hostname\n;
$ftp-binary or die Cannot set binary mode\n;
$ftp-cwd( $sourcedir ) or die Cannot change to directory
$sourcedir\n;
$ftp-get( $file ) or die Cannot get $file\n;
$ftp-quit;

__END__


John
-- 
use Perl;
program
fulfillment

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




Re: Changing STDERR

2002-02-19 Thread Jeff 'japhy' Pinyan

On Feb 19, Laycock, Angus said:

Can someone tell me how to change STDERR to output to a file then change it
back to its original output.

Look at the documentation for open().  It shows you how to temporarily
change a filehandle.  Here are the first four lines of code:

  open(OLDOUT, STDOUT);
  open(OLDERR, STDERR);

  open(STDOUT, foo.out) || die Can't redirect stdout;
  open(STDERR, STDOUT) || die Can't dup stdout;

The rest await you at 'perldoc -f open'.

-- 
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: Illegal seek

2002-02-19 Thread Jeff 'japhy' Pinyan

On Feb 19, Tony McGuinness said:

from a simple Perl script (below). The system command is returning
the error and the pathname points to the current directory. I cannot
seem to find any documentation on this error. Has anyont encountered
the same.

As John said, Perl has a module for FTP.

system(chmod +x ftpscr);

Not only does Perl have a chmod() function, but I wrote File::chmod which
allows you to say

  chmod +x, ftpscr;

if you like using symbolic modes instead.

system(/usr/users/tony/perl/proj1/ftpscr) or die cannot execute ftpscr
$!;

system() returns zero on SUCCESS.  Check its documentation at 'perldoc -f
system'.

DISCLAIMER
[...]

Ugh.

-- 
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: Table Access OR File Manipulation

2002-02-19 Thread Gyro

Greeting Tony,

Tony Ho [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi guys
 I was wondering if you could help me.

 I am currently designing Perl DBI code to extract data from tables from
 Sybase Database under UNIX.
 There are a dozen of tables I need to extract information from.
 The biggest tables are ACCOUNTS and SUBSCRIBERS.
 ACCOUNT has 10 million rows and SUBSCRIBERS has 20 million rows.
 SUBSCRIBERS is related to the ACCOUNTS table as every account has
 subscribers.

 At the end of the extraction process, I need to end up with 1 or 2 flat
 files that shows rows of SUBSCRIBER data and rows of ACCOUNT data
associated
 to those subscribers.

Oooo, flat files


 Which is the better option in terms of performance and reliability:

 Access the sybase tables with SELECT+JOIN sql statements, order and write
 the results to the overall flat file file immediately ?


This really a DBA question and not a perl.


 OR

 BCP out the results into multiple files and manipulate/rearrange/order
them
 into a single file under Unix.

BCP is fast and quick but will generate more data than it looks like you
will use.  If you are planning to join multiple tables leverage the power of
the dataserver. Combine the data you need in the dataserver via a join or
joining on multiple temp tables. Don't extract all your data to flat files
just to combine them, your asking for more work than necessary. When you
generate your results print it to a file.

What are you planning to do with the flat file?


 I would be most grateful if you could help me out.
 Cheers
 T




Gyro



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




Re: help with html

2002-02-19 Thread William.Ampeh


If you are really determined to send an html document via email, you can
simply
rename the file(remove the .htm[l] extension), send it,
and let the recipients rename it back.

Alternatively, I will simply send the file in plain ASCII (text) form.

Another way is to compress the file, and send it.

By the way, why do you have to send the document in html format?  It will
help if you could give us your reasons.

__

William Ampeh (x3939)
Federal Reserve Board


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




Sorted off list (was: help with html)

2002-02-19 Thread John Edwards

Just FYI, this was sorted off list. Chris, see what happens when you take
things off list...

John

-Original Message-
From: Chris Zampese [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 11:42
To: John Edwards
Subject: Re: help with html



Thanks John,
   I will rewrite my script so that it sends plain text and include the
link, plus instructions on what to do if the link does not work,
  Your help has been invaluable,

   many and varied thanks,

   Chris.


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




Illegal seek

2002-02-19 Thread Tony McGuinness

Hi there,

I checked up on system and rewrote the line that
calls system. Now I have:

@args = ($Basedir/ftpscr);
system(@args) == 0 or die cannot execute ftpscr $!;

but the script is not executed. No errors are returned.

Any ideas?

Tony
=
DISCLAIMER

1. The information contained in this E-mail is confidential. 
   It is intended only for the stated addressee(s) and access 
   to it by any other person is unauthorised. 
   If you are not an addressee, you must not disclose, copy, 
   circulate or in any other way use or rely on the information 
   contained in this E-mail. Such unauthorised use may be unlawful. 
   If you have received this E-mail in error, please inform us 
   immediately and delete it and all copies from your system.

2. The views expressed in this E-mail are those of the author, 
and do not represent the views of AMT-Sybex Group Ltd., its 
associates or subsidiaries, unless otherwise expressly indicated.
In the avoidance of doubt, the insertion of the name of AMT-Sybex 
Group Ltd., its associate or subsidiary under the name of the sender 
may constitute an express indication that the views stated in the Mail 
are those of the named company.
=
For more information on the AMT Sybex group visit: http://www.amt-sybex.com 



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




RE: Illegal seek

2002-02-19 Thread John Edwards

OK. Maybe I've missed something here, but why are you storing a single
string in an array??

Try this

$arg = $Basedir/ftpscr;
if (system($arg)) { die cannot execute ftpscr $!; }

John

-Original Message-
From: Tony McGuinness [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 14:55
To: Perl List (E-mail)
Subject: Illegal seek


Hi there,

I checked up on system and rewrote the line that
calls system. Now I have:

@args = ($Basedir/ftpscr);
system(@args) == 0 or die cannot execute ftpscr $!;

but the script is not executed. No errors are returned.

Any ideas?

Tony
=
DISCLAIMER

1. The information contained in this E-mail is confidential. 
   It is intended only for the stated addressee(s) and access 
   to it by any other person is unauthorised. 
   If you are not an addressee, you must not disclose, copy, 
   circulate or in any other way use or rely on the information 
   contained in this E-mail. Such unauthorised use may be unlawful. 
   If you have received this E-mail in error, please inform us 
   immediately and delete it and all copies from your system.

2. The views expressed in this E-mail are those of the author, 
and do not represent the views of AMT-Sybex Group Ltd., its 
associates or subsidiaries, unless otherwise expressly indicated.
In the avoidance of doubt, the insertion of the name of AMT-Sybex 
Group Ltd., its associate or subsidiary under the name of the sender 
may constitute an express indication that the views stated in the Mail 
are those of the named company.
=
For more information on the AMT Sybex group visit: http://www.amt-sybex.com 



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


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




RE: Illegal seek

2002-02-19 Thread John Edwards

Sorry, I can't help with this issue. It was just something to try based on
your last post.

I've cc'd this back to the list. Please keep the discussion there.

Thanks

John

-Original Message-
From: Tony McGuinness [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 15:08
To: John Edwards
Subject: RE: Illegal seek


Hi John,

Thanks for the response.

I tried this to no avail.

The script I want to execute is executable.

Regards,

Tony

-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 14:55
To: 'Tony McGuinness'; Perl List (E-mail)
Subject: RE: Illegal seek


OK. Maybe I've missed something here, but why are you storing a single
string in an array??

Try this

$arg = $Basedir/ftpscr;
if (system($arg)) { die cannot execute ftpscr $!; }

John

-Original Message-
From: Tony McGuinness [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 14:55
To: Perl List (E-mail)
Subject: Illegal seek


Hi there,

I checked up on system and rewrote the line that
calls system. Now I have:

@args = ($Basedir/ftpscr);
system(@args) == 0 or die cannot execute ftpscr $!;

but the script is not executed. No errors are returned.

Any ideas?


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




How to count lines in an output file

2002-02-19 Thread Tim Lago

I've written a really simple script that opens a file, reads for specific
line of text and copies the matches to an output file,

Here it is:

open(INFILE, rmaccess1.txt);
open(OUTFILE, outfile.txt);

print Enter the name of the Media file to analyze and press Enter: \n;

chomp($realname = STDIN);

while(INFILE) {

 if(/$realname/) {
  print OUTFILE;
   }

}

Now, I want to add another line that counts the number of lines that were
created in the outfile.txt, any help?



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




ifconfig and too many pppd's

2002-02-19 Thread Ian McKenna

Hi, I am new to PERL and have a relativly easy question.

I have a SUSE Linux machine that does some dial-up, gathers infirmation
from the servers I look after, however he dial up when shut down keeps a
pppd deamon up, sometime I see at least 20 ppp1ppp21 for example.
I've tried to write a PERL script that simply list the pppd from
ifconfig so it list all the pppds like this

ppp1
ppp2
ppp3
..
..
..
ppp21

I want ppp1 kelt up and all the rest killed off - anyone know how I can
do this ?

Regs Ian




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




Re: Perl and apache

2002-02-19 Thread Johannes Franken

On Tue, Feb 19, 2002 at 02:32:34AM +, Matthew Harrison wrote:
 I am a newbie to perl and linux and i am having trouble with my apache server 
 and cgi scripts.

 [Tue Feb 19 02:23:39 2002] [error] (2)No such file or directory: exec of 
 /var/www/cgi-bin/admin.cgi failed

First thing I'd suggest you to do is
- become apache 
  (su - apache, you might need to give it a shell in /etc/passwd before)
- call the script from the shell

Does this one spit out hells of html code at you?

IF YES:
- Your apache needs reconfiguration. See the postings about
  ScriptAlias directives in this thread.

IF NO:
There's something wrong with the script itself.
- Check if the first line of the script points to the place 
  where it's interpreter's sitting (e.g. #!/usr/bin/perl)
- Check the permissions: the User or Group defined in httpd.conf 
  should be able to r and x the script and the dirs above. 
  In doubt, just chmod 555 the script.
- Try it again (via shell and browser). 
  If it still doesn't work, please post the full shell output.

-- 
Johannes Franken
 
Professional unix/network development
mailto:[EMAIL PROTECTED]
http://www.jfranken.de/

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




RE: How to count lines in an output file

2002-02-19 Thread Tony McGuinness



-Original Message-
From: Tim Lago [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 14:31
To: [EMAIL PROTECTED]
Subject: How to count lines in an output file


I've written a really simple script that opens a file, reads for specific
line of text and copies the matches to an output file,

Here it is:

open(INFILE, rmaccess1.txt);
open(OUTFILE, outfile.txt);

print Enter the name of the Media file to analyze and press Enter: \n;

chomp($realname = STDIN);

while(INFILE) {

 if(/$realname/) {
  print OUTFILE;
$count++;
   }

}

Now, I want to add another line that counts the number of lines that were
created in the outfile.txt, any help?



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

1. The information contained in this E-mail is confidential. 
   It is intended only for the stated addressee(s) and access 
   to it by any other person is unauthorised. 
   If you are not an addressee, you must not disclose, copy, 
   circulate or in any other way use or rely on the information 
   contained in this E-mail. Such unauthorised use may be unlawful. 
   If you have received this E-mail in error, please inform us 
   immediately and delete it and all copies from your system.

2. The views expressed in this E-mail are those of the author, 
and do not represent the views of AMT-Sybex Group Ltd., its 
associates or subsidiaries, unless otherwise expressly indicated.
In the avoidance of doubt, the insertion of the name of AMT-Sybex 
Group Ltd., its associate or subsidiary under the name of the sender 
may constitute an express indication that the views stated in the Mail 
are those of the named company.
=
For more information on the AMT Sybex group visit: http://www.amt-sybex.com 



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




RE: How to count lines in an output file

2002-02-19 Thread John Edwards

open(INFILE, rmaccess1.txt) or die Can't open rmaccess1.txt: $!;
open(OUTFILE, outfile.txt) or die Can't create outfile.txt: $!;
# ALWAYS check for errors when opening file handles. It's a good habit to
get into.

print Enter name of the Media file to analyse: ;
# I'd keep the above on one line. Looks a little neater

chomp($realname = STDIN);

$counter = 0;
# Add this

while(INFILE) {

 if(/$realname/) {
  print OUTFILE;
  $counter++;
  # And add this
 }

}

# And finally do something with the new value of $counter
print $counter lines were saved to the output file\n;

HTH

John

-Original Message-
From: Tim Lago [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 14:31
To: [EMAIL PROTECTED]
Subject: How to count lines in an output file


I've written a really simple script that opens a file, reads for specific
line of text and copies the matches to an output file,

Here it is:

open(INFILE, rmaccess1.txt);
open(OUTFILE, outfile.txt);

print Enter the name of the Media file to analyze and press Enter: \n;

chomp($realname = STDIN);

while(INFILE) {

 if(/$realname/) {
  print OUTFILE;
   }

}

Now, I want to add another line that counts the number of lines that were
created in the outfile.txt, any help?



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


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




Re: How to count lines in an output file

2002-02-19 Thread Geoffrey F. Green

See below:

On 2/19/02 9:30 AM, Tim Lago [EMAIL PROTECTED] wrote:

 open(INFILE, rmaccess1.txt);
 open(OUTFILE, outfile.txt);
 
 print Enter the name of the Media file to analyze and press Enter: \n;
 
 chomp($realname = STDIN);

my $count;
 
 while(INFILE) {
 
 if(/$realname/) {
 print OUTFILE;
++$count;
  }
 
 }
 
print Number of lines created in outfile.txt: $count;

 - geoff


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




Re: Running Perl Scripts

2002-02-19 Thread William.Ampeh


Do this:


1.  Open up a terminal session
2.  Type which perl  or to get the location of the Perl interpreter
3.  On the very first line of your Perl program, insert the location of the
Perl interpreter as determined in 2.
  In my case, this what I got:

momoni:/home/william/bin/PERL_CGI(4)% which perl
/opt/local/bin/perl -  my system's response

So my all my Perl programs begin as follows:

#!/opt/local/bin/perl

4.  You must then make the file executable.  In this case, depending on who
else will be using
the file, the permission setting will vary.  In most cases, this will be
enough:

chmod 750 {the name of your Perl program}

E.g.: chmod 750 foo.pl

5.  If the location of your Perl program is in your PATH variable (echo
$PATH), you can run the
program by simply entering the name of the program.

That is:

foo.pl

If not, and your PATH variable does not include ./ (current directory),
since most workshops
do not allow the inclusion of ./ in the PATH variable (for security
reasons).  Then you have
to enter ./ before the name of your program.

That is:

../foo.pl

Hope this helps.

__

William Ampeh (x3939)
Federal Reserve Board


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




Re: Table Access OR File Manipulation

2002-02-19 Thread Jenda Krynicky

From:   Ho, Tony [EMAIL PROTECTED]
 I am currently designing Perl DBI code to extract data from tables
 from Sybase Database under UNIX. There are a dozen of tables I need to
 extract information from. The biggest tables are ACCOUNTS and
 SUBSCRIBERS. ACCOUNT has 10 million rows and SUBSCRIBERS has 20
 million rows. SUBSCRIBERS is related to the ACCOUNTS table as every
 account has subscribers. 
 
 At the end of the extraction process, I need to end up with 1 or 2
 flat files that shows rows of SUBSCRIBER data and rows of ACCOUNT data
 associated to those subscribers. 
 
 Which is the better option in terms of performance and reliability: 
 
 Access the sybase tables with SELECT+JOIN sql statements, order and
 write the results to the overall flat file file immediately ? 
 
 OR 
 
 BCP out the results into multiple files and manipulate/rearrange/order
 them into a single file under Unix. 

I'd leave the joining and sorting to sybase. The code there is (read 
should be) heavily optimized and thus be better than what you 
can come up with in reasonable time.

Optimize the query, maybe add some more indexes if that helps 
and select only the things you need. That's IMHO the best you can 
do.

Jenda

P.S.: I always TRY to do as much work as possible as near to the 
data as possible and only fetch from database the data I'll need to 
show to the user, write to a file or that I use to identify an object in 
the database later.

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

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




Re: Changing STDERR

2002-02-19 Thread Jenda Krynicky

From:   Laycock, Angus [EMAIL PROTECTED]
 Can someone tell me how to change STDERR to output to a file then
 change it back to its original output.

#!perl -w
print STDERR First msg\n;

use vars qw(*ORIGSTDERR); # to make -w happy
open ORIGSTDERR, 'STDERR';
open STDERR, 'c:\temp\zkERR.txt';

print STDERR Second msg\n;

close STDERR;
open STDERR, 'ORIGSTDERR';

print STDERR Third msg\n;
__END__

HTH, Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

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




Re: help with html

2002-02-19 Thread Jenda Krynicky

From:   Chris Zampese [EMAIL PROTECTED]
 -- Honestly, no spam. Just want to automate the office a bit.  Changed
 a form that they usually send by paper (fax or snail mail) to an email
 form. 

Wouldn't it be better to put the form on your (read the company 
you do this for) website and only send them a URL?

What do you expect them to do if they use a mail client that 
doesn't support HTML forms?

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

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




RE: Changing STDERR

2002-02-19 Thread Laycock, Angus

Job sorted, it works!!!

Thanks you all for your help.

Gus

-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
Sent: 19 February 2002 15:20
To: '[EMAIL PROTECTED]'
Subject: Re: Changing STDERR


From:   Laycock, Angus [EMAIL PROTECTED]
 Can someone tell me how to change STDERR to output to a file then
 change it back to its original output.

#!perl -w
print STDERR First msg\n;

use vars qw(*ORIGSTDERR); # to make -w happy
open ORIGSTDERR, 'STDERR';
open STDERR, 'c:\temp\zkERR.txt';

print STDERR Second msg\n;

close STDERR;
open STDERR, 'ORIGSTDERR';

print STDERR Third msg\n;
__END__

HTH, Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

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



--
This message is intended only for the personal and confidential use of the designated 
recipient(s) named above.  If you are not the intended recipient of this message you 
are hereby notified that any review, dissemination, distribution or copying of this 
message is strictly prohibited.  This communication is for information purposes only 
and should not be regarded as an offer to sell or as a solicitation of an offer to buy 
any financial product, an official confirmation of any transaction, or as an official 
statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or 
error-free.  Therefore, we do not represent that this information is complete or 
accurate and it should not be relied upon as such.  All information is subject to 
change without notice.



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




RE: How to count lines in an output file

2002-02-19 Thread Timothy Johnson


You could always try something like this:

while(INFILE) {

 if(/$realname/) {
  print OUTFILE;
  $count++;
 }

}
 
$count should have the number of lines at the end.

-Original Message-
From: Tim Lago
To: [EMAIL PROTECTED]
Sent: 2/19/02 6:30 AM
Subject: How to count lines in an output file

I've written a really simple script that opens a file, reads for
specific
line of text and copies the matches to an output file,

Here it is:

open(INFILE, rmaccess1.txt);
open(OUTFILE, outfile.txt);

print Enter the name of the Media file to analyze and press Enter: \n;

chomp($realname = STDIN);

while(INFILE) {

 if(/$realname/) {
  print OUTFILE;
   }

}

Now, I want to add another line that counts the number of lines that
were
created in the outfile.txt, any help?



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




This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

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




foreach() index scoping question

2002-02-19 Thread Bradford Ritchie

Hi,

I want to use a foreach loop to iterate over a list but I want to be able to
retain the index variable when the loop ends (either at the end of the list
or by an early-exit last statement).

Given the following example code:

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

my %hash = ( one = {},## This part isn't important for this example
 two = {},
 three = {},
   );

## code to populate %hash subhashes goes here...

foreach my $elem (@long_list) {
my $k=junk;
foreach $k (keys %hash) {
   last if($elem =~ /$k/);## ok, I've got the $k I need
}
$hash{$k}-{'foo'} = 42;## oops, $k is reset to junk
}

I guess I need to assign $k to some other variable that will be visible
outside of the foreach loop before I call last...
but I want it to look nice too :)and that's the problem.

my $bar;
foreach $k (keys %hash) {
if($elem =~ /$k/) {
$bar = $k;## can't I do better than this?
last;
}
}

Ok, so it's not much of a problem but is there a way to get the nice feel of
the one-line last if(... and still do the assignment operation to retain
the value of $k?

Or, is there any way to get around the way foreach localizes the index
variable?

Thanks.
-- Brad


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




im a beginner using perl

2002-02-19 Thread Wood, Richard



All,

This is part of what I have,  if the service is not equal to 1,  how would I
issue a command to email someone?  Can not find this in
the literature.

 Check certain ARS stuff
#1) Check for the availability of telalert
$telalertcheck=`ps -ef | grep telalertd | grep -v grep`;
$telreturn=$?;
logmesg($telreturn,Urgent telalertd process (on $host) indicates the
process is down);
##2) check other ars process

if (telreturn != 1) {



}
elsif (telreturn == 1)
{

Thanks,

Richard

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




system

2002-02-19 Thread Tony McGuinness

Hi,

I have the following code and the system call just does not happen.

Furthermore there is no error message.

$arg = $Basedir/ftpscr;
system($arg) == 0 or die cannot execute ftpscr $!;

At this stage $Basedir/ftpscr exists and is an executable ksh
script.

I have similar scripts that are working ok.

Can anyone shed any light on this?

Thanks in advance,

Tony
=
DISCLAIMER

1. The information contained in this E-mail is confidential. 
   It is intended only for the stated addressee(s) and access 
   to it by any other person is unauthorised. 
   If you are not an addressee, you must not disclose, copy, 
   circulate or in any other way use or rely on the information 
   contained in this E-mail. Such unauthorised use may be unlawful. 
   If you have received this E-mail in error, please inform us 
   immediately and delete it and all copies from your system.

2. The views expressed in this E-mail are those of the author, 
and do not represent the views of AMT-Sybex Group Ltd., its 
associates or subsidiaries, unless otherwise expressly indicated.
In the avoidance of doubt, the insertion of the name of AMT-Sybex 
Group Ltd., its associate or subsidiary under the name of the sender 
may constitute an express indication that the views stated in the Mail 
are those of the named company.
=
For more information on the AMT Sybex group visit: http://www.amt-sybex.com 



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




Re: im a beginner using perl

2002-02-19 Thread shock

Check out Mail::Sendmail at 
http://search.cpan.org/search?mode=modulequery=mail%3A%3Asendmail

* Wood, Richard ([EMAIL PROTECTED]) spake thusly:
 
 
 All,
 
 This is part of what I have,  if the service is not equal to 1,  how would I
 issue a command to email someone?  Can not find this in
 the literature.
 
  Check certain ARS stuff
 #1) Check for the availability of telalert
 $telalertcheck=`ps -ef | grep telalertd | grep -v grep`;
 $telreturn=$?;
 logmesg($telreturn,Urgent telalertd process (on $host) indicates the
 process is down);
 ##2) check other ars process
 
 if (telreturn != 1) {
   
 
 
   }
 elsif (telreturn == 1)
   {
 
 Thanks,
 
 Richard
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

-- 
 ) ,_),_)
(-(__  |_  _  _ |/
 ) | |(_)(_ |\
( \_,
 ___
| http://www.exitwound.org: hard to find|
| http://www.buckowensfan.com : he's the man|
 ___
| Keep your boss's boss off your boss's back.   |
 ___
 -BEGIN GEEK CODE BLOCK-
| Version: 3.1  |
| GJ/IT d- s: a C+++$ UL P+++ L+++ E--- W++| 
| N+@ o K- w O- M- V PS+ PE Y+ PGP++ t+@ 5@ X++ |
| R tv+@ b+ DI D+ G++ e h r+++ y+++ |
 --END GEEK CODE BLOCK--

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




Re: system

2002-02-19 Thread Brett W. McCoy

On Tue, 19 Feb 2002, Tony McGuinness wrote:

 I have the following code and the system call just does not happen.

 Furthermore there is no error message.

 $arg = $Basedir/ftpscr;
 system($arg) == 0 or die cannot execute ftpscr $!;

 At this stage $Basedir/ftpscr exists and is an executable ksh
 script.

When using system, you should use $? in your error message -- I don't
think system sets !$.  Are *any* error messages being printed?  Do you
have -w and 'use strict' at the top of your script?

-- Brett
(PS. The disclaimer at the bottom of your message was longer than the
message itself.  Very bad form.  Such disclaimers are unnecessary, but if
your company automatically appends them, perhaps you should post from a
different address).
  http://www.chapelperilous.net/

If man is only a little lower than the angels, the angels should reform.
-- Mary Wilson Little


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




Regular Expressions II

2002-02-19 Thread Kittler, Karl

Okay, I got the string parsing working with one exception.
 
When the A HREF... /a tag runs across two or more lines the test
fails. Any suggestions?
 
Here's what I'm using for a multiple tag search throughout the
string(condensed):
 
while ($line =~
m/[\s]*A[\s]*HREF[\s]*=[\s]*[|'|]*([\D\w\d][^'\s]*)[|'|]*[]*(.*?)
\/a[]/gi){

 $url= $1;
 $linkname = $2;
 
print FILE $url\t$linkname\n;
 
}
 
This works for tags that occur on a single line.
 
I've tried adding in \r and \n and [\r\n] but no success.
 
Thanks again.



qw for variables?

2002-02-19 Thread Dennis G. Wicks

Greetings;

I can get qw to work for things like

@n = qw( john jacob jingleheimer schmidt );

but something like

@n = qw( $names );

doesn't work. I get the literal string $names in @n!

What does the equivalent of qw(???) for a variable?

Many TIA!
Dennis

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




RE: qw for variables?

2002-02-19 Thread Nikola Janceski

qw( john jacob $name ) is equivelent to

('john', 'jacob', '$name')  notice the single quote. The single quotes does
not interpolate (use the special meanings of special charaters, so the $
doesn't designate a varible name it's just a $ character).

see man perlop
or perldoc perlop

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 2:39 PM
To: [EMAIL PROTECTED]
Subject: qw for variables?


Greetings;

I can get qw to work for things like

@n = qw( john jacob jingleheimer schmidt );

but something like

@n = qw( $names );

doesn't work. I get the literal string $names in @n!

What does the equivalent of qw(???) for a variable?

Many TIA!
Dennis

-- 
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: qw for variables?

2002-02-19 Thread Jonathan E. Paton

 What does the equivalent of qw(???) for a variable?

You mean like:

my @array = ($var1, $var2, $var3);

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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




Re: How to count lines in an output file

2002-02-19 Thread Tim Lago

thanks for everyones help, it worked great.

Tim Lago [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I've written a really simple script that opens a file, reads for specific
 line of text and copies the matches to an output file,

 Here it is:

 open(INFILE, rmaccess1.txt);
 open(OUTFILE, outfile.txt);

 print Enter the name of the Media file to analyze and press Enter: \n;

 chomp($realname = STDIN);

 while(INFILE) {

  if(/$realname/) {
   print OUTFILE;
}

 }

 Now, I want to add another line that counts the number of lines that were
 created in the outfile.txt, any help?





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




Re: qw for variables?

2002-02-19 Thread Dennis G. Wicks

Greetings;

No, I mean if $names contains Jesus Mary Joseph and I do

my @n = qw( $names );

I want the same results as if I had done

my @n = qw( Jesus Mary Joseph );

Obviously qw() does not work this way, but I can't find the
equivalent that does.

Thanks,
Dennis

}On Feb 19, 17:47, =?iso-8859-1?q?Jonathan=20E.=20Paton?= wrote:
} Subject: Re: qw for variables?
 What does the equivalent of qw(???) for a variable?

You mean like:

my @array = ($var1, $var2, $var3);

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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

}-- End of excerpt from =?iso-8859-1?q?Jonathan=20E.=20Paton?=



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




RE: qw for variables?

2002-02-19 Thread Nikola Janceski

you want split then..

my $names = Jesus Mary Joseph;
my @n = split /\s+/, $names;


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 3:08 PM
To: [EMAIL PROTECTED]
Subject: Re: qw for variables?


Greetings;

No, I mean if $names contains Jesus Mary Joseph and I do

my @n = qw( $names );

I want the same results as if I had done

my @n = qw( Jesus Mary Joseph );

Obviously qw() does not work this way, but I can't find the
equivalent that does.

Thanks,
Dennis

}On Feb 19, 17:47, =?iso-8859-1?q?Jonathan=20E.=20Paton?= wrote:
} Subject: Re: qw for variables?
 What does the equivalent of qw(???) for a variable?

You mean like:

my @array = ($var1, $var2, $var3);

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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

}-- End of excerpt from =?iso-8859-1?q?Jonathan=20E.=20Paton?=



-- 
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: foreach() index scoping question

2002-02-19 Thread Jeff 'japhy' Pinyan

On Feb 19, Bradford Ritchie said:

foreach my $elem (@long_list) {
my $k=junk;
foreach $k (keys %hash) {
   last if($elem =~ /$k/);## ok, I've got the $k I need
}
$hash{$k}-{'foo'} = 42;## oops, $k is reset to junk
}

That behavior is documented, yes.

Perhaps you want to do:

  for my $elem (@long_list) {
for my $k (keys %hash) {
  if ($elem =~ $k) {
$hash{$k}{foo} = 42;
last;
  }
}
  }

Or, is there any way to get around the way foreach localizes the index
variable?

No.  It does that on purpose, and is documented to do so.

-- 
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: PERL - JAVASCRIPT Help please

2002-02-19 Thread Johnathan Kupferer

This really isn't a perl question.  Write out your javascript in a 
simple HTML file and see if that works.  If it does then port write the 
perl code to output that HTML.

This isn't the forum for this but...  When you call 
nwin.document.write() you should be passing HTML, not just any old 
string.  You should have write everything from the html to /html 
and then call nwin.document.close().  Netscape is probably just being 
picky about how you're writing to the window.

- Johnathan


[EMAIL PROTECTED] wrote:

Hi,

I am using a perl program to invoke a small javascript to first open a new
window,
and then another javascript to write some text or form to the new window.
I can't get it to work in Netscape 4.72

I will open a window but won't write to it.

It works fine in IE 5.0

The problem is between --- lines below.
Any help is appreciated.

Edgar.



===
#!/usr/bin/perl
$|=1;

use 5.004;
use CGI ':all';

print header;
print start_html(-title='Test',
   -bgcolor='FF'
   ); 

# print some text to the main page
print first pageBR;

# call function to pop up a new window with some text or form
do_java();

print end_html;
exit(1);

sub do_java {
$text=here is the text for the popup window; 
   
print start_heredoc;
SCRIPT
var nwin = window.open(,nwin,height=400,width=400);
/SCRIPT  
start_heredoc


#-
# write to the window.
#THIS WILL NOT WORK FOR NETSCAPE 4.72 
#IT WILL OPEN THE WINDOW BUT WILL NOT WRITE OUT THE TEXT.

print start_heredoc;
SCRIPT
nwin.document.write($text);
/SCRIPT  
start_heredoc
#-

}  




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




RE: foreach() index scoping question

2002-02-19 Thread Nikola Janceski

You could use a temporary variable to keep the last value.

my $temp;
foreach my $elem (@long_list) {
my $k=junk;
foreach $k (keys %hash) {
   $temp = $k;
   last if($elem =~ /$k/);## ok, I've got the $k I need
}
$hash{$temp}-{'foo'} = 42;## now it works
}


-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 1:14 PM
To: Bradford Ritchie
Cc: [EMAIL PROTECTED]
Subject: Re: foreach() index scoping question


On Feb 19, Bradford Ritchie said:

foreach my $elem (@long_list) {
my $k=junk;
foreach $k (keys %hash) {
   last if($elem =~ /$k/);## ok, I've got the $k I need
}
$hash{$k}-{'foo'} = 42;## oops, $k is reset to junk
}

That behavior is documented, yes.

Perhaps you want to do:

  for my $elem (@long_list) {
for my $k (keys %hash) {
  if ($elem =~ $k) {
$hash{$k}{foo} = 42;
last;
  }
}
  }

Or, is there any way to get around the way foreach localizes the index
variable?

No.  It does that on purpose, and is documented to do so.

-- 
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]



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: qw for variables?

2002-02-19 Thread Johnathan Kupferer

Dennis G. Wicks wrote:

Greetings;

No, I mean if $names contains Jesus Mary Joseph and I do

   my @n = qw( $names );

I want the same results as if I had done

   my @n = qw( Jesus Mary Joseph );

Obviously qw() does not work this way, but I can't find the
equivalent that does.

Thanks,
Dennis

How about:

my @n = split(/\s+/, $names);

- Johnathan



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




Re: Illegal seek

2002-02-19 Thread Randal L. Schwartz

 Tony == Tony McGuinness [EMAIL PROTECTED] writes:

Tony I checked up on system and rewrote the line that
Tony calls system. Now I have:

Tony @args = ($Basedir/ftpscr);
Tony system(@args) == 0 or die cannot execute ftpscr $!;

Tony but the script is not executed. No errors are returned.

The $! there is a red herring.  It has nothing to do with your actual
launch error.  Until you tell us how you know it's not executed,
there's not a lot more we can do.  All we know is that it is exiting
with a non-zero exit status, so you have to ask the author of ftpscr
why that is so.

Tony =
Tony DISCLAIMER

Tony 1. The information contained in this E-mail is confidential. 
TonyIt is intended only for the stated addressee(s) and access 
Tonyto it by any other person is unauthorised. 
TonyIf you are not an addressee, you must not disclose, copy, 
Tonycirculate or in any other way use or rely on the information 
Tonycontained in this E-mail. Such unauthorised use may be unlawful. 
TonyIf you have received this E-mail in error, please inform us 
Tonyimmediately and delete it and all copies from your system.

Tony 2. The views expressed in this E-mail are those of the author, 
Tony and do not represent the views of AMT-Sybex Group Ltd., its 
Tony associates or subsidiaries, unless otherwise expressly indicated.
Tony In the avoidance of doubt, the insertion of the name of AMT-Sybex 
Tony Group Ltd., its associate or subsidiary under the name of the sender 
Tony may constitute an express indication that the views stated in the Mail 
Tony are those of the named company.
Tony =
Tony For more information on the AMT Sybex group visit: http://www.amt-sybex.com 

You have exceeded the 4-line .sig boilerplate limit with a worthless
unenforcable disclaimer.  Please remove this text from future postings
to this mailing list.  If you cannot do so for mail from your domain,
please get a freemail account and rejoin the list from there.

For the record, your question (including the closing Tony) was a
total of 244 characters, and your worthless disclaimer (not including
the final sig-like line) was 1103 characters.  Ludicrous, I tell you.
Get an account from a freemail host, IMMEDIATELY.  {sigh}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




can't find docs on ''

2002-02-19 Thread Nikola Janceski

I am looking for the documentation on the  operator in the context of the
following:

print END;
Some pre-formatted text.
END

Not in the sense of bitwise shift operator. I have tried searching on
perldoc.com for  and  but no cigar. Any ideas were the docs are on
this thing in this context?


Nikola Janceski

I have great faith in fools; My friends call it self-confidence.
-- Edgar Allen Poe 




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: qw for variables?

2002-02-19 Thread Dennis G. Wicks

The split did the trick, and cut out a few lines of code
also. I had already done some splits and joins to get ready
for qw() which I can n ow delete!

Thanks for the help everyone!
Dennis

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




Re: can't find docs on ''

2002-02-19 Thread Peter Scott

At 02:08 PM 2/19/02 -0500, Nikola Janceski wrote:
I am looking for the documentation on the  operator in the context of the
following:

print END;
Some pre-formatted text.
END

perldata, end of the section on Scalar value Constructors.

It could be easier to find.  I keep expecting to find it in perlop under 
Quote and Quote-like Operators.  What do others think?

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


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




Email Validation

2002-02-19 Thread Roger Morris

I've been working on email validation for a script.  The examples I've seen 
haven't exactly done that great of a job.  I've taken the code and messed 
with it some.
My thoughts were, if the email is in the correct format, 
ie  [EMAIL PROTECTED]  or some form like   [EMAIL PROTECTED]  then go 
to the second 'if' statement and check for bad characters.
It seems to work how I want, have I caught most of the problems?   I'm only 
interested in the email address, not checking to see if this is 
valid:  roger [EMAIL PROTECTED]


sub  valid_email ()
{
if ($e_address =~ /^\w+(\.\w+){0,}\@\w+(\.\w+){1,}$/i)
{
if ($e_address =~ /\'\{\}\[\]\(\)\$\%*/i)
{   
return 0;
}
return 1;
}
return 0;
}




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




Changing Ownership

2002-02-19 Thread slhgkh5

I am working on AIX 4.3 and attempting to change 
ownership of files.  Below is an excerpt from my script 
of the area that is causing the problem.

defined($user = getpwnam $_) or die Bad user name;
defined($group = getgrnam staff) or die Bad group
name;
chdir /home/$_;
chown $user, $group, glob *;

The input $_ is the username either from a file or User 
input inside 
a loop.  The user
has a choice.  When I run the above I get bad username.  
It is like it is trying to lookup the numeric user ID 
for $_ and not 
what $_ actually contains.  If I replace $_
with an actual user name in the getpwnam function it 
works fine.

Any comments or suggestions would be appreciated.

Thanks in Advance.

Grant

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




Is it just a question of preference/time/money?

2002-02-19 Thread Nikola Janceski

I have old perl code, but it still does what it needs to, and is currently
being used.
Now I need to make changes to the code, (about once every 4 months).
Over time we all code better -- learning better ways to write things,
clearer ways to write code, write more comments.
Note: I haven't started using strict or -w yet... soon hopefully with my new
programs.

Do I rewrite all the code?
Do I just chuck in the changes and hope for the best?
Do I cut 'n' paste what I know works (ie subroutines [poorly written]) and
change the rest?

I know when I have to look at someone else's script most of the time I say,
If you want me to maintain it then I should have written it in the first
place and then I rewrite all the code.

Any suggestions? (I hope I didn't open a can o' worms).


Nikola Janceski

Military intelligence is a contradiction in terms.
-- Groucho Marx 




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]




How to I am not sure how to reference a perl script from the web

2002-02-19 Thread Lance Prais

I am not sure how to do this.  I wrote a perl script that searches a doc
table and I need to have it called when I reference a web page.

Example.
a user searches my site for a particular solution.  After they read it there
is an option to give feedback to as weather or not it helped them.   In the
Href the Solution Id is passed to the next page.

I need to populate both the solution Id and the Title.  It is not an option
to send the Title as a string because of the length.  Also this title
information is not stored in a database table because we are using Verity as
in Indexer.  All the reverent information is stored in the Doc Table  We
want to grab the solution Id and use a perl script to get the title from
this table and send it back to the page.

Does anyone know how to do this?


Thank you in advance
Lance


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




Storing Newsletter in Database

2002-02-19 Thread Kevin Old

Hello all,

I have a challenge that has been put on me.  I have built a website for my
church and we are now wanting to put our newsletter online.  It is currently
being done in Microsoft Publisher.

I would like to take the MS Publisher file and extract the data and insert
it into a database (PostgreSQL) and then display it via PHP/Perl.  Catch is,
the data is not that consistent.

The only thing I can think of is to have MS Publisher save it as HTML, and
then go through and parse everything and get it put in the database.  I know
that would still involve some kind of consistency with the data.  If there
was a way for me to apply an XML DTD to the HTML, that would automate the
process more.

On the other hand, I could just have the entire newsletter HTML dumped in
the database and then have it displayed like that (modifying the HTML of
course).  But that defeats the entire purpose of automating data.

Any ideas on how this can be done, even if I don't have consistency in the
data?

Any help is appreciated,
Kevin



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




Re: qw for variables?

2002-02-19 Thread Andrea Holstein

In article [EMAIL PROTECTED] wrote Dennis G. Wicks [EMAIL PROTECTED]:

 Greetings;
 
 I can get qw to work for things like
 
 @n = qw( john jacob jingleheimer schmidt );
 
 but something like
 
 @n = qw( $names );
 
 doesn't work. I get the literal string $names in @n!
 
 What does the equivalent of qw(???) for a variable?
 
Do you mean that $names contains the string
john jacob jingleheimer schmidt

Then split is your friend:
@n = split / /, $names;

Greetings,
Andrea

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




Re: Is it just a question of preference/time/money?

2002-02-19 Thread Brett W. McCoy

On Tue, 19 Feb 2002, Nikola Janceski wrote:

 I have old perl code, but it still does what it needs to, and is currently
 being used.
 Now I need to make changes to the code, (about once every 4 months).
 Over time we all code better -- learning better ways to write things,
 clearer ways to write code, write more comments.
 Note: I haven't started using strict or -w yet... soon hopefully with my new
 programs.

 Do I rewrite all the code?
 Do I just chuck in the changes and hope for the best?
 Do I cut 'n' paste what I know works (ie subroutines [poorly written]) and
 change the rest?

I've found myself in a similar position, having to wade through some very
poorly written Perl code and having to maintain it.  Here are the things I
do, as independent steps to progressively get the code up to snuff (that
way each little step takes only a little bit of time):

1. add -w and 'use strict' and do the basic code clean up
2. abstract out hard-coded data into variables and/or constants
3. try to make ill-begotten algorithms into more idiomatic Perl style
4a) for a single script, abstract out code into subroutines
5b) for multiple scripts, abstract out code into modules
6) abstract out even more hard-coded data into an external config file

Repeat steps 2-4 until your code is a thing of beauty.  There are more
steps you can add to fine tune this, but those are the basic steps I take,
and each step must pass regression tests (i.e., each step must
functionally do the same thing as the previous steps) to verify you
haven't broken anything.  But testing is a whole 'nother can of worms...

-- Brett
  http://www.chapelperilous.net/

Don't sweat it -- it's only ones and zeros.
-- P. Skelly


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




RE: Storing Newsletter in Database

2002-02-19 Thread Timothy Johnson


I think the last time I tried to make a webpage with Publisher it made the
whole document into a picture background with links on top.  That might put
a dent in your plan if that's still the way it's set up.

-Original Message-
From: Kevin Old [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 1:11 PM
To: [EMAIL PROTECTED]
Subject: Storing Newsletter in Database


Hello all,

I have a challenge that has been put on me.  I have built a website for my
church and we are now wanting to put our newsletter online.  It is currently
being done in Microsoft Publisher.

I would like to take the MS Publisher file and extract the data and insert
it into a database (PostgreSQL) and then display it via PHP/Perl.  Catch is,
the data is not that consistent.

The only thing I can think of is to have MS Publisher save it as HTML, and
then go through and parse everything and get it put in the database.  I know
that would still involve some kind of consistency with the data.  If there
was a way for me to apply an XML DTD to the HTML, that would automate the
process more.

On the other hand, I could just have the entire newsletter HTML dumped in
the database and then have it displayed like that (modifying the HTML of
course).  But that defeats the entire purpose of automating data.

Any ideas on how this can be done, even if I don't have consistency in the
data?

Any help is appreciated,
Kevin



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



This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

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




RE: Storing Newsletter in Database

2002-02-19 Thread Stout, Joel R

Any thought to storing links to the docs in a db rather than the data
itself, maybe with some keywords you can search on?



Joel

Headline- Apathy Runs Rampant; But Noone Seems to Care

 -Original Message-
 From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 19, 2002 1:27 PM
 To: 'Kevin Old'; [EMAIL PROTECTED]
 Subject: RE: Storing Newsletter in Database
 
 
 
 I think the last time I tried to make a webpage with 
 Publisher it made the
 whole document into a picture background with links on top.  
 That might put
 a dent in your plan if that's still the way it's set up.
 
 -Original Message-
 From: Kevin Old [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 19, 2002 1:11 PM
 To: [EMAIL PROTECTED]
 Subject: Storing Newsletter in Database
 
 
 Hello all,
 
 I have a challenge that has been put on me.  I have built a 
 website for my
 church and we are now wanting to put our newsletter online.  
 It is currently
 being done in Microsoft Publisher.
 
 I would like to take the MS Publisher file and extract the 
 data and insert
 it into a database (PostgreSQL) and then display it via 
 PHP/Perl.  Catch is,
 the data is not that consistent.
 
 The only thing I can think of is to have MS Publisher save it 
 as HTML, and
 then go through and parse everything and get it put in the 
 database.  I know
 that would still involve some kind of consistency with the 
 data.  If there
 was a way for me to apply an XML DTD to the HTML, that would 
 automate the
 process more.
 
 On the other hand, I could just have the entire newsletter 
 HTML dumped in
 the database and then have it displayed like that (modifying 
 the HTML of
 course).  But that defeats the entire purpose of automating data.
 
 Any ideas on how this can be done, even if I don't have 
 consistency in the
 data?
 
 Any help is appreciated,
 Kevin
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 --
 --
 This email may contain confidential and privileged 
 material for the sole use of the intended recipient. 
 If you are not the intended recipient, please contact 
 the sender and delete all copies.
 
 -- 
 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]




Grep function inside a for loop does grep the values.

2002-02-19 Thread Satya_Devarakonda

Can somebody help me on what is wrong in the following piece of code?

foreach (@prv_lst)
{
$item = $_;
@list_prv = grep (/$item/, @txn_log);
print The foll. are the Txn details for Trading Partner $item \n;
print @list_prv;
for (@txn_lst)
{
$aprf = $_;
$cnt = 0;
@list_prv_txn = grep (/$aprf/, @list_prv);
for (@list_prv_txn)
{$cnt++};
print The number of ${aprf}'s are ${cnt} \n ;
}
}

I dont see any values in the @list_prv eventhough I get one assiging a
value to $item
like
$item = abc;

Thanks in advance,
Satya



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




Grep function inside a for loop does NOT grep the values.

2002-02-19 Thread Satya_Devarakonda

Hi,

I am sorry, I meant to say grep does not work inside a for loop.

regards,
Satya
- Forwarded by Satya Devarakonda/THP on 02/19/2002 05:18 PM -
   
   
Satya_Devarakonda@tufts-   
   
health.com  To: [EMAIL PROTECTED] 
   
cc:
   
02/19/2002 05:13 PM Subject: Grep function inside 
a for loop does grep the values.
   
   
   
   




Can somebody help me on what is wrong in the following piece of code?

foreach (@prv_lst)
{
$item = $_;
@list_prv = grep (/$item/, @txn_log);
print The foll. are the Txn details for Trading Partner $item \n;
print @list_prv;
for (@txn_lst)
{
$aprf = $_;
$cnt = 0;
@list_prv_txn = grep (/$aprf/, @list_prv);
for (@list_prv_txn)
{$cnt++};
print The number of ${aprf}'s are ${cnt} \n ;
}
}

I dont see any values in the @list_prv eventhough I get one assiging a
value to $item
like
$item = abc;

Thanks in advance,
Satya



--
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: Grep function inside a for loop does grep the values.

2002-02-19 Thread Brett W. McCoy

On Tue, 19 Feb 2002 [EMAIL PROTECTED] wrote:

 Can somebody help me on what is wrong in the following piece of code?

 foreach (@prv_lst)
 {
 $item = $_;
 @list_prv = grep (/$item/, @txn_log);
 print The foll. are the Txn details for Trading Partner $item \n;
 print @list_prv;
 for (@txn_lst)
 {
 $aprf = $_;
 $cnt = 0;
 @list_prv_txn = grep (/$aprf/, @list_prv);
 for (@list_prv_txn)
 {$cnt++};
 print The number of ${aprf}'s are ${cnt} \n ;
 }
 }

 I dont see any values in the @list_prv eventhough I get one assiging a
 value to $item
 like
 $item = abc;

Possible $_ contains a trailing newline?  See perldoc -f chomp.  It's hard
to say without knowing what the actual data is.

-- Brett
  http://www.chapelperilous.net/

There are three rules for writing a novel.  Unfortunately, no one knows
what they are.
-- Somerset Maugham


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




RE: Grep function inside a for loop does NOT grep the values.

2002-02-19 Thread Nikola Janceski

can you give us a snip of what's in 
@prv_lst
@txn_log


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 5:18 PM
To: [EMAIL PROTECTED]
Subject: Grep function inside a for loop does NOT grep the values.


Hi,

I am sorry, I meant to say grep does not work inside a for loop.

regards,
Satya
- Forwarded by Satya Devarakonda/THP on 02/19/2002 05:18 PM -
 

Satya_Devarakonda@tufts-

health.com  To:
[EMAIL PROTECTED]
cc:

02/19/2002 05:13 PM Subject: Grep
function inside a for loop does grep the values.
 

 





Can somebody help me on what is wrong in the following piece of code?

foreach (@prv_lst)
{
$item = $_;
@list_prv = grep (/$item/, @txn_log);
print The foll. are the Txn details for Trading Partner $item \n;
print @list_prv;
for (@txn_lst)
{
$aprf = $_;
$cnt = 0;
@list_prv_txn = grep (/$aprf/, @list_prv);
for (@list_prv_txn)
{$cnt++};
print The number of ${aprf}'s are ${cnt} \n ;
}
}

I dont see any values in the @list_prv eventhough I get one assiging a
value to $item
like
$item = abc;

Thanks in advance,
Satya



--
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]



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: Email Validation

2002-02-19 Thread Randal L. Schwartz

 Roger == Roger Morris [EMAIL PROTECTED] writes:

Roger I've been working on email validation for a script.  The examples I've
Roger seen haven't exactly done that great of a job.  I've taken the code
Roger and messed with it some.

But not enough. :)

Roger sub  valid_email ()
Roger {
Roger if ($e_address =~ /^\w+(\.\w+){0,}\@\w+(\.\w+){1,}$/i)

That ignores fred[EMAIL PROTECTED], a valid and active email
address. (Try it!  It's an autoresponder!)

It permits [EMAIL PROTECTED], an invalid email address.

Definitely wanna look at those other modules.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




RE: Changing Ownership

2002-02-19 Thread Timothy Johnson


Okay, I have to ask...

Are you chomping your user input before you pass it to the function?
Have you tested what $_ prints out?  (E.g: print \#$_\#;)

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 11:56 AM
To: Perl Beg
Subject: Changing Ownership


I am working on AIX 4.3 and attempting to change 
ownership of files.  Below is an excerpt from my script 
of the area that is causing the problem.

defined($user = getpwnam $_) or die Bad user name;
defined($group = getgrnam staff) or die Bad group
name;
chdir /home/$_;
chown $user, $group, glob *;

The input $_ is the username either from a file or User 
input inside 
a loop.  The user
has a choice.  When I run the above I get bad username.  
It is like it is trying to lookup the numeric user ID 
for $_ and not 
what $_ actually contains.  If I replace $_
with an actual user name in the getpwnam function it 
works fine.

Any comments or suggestions would be appreciated.

Thanks in Advance.

Grant

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




This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

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




HTML::TableExtract

2002-02-19 Thread Daniel Falkenberg

Hi all,

At the moment I am working with HTML::TableExtract.  I must say that I
am having alot of fun with it and most of it is working really well.
What I am looking for is some ideas on how I can go about the
following...

Basically I have my own CGI/Perl page that a user enters some
credentials after these are entered the form data is then sent off to
another WWW site that does 'stuff' with the data.  Of coarse after this
is sent and maniputlated at the other end the required data from the
remote WWW site is returned.  Now at the moment the user can enter data
and depending on the data there is a possbile 4 outcomes that the remote
WWW site will return.

What I would like to use (but am very happy to hear other suggestions)
is an if elsif statement that can get this returned data.  Lets say the
user enters a phone number that checks against 'stuff'.  If the phone
number doesn't exist on the remote WWW site then there is one returned
outcome.  If the phone number does exist and can successfully get a
service with the provider then there is another outcome (2)... and so
on.

Here is the code I have so far...

@headers = qw /sorry/;
$te = new HTML::TableExtract( headers = [@headers] );
$te-parse($html_string);
# Examine all matching tables
foreach $ts ($te-table_states) {
  #print Table (, join(',', $ts-coords), ):\n;
  foreach $row ($ts-rows) {
  $mRow = @$row;
  $mRow =~ s/.*\//g;
  #$mRow =~ s/[^.\d\s]//g;
  @webValues = split/\s+/, $mRow;
  print join(' ', $mRow), \n;
  }
  undef @headers;
}

Now the code works OK only if the out come in the headers is sorry :).
Does any one know how I would go about checking to see if the headers
returned on a successfull page were not sorry but other words.

Kind Regards,

Dan

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




Re: Email Validation

2002-02-19 Thread Roger Morris

At 03:35 PM 2/19/2002 -0800, Randal L. Schwartz wrote:
  Roger == Roger Morris [EMAIL PROTECTED] writes:

Roger I've been working on email validation for a script.  The examples I've
Roger seen haven't exactly done that great of a job.  I've taken the code
Roger and messed with it some.

But not enough. :)

Roger sub  valid_email ()
Roger {
Roger if ($e_address =~ /^\w+(\.\w+){0,}\@\w+(\.\w+){1,}$/i)

That ignores fred[EMAIL PROTECTED], a valid and active email
address. (Try it!  It's an autoresponder!)

It permits [EMAIL PROTECTED], an invalid email address.

Definitely wanna look at those other modules.


I hadn't found that module when I was searching the net.  the 
Email::Validdoesn't catch the @this_host.com  It also doesn't catch | 
in the email, which I would've thought shouldn't be permitted.
I'll keep digging.


Roger



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




Re: Email Validation

2002-02-19 Thread Kevin Meltzer

On Tue, Feb 19, 2002 at 03:53:57PM -0800, Roger Morris ([EMAIL PROTECTED]) said 
something similar to:
 I hadn't found that module when I was searching the net.  the 
 Email::Validdoesn't catch the @this_host.com  It also doesn't catch | 
 in the email, which I would've thought shouldn't be permitted.
 I'll keep digging.

No, it doesn't. But, if I recall, @this_host.com is valid email address syntax,
even though domain names can't (currently) contain the _ character. So,
Email::Valid is sticking to RFC822 (http://www.faqs.org/rfcs/rfc822.html). This
is why I mentioned that Email::Valid has MX host checking, which is where
@host_name.com would fail (since there is not, and can not be a host_name.com
MX record).

Cheers,
Kevin


-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
I gained nothing at all from Supreme Enlightenment, and for that very
reason it is called Supreme Enlightenment.
-- Gautama Buddha

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




Matching a variable against nothing

2002-02-19 Thread Daniel Falkenberg

Hey all,

Just wondering how I check if a variable contains nothing or not.  I
thought it was something like the following...

if ( $string eq '' ) {
  print String contains nothing;
} else {
  print The string contains the following: $string;
}

Is this correct?

Dan

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




Re: Matching a variable against nothing

2002-02-19 Thread Brett W. McCoy

On Wed, 20 Feb 2002, Daniel Falkenberg wrote:

 Just wondering how I check if a variable contains nothing or not.  I
 thought it was something like the following...

 if ( $string eq '' ) {
   print String contains nothing;
 } else {
   print The string contains the following: $string;
 }

Yes, that is correct, if the string is an emoty string, as opposed to
being undefined (never assigned to).

An empty string also yields boolean false, so you can say:

if(!$string) {
  #...
} else {
  #...
}

This is also different from an undefined or uninitialized string, for
which you should do:

if(!defined($string)) {
 #...
} else {
 #...
}

-- Brett

  http://www.chapelperilous.net/

There are more dead people than living, and their numbers are increasing.
-- Eugene Ionesco


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




renaming files (versioning)

2002-02-19 Thread Bill Akins

Hi all,

After processing files in my perl script, I need to move them to the final
destination.  My problem is if the file already exists (lets call it
data.txt), I need to rename it to data-v01.txt (where -v01 is version 01).

So... if there are four other esisting versions, data-v03.txt should become
data-v04.txt, then data-v02.txt should become data-v03.txt, then
data-v01.txt should become data-v02.txt, data.txt should become
data-v01.txt, finally data.txt can be written.

I have to keep all versions of the existing files and oldest must have the
highest -v## (version number) and newest is just data.txt.  I will end up
with 20 or more versions of each file.

Is this a job better done in bash or perl?  Either way, any pointers would
be greatly appreciated!

Thanx!



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




How this works?

2002-02-19 Thread Tushar Kulkarni

Hi,
I have this code, but I am not getting how this works. Can someone
help?

%h = ( one = 15,
two = 26,
three = 37 );

my @a;

foreach (@a {keys %h})
{
$_ = $_ + 10;
}

print New\n;

foreach (@a{keys %h})
{
print $_\n;
}

This prints

New
10
10
10

Can someone explain what is happening here?

Thanks
Tushar


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




Stripping words from a string

2002-02-19 Thread Daniel Falkenberg

Hey all,

Just wondering how I would go about stripping words from a string.

If I have a string that has the following...

$string = Hello world how are you?;

How would I go about stripping the words 'how' and 'Hello' ignoring case
each time?

Would it go something like the following...

$string =~ s/.*hello/how\//gi;

Thx,

Da

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




RE: Stripping words from a string

2002-02-19 Thread Wagner-David

Put the string in $_ and with 

s(world |how )//gi;

If you don't take out a space then you get a couple of spaces:
Output(no space part of check (world|how):
Hello   are you? 

Output(w/ space part of check above):
Hello are you?

Wags ;)
-Original Message-
From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 21:25
To: [EMAIL PROTECTED]
Subject: Stripping words from a string


Hey all,

Just wondering how I would go about stripping words from a string.

If I have a string that has the following...

$string = Hello world how are you?;

How would I go about stripping the words 'how' and 'Hello' ignoring case
each time?

Would it go something like the following...

$string =~ s/.*hello/how\//gi;

Thx,

Da

-- 
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: HTML::TableExtract

2002-02-19 Thread Kevin Old

Daniel,

Try using a switch statement (even though Perl doesn't officially have a
switch statement).  Here's some code below.let me know if you have
questions.

#!/usr/bin/perl

use HTML::TableExtract;

@headers = (kevin, sorry, larry);

foreach $a (@headers){

SWITCH: {

if($a =~ qw/sorry/) { $sorry = 1; last SWITCH; }
if($a =~ qw/kevin/) { $kevin = 1; last SWITCH; }
if($a =~ qw/larry/) { $larry = 1; last SWITCH;}
$nothing = 1;
}
}

$te = new HTML::TableExtract( headers = [@headers] );
$te-parse($html_string);
# Examine all matching tables
foreach $ts ($te-table_states) {
  print Table (, join(',', $ts-coords), ):\n;
  foreach $row ($ts-rows) {
  $mRow = @$row;
  $mRow =~ s/.*\//g;
  #$mRow =~ s/[^.\d\s]//g;
  @webValues = split/\s+/, $mRow;
  print join(' ', $mRow), \n;
  }
  undef @headers;
}

Hope this helps,
Kevin
- Original Message -
From: Daniel Falkenberg [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 19, 2002 7:07 PM
Subject: HTML::TableExtract


Hi all,

At the moment I am working with HTML::TableExtract.  I must say that I
am having alot of fun with it and most of it is working really well.
What I am looking for is some ideas on how I can go about the
following...

Basically I have my own CGI/Perl page that a user enters some
credentials after these are entered the form data is then sent off to
another WWW site that does 'stuff' with the data.  Of coarse after this
is sent and maniputlated at the other end the required data from the
remote WWW site is returned.  Now at the moment the user can enter data
and depending on the data there is a possbile 4 outcomes that the remote
WWW site will return.

What I would like to use (but am very happy to hear other suggestions)
is an if elsif statement that can get this returned data.  Lets say the
user enters a phone number that checks against 'stuff'.  If the phone
number doesn't exist on the remote WWW site then there is one returned
outcome.  If the phone number does exist and can successfully get a
service with the provider then there is another outcome (2)... and so
on.

Here is the code I have so far...

@headers = qw /sorry/;
$te = new HTML::TableExtract( headers = [@headers] );
$te-parse($html_string);
# Examine all matching tables
foreach $ts ($te-table_states) {
  #print Table (, join(',', $ts-coords), ):\n;
  foreach $row ($ts-rows) {
  $mRow = @$row;
  $mRow =~ s/.*\//g;
  #$mRow =~ s/[^.\d\s]//g;
  @webValues = split/\s+/, $mRow;
  print join(' ', $mRow), \n;
  }
  undef @headers;
}

Now the code works OK only if the out come in the headers is sorry :).
Does any one know how I would go about checking to see if the headers
returned on a successfull page were not sorry but other words.

Kind Regards,

Dan

--
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: How this works?

2002-02-19 Thread Kevin Old

Tushar,

Truthfully, all it really does is print

New
10
10
10

Below, I'll explain it line by line and show you how it really doesn't do
that much.

This is a hash where the key is one and the value is 15...and so on,
respectively.
 %h = ( one = 15,
 two = 26,
 three = 37 );

All this does is delcare an empty array (a).
 my @a;

This loops through each item in the array a and adds 10 to the value that
is there (which is nothing).
It looks like they are attempting to compare the items in the array to the
items in the hash.
 foreach (@a {keys %h})
 {
 $_ = $_ + 10;
 }


This prints the word New and a new line character.
 print New\n;


This loop prints each item in the array (a).
 foreach (@a{keys %h})
 {
 print $_\n;
 }

Hope this helps,
Kevin


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




RE: Stripping words from a string

2002-02-19 Thread Wagner-David

Though s(world .. worked w/o /, it should be written s/(world | how )//gi;
Perl gurus, why does s(world |how )//gi w/o errors?

Wags ;)

-Original Message-
From: Wagner-David 
Sent: Tuesday, February 19, 2002 21:48
To: 'Daniel Falkenberg'; [EMAIL PROTECTED]
Subject: RE: Stripping words from a string


Put the string in $_ and with 

s(world |how )//gi;

If you don't take out a space then you get a couple of spaces:
Output(no space part of check (world|how):
Hello   are you? 

Output(w/ space part of check above):
Hello are you?

Wags ;)
-Original Message-
From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 21:25
To: [EMAIL PROTECTED]
Subject: Stripping words from a string


Hey all,

Just wondering how I would go about stripping words from a string.

If I have a string that has the following...

$string = Hello world how are you?;

How would I go about stripping the words 'how' and 'Hello' ignoring case
each time?

Would it go something like the following...

$string =~ s/.*hello/how\//gi;

Thx,

Da

-- 
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: Stripping words from a string

2002-02-19 Thread Tanton Gibbs

s(world | how)//gi works for the same reason
s{world | how}{}gi works
The first and second set of regex delimiters do not have to be the same, so
in the first instance, the first set of delimiters is () and the second set
is //.
- Original Message -
From: Wagner-David [EMAIL PROTECTED]
To: Wagner-David [EMAIL PROTECTED]; 'Daniel Falkenberg'
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, February 20, 2002 1:22 AM
Subject: RE: Stripping words from a string


 Though s(world .. worked w/o /, it should be written s/(world | how )//gi;
 Perl gurus, why does s(world |how )//gi w/o errors?

 Wags ;)

 -Original Message-
 From: Wagner-David
 Sent: Tuesday, February 19, 2002 21:48
 To: 'Daniel Falkenberg'; [EMAIL PROTECTED]
 Subject: RE: Stripping words from a string


 Put the string in $_ and with

 s(world |how )//gi;

 If you don't take out a space then you get a couple of spaces:
 Output(no space part of check (world|how):
 Hello   are you?

 Output(w/ space part of check above):
 Hello are you?

 Wags ;)
 -Original Message-
 From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 19, 2002 21:25
 To: [EMAIL PROTECTED]
 Subject: Stripping words from a string


 Hey all,

 Just wondering how I would go about stripping words from a string.

 If I have a string that has the following...

 $string = Hello world how are you?;

 How would I go about stripping the words 'how' and 'Hello' ignoring case
 each time?

 Would it go something like the following...

 $string =~ s/.*hello/how\//gi;

 Thx,

 Da

 --
 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: How this works?

2002-02-19 Thread Sudarsan Raghavan

Tushar Kulkarni wrote:

 Hi,
 I have this code, but I am not getting how this works. Can someone
 help?

 %h = ( one = 15,
 two = 26,
 three = 37 );

 my @a;

Not sure what purpose this declaration serves. The 'a' referred to from here on in 
the code is the hash 'a'
and not the array 'a'.



 foreach (@a {keys %h})

A hash slice is what is being used here. The above line can also be written as
foreach ($a{one}, $a{two}, $a{three}), the keys function applied on %h returns 
('one', 'two', 'three').



 {
 $_ = $_ + 10;

The foreach loop index variable is an alias for each item in the list you are 
looping over.
 Changing $_ here changes the value it refers to.
 perldoc perlsyn (Read through the foreach section)


 }





 print New\n;

 foreach (@a{keys %h})
 {
 print $_\n;
 }

 This prints

 New
 10
 10
 10

 Can someone explain what is happening here?

 Thanks
 Tushar

 --
 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: HTML::TableExtract

2002-02-19 Thread Jeff 'japhy' Pinyan

On Feb 20, Kevin Old said:

if($a =~ qw/sorry/) { $sorry = 1; last SWITCH; }
if($a =~ qw/kevin/) { $kevin = 1; last SWITCH; }
if($a =~ qw/larry/) { $larry = 1; last SWITCH;}

Uh, qw// is not the right thing to use there.  Perhaps q// or qq// or
qr//.  Or, better yet, m//.  Or just //, since the 'm' is optional.

-- 
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: How this works?

2002-02-19 Thread Jeff 'japhy' Pinyan

On Feb 20, Tushar Kulkarni said:

%h = ( one = 15,
two = 26,
three = 37 );

my @a;

foreach (@a {keys %h}) { $_ = $_ + 10; }

Uh, why did you declare @a and then use %a here?  @a{...} is a HASH slice
of %a.  @a[...] is an ARRAY slice of @a.  Two different things.

What your code does is make a hash, %a, with the same keys as %h, and sets
the values for those keys to 10.

-- 
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: How this works?

2002-02-19 Thread Tushar Kulkarni

OK, Thanks. Now I have understood.

Actually I saw this code at one place and it was used to trim starting and beginning 
spaces of values of hash(it
had s/\s+$// and s/^\s+// in loop instead of $_ += 10). I tried same thing with 
numbers and got more confused(also
in foreach '@h' is important. I replaced it with '@a' and then I was not getting 
results like original code which
added confusion). Actually I never gave a thought to slice of a hash.

Thanks again,
Tushar

Sudarsan Raghavan wrote:

 Tushar Kulkarni wrote:

  Hi,
  I have this code, but I am not getting how this works. Can someone
  help?
 
  %h = ( one = 15,
  two = 26,
  three = 37 );
 
  my @a;

 Not sure what purpose this declaration serves. The 'a' referred to from here on 
in the code is the hash 'a'
 and not the array 'a'.

 
 
  foreach (@a {keys %h})

 A hash slice is what is being used here. The above line can also be written as
 foreach ($a{one}, $a{two}, $a{three}), the keys function applied on %h returns 
('one', 'two', 'three').

 
  {
  $_ = $_ + 10;

 The foreach loop index variable is an alias for each item in the list you are 
looping over.
  Changing $_ here changes the value it refers to.
  perldoc perlsyn (Read through the foreach section)

 
  }
 

 
  print New\n;
 
  foreach (@a{keys %h})
  {
  print $_\n;
  }
 
  This prints
 
  New
  10
  10
  10
 
  Can someone explain what is happening here?
 
  Thanks
  Tushar
 
  --
  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: HTML::TableExtract

2002-02-19 Thread John W. Krahn

Jeff 'Japhy' Pinyan wrote:
 
 On Feb 20, Kevin Old said:
 
 if($a =~ qw/sorry/) { $sorry = 1; last SWITCH; }
 if($a =~ qw/kevin/) { $kevin = 1; last SWITCH; }
 if($a =~ qw/larry/) { $larry = 1; last SWITCH;}
 
 Uh, qw// is not the right thing to use there.  Perhaps q// or qq// or
 qr//.  Or, better yet, m//.  Or just //, since the 'm' is optional.

Also, since a regex returns true or false in a scalar context you can
simplify this to:

   last SWITCH if $sorry = $a =~ /sorry/;
   last SWITCH if $kevin = $a =~ /kevin/;
   last SWITCH if $larry = $a =~ /larry/;

:-)

John
-- 
use Perl;
program
fulfillment

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




problem with getting the noncrypted password from crypted

2002-02-19 Thread peter grotz

hi list,

I´m using the following scripts to manage my passwords.
I can crypt my new passwords to change the old one, but how can I get
the clear pass from my crypted again??
Thanks for your hints!!

Peter


# test if passwords are equal

$salt = substr($existuspassword, 0, 2);
$incrypt = crypt($uspassword, $salt);
if ( $existuspassword eq $incrypt ) {
..
..
..
}

# set new password

$incrypt = crypt($newuspassword,chr((46..57,65..90,97..122)[rand 
64]).chr((46..57,65..90,97..122)[rand 64]));
$db{uspassword} = $incrypt;




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


  1   2   >