a few more questions while I am at it....

2003-08-21 Thread Catriona Wordsworth
I am interested in programming my script to pick up the email addresses operated by 
the main email client as a particular page is opened and then pass that on to me via 
email.

presumably I could then do the same with picking up the IP and browser details as 
well...

can someone point me in the right direction for a start on thisI know I am not 
reinventing the wheel here, but just don't quite know which are to look to first with 
this.

any help would be appreciated...

Cat the novice, but learning fast.


Re: cgi error

2003-08-21 Thread Erich Musick
Another thing you'll want to check is your path to perl (the first line).
For example, when I run a script on windows, I must change the path to
e:/perl/bin/perl.exe - because that's my path to my perl executable.

-- 
Erich Musick
http://erichmusick.com


Rob Hanson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 The message you see in the browser usually means very little, and doesn't
 help much.  Check your web server's error logs to see the real error.

 If you are getting that error you can be pretty sure that your web server
is
 at least trying to execute the script.  So after checking your logs, I
would
 check the following in this order:

 1. Is the script executable (chmod +x)
 2. Can your web server user execute perl.
 3. Can your web server user read and exec your script.

 If you have root access you can try su'ing to that user and attempt to run
 the script.  That would eliminate all of the above.

 Rob

 -Original Message-
 From: David Glucksman [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 15, 2003 1:26 PM
 To: [EMAIL PROTECTED]
 Subject: cgi error


 Hello everyone,

 I am new to Perl and CGI so I need some help. I have a
 simple cgi script:

 #!/usr/bin/perl

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

 print This is my first CGI application;


 I save the script using the .cgi nameing convention. I
 can run the script from unix with no errors but when I
 try to run it in a browser I get:

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

 I must be missing something obvious.
 Any suggestions?
 Thanks
 David



 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.com

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



elsif issues ....still

2003-08-21 Thread Catriona Wordsworth
Hi Guys,

trying to get the following code to print each line where relevantbut it only 
prints the first statement yes its one!  even if the $variable is 5

$variable = $var

if ($variable == 1){

print MAIL yes its one!\n;

} elsif ($variable == 2){

print MAIL it is two!\n;

} elsif ($variable == 3){

print MAIL the number three.\n;

} elsif ($variable == 4){

print MAIL 4 is on the cards.\n;

} elsif ($variable == 5){

print MAIL number 5 is alive.\n;

} elsif ($variable == 6){

print MAIL pick up sticks.\n;

} elsif ($variable == 7){

print MAIL go to heaven.\n;

} else {

print this is not working\n;

}





any ideas where I might be going wrong?  I copied this direct out of my perl 
booktheoretically it should work right??

regards

Cat

Counter triggered on download

2003-08-21 Thread Merrill Oakes
I have a link to a PDF file on a web page.  I want to count how many 
times that someone clicks on the link (i.e. downloads the PDF).  The 
easy way (at least for me) would be to make them go to a download page 
first, and I could put a counter in the page, BUT this requires an extra 
step for the user.

SO, is there any way to:#1. monitor how many a times a file has been 
downloaded, or maybe #2. have them click on a link (that is really a cgi 
script, that then increments the counter then starts the download/open 
of the PDF?  Of course this last method will disable the ability to do a 
shift-click to download the doc.

Thoughts, or pointers would be appreciated,

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


Replacing carriage return with character string '\n' coming from a textarea param

2003-08-21 Thread Li, Kit-Wing
Hi,

Can someone help me with the following?  I have a simple cgi script that is
trying to take the paragraph from a TEXTAREA field and insert the text into
a MySql table.

This works:
insert into description_tbl(1,'This is a sample paragraph.\nThis is just a
test.\n');

However, by passing $query-param('description') into the sql through DBI
converts the insert statement to:
insert into description_tbl(1,'This is a sample paragraph.
This is just a test.
');
The DBI call fails.

I tried using the following to change the carriage return to two characters
'\n' in the string.  But that doesn't work either.

my $query = new CGI;

$query-param('description') =~ tr/\n/'\n'/;
print OUT $query-param('description'),\n; - prints nothing

Thoughts anyone?

Thanks in advance!
- Kit


--
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: Running process in background?

2003-08-21 Thread Nicholson, Dale
For the original poster, this might help in the future:

The columns in a cron entry are as follows:  minute, hour, day of month,
month, day of week.  The day of week starts at 0 for Sunday through 6 for
Saturday.  Examples follow.

If you wanted to have a process run every 10 minutes on Monday through
Friday, your entry might look like this:
00,10,20,30,40,50 * * * 1-5

Every 10 minutes but only between the hours of 8am and 2pm:
00,10,20,30,40,50 08-14 * * 1-5

Once every hour on the 15th of each month but only when it's on a Saturday:
00 * 15 * 6

Run once at 10 am on December 25th every year:
00 10 25 12 *



-Original Message-
From: Yupapa.com [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 20, 2003 5:25 PM
To: [EMAIL PROTECTED]
Subject: Re: Running process in background?


Hi~

0 * * * * /usr/bin/perl /full/path/to/your/script

That will run the script every hour at 0


ByeBye~
Yupapa
###
# Yupapa Web Hosting =^.^=
# Web Site - http://www.yupapa.com
# Email - [EMAIL PROTECTED]
###
Kevin Pfeiffer [EMAIL PROTECTED]
???:[EMAIL PROTECTED]
 In article [EMAIL PROTECTED], Octavian
Rasnita
 wrote:

  Can you tell me how to define a cron job that is executed each hour?
  Thank you.

 10 0-23 * * * echo run 10 minutes after the hour, every hour, everyday


 man 5 crontab





 --
 Kevin Pfeiffer
 International University Bremen



-- 
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: Replacing carriage return with character string '\n' coming from a textarea param

2003-08-21 Thread zsdc
Li, Kit-Wing wrote:

Can someone help me with the following?  I have a simple cgi script that is
trying to take the paragraph from a TEXTAREA field and insert the text into
a MySql table.
Use placeholders. See: 
http://search.cpan.org/author/TIMB/DBI-1.37/DBI.pm#Placeholders_and_Bind_Values

You can also quote it yourself:
http://search.cpan.org/author/TIMB/DBI-1.37/DBI.pm#quote
but placeholders are better.
-zsdc.

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


Re: elsif issues ....still

2003-08-21 Thread zsdc
Catriona Wordsworth wrote:

trying to get the following code to print each line where relevant
 but it only prints the first statement yes its one!  even if the
 $variable is 5
Are you sure that your $variable is really what you think it is? Maybe 
some other part of your code is changing it? Insert:

  print variable is $variable\n;

just before the if. Do you have:

  use strict;
  use warnings;
in the beginning of your program?

-zsdc.

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


Re: Counter triggered on download

2003-08-21 Thread Camilo Gonzalez
I would solve this by using the link to invoke a Perl script that would 
trip a counter and serve up the PDF document, shift-click be damned. Who 
uses shift-click anyway?

Merrill Oakes wrote:

I have a link to a PDF file on a web page.  I want to count how many 
times that someone clicks on the link (i.e. downloads the PDF).  The 
easy way (at least for me) would be to make them go to a download 
page first, and I could put a counter in the page, BUT this requires 
an extra step for the user.

SO, is there any way to:#1. monitor how many a times a file has been 
downloaded, or maybe #2. have them click on a link (that is really a 
cgi script, that then increments the counter then starts the 
download/open of the PDF?  Of course this last method will disable the 
ability to do a shift-click to download the doc.

Thoughts, or pointers would be appreciated,

Thanks,
MO.
[EMAIL PROTECTED]



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


Re: Counter triggered on download

2003-08-21 Thread Merrill Oakes
Camilo:

THANKS!  I agree.  I also did a little more due diligence searching and 
found some scripts (guess I should have done that before I posted).

Thanks everyone, great group/list.

MO.

Camilo Gonzalez wrote:
I would solve this by using the link to invoke a Perl script that would 
trip a counter and serve up the PDF document, shift-click be damned. Who 
uses shift-click anyway?

Merrill Oakes wrote:

I have a link to a PDF file on a web page.  I want to count how many 
times that someone clicks on the link (i.e. downloads the PDF).  The 
easy way (at least for me) would be to make them go to a download 
page first, and I could put a counter in the page, BUT this requires 
an extra step for the user.

SO, is there any way to:#1. monitor how many a times a file has been 
downloaded, or maybe #2. have them click on a link (that is really a 
cgi script, that then increments the counter then starts the 
download/open of the PDF?  Of course this last method will disable the 
ability to do a shift-click to download the doc.

Thoughts, or pointers would be appreciated,

Thanks,
MO.
[EMAIL PROTECTED]





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


Monitor Bandwidth.

2003-08-21 Thread Mike Blezien
Hello,

Does anyone know of a Perl module or other means with Perl to monitor and/or 
measure bandwidth usage ??

TIA

--
MikemickaloBlezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Web Hosting
http://www.justlightening.net
Tel:  1(985)902-8484
MSN: [EMAIL PROTECTED]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: perl script as binary

2003-08-21 Thread David T-G
Sven --

...and then Sven Bentlage said...
% 
% Thanks for the tips to everyone.
%  Can you turn the app into a web app?
% Unluckily that would be even more difficult, I think.

Hmmm...


% I`m trying to write a small script / program to shutdown a linux box 
% remotely.

That sounds easy.  Why not a secure  password-locked web page that takes
a challenge-response password and then uses sudo to execute a reboot?
You can do any number of things to ensure a one-time use of a page and
even a password so that nobody can resubmit the page or even the captured
stream and bounce your box when you weren't expecting it.

Frankly I'd rather something like this than a remote script that can
connect to bounce the box; the latter seems entirely too hackable and now
you've just given away root access entirely.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Formatting integer input

2003-08-21 Thread Sara
$one = 2.5;
$two = 2;
$three = $one + $two;

print $three; # prints 4.5

I want 4.5 in proper format as 04.05

Any ideas?

Thanks,
Sara.

Re: elsif issues ....still

2003-08-21 Thread zsdc
Lile, James AZ2 (VAW-115) wrote:

Someone correct me if I am wrong, the numbers in quotes are being read as
strings and not numbers, or numbers not strings.
The == works with numbers, and the quotes are for strings. I think that the
way you have it set up, the number one is returning true when the $variable
is defined.
Numbers in quotes are strings but in the numerical context (which is 
provided by the numerical equality operator == here) they are 
converted to numbers on the fly (non-number strings being 0), so that's 
not the issue here. Besides, if you run this sample code, you'll see 
that it works just fine.

-zsdc.

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


Secure Form Submission

2003-08-21 Thread Greenhalgh David
Hi All,

I need to implement a form that is submitted securely. My client does 
not have access to SSL on his host. I was thinking in terms of a 
session cookie with a client side RC4 encrypt and a decrypt in the Perl 
script. Do peoople here consider that to be a secure scenario, or is 
there another method that you could recommend? The encryption needs to 
be reversible.

Thanks

dave

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


AW: File::Copy CGI.pm

2003-08-21 Thread B. Fongo
Hey!

If you want to transfer file through the browser, then you don't need an
FTP server.  
On submitting the upload form, the browser transmits the file to the web
server, and it is store in a temporary folder where you can ask for. You
need too  extra the value of the file field with param('field name') and
use it to ask the web server for the file. 

The whole thing may look like this:

# Get the directory and file name using param().
$location_and_file_name = $xyz-param('field name');

# Use regex to convert all Windows slashes \ (e.g. c:\blah\blah.txt)
to Linux / and # basename() will work ok.

$tmp = $location_and_file_name;
$tmp =~s/\\/\//g;
$file_name = basename($tmp);

open(DESTINATION, destination/$file_name) || die Failed to open
file!
while ($location_and_file_name ){
chomp;
print  DESTINATION $_;
}
close (DESTINATION);



This work well. I used it on my recent project.

Good luck






-Ursprüngliche Nachricht-
Von: Yupapa.com [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 21. August 2003 00:10
An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Betreff: Re: File::Copy  CGI.pm

HiHi~

If you are transfering file from a local machine to a remote machine,
you do
not use File::Copy module to copy files.  File::Copy is used for copying
files locally.  You can use Net::FTP to transfer files from one machine
to
another.  And of course, you will need a FTP server for the machine
receiving the file.


Bye~
Yupapa
###
# Yupapa Web Hosting =^.^=
# Web Site - http://www.yupapa.com
# Email - [EMAIL PROTECTED]
###
B. Fongo [EMAIL PROTECTED]
???:[EMAIL PROTECTED]
 Hi,

 I've a small script intended for file transfer from a windows machine
to
 a remote linux server.  To implement that, I decided to use two module
 i.e File::Basename, File::Copy and CGI.pm.

 The File::Copy is working well locally, but it fails to copy files to
a
 remote machine through the Browser. I use CGI.pm to generate a form
 where users could browser and select a file to be transferred.  The
 error message is always: No such file or directory though the file
or
 directory  exist and permission is set 777.

 What may be the case? Any suggestion on how to transfer file to remote
 location?
 I'm not sure whether it will be applicable to use file handles and use
a
 loop to read the files from the source location and write them to a
 destination folder.

 Thanks for any help



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

 use strict;
 use CGI qw/ :standard/;
 my $cgi = new CGI;

 use File::Basename;

 if( param()){
 upload_file(param(upload_file));
 } else {
 print_form();
 }


  Subroutine to transfer file ###

 sub upload_file{

 my ($file, $file_destination, $file_name, $forwarded_value);
$original_src = $forwarded_value = $_[0];
 $file_destination = q(/data/Software_Pakete);
 $forwarded_value =~ s/\\/\//g;
 $file_name = basename($forwarded_value);
 if (copy($original_src,$file_destination/$file_name)){
 print_success()
 }
 else{
 print_error($forwarded_value,$file_destination/$file _name)
 }










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



RE: create log as well as print on screen

2003-08-21 Thread Marcos . Rebelo
old_script.pl | perl -e while () {print $_; warn $_} 2 $logFile

Or redefine the print

-Original Message-
From: mark sony [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 20, 2003 3:11 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: create log as well as print on screen


Hi All,

I wrote a script which is running perfectly fine providing 
many outputs on the screen . Only glitch is that it does not print 
in a log file . Now what I want is that it would print on the 
screen as well as create a log file . At the end of the program  I 
will output that the above output can also be seen at the 
$log_File_position . Hope I am clear with my question . Any type 
of pointers and I would be over the moon ;)

Thanx in advance

Mark
___
Meet your old school or college friends from
1 Million + database...
Click here to reunite www.batchmates.com/rediff.asp



-- 
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: File::Copy CGI.pm

2003-08-21 Thread Jenda Krynicky
From: Yupapa.com [EMAIL PROTECTED]
 If you are transfering file from a local machine to a remote machine,
 you do not use File::Copy module to copy files.  File::Copy is used
 for copying files locally.  You can use Net::FTP to transfer files
 from one machine to another.  And of course, you will need a FTP
 server for the machine receiving the file.

This aint entirely true. You can use File::Copy to copy files to 
remote shares (Windows Networking), remote drives mounted via NFS , 
... basicaly anything that the OS allows you to treat like a local 
disk.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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



telnet problems

2003-08-21 Thread Miguel Angel Morales
Hi all!

I'm programming a tunnelbroker with perl. We are already able to create tunnels by 
means of a telnet session using a telnet library of perl, 
but, when I try to delete the tunnel (delete -r tunnel tb-008, for example)  logouts 
the telnet session and the tunnel wasn't removed. 

The following is my code:

 $t-open('10.0.0.4');
  $t-login('XX', 'XX');

  $t-print('admin');
  $t-waitfor('/Password/');

  $t-print('XX');

  $t-waitfor('/CONSULINTEL/');  
  $t-cmd('config');

  $t-cmd('delete -r tunnel tb-004');

  $t-waitfor('/Are you sure? (y/n):.*$/');
  $t-print('y');

  $t-waitfor('/CONSULINTEL/');
  $t-cmd('save');

After the 'delete' command, the router asks about if you are sure, but I'm not able to 
answer this question. I try to waitfor the question and then $t-print('y'); but it 
doesn't work. Could anybody help me? I'm desperate.

Thanks is advance,

Miguel Angel



*
Madrid 2003 Global IPv6 Summit
Presentations and videos on-line at:
http://www.ipv6-es.com


RE: create log as well as print on screen

2003-08-21 Thread Darbesio Eugenio

Mark wrote:

-Original Message-
From: mark sony [mailto:[EMAIL PROTECTED]
Sent: mercoledì 20 agosto 2003 15.11
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: create log as well as print on screen


Hi All,

I wrote a script which is running perfectly fine providing 
many outputs on the screen . Only glitch is that it does not print 
in a log file . Now what I want is that it would print on the 
screen as well as create a log file . At the end of the program  I 
will output that the above output can also be seen at the 
$log_File_position . Hope I am clear with my question . Any type 
of pointers and I would be over the moon ;)

Thanx in advance

Mark


I simply solve your problem in this manner (defining a sub log()...):

 . . .
 . . .
open (LOG, my_log_file); 
 . . .
log(some text\n, 1, 1);  # log on screen AND log on file 
 . . .
log(some text\n, 1, 0);  # log on screen only
 . . .
log(some text\n, 0, 1);  # log on file only  
 . . .
close(LOG);
 . . .
 . . .
sub log() {
my ($stg, $a, $b) = @_;
print $stg if $a;
print LOG $stg if $b;   
}

E.

LOQUENDO S.p.A. 
 Vocal Technology and Services 
 www.loquendo.it 
 [EMAIL PROTECTED] 




CONFIDENTIALITY NOTICE
This message and its attachments are addressed solely to the persons
above and may contain confidential information. If you have received
the message in error, be informed that any use of the content hereof
is prohibited. Please return it immediately to the sender and delete
the message. Should you have any questions, please contact us by
replying to [EMAIL PROTECTED] Thank you


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



Please take me off list

2003-08-21 Thread [EMAIL PROTECTED]





Please take me off your mailing list. I am receiving hundreds of emails daily. Thank you. Gerda







 IncrediMail - Email has finally evolved - Click Here

Reading columns, Missing data and more

2003-08-21 Thread Antonio Jose
Hello

I am just learning a bit of Perl but I have some questions;

I have to read a file (numbers of rows variable), to obviate the first
lines until I find only columns with numbers, after, I have to create
vectors with each of this columns (indenpendent columns) but obviating
missing data (represented by the specific number -999.999). After I need
to process this vectors using iteractive method, subroutines, etc. I am
just working but after I define a new vector containing non missing
values I don't know how to read them, the languaje give an error like:
Use of uninitialized value in array element at columnas.pl line xx,
filename line YYY

The program is too long to send you but if you want I could

Thanks and excuse my english

Antonio




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



RE: Reading columns, Missing data and more

2003-08-21 Thread Paul Kraus
Can you send some sample data

-Original Message-
From: Antonio Jose [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 8:58 AM
To: [EMAIL PROTECTED]
Subject: Reading columns, Missing data and more


Hello

I am just learning a bit of Perl but I have some questions;

I have to read a file (numbers of rows variable), to obviate the first
lines until I find only columns with numbers, after, I have to create
vectors with each of this columns (indenpendent columns) but obviating
missing data (represented by the specific number -999.999). After I need
to process this vectors using iteractive method, subroutines, etc. I am
just working but after I define a new vector containing non missing
values I don't know how to read them, the languaje give an error like:
Use of uninitialized value in array element at columnas.pl line xx,
filename line YYY

The program is too long to send you but if you want I could

Thanks and excuse my english

Antonio




-- 
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: telnet problems

2003-08-21 Thread James Edward Gray II
On Thursday, August 21, 2003, at 06:15  AM, Miguel Angel Morales wrote:

Hi all!

I'm programming a tunnelbroker with perl. We are already able to 
create tunnels by means of a telnet session using a telnet library of 
perl,
but, when I try to delete the tunnel (delete -r tunnel tb-008, for 
example)  logouts the telnet session and the tunnel wasn't removed.

The following is my code:

 $t-open('10.0.0.4');
  $t-login('XX', 'XX');
  $t-print('admin');
  $t-waitfor('/Password/');
  $t-print('XX');

  $t-waitfor('/CONSULINTEL/');
  $t-cmd('config');
  $t-cmd('delete -r tunnel tb-004');

  $t-waitfor('/Are you sure? (y/n):.*$/');
  $t-print('y');
  $t-waitfor('/CONSULINTEL/');
  $t-cmd('save');
After the 'delete' command, the router asks about if you are sure, but 
I'm not able to answer this question. I try to waitfor the question 
and then $t-print('y'); but it doesn't work. Could anybody help me? 
I'm desperate.
It would be very hard to troubleshoot something like this remotely, for 
me at least.  My two thoughts are that the waitfor() call has the wrong 
information, and thus isn't working out or you are forgetting to 
include line endings and the router isn't liking that.  Remember that a 
telnet line ending is \015\012.  That's about all I can think of, from 
the information provided.  Sorry if that isn't much help.

James

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


Re: Please take me off list

2003-08-21 Thread Jenda Krynicky
Date sent:  Thu, 21 Aug 2003 08:54:27 -0400 (Eastern Daylight Time)
From:   [EMAIL PROTECTED] [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject:Please take me off list

 Please take me off your mailing list. I am receiving hundreds of
 emails daily. Thank you.Gerda

Now sending an unsubscribe request to all members of the list is 
really clever.

You are supposed to send it to [EMAIL PROTECTED]
(As you could see if you looked at the headers of any of those 
hundreds of emails.)

And if that does not work you are supposed to contact beginners-
[EMAIL PROTECTED]

BTW, if you went to http://www.perl.org/ and clicked the See our 
Resources for Perl Beginners link, you'd get a nice 
subscription/unsubscription form.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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



LWP error string

2003-08-21 Thread Dan Muey
Howdy All,

Sorry for leaving the suubject out previously!

With LWP or LWP::UserAgent I can check if the request 
was ok and then print the content if it was like so:

if ($res-is_success) {
  print $res-content;
}

But I havn't found a way to see what the error is if it fails. So I have to just :  
else { print IT failed, do it right nect time loser; }

What I'd like to be able to do is sometyhign like:

else { print $res-errstr; }

Does such a beast exist in LWP and I just missed it or ???


TIA

Dan

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



RE: Here you have a sample

2003-08-21 Thread Paul Kraus
Without more specifics I can show you how to get the data. This is
assuming a lot because I am confused about what you want to do. 
Here is what I gathered.
Read file if line is not all numeric, '-', and spaces then skip.

I am not sure what you want to do with columns that contain 999.999 so I
am going to leave them in the array. That way your subroutines can
account for the 999.999 and do what ever you need to the missing data.

open (IN, filename ) or die (Could not open file $!\n);
While (IN){
next unless /^\d+/;  # if line does not start with numeric skip
my @array = split /\s+/;
}

This is untested. But each column should now be in the @array. Column 1
being $array[0].

Hope that helps.
Paul
-Original Message-
From: Antonio Jose [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 9:51 AM
To: [EMAIL PROTECTED]
Subject: Here you have a sample


Here you have a sample of my data:

Column 1 correspond a depth and the rest correspond to diferent
variables

1500.12.6740-999.25000.2204
-999.2500   -999.2500   1.4471
1500.5000  9.1897   -999.25000.2200
-999.2500   -999.2500   1.4526
1501.  6.5566   -999.25000.2161
0.9229   -999.2500   1.4835
1501.50004.7251 -999.2500   -999.2500  0.6541
-999.2500   1.7951
1502.  3.5049   -999.2500   -999.2500
0.7702   -999.2500   2.2192
1502.50003.0459  0.9990  0.00101.
0.0001   0.0309
1503.  2.93460.9990  0.0010
1.0.   0.0118
1503.5000  2.95980.9990  0.00101.
0.   0.0056
1504.  3.00540.9990  0.0010
1.0.   0.0057
1504.5000  3.06420.9990  0.0010
1.0.   0.0090
1505.  3.32590.9990  0.0010
1.0.0001   0.0236
1505.5000  4.20540.9766  0.0234
1.0.0074   0.0719
1506.  5.46580.8294  0.1428
1.0.2796   0.2179
1506.5000  6.45380.6971  0.1754
0.99811.9523   0.5869

We don't have the same lenght by variable, example: we can have 3456
values to variable 1 and 3460 to the second and so for.

Thanks

==Original message text===
On Thu, 21 Aug 2003 09:10:01 -0400 Paul Kraus wrote:

Can you send some sample data

-Original Message-
From: Antonio Jose [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 8:58 AM
To: [EMAIL PROTECTED]
Subject: Reading columns, Missing data and more


Hello

I am just learning a bit of Perl but I have some questions;

I have to read a file (numbers of rows variable), to obviate the first
lines until I find only columns with numbers, after, I have to create
vectors with each of this columns (indenpendent columns) but obviating
missing data (represented by the specific number -999.999). After I need
to process this vectors using iteractive method, subroutines, etc. I am
just working but after I define a new vector containing non missing
values I don't know how to read them, the languaje give an error like:
Use of uninitialized value in array element at columnas.pl line xx,
filename line YYY

The program is too long to send you but if you want I could

Thanks and excuse my english

Antonio




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] ===End
of original message text===




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



Re: LWP error string

2003-08-21 Thread Peter Scott
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Dan Muey) writes:
With LWP or LWP::UserAgent I can check if the request=20
was ok and then print the content if it was like so:

if ($res-is_success) {
  print $res-content;
}

But I havn't found a way to see what the error is if it fails. So I have =
to just :  else { print IT failed, do it right nect time loser; }

What I'd like to be able to do is sometyhign like:

else { print $res-errstr; }

Does such a beast exist in LWP and I just missed it or ???

Yes, you just missed it.  Look in the documentation for HTTP::Response
for these methods:

message
code
status_line

-- 
Peter Scott
http://www.perldebugged.com

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



RE: LWP error string

2003-08-21 Thread Kipp, James
 Sorry for leaving the suubject out previously!
 
 With LWP or LWP::UserAgent I can check if the request 
 was ok and then print the content if it was like so:
 
 if ($res-is_success) {
   print $res-content;
 }
 
 But I havn't found a way to see what the error is if it 
 fails. So I have to just :  else { print IT failed, do it 
 right nect time loser; }
 
 What I'd like to be able to do is sometyhign like:
 
 else { print $res-errstr; }

Dan
Have you seen the Oreilly Open books site. It has the web client
programming book online. 
http://www.oreilly.com/openbook/webclient/

here is a snip of code from it that may help:
--
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
 
my $ua = new LWP::UserAgent;
 
my $request = new HTTP::Request('GET', $ARGV[0]);
my $response = $ua-request($request);
if ($response-is_success) {
 print $response-content;
} else {
 print $response-error_as_HTML; 
}

 


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



unlink output of printf

2003-08-21 Thread Ronen Kfir
I need to delete oldest modified file in a directory. I find this file with this:

my $oldest= printf %s\n, (sort{ (-M $b) = (-M$a) } glob(v:\*));
print $oldest;

unlink $oldest;


What I get in response is:

oldest_filename  
1

File is not deleted.

How would I do it?


?Ronen Kfir
System Administrator
?CIT div.
Tel Aviv University
Tel: 972-3-6407416
Fax: 972-3-6405158
cellular: 972-55-405910
E-mail: [EMAIL PROTECTED]



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



RE: LWP error string

2003-08-21 Thread Dan Muey
  What I'd like to be able to do is sometyhign like:
  
  else { print $res-errstr; }
 
 Dan
 Have you seen the Oreilly Open books site. It has the web 
 client programming book online. 
 http://www.oreilly.com/openbook/webclient/
 
 here is a snip of code from it that may help:
 --
 use LWP::UserAgent;
 use HTTP::Request;
 use HTTP::Response;
  
 my $ua = new LWP::UserAgent;
  
 my $request = new HTTP::Request('GET', $ARGV[0]);
 my $response = $ua-request($request);
 if ($response-is_success) {
  print $response-content;
 } else {
  print $response-error_as_HTML; 
 }

Thanks James! I'll look a bit there also.


Dan

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



RE: LWP error string

2003-08-21 Thread Dan Muey

 Does such a beast exist in LWP and I just missed it or ???
 
 Yes, you just missed it.  Look in the documentation for 
 HTTP::Response for these methods:
 
   message
   code
   status_line

Thankd Peter I'll take a look there!

 
 -- 
 Peter Scott
 http://www.perldebugged.com
 
 -- 
 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]



Tk mailing list

2003-08-21 Thread sc00170
I want to deal with the Tk.

Is there any relevant mailing list to gain information?



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



RE: Tk mailing list

2003-08-21 Thread NYIMI Jose (BMB)
http://lists.perl.org/showlist.cgi?name=ptk

José.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 4:32 PM
To: [EMAIL PROTECTED]
Subject: Tk mailing list


I want to deal with the Tk.

Is there any relevant mailing list to gain information?



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



 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


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



Hi

2003-08-21 Thread SiyandaK
am having a problem with my perl scripts in that the news items are not
being displayed when i execute the wed pages on which perl is expected to
display the news titles.
i have checked the path were perl is being executed from (checked both in
the Apache httpd.conf file and in the scripts) as shown below.
am using windows advanced server
active perl 5.6
apache1.3


#!d:/intranet/usr/local/perl/bin/perl 
# Define Variables 
require config.cgi; 
require np-lib.cgi; 
## 
# # 
# DO NOT EDIT BELOW THIS LINE # 
# # 
## 



RE: Hi

2003-08-21 Thread Dan Muey
 am having a problem with my perl scripts in that the news 
 items are not being displayed when i execute the wed pages on 

Where do these news items come from?

 which perl is expected to display the news titles. i have 

How does perl get the news titles and how are you having it display them?

 checked the path were perl is being executed from (checked 
 both in the Apache httpd.conf file and in the scripts) as 
 shown below. am using windows advanced server active perl 5.6 
 apache1.3
 
 
 #!d:/intranet/usr/local/perl/bin/perl 
 # Define Variables 
 require config.cgi; 
 require np-lib.cgi; 
 ##
  
 # # 
 # DO NOT EDIT BELOW THIS LINE # 
 # # 
 ## 

This doen't tell us anything really, how is it getting the data and what 
is it you're trying to get it to do with thte data and how are oyu trying to do it?


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



Tell if cookies are enabled

2003-08-21 Thread Dan Muey
Hello List,

I'm trying to figure the best method to see if cookies are enabled before proceeding.

So what I've done is this:

METHOD 1:
see if a certain cookie exists and if not set it
then later on teste for the cookie again 
it will not be set because the headers just set it
so while the browser now has one it is not returned 
to the same script that set it so this way is no go

METHOD 2:
if(param('cookie_should_be_set')) {
test for cookie and if not defined die you need cookies
} else { 
see if a certain cookie exists and if not set it 
and print a Location header to self_url with
cookie_should_be_set=1 appended
}

Method 2 works but I'm looking for the best way to test it with each request, in case 
they turn cookies off and then click a link or something. And doing a Location: 
$self_url everytime isn't desireable and setting one cookie and testing it over and 
over sounds good but sometimes browsers will still return a cookie even thought 
cookies are disabled/blocked/off so that will show it has a cookie but wonb't tell me 
if it can successfully set others.

The best I can come up with so far is METHOD 2 with the cookie life set to a few 
minutes so it only has to do the Location: ... Bit once evr few minutes instead of 
every single request.

Any other ideas/modules I'm missing?

Tia

Dan

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



Split on white space from `command` return?

2003-08-21 Thread Bill Akins
Hi!

I would like to grab the first column (variable width) of data in each
line that will be returned from an external command.
I tried @PSARRAY = `command | grep bf1`; and got just the lines with
data I wanted.  The returned data looks like this:

EHCFS001   Booted Down  bf1/p20   Windows/MUYes,Opt,0 12:55:29
VMDFS  Booted Upbf1/p14   VM25AS21e16/MU Yes,Opt,0
12:52:12
ORA_1  Booted Upbf1/p18   VM25AS21e16/MU Yes,Opt,0
12:56:25
ps3Booted Upbf1/p3custom/MU Yes,Opt,0 12:51:56
ps4Booted Upbf1/p4custom/MU Yes,Opt,0 12:51:42
ps5Booted Upbf1/p5custom/MU Yes,Opt,0 12:51:22

I need to capture just EHCFS001, VMDFS, ORA_1, PS3, PS4 and PS5  in a
var, array, hash, whatever and I don't care about any of the other data.
 A variable would be preferable over array, I think.

I then tried @PSARRAY = `command | grep bf1 | awk -F   '{print $1}'`
but got the same exact results.  Anyone know why it didn't like the awk
command or just decided to ignore it?
If I run command | grep bf1 | awk -F   '{print $1}' on the command
line I get exactly what I need, why doesn't this work during an external
call?

Running on Linux, Perl 5.6.1

Thanks all.



Bill Akins
SSS III
Emory Healthcare
(404) 712-2879 - Office
12674 - PIC
[EMAIL PROTECTED]

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



RE: Split on white space from `command` return?

2003-08-21 Thread Bob Showalter
Bill Akins wrote:
 Hi!
 
 I would like to grab the first column (variable width) of data in each
 line that will be returned from an external command.
 I tried @PSARRAY = `command | grep bf1`; and got just the lines with
 data I wanted.  The returned data looks like this:
 
 EHCFS001   Booted Down  bf1/p20   Windows/MUYes,Opt,0 12:55:29
 VMDFS  Booted Upbf1/p14   VM25AS21e16/MU Yes,Opt,0
 12:52:12 ORA_1  Booted Upbf1/p18   VM25AS21e16/MU
 Yes,Opt,0 12:56:25 ps3Booted Upbf1/p3custom/MU   
 Yes,Opt,0 12:51:56 ps4Booted Upbf1/p4custom/MU   
 Yes,Opt,0 12:51:42 ps5Booted Upbf1/p5custom/MU   
 Yes,Opt,0 12:51:22 
 
 I need to capture just EHCFS001, VMDFS, ORA_1, PS3, PS4 and PS5  in a
 var, array, hash, whatever and I don't care about any of the
 other data.
  A variable would be preferable over array, I think.
 
 I then tried @PSARRAY = `command | grep bf1 | awk -F   '{print $1}'`
 but got the same exact results.  Anyone know why it didn't
 like the awk
 command or just decided to ignore it?

Variables are expanded in backticks, so you need to protect the $ on $1, or
use qx'' around your command (but then you have to protect the single quotes

But there's no need for the awk or grep, since perl has functions to handle
that kind of thing. Try something like:

   @PSARRAY = map +(split)[0], grep /bf1/, `command`;

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



RE: Split on white space from `command` return?

2003-08-21 Thread Hanson, Rob
I'm not well versed in awk, but you could use cut instead...

command | grep bf1 | cut -d ' ' -f 1

...Or just use Perl

# untested
my @var = map {/^\w+/;$} grep {/bf1/} `command`;

 on the command line I get exactly what I
 need, why doesn't this work during an
 external call?

Hmmm... my guess is the $1.  The `` interpolates.  You need to escape the
dollar sign with a backslash... otherwise it puts the value of $1 into your
command before executing it.

You might want to use strict, it would have caught that.

Rob

-Original Message-
From: Bill Akins [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 2:01 PM
To: [EMAIL PROTECTED]
Subject: Split on white space from `command` return?


Hi!

I would like to grab the first column (variable width) of data in each
line that will be returned from an external command.
I tried @PSARRAY = `command | grep bf1`; and got just the lines with
data I wanted.  The returned data looks like this:

EHCFS001   Booted Down  bf1/p20   Windows/MUYes,Opt,0 12:55:29
VMDFS  Booted Upbf1/p14   VM25AS21e16/MU Yes,Opt,0
12:52:12
ORA_1  Booted Upbf1/p18   VM25AS21e16/MU Yes,Opt,0
12:56:25
ps3Booted Upbf1/p3custom/MU Yes,Opt,0 12:51:56
ps4Booted Upbf1/p4custom/MU Yes,Opt,0 12:51:42
ps5Booted Upbf1/p5custom/MU Yes,Opt,0 12:51:22

I need to capture just EHCFS001, VMDFS, ORA_1, PS3, PS4 and PS5  in a
var, array, hash, whatever and I don't care about any of the other data.
 A variable would be preferable over array, I think.

I then tried @PSARRAY = `command | grep bf1 | awk -F   '{print $1}'`
but got the same exact results.  Anyone know why it didn't like the awk
command or just decided to ignore it?
If I run command | grep bf1 | awk -F   '{print $1}' on the command
line I get exactly what I need, why doesn't this work during an external
call?

Running on Linux, Perl 5.6.1

Thanks all.



Bill Akins
SSS III
Emory Healthcare
(404) 712-2879 - Office
12674 - PIC
[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: multiple regex in if() staetment

2003-08-21 Thread David Storrs
On Tue, Aug 19, 2003 at 05:54:42PM -0500, Dan Muey wrote:
 Howdy all:
 
 I'm trying to figure out the best way to test a string agains a list of regexs like 
 so:
 
 my @regex = qw(qr(joe$) qr(^mama) qr([abc]));

As was pointed out already, don't use the qw().

Here are some interesting benchmarks.  The 'docs_in_col' file was
about 16k, and the strings I was testing for were right at the bottom.

#!/usr/bin/perl

use warnings;
use strict;
use IO::File;
use Benchmark;

my $fh = new IO::File(docs_in_col) or die $!;
my $str;
{
local $/;
$str = $fh;
}

my $alt_re  = qr(Zucker|Zuckerman|Zurrow);
my @grep_re = (qr(Zucker), qr(Zuckerman), qr(Zurrow));

timethese(5000, 
  { 
  match_alts_scalar = \match_alts_scalar,
  match_alts_array = \match_alts_array,
  grep_mults = \grep_mults,
  }
 );

###

sub match_alts_scalar {
my $found = ($str =~ /$alt_re/);
return $found;
}

###

sub grep_mults {
my $found = grep { $str =~ /$_/ } @grep_re;
return $found;
}


And here are the results:

Benchmark: timing 5000 iterations of grep_mults, match_alts_scalar...
grep_mults:  1 wallclock secs ( 0.54 usr +  0.00 sys =  0.54 CPU) @ 9275.36/s (n=5000)
match_alts_scalar: 40 wallclock secs (39.20 usr +  0.02 sys = 39.22 CPU) @ 127.49/s 
(n=5000)


This should only be considered a first approximation, since there are
various things I'm not controlling for (all my strings were at the
end, they were fixed strings, etc).

Still, I would use the grep version.


--Dks

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



list of child pids

2003-08-21 Thread Robert Citek

Hello all,

getppid returns the parent process ID given a processes ID.  Is there a
corresponding function which returns a list of child processes IDs?

I could do an external system call to ps or pstree, but thought perhaps
something internal to perl might already exist.  I've Googled, but haven't
found anything yet.

Regards,
- Robert


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



Re: Using hex.

2003-08-21 Thread Rich Parker
Thanks guys,
This is what I was looking for, more of those undocumented way to do 
things. But with the way programmers Do things do you find there is a 
Standard generally when it comes to dealing with hex 
variables/characters??

Thanks.

zsdc wrote:

Rich Parker wrote:

$loc = index($rec, $HexValue);  OR
@sub_field1 = split(/$HexValue/, $rec);
Where the $HexValue is either a variable that contains my hex'01' or 
the absolute value itself.


The chr function returns the character with a given ASCII (or Unicode) 
value and you can use \x01 inside of double-quoted strings, so e.g. to 
have a space, you could write:

$char = chr 32;# decimal
$char = chr 0x20;  # hexadecimal
$char = \x20;# hexadecimal
$char = \040;# octal
$HexValue = v32;   # decimal
or
$string = abc\x{20}def 123\x{20}456;
etc.
Is that what you need?

Take a look at perldata manpage:
http://www.perldoc.com/perl5.6/pod/perldata.html#Scalar-value-constructors
and Quote and Quote-like Operators in perlop manpage:
http://www.perldoc.com/perl5.6/pod/perlop.html#Quote-and-Quote-like-Operators 

-zsdc.


--
Rich Parker
http://www.fssi-ca.com
mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


trouble with math... driving me nuts.

2003-08-21 Thread Peter_Farrar
Luckily I was easily able to recreate the problem.  See code below:

  print 37.75 - 33.67 - 4.08 ;
  STDIN;

I find these things all the time.  Is there a particular module I can use
to fix these things?

Output is

  -1.77635683940025e-015

Should be 0

Running on Win2000 / Intel P3

-Peter


** CONFIDENTIALITY NOTICE **
NOTICE:  This e-mail message and all attachments transmitted with it may
contain legally privileged and confidential information intended solely for
the use of the addressee.  If the reader of this message is not the
intended recipient, you are hereby notified that any reading,
dissemination, distribution, copying, or other use of this message or its
attachments is strictly prohibited.  If you have received this message in
error, please notify the sender immediately and delete this message from
your system.  Thank you.




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



Re: Parse text file and increment

2003-08-21 Thread zsdc
rmck wrote:

I was wondering when you get time could you break this down for me?:

print $1$_$4 for $2..$3;

I'm having a hard time grasping it
OK, I'll explain how the whole program works. (I'm CCing the list, other 
people could benefit as well.) Here's the program:

  #!/usr/bin/perl -nlw
  if (/(.*)\b(\d+)-(\d+)\b(.*)/) {
  print $1$_$4 for $2..$3;
  } else {
  print;
  }
The -n switch means that the body of this program is in the implicit 
while() loop, i.e. it's run for every line of input (the input can be 
read from files with names given as program arguments or from standard 
input, just like with traditional Unix filters like sort or grep).

Read more about -n switch in perlrun(1) manpage and read about the null 
filehandle  in I/O Operators section of perlop(1) manpage.

http://www.perldoc.com/perl5.8.0/pod/perlrun.html#-n
http://www.perldoc.com/perl5.8.0/pod/perlop.html#I-O-Operators
If a given line matches the regular expression /(.*)\b(\d+)-(\d+)\b(.*)/ 
then four parts of the line are stored in $1, $2, $3 and $4 variables 
(one for every pair of capturing parentheses). See perlre(1):

http://www.perldoc.com/perl5.8.0/pod/perlre.html

Now $1 contains everything before the first number of the 
number1-number2 pair, $2 contains the first number, $3 the second number 
and $4 is everything after those numbers.

The for $2..$3 means to run the print function for every number in the 
range between $2 and $3 inclusive (this double dot is a range operator, 
see perlop(1) manpage) with this number stored in the $_ variable every 
time the print is run. See Foreach Loops in perlsyn(1).

http://www.perldoc.com/perl5.8.0/pod/perlsyn.html#Foreach-Loops
http://www.perldoc.com/perl5.8.0/pod/perlop.html#Range-Operators
If you are familiar with the C syntax, then:

  print $1$_$4 for $2..$3;

is actually equivalent to this C-style for loop:

  $text_before_nums = $1;
  $num1 = $2;
  $num2 = $3;
  $text_after_nums = $4;
  for ($i = $num1; $i = $num2; $i++) {
  print $text_before_nums, $i, $text_after_nums;
  }
Every print implicitly prints a \n thanks to the -l switch in the #! 
line. See perlrun(1):

http://www.perldoc.com/perl5.8.0/pod/perlrun.html#-l%5boctnum%5d

-zsdc.

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


RE: trouble with math... driving me nuts.

2003-08-21 Thread Bob Showalter
[EMAIL PROTECTED] wrote:
 Luckily I was easily able to recreate the problem.  See code below:
 
   print 37.75 - 33.67 - 4.08 ;
   STDIN;
 
 I find these things all the time.  Is there a particular
 module I can use
 to fix these things?
 
 Output is
 
   -1.77635683940025e-015
 
 Should be 0

That is zero, within the limits of the precision of floating point numbers.

Read the faq article:

   perldoc -q 'long decimals'

There are a number of modules on CPAN that go beyond the FAQ to address this
issue. What are you trying to do?

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



Re: Cron jobs and perl

2003-08-21 Thread Chuck Fox
Venkat,

FWIW, I would wrap the whole job in a shell script and have cron execute 
that.

Chuck

[EMAIL PROTECTED] wrote:

Anytime you have problems with a cron, the easiest place to look first is in the cronlog.  If you have root access, look at the file /var/cron/log (this is Solaris, other *nix may have it elsewhere).  If you don't have root access, delete my E-mail and I apoligize for intruding. :-)

In the cron log you will see if the command executed or if it failed out.  You may also note you have mail, which may contain some useful info.  (again, this is all from a Solaris point of view).

Looking at your pasted entries, it looks ok, however running the .profile first may be causing problems.

John

-Original Message-
From: Vema Venkata [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 19, 2003 10:00 PM
To: Dan Muey; Jeff Westman; beginners
Subject: Cron jobs and perl
Hi Dan 

The problem still persisits pls. help/suggest me what to do ?

When iam executing the xapipgm.pl it is getting executed properly but when iam trying to execute thru crontab
it is not 

xapipgm.pl
**
#!/bin/sh
 #myrun.shell
 xapipgm=srvtst26.pl
 pgrep -f $xapipgm  /dev/null
 # runrc=$?
 # echo Return Code is: $?
 if [ $? -eq 0 ]
 then
 set `pgrep -f $xapipgm `
 echo AHD XAPI Server ($xapipgm) Running with Process Id: $1 
else 
 echo AHD XAPI Server is now Started Running on  `date`.log/init/ahdxapi.init.$1$2$3.$4$5.log
 set `date '+%Y %m %d %H %M' `
 xapipgm=srvtst26.pl
perl -w $xapipgm  log/init/ahdxapi.init.$1$2$3.$4$5.log 2log/init/ahdxapi.init.$1$2$3.$4$5.err
 #perl -w $4$5log/init/ahdxapi.init
 fi
 
**

Cron tab settings are as follows

* * * * * . /home/paradigm/.profile; /proj/ahd02/CAisd/site/mods/scripts/xapipgm.pl  
/proj/ahd02/CAisd/site/mods/scripts/log/init/ahdxapi.init.log  21
_

Access permsissons Details

In the following path i have

/proj/ahd02/CAisd/site/mods/scripts-Xapipgm.pl
/proj/ahd02/CAisd/site/mods/scripts/log/init-ahdxapi.init.log
and the access permission for log folder is drwxr-xr-x and init folder is drwxr-xr-x.
And the log file name i.e (agdxapi.init.log) is -rwxrwxrwx



rgds
venkat




 



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


Spreadsheet::WriteExcel Column width

2003-08-21 Thread Paul Kraus
Is there any way to set the column width to the be as wide as the
longest cell in that column?

Paul Kraus


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



RE: Split on white space from `command` return?

2003-08-21 Thread Bill Akins
I did have use strict; on but it didn't complain...  Thanks for the input!  I'll use 
Perl.


 Hanson, Rob [EMAIL PROTECTED] 08/21/03 14:14 PM 
I'm not well versed in awk, but you could use cut instead...

command | grep bf1 | cut -d ' ' -f 1

...Or just use Perl

# untested
my @var = map {/^\w+/;$} grep {/bf1/} `command`;

 on the command line I get exactly what I
 need, why doesn't this work during an
 external call?

Hmmm... my guess is the $1.  The `` interpolates.  You need to escape the
dollar sign with a backslash... otherwise it puts the value of $1 into your
command before executing it.

You might want to use strict, it would have caught that.

Rob

-Original Message-
From: Bill Akins [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 2:01 PM
To: [EMAIL PROTECTED]
Subject: Split on white space from `command` return?


Hi!

I would like to grab the first column (variable width) of data in each
line that will be returned from an external command.
I tried @PSARRAY = `command | grep bf1`; and got just the lines with
data I wanted.  The returned data looks like this:

EHCFS001   Booted Down  bf1/p20   Windows/MUYes,Opt,0 12:55:29
VMDFS  Booted Upbf1/p14   VM25AS21e16/MU Yes,Opt,0
12:52:12
ORA_1  Booted Upbf1/p18   VM25AS21e16/MU Yes,Opt,0
12:56:25
ps3Booted Upbf1/p3custom/MU Yes,Opt,0 12:51:56
ps4Booted Upbf1/p4custom/MU Yes,Opt,0 12:51:42
ps5Booted Upbf1/p5custom/MU Yes,Opt,0 12:51:22

I need to capture just EHCFS001, VMDFS, ORA_1, PS3, PS4 and PS5  in a
var, array, hash, whatever and I don't care about any of the other data.
 A variable would be preferable over array, I think.

I then tried @PSARRAY = `command | grep bf1 | awk -F   '{print $1}'`
but got the same exact results.  Anyone know why it didn't like the awk
command or just decided to ignore it?
If I run command | grep bf1 | awk -F   '{print $1}' on the command
line I get exactly what I need, why doesn't this work during an external
call?

Running on Linux, Perl 5.6.1

Thanks all.



Bill Akins
SSS III
Emory Healthcare
(404) 712-2879 - Office
12674 - PIC
[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: Split on white space from `command` return?

2003-08-21 Thread Bill Akins
Awesome!  Thanks Bob!

 Bob Showalter [EMAIL PROTECTED] [SNIP]
Variables are expanded in backticks, so you need to protect the $ on $1, or
use qx'' around your command (but then you have to protect the single quotes

But there's no need for the awk or grep, since perl has functions to handle
that kind of thing. Try something like:

   @PSARRAY = map +(split)[0], grep /bf1/, `command`;


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



Re: unlink output of printf

2003-08-21 Thread John W. Krahn
Ronen Kfir wrote:
 
 I need to delete oldest modified file in a directory. I find this file with this:
 
 my $oldest= printf %s\n, (sort{ (-M $b) = (-M$a) } glob(v:\*));
 print $oldest;
 
 unlink $oldest;
 
 What I get in response is:
 
 oldest_filename
 1
 
 File is not deleted.
 
 How would I do it?

As you have observed, printf returns true if it worked (or false if it
didn't.)  You
could do it like this:

my ( $oldest ) = sort { (-M $b) = (-M $a) } glob v:\*;

unlink $oldest or warn Cannot delete $oldest: $!;


Or like this:

my $oldest = ( sort { (-M $b) = (-M $a) } glob v:\* )[ 0 ];

unlink $oldest or warn Cannot delete $oldest: $!;


But both of those methods use an inefficient sort because you are
stat()ing each
file more than once.  Here are two methods that only stat()s each file
once.

my ( $oldest ) = map $_-[ 0 ],
 sort { $b-[ 1 ] = $a-[ 1 ] }
 map [ $_, -M ],
 glob v:\*;

unlink $oldest or warn Cannot delete $oldest: $!;


This is the most efficient as it only stat()s each file once and it
doesn't have to sort.

my $oldest = [ '', 0 ];
for my $file ( glob v:\* ) {
my $date = -M $file;
$oldest = [ $file, $date ] if $oldest-[ 1 ]  $date;
}

unlink $oldest-[ 0 ] or warn Cannot delete $oldest-[0]: $!;



John
-- 
use Perl;
program
fulfillment

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



Re: list of child pids

2003-08-21 Thread david
Robert Citek wrote:

 
 Hello all,
 
 getppid returns the parent process ID given a processes ID.  Is there a
 corresponding function which returns a list of child processes IDs?
 
 I could do an external system call to ps or pstree, but thought perhaps
 something internal to perl might already exist.  I've Googled, but haven't
 found anything yet.

take a look at the Proc::ProcessTable module, no need to shell out for 
external sys call:

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

use Proc::ProcessTable;

#--
#-- we will ignore the child
#--
$SIG{CHLD} = 'IGNORE';

#--
#-- create 5 child processes for demo purpose. arrange them so they stay
#-- long enough so we can find them later
#--
for(1..5){
sleep(10) and exit if(fork == 0);
}

#--
#-- list all process running in your machine and find all 
#-- child process
#--
for my $p (@{new Proc::ProcessTable-table}){
print $p-pid, child of $$\n if($p-ppid == $$);
}

__END__

prints:

21099 child of 21098
21100 child of 21098
21101 child of 21098
21102 child of 21098
21103 child of 21098

perldoc Proc::ProcessTable

david

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



RE: Spreadsheet::WriteExcel Column width

2003-08-21 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Paul Kraus wrote:
 Is there any way to set the column width to the be as wide as the
 longest cell in that column?
 
 Paul Kraus

   
$MyWorkSheet-set_column(Col1, Col2, widthdesired); 

Now to get width desired, need to do a length of the data being processed and save the 
largest to be applied vs the col(s) desired.

Wags ;)


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



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



Re: Using hex.

2003-08-21 Thread zsdc
Rich Parker wrote:

Thanks guys,
This is what I was looking for, more of those undocumented way to do 
things. But with the way programmers Do things do you find there is a 
Standard generally when it comes to dealing with hex 
variables/characters??
I don't know what you mean by standard. Just use whatever is the most 
convenient way for a given task, like chr($num) if you have your 
ASCII/Unicode value in the variable, abc\x{0123}def if you write a 
known value in a string literal, v5.6.7 if you want to compare version 
numbers, etc.

-zsdc.

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


RE: Spreadsheet::WriteExcel Column width

2003-08-21 Thread Paul Kraus
That is what I am currently doing. 
So $maxwidth=  length $mylargeststring 
But if I then set the width to that length it does not work. Its still
to short.

Any ideas?

-Original Message-
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 3:46 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Spreadsheet::WriteExcel Column width


Paul Kraus wrote:
 Is there any way to set the column width to the be as wide as the 
 longest cell in that column?
 
 Paul Kraus

   
$MyWorkSheet-set_column(Col1, Col2, widthdesired); 

Now to get width desired, need to do a length of the data being
processed and save the largest to be applied vs the col(s) desired.

Wags ;)


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



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



RE: Spreadsheet::WriteExcel Column width

2003-08-21 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Paul Kraus wrote:
 That is what I am currently doing.
 So $maxwidth=  length $mylargeststring
 But if I then set the width to that length it does not work. Its still
 to short.
 
 Any ideas?
 
You might add a couple to the size of the length, but otherwise I would do all 
my checking and then apply the sizes at the end of the processing.

Wags ;) 


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



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



RE: trouble with math... driving me nuts.

2003-08-21 Thread Peter_Farrar

Hi Bob,

I'm doing data-processing (EDI).  I need to format and present values in
text, round here and there.  Have lots of various attempts that have failed
for one math related reason or another.  Currently I convert to a string
and split and round, etc. (Even modulo '%' has failed me at times).  So
this 0 comes across as -1.78.  Tried printf(%.02f, $value) and got -0.00
back (negative 0?), so I'm not trusting that route much.

The documentation you refered me to (which didn't work on 2000, but luckily
I keep my Linux laptop near me at all times) refers to Math::BigFloat.  If
you can think of a better package I'd go that route though.

Thanks,
Peter

P.S. Things are a little crazy here, so I'm getting chatty.  Sorry if
there's too many words above.



|-+---
| |   Bob Showalter |
| |   [EMAIL PROTECTED]|
| |   rwhite.com |
| |   |
| |   08/21/2003 03:18 PM |
| |   |
|-+---
  
--|
  |
  |
  |   To:   '[EMAIL PROTECTED]' [EMAIL PROTECTED], [EMAIL PROTECTED]   
   |
  |   cc:  
  |
  |   Subject:  RE: trouble with math... driving me nuts.  
  |
  
--|




[EMAIL PROTECTED] wrote:
 Luckily I was easily able to recreate the problem.  See code below:

   print 37.75 - 33.67 - 4.08 ;
   STDIN;

 I find these things all the time.  Is there a particular
 module I can use
 to fix these things?

 Output is

   -1.77635683940025e-015

 Should be 0

That is zero, within the limits of the precision of floating point numbers.

Read the faq article:

   perldoc -q 'long decimals'

There are a number of modules on CPAN that go beyond the FAQ to address
this
issue. What are you trying to do?

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





** CONFIDENTIALITY NOTICE **
NOTICE:  This e-mail message and all attachments transmitted with it may
contain legally privileged and confidential information intended solely for
the use of the addressee.  If the reader of this message is not the
intended recipient, you are hereby notified that any reading,
dissemination, distribution, copying, or other use of this message or its
attachments is strictly prohibited.  If you have received this message in
error, please notify the sender immediately and delete this message from
your system.  Thank you..




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



Re: the File::Copy module

2003-08-21 Thread R. Joseph Newton
Dan Muey wrote:

  That won't work if the write decides that file1 should be a
  variable instead.  Just a thought :-/

 Ok, in the example file1 wasn't a variable but if you dod want to do
 \\machine1\share\$file

  copy(qq(\\machine1\share\$file),qq(\\mahine2\share\$file)) or ...

 Would that cover all the bases?

 DMuey

Hi Dan,

I think what you would be looking for here is the quotemeta function.
AFAIK, qq()  only substitutes for the double quotes, but does not escape
control characters.  Use quotemetas to prepare a literal string for double
quotes.  I haven't used it much, though, so I don't know whether it will
also escape scalar indicators and toast interpolated variables.

I think it is best to explicitly escape the path separators if you are
going to include variables.

Of course, it is questioable whether backslashes are necessary anyway.
Unless the string is to be handed direct to the Win/DOS system in a system
call, they shouldn't be needed.  All Perl file-handling functions properly
abstract path separators, so you can use forward slashes for all file-paths
and trust the language to interpret the path in the context of the local
file system.

Joseph


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



RE: Spreadsheet::WriteExcel Column width

2003-08-21 Thread Hanson, Rob
 Its still to short.

From the WriteExcel docs:

The width corresponds to the column width value that is specified in Excel.
It is approximately equal to the length of a string in the default font of
Arial 10.

So if you are using a different font or different size it could be way off.
You just need to play with it to get a good fit.  Maybe the length of the
target string times 2 (or 1.5, etc).

Rob


-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 4:17 PM
To: 'Wagner, David --- Senior Programmer Analyst --- WGO'
Cc: [EMAIL PROTECTED]
Subject: RE: Spreadsheet::WriteExcel Column width


That is what I am currently doing. 
So $maxwidth=  length $mylargeststring 
But if I then set the width to that length it does not work. Its still
to short.

Any ideas?

-Original Message-
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 3:46 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Spreadsheet::WriteExcel Column width


Paul Kraus wrote:
 Is there any way to set the column width to the be as wide as the 
 longest cell in that column?
 
 Paul Kraus

   
$MyWorkSheet-set_column(Col1, Col2, widthdesired); 

Now to get width desired, need to do a length of the data being
processed and save the largest to be applied vs the col(s) desired.

Wags ;)


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



-- 
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: trouble with math... driving me nuts.

2003-08-21 Thread Levon Barker
Hi Peter,

This is a floating point issue. It is a general computing problem and not
just subject to Perl. In decimal form the result
is -0.0017763568.

Generally thats usually acurate enough. Otherwise you could truncate it or
round it to the nearest quadrabillionth.

Cheers,
Levon Barker

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 3:06 PM
 To: [EMAIL PROTECTED]
 Subject: trouble with math... driving me nuts.


 Luckily I was easily able to recreate the problem.  See code below:

   print 37.75 - 33.67 - 4.08 ;
   STDIN;

 I find these things all the time.  Is there a particular module I can use
 to fix these things?

 Output is

   -1.77635683940025e-015

 Should be 0

 Running on Win2000 / Intel P3

 -Peter


 ** CONFIDENTIALITY NOTICE **
 NOTICE:  This e-mail message and all attachments transmitted with it may
 contain legally privileged and confidential information intended
 solely for
 the use of the addressee.  If the reader of this message is not the
 intended recipient, you are hereby notified that any reading,
 dissemination, distribution, copying, or other use of this message or its
 attachments is strictly prohibited.  If you have received this message in
 error, please notify the sender immediately and delete this message from
 your system.  Thank you.




 --
 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: trouble with math... driving me nuts.

2003-08-21 Thread zsdc
[EMAIL PROTECTED] wrote:

  print 37.75 - 33.67 - 4.08 ;
  STDIN;
I find these things all the time.  Is there a particular module I can use
to fix these things?
Take a look at Math::BigFloat, it's an arbitrary length float math package:

  #!/usr/bin/perl -wl
  use Math::BigFloat;
  $x = 37.75;
  print $x - 33.67 - 4.08;
  $x = Math::BigFloat-new('37.75');
  print $x - 33.67 - 4.08;
** CONFIDENTIALITY NOTICE **
NOTICE:  This e-mail message and all attachments transmitted with it may
contain legally privileged and confidential information intended solely for
the use of the addressee.
OK, I won't tell anyone.

-zsdc.



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


only first checked item passed

2003-08-21 Thread Prachi Shah
Hi all,

I have a CGI script which does a select on a database and builds a checkbox 
group iterating through the result of the select. The problem is when a user 
submits the form, only the first checked item in the checkbox group is 
passed.
Below is the snippet of the perl code that generates the checkbox group. 
Please advise me if there is anything I am doing wrong. Any help is 
appreciated.

Thanks,
Prachi.
### cut code 
if (!$sth) {
 $sth = $dbh-prepare(SELECT * FROM  . $schema .
dberge_ranges WHERE chrom = ?  .
 AND start_pt = ? AND stop_pt = ? ORDER BY id, start_pt);
  }
  $sth-execute($chr, $stp, $st);
  my(@row) = $sth-fetchrow_array;
   #print @row\n;
  if ([EMAIL PROTECTED]) {
 print $q-strong(No  results and Expression data found\n), $q-br;
  }else {
 print $q-strong(Experimental results of gene expression), $q-br;
 print $q-start_form(-action = $dberge_url);
 print $q-br;
 print $q-start_table({-border=1}), $q-Tr,
   $q-td(ExperimentID  Assay),
   $q-td(range affected);
 my $pid = 0;
 while (@row) {
$row[3] = commify($row[3]);
$row[4] = commify($row[4]);
if ($pid == $row[0]) { #same variant another range
   if ($row[3] ne $row[4]) {
  print $q-br, $row[2] $row[3] - $row[4];
   }else {
  print $q-br, $row[2] $row[3];
   }
}else { #new dberge entry
print $q-Tr;
   print $q-td( $q-checkbox(-name='id',
  -value=$row[0],
  -label=$row[0] $row[1]));
   if ($row[3] ne $row[4]) {
  print $q-td, $row[2] $row[3] - $row[4]; #may continue
   }else {
  print $q-td, $row[2] $row[3];
   }
}
$pid = $row[0];
@row = $sth-fetchrow_array;
 }
 print $q-br;
 print $q-end_table;
 print $q-br;
print $q-hidden(mode, Submit query),
   $q-hidden(disp,All data);
 print $q-submit(-name=View, -value=Submit);
 end cut code ###

_
Chat privately with Bon Jovi, Seal, Bow Wow, or Mary J Blige using MSN 
Messenger! http://www5.msnmessenger-download.com/imastar/default.aspx

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


Re: Setting shell enviro through perl?

2003-08-21 Thread Trina Espinoza



Does anyone know how to set an shell enviroment using perl? I have tried using the 
backticks, the system command, but they
don't seem to be working. I found ENV{'FLEE'} = 'FLEE'; online, but I don't understand 
how that works. It sets your enviroment for
a child process but won't change your current environment, is that right?  If anyone 
has suggestions I am all ears.

thanks,

-T



sub setEnviro {
  my($var1, $var2) = @_;
  print INSIDE FLEE: $var1\n;
  print INSIDE FLAA: $var2\n;
  #system (FLEE=$var1);##ALL lines below don't seem to work. . .
  #system(FLAA=$var2);
   
   #$ENV{'FLEE'} = 'FLEE';
   #$ENV{'FLOO'} = 'FLAA';
  `echo $FLEE`;
  `echo $FLAA`;

Re: Setting shell enviro through perl?

2003-08-21 Thread John W. Krahn
Trina Espinoza wrote:
 
 Does anyone know how to set an shell enviroment using perl? I
 have tried using the backticks, the system command, but they
 don't seem to be working. I found ENV{'FLEE'} = 'FLEE'; online,
 but I don't understand how that works. It sets your enviroment
 for a child process but won't change your current environment,
 is that right?  If anyone has suggestions I am all ears.

You can change the current environment and you can set a child's
environment before it runs but you can't change your parent's
environment.  Modifying %ENV does change the current environment however
backticks and system() run as a separate process and so do not effect
the current environment.


John
-- 
use Perl;
program
fulfillment

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



Re: list of child pids

2003-08-21 Thread John W. Krahn
Robert Citek wrote:
 
 Hello all,

Hello,

 getppid returns the parent process ID given a processes ID.  Is there a
 corresponding function which returns a list of child processes IDs?

If YOU create a child process then YOU should store the PID that the
process returns.


John
-- 
use Perl;
program
fulfillment

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



Re: Setting shell enviro through perl?

2003-08-21 Thread zsdc
Trina Espinoza wrote:

Does anyone know how to set an shell enviroment using perl? I have tried using the 
backticks, the system command, but they
don't seem to be working. I found ENV{'FLEE'} = 'FLEE'; online, but I don't understand 
how that works. It sets your enviroment for
a child process but won't change your current environment, is that right?  If anyone 
has suggestions I am all ears.
$ENV{FLEE} = 'FLEE';
^remember about the '$' sigil.
See perlvar(1) manpage:
http://www.perldoc.com/perl5.8.0/pod/perlvar.html#%25ENV
The hash %ENV contains your current environment. Setting a value in ENV 
changes the environment for any child processes you subsequently fork() 
off.

Perl programming is an *empirical* science after all, so you can ckeck 
out if it changes the real environment:

  #!/usr/bin/perl -wl
  print Old  PATH: $ENV{PATH};
  $ENV{PATH} .= ':/ABCDEF';
  print %ENV PATH: $ENV{PATH};
  $/ = \0;
  open $env, '', /proc/$$/environ or die $!;
  while ($env) {
  print Real PATH: $1 if /^PATH=(.*)/;
  }
  close $env;
And it doesn't. %ENV is just a normal hash, it's not tied or anything. 
But if it is your only way of reading your environment (and even 
POSIX::getenv() just returns the %ENV elements) then it doesn't really 
matter. I'm not quite sure if that answers your question though.

sub setEnviro {
  my($var1, $var2) = @_;
  print INSIDE FLEE: $var1\n;
  print INSIDE FLAA: $var2\n;
  #system (FLEE=$var1);##ALL lines below don't seem to work. . .
  #system(FLAA=$var2);
This won't work, because it will change the environment of the child 
shell processes, which doesn't affect the environment of their parent, 
i.e. your program process.

   #$ENV{'FLEE'} = 'FLEE';
   #$ENV{'FLOO'} = 'FLAA';
  `echo $FLEE`;
  `echo $FLAA`;
Try:

  print `echo \$FLEE`;
  print `echo \$FLAA`;
You need to print the value returned by backticks and you need the 
backslach to escape the $ sigil, because otherwise perl would 
interpolate its $FLEE variable there. Or instead of backticks, just use 
system():

  system 'echo $FLEE';

You don't have to escape $ in single quotes and system() doesn't capture 
the output of your command, so it's just printed to stdout.

-zsdc.

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


AW: File::Copy CGI.pm

2003-08-21 Thread B. Fongo
Hey!

If you want to transfer file through the browser, then you don't need an
FTP server.  
On submitting the upload form, the browser transmits the file to the web
server, and it is store in a temporary folder where you can ask for. You
need too  extra the value of the file field with param('field name') and
use it to ask the web server for the file. 

The whole thing may look like this:

# Get the directory and file name using param().
$location_and_file_name = $xyz-param('field name');

# Use regex to convert all Windows slashes \ (e.g. c:\blah\blah.txt)
to Linux / and # basename() will work ok.

$tmp = $location_and_file_name;
$tmp =~s/\\/\//g;
$file_name = basename($tmp);

open(DESTINATION, destination/$file_name) || die Failed to open
file!
while ($location_and_file_name ){
chomp;
print  DESTINATION $_;
}
close (DESTINATION);



This work well. I used it on my recent project.

Good luck






-Ursprüngliche Nachricht-
Von: Yupapa.com [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 21. August 2003 00:10
An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Betreff: Re: File::Copy  CGI.pm

HiHi~

If you are transfering file from a local machine to a remote machine,
you do
not use File::Copy module to copy files.  File::Copy is used for copying
files locally.  You can use Net::FTP to transfer files from one machine
to
another.  And of course, you will need a FTP server for the machine
receiving the file.


Bye~
Yupapa
###
# Yupapa Web Hosting =^.^=
# Web Site - http://www.yupapa.com
# Email - [EMAIL PROTECTED]
###
B. Fongo [EMAIL PROTECTED]
???:[EMAIL PROTECTED]
 Hi,

 I've a small script intended for file transfer from a windows machine
to
 a remote linux server.  To implement that, I decided to use two module
 i.e File::Basename, File::Copy and CGI.pm.

 The File::Copy is working well locally, but it fails to copy files to
a
 remote machine through the Browser. I use CGI.pm to generate a form
 where users could browser and select a file to be transferred.  The
 error message is always: No such file or directory though the file
or
 directory  exist and permission is set 777.

 What may be the case? Any suggestion on how to transfer file to remote
 location?
 I'm not sure whether it will be applicable to use file handles and use
a
 loop to read the files from the source location and write them to a
 destination folder.

 Thanks for any help



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

 use strict;
 use CGI qw/ :standard/;
 my $cgi = new CGI;

 use File::Basename;

 if( param()){
 upload_file(param(upload_file));
 } else {
 print_form();
 }


  Subroutine to transfer file ###

 sub upload_file{

 my ($file, $file_destination, $file_name, $forwarded_value);
$original_src = $forwarded_value = $_[0];
 $file_destination = q(/data/Software_Pakete);
 $forwarded_value =~ s/\\/\//g;
 $file_name = basename($forwarded_value);
 if (copy($original_src,$file_destination/$file_name)){
 print_success()
 }
 else{
 print_error($forwarded_value,$file_destination/$file _name)
 }










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



RE: create log as well as print on screen

2003-08-21 Thread Jonathan E. Hogue
In unix there is a program called tee.

It works something like
program.pl | tee log.file

you just have program.pl write to STDOUT

alternatively, in your program, you could just do

my $log = log.file;

open( LOG, log.file );
print THING\n;
print LOG THING\n;
close LOG;

( basically print twice for everything you print.


-Original Message-
From: mark sony [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 20, 2003 8:11 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: create log as well as print on screen

Hi All,

I wrote a script which is running perfectly fine providing 
many outputs on the screen . Only glitch is that it does not print 
in a log file . Now what I want is that it would print on the 
screen as well as create a log file . At the end of the program  I 
will output that the above output can also be seen at the 
$log_File_position . Hope I am clear with my question . Any type 
of pointers and I would be over the moon ;)

Thanx in advance

Mark
___
Meet your old school or college friends from
1 Million + database...
Click here to reunite www.batchmates.com/rediff.asp



-- 
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: File::Copy CGI.pm

2003-08-21 Thread Jenda Krynicky
From: Yupapa.com [EMAIL PROTECTED]
 If you are transfering file from a local machine to a remote machine,
 you do not use File::Copy module to copy files.  File::Copy is used
 for copying files locally.  You can use Net::FTP to transfer files
 from one machine to another.  And of course, you will need a FTP
 server for the machine receiving the file.

This aint entirely true. You can use File::Copy to copy files to 
remote shares (Windows Networking), remote drives mounted via NFS , 
... basicaly anything that the OS allows you to treat like a local 
disk.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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