RE: Little code fragment request (Is this code ok?)

2002-05-07 Thread Scot Robnett

Is this on UNIX? Somebody on the list please correct me if I'm wrong, but I don't 
believe flock will work on Windows, and I have no idea about Mac.

Scot Robnett
inSite Internet Solutions
[EMAIL PROTECTED]
[EMAIL PROTECTED]


-Original Message-
From: Rafael Cotta [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 1:15 AM
To: [EMAIL PROTECTED]
Subject: Re: Little code fragment request (Is this code ok?)


Well, after searching I come to this:

#---
sub WriteLog
{
 open(OUTF,$filenamedate.dat) or die(Couldn't open $filenamedate.dat
for writing: $!);

 # This locks the file so no other CGI can write to it at the
 # same time...
 flock(OUTF,2);

 # Reset the file pointer to the end of the file, in case
 # someone wrote to it while we waited for the lock...
 seek(OUTF,0,2);

 print OUTF $linha\n;
 close(OUTF);
}
#---

Where $filenamedate will have something like 2002-05-06 and $linha will
contain the information I need to append to the file.

Will this code run fine on a website with several simultaneous accesses?

Rafael



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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/02

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/02



Re: Little code fragment request (Is this code ok?)

2002-05-07 Thread Rafael Cotta

Yes, it is UNIX. I also read it won't work on Windows.

Rafael

Scot Robnett [EMAIL PROTECTED] escreveu na mensagem
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Is this on UNIX? Somebody on the list please correct me if I'm wrong, but
I don't believe flock will work on Windows, and I have no idea about Mac.

 Scot Robnett
 inSite Internet Solutions
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]




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




Re: trouble setting up (solution?)

2002-05-07 Thread Jake

Several people have responded so I thought I'd post my solution...

In commonhttpd.conf (someone keeps changing the configuration file) there were 
the following lines...

Directory /var/www/cgi-bin
AllowOverride All
Options ExecCGI
/Directory

and I inserted a couple of lines so it now reads...

Directory /var/www/cgi-bin
AllowOverride All
Options ExecCGI
Order allow,deny
Allow from all
/Directory

I dont know if this is good or bad, but it's workin for me :)

Thanks all
J

On Sunday 05 May 2002 05:37 am, [EMAIL PROTECTED] wrote:
 On Sat, 4 May 2002, Webster wrote:
   I just installed Mandrake 8.2 with Apache and I'm trying to get
 
  some of my  scripts to run on it.   I put them into the www/cgi-bin
  directory and chmoded them to 755  I also set their owner and
  group to apache But I'm still getting Forbidden...You dont
  have permission errors  What am I forgetting to do?  it's an
  install directly from the rpms, so I havent fiddled with any of the
  conf files.

 Probably need to edit httpd.conf to enable the file extensions,
 grep cgi httpd.conf and you'll see.


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




Accessing form elements before submit..

2002-05-07 Thread onkar sangoram

Hi ,
 I badly need ur help regarding to the CGI scripts.
 i have written one perl script to design a tree ,with
recursive function in it. I am accepting parameters
from the user (STDIN) and then splicing the
array.The things are fine.
 But when i want to put it in the web page,there will
be a text-box fot input. But how can i access the
values entered by the user in the same script before
submit. Because after each input the array is
reforming.
 So is it possible to access the values of form
element before pressing submit button ??
 I really want this problem to be solved,
 please do help me.
Onkar

__
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

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




Mod Perl / CGI problem

2002-05-07 Thread Elwyn Chow

Hi,

Is there a good web site where I can get tips of potential modPerl
problems, particularly relating to CGI?

Also, I'm getting a modPerl problem with my script:
I keep finding that $param{form}{type} has the wrong value in it.

Any help would be greatly appreciated.

Bye
Elwyn

#!/usr/bin/perl

use strict;
use CGI;
use DBI;
use lib '.';

my $HOST = 'localhost';
my $DATABASE = 'shopping';
my $DEBUG = 1;
my $MAINTAINER_EMAIL = '[EMAIL PROTECTED]';

my @EQUIPMENT_LIST = 
('cpu','memory','modem','storage_disk','mainboard','graphics_card','monitor','IDE_controller','firewire','hard_disk','CD_ROM','DVD_ROM','CD_writer','keyboard','mouse','networking','case','zip','floppy_drive','sound_card','speakers','printer','scanner');

my @PARAM_TO_EXTRACT = (id, type, brand, description, price);

my $cgi;
$cgi  = new CGI;

my $Sdb = DBI-connect(DBI:mysql:database=$DATABASE;host=$HOST, 'root', 'password') 
|| error(Database couldn't connect: $DBI::errstr, {});

my %p = ();

#---

main();
exit 1;
#---

sub main {
my %param;
%param = get_param();

my $body;
$body = ;

$body .= $cgi-header;
$body .= $cgi-start_html(-title=Equipment Editor,
  -style={-src=../style/stylesheet.css});
print Type:  . $param{form}{type} .br /;

if ($cgi-param('style') eq 'add_save') {
   $body .=save_add_item(\%param);
} elsif ($cgi-param('style') eq 'add_item') {
   $body .= add_item(\%param);
} elsif ($cgi-param('style') eq 'show_items') {
   $body .= !--- Device Type: $param{form}{type} ---\n;
   $body .= show_items(\%param);
} elsif ($cgi-param('style') eq 'Edit Selected Items') {
  $body .= edit_items(\%param);
} elsif ($cgi-param('style') eq 'Delete Selected Items') {
  $body .= delete_items(\%param);
} elsif ($cgi-param('style') eq 'Return to Menu') {
  $body .= show_menu(\%param);
} else {
  $body .= show_menu(\%param);
}

$body .= $cgi-end_html;

print $body;
}
#---
sub get_param {
   my %param;
   %param = undef;

   my $to_ex;
   foreach $to_ex (@PARAM_TO_EXTRACT) {
  $param{form}{$to_ex} = ;
   }

   foreach $to_ex (@PARAM_TO_EXTRACT) {
  $param{form}{$to_ex} = $cgi-param($to_ex);
   }

print h1Here it is:  .$param{form}{type} ./h1;
   return %param;
}

#---
# Print an 'I'm sorry' message, mail an error report to the maintainer
# and quit (using exit, not die; die was making mod_perl lock up
# sometimes, I don't know why.)  Pass it the message and a ref to the
# parameters hash

sub error {
my (  $message, $p ) = @_;
my $body = EOHTML;

EOHTML

if ($DEBUG) {
   $body .= p class='content'[$message]/p\n;
} elsif ($message =~ /Too many connections/) {
   $body .= p class='content'There are currently too many connections to the 
database, please try again later./p\n;
}

$p{title_sem} = '';
#write_output($body, $p);
if( !$DEBUG  open(SENDMAIL, | /usr/lib/sendmail -t -n -oi) ) {
print SENDMAIL EOMAIL;
From: nobody\@it.uts.edu.au
To: $MAINTAINER_EMAIL
Subject: [www-trouble] $ENV{SCRIPT_NAME}

#The mod_perl script $ENV{SCRIPT_NAME} had a fatal error.

 $message 

Its environment was:
EOMAIL
  foreach ( sort keys %ENV ) {
 print SENDMAIL $_: $ENV{$_}\n;
  }

  close SENDMAIL;
   }
   warn($message);

   display_html($body, \%p);
   exit;
}
#---
# Wrapper function for simple DBI queries (ie ones without
# placeholders).  Returns a results handle.
#
sub db_query {
my $sql = shift;
#print SQL: $sqlhr /;
my $sth = $Sdb-prepare($sql) || error($Sdb-errstr .  [$sql], {});
$sth-execute || error($Sdb-errstr  .  [$sql], {});
$sth;
}

#---

sub display_html {
  my ($body, $temp) = @_;

  my %p = %{$temp};
  print h1An error occurred/h1$body;
}

#---
sub some_upcase {
   my $str = shift;

   my @bits = split(/_/, $str);

   my $output = ;
   foreach my $bit (@bits) {
  $bit =~ /^(.)(.+)$/;
  $output .= uc($1) . $2;
   }

   return $output;
}

#---

sub adjust_decimal_price {
   my $price = shift;
   $price = sprintf(%.2f, $price) if ($price != int($price));
   return $price;
}
#---

sub add_item {
   my $tmp = shift;
   my %param = %{$tmp};

   my $body = ;
   $body .= $cgi-start_form(-method=get, -action=$ENV{SCRIPT_NAME});

   my %labels = map{ $_ = some_upcase($_) } @EQUIPMENT_LIST;
   my $type_popup_menu = 

Re: Mod Perl / CGI problem

2002-05-07 Thread Elwyn Chow

Hi,

I forgot to ask this...

In the other parts of my modPerl script, are there any other
glaring errors in my programming style that I've programmed for modPerl
besides the problem with that particular variable and what's the easiest
way to fix them without changing my lovely style. :-)

My script should work okay in non-modPerl, if it works for the 8
or so times that it does work right before it starts reusing old variable
values, right?

Bye
Elwyn


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




Re: Accessing form elements before submit..

2002-05-07 Thread David vd Geer Inhuur tbv IPlib


Hi Onkar,

Yes there is a solution, Javascript :)

Maybe you'dd take a look at : http://codepunk.hardwar.org.uk/bjs.htm
Believe me, it's easier than you think.

Good luck. David

 
 Hi ,
  I badly need ur help regarding to the CGI scripts.
  i have written one perl script to design a tree ,with
 recursive function in it. I am accepting parameters
 from the user (STDIN) and then splicing the
 array.The things are fine.
  But when i want to put it in the web page,there will
 be a text-box fot input. But how can i access the
 values entered by the user in the same script before
 submit. Because after each input the array is
 reforming.
  So is it possible to access the values of form
 element before pressing submit button ??
  I really want this problem to be solved,
  please do help me.
 Onkar
 
 __
 Do You Yahoo!?
 Yahoo! Health - your guide to health and wellness
 http://health.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]




(OT) Re: Accessing form elements before submit..

2002-05-07 Thread John Brooking

To expand a bit from a more general persective:

The important distinction here is what is client-side
and what is server-side. HTTP is a request/response
protocol. So the interaction looks like this:

  1) User (Client) requests page where your form is
  2) Server delivers that page
  3) User fills out the form
  4) User submits the form, resulting in another
request
  5) Server processes that request and delivers
another response

What it sounds like you are looking for is something
to allow the client browser to make some decisions
during step 3, while the user is filling out the form.
Since the last server response has completed (the page
was successfully delivered), and the next won't start
until the user submits, the client is on its own, and
no server-side technology (Perl or whatever) can help
at that point. You need a client-side technology.
That's JavaScript. (Not to be confused with Java,
which is an entirely separate language and is on the
server side.)

By the way, if you happen to look at Microsoft's
support side, you'll see references to JScript, which
is IE's implementation of JavaScript (although
JavaScript works in IE too). IE also supports VBScript
(similar syntax to Visual Basic) on the client. But of
course browser-dependent technology is a big no-no
unless you are programming for internal people only
whom you can assume have a company-standard browser.

A short JavaScript intro: If you have a form named
myForm with a text input called myInput, inside an
HTML script tag you can refer to the value in this
form as document.myForm.myInput.value. You can use
this value to assign to JavaScript variables or to
other fields on the form, possibly hidden ones. That
sounds like the sort of thing you're wanting to do.
There are many good JavaScript references on-line to
help you learn.

- John

--- David vd Geer Inhuur tbv IPlib
[EMAIL PROTECTED] wrote:
 
 Hi Onkar,
 
 Yes there is a solution, Javascript :)
 
 Maybe you'dd take a look at :
 http://codepunk.hardwar.org.uk/bjs.htm
 Believe me, it's easier than you think.
 
 Good luck. David


__
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

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




Re: Accessing form elements before submit..

2002-05-07 Thread MARCOS LABORDE

You can do client processing in javascript but you can also put your values in hidden 
fields as you change your array of values, use one button for the final submit and 
other submit buttons disguised as preprocessing buttons.

 onkar sangoram [EMAIL PROTECTED] 05/07/02 06:58AM 
Hi ,
 I badly need ur help regarding to the CGI scripts.
 i have written one perl script to design a tree ,with
recursive function in it. I am accepting parameters
from the user (STDIN) and then splicing the
array.The things are fine.
 But when i want to put it in the web page,there will
be a text-box fot input. But how can i access the
values entered by the user in the same script before
submit. Because after each input the array is
reforming.
 So is it possible to access the values of form
element before pressing submit button ??
 I really want this problem to be solved,
 please do help me.
Onkar

__
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.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]




RE: Matching string (here I am again)

2002-05-07 Thread Camilo Gonzalez

Try /[a-z]*\d[2]/

-Original Message-
From: Rafael Cotta [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 12:16 PM
To: [EMAIL PROTECTED]
Subject: Matching string (here I am again)


First of all, special thanks to Drieux.

I need to check if a string with the following patern:

lowercase charactersnumbernumber.html

Like cae01.html or djavan10.html (without quotes).

I tryied

$musica =~ /([a-z]*)[0-9][0-9]\.html/

but this matches djavan001.html, when this should not.

Wich regexpr can I use? This time a link to a howto will be very welcome,
once this is not the unique regexpr I'll need to build myself.

Rafael





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




(OT) RE: Matching string (here I am again)

2002-05-07 Thread John Brooking

Okay, what's the [2] doing? It appears to be saying to
match \d exactly two times, but I thought that would
be {2} instead. But changing your [] to {} leads to
the same problem as the original expression.

You probably know, Camilo, but since you didn't say,
let me guess at why Rafael's original RE did not work.
The problem seemed to be the use of * (zero or more)
when + (one or more) was probably meant. So the
original RE was asking if there are any ocurrences of
*ZERO OR MORE* characters followed by two digits and
the string .html. The answer is yes, the substring
01.html of djavan001.html fits that criteria, as
it is ZERO characters followed by two digits, etc.
Changing the * to a + makes his original RE work
as intended, so there has to be at least one
character. This also prevents something like 99.html
from matching, which I'm assuming from his description
is also desired.

--- Camilo Gonzalez [EMAIL PROTECTED]
wrote:
 Try /[a-z]*\d[2]/
 
 -Original Message-
 From: Rafael Cotta [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 07, 2002 12:16 PM
 To: [EMAIL PROTECTED]
 Subject: Matching string (here I am again)
 
 
 First of all, special thanks to Drieux.
 
 I need to check if a string with the following
 patern:
 
 lowercase charactersnumbernumber.html
 
 Like cae01.html or djavan10.html (without
 quotes).
 
 I tryied
 
 $musica =~ /([a-z]*)[0-9][0-9]\.html/
 
 but this matches djavan001.html, when this should
 not.
 
 Wich regexpr can I use? This time a link to a howto
 will be very welcome,
 once this is not the unique regexpr I'll need to
 build myself.
 
 Rafael


__
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

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




RE: Little code fragment request (Is this code ok?)

2002-05-07 Thread Bob Showalter

 -Original Message-
 From: Rafael Cotta [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 07, 2002 2:15 AM
 To: [EMAIL PROTECTED]
 Subject: Re: Little code fragment request (Is this code ok?)
 
 
 Well, after searching I come to this:
 
 #---
 sub WriteLog
 {
  open(OUTF,$filenamedate.dat) or die(Couldn't open 
 $filenamedate.dat
 for writing: $!);
 
  # This locks the file so no other CGI can write to it at the
  # same time...
  flock(OUTF,2);
 ^^^
You should import the constants from Fcntl instead
of using magic numbers:

   use Fcntl qw(:flock);

 
  # Reset the file pointer to the end of the file, in case
  # someone wrote to it while we waited for the lock...
  seek(OUTF,0,2);
   ^^
This is unecessary. When a file is opened in append mode,
writes always and only go to the end.

 
  print OUTF $linha\n;
  close(OUTF);
 }
 #---
 
 Where $filenamedate will have something like 2002-05-06 and 
 $linha will
 contain the information I need to append to the file.
 
 Will this code run fine on a website with several 
 simultaneous accesses?

Additional considerations:

1. Where is $filename coming from? If it's from outside the
script, you should run with -T and properly untaint it.

2. You shouldn't assume any particular current working directory
in the CGI environment. You need to specify a path name in your
open() or use chdir() to set a specific directory.

3. Perl 5.6 allows you to use the following form for open:

   open(my $fh, $filename.dat) or die ...

This makes your code more modular as it avoids use of a global
filehandle.

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




RE: Taking data from the screen to a file

2002-05-07 Thread Timothy Johnson

 
Here's one take on this off the top of my head(I haven't tested it, but I
_think_ it will work).  The text you are looking for is bordered by a line
that starts with the word User after some spaces, and a line that has only
white space.  It seems like there should be a better way somewhere, but
until we know what that is...



my @output = `myApp.exe`; #using backticks to get output
my @users = '';

foreach(@output){
   my $found = '';
   if($_ =~ /^\s*User/i){
  $found = 1;
   }elsif($_ =~ /^\s+$/){
  $found = 0;
   }
   if($found){
  my @temp = split /\s+/,$_;
  push @users,$temp[1];
   }
}

shift @users; #get rid of the word 'User'

print These are my users:\n;
foreach(@users){
   print$_\n;
}

###



-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 5/6/02 10:04 PM
Subject: Taking data from the screen to a file

Hi, 

I'm just new to Perl and have no idea where to start with the task that
I have to complete.  Any help would be appreciated.

Currently when a particular .exe is run, the following is displayed in
the command window - 

License server on host kronos.
Running since Monday 4/04/96 15:53:13.

LICENSES:
 Max-Users   Expires   Password [status]
19   none  2aae4b60.b4ac4f0f.02 [Valid]

 Maximum active users allowed: 19
 Current active users: 6
 Available licenses: 13

ACTIVE users:
UserPriority   Time-out in
rdc 2  59 minutes (at 10:44:20)
chris   1  26 minutes (at 10:10:45)
cheryl   none  23 minutes (at 10:07:27)

License Usage Statistics:
2 licenses revoked today 4/14/96.
0 license requests denied.
0 active users bumped by preferred user.

From this i need to extract just the user names and place them into an
external file.  How do I go about this?

Thanks heaps
Melissa



--
This message and any attachment is confidential and may be privileged or
otherwise protected from disclosure.  If you have received it by mistake
please let us know by reply and then delete it from your system; you
should not copy the message or disclose its contents to anyone.





-- 
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: Piping mail spool through a Perl script?

2002-05-07 Thread Sudarsan Raghavan

jc wrote:

 Hello,

 I inherited a project where we use a procmail filter to filter emails as
 they come to our web server and pipe them through a perl script.  The
 script called filterme goes through the email line by line and grabs
 information on the email, puts it into an array, and when it is finished,
 it appends the data collected to a file, (a log file of sorts).

 I have to redo this script to grab a different set of information, but I
 need to filter existing emails already in the mail spool.  It was suggested
 to me that I could go to the mail folder (var/users/mail) and grab the
 folder and then pipe all the files in the mail folder through the
 filterme script.  However, when I look at the mailspool folder, I only
 see one file that contains all the emails.  I was wondering if there was a
 way to somehow parse this file and pipe the results through the filterme
 script.

#This assumes that filterme can executed and is in the PATH
open (FILTERME, | filterme) or die Failed to get handle to write to filterme
: $!\n;
print FILTERME some stuff #piping some stuff to filterme
close (FILTERME)

Is this what you are looking for
perldoc -f open



 I realize I need more education in how email works and I am slowly picking
 through the sendmail book by O'Reilly.  But if anyone knows a simple answer
 to this, I would be much obliged.

 Thanks in advance,

 Joan Chyun

 --
 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: Piping mail spool through a Perl script?

2002-05-07 Thread Timothy Johnson

 
Is there a particular line or lines of text that delimits each email?

-Original Message-
From: jc
To: [EMAIL PROTECTED]
Sent: 5/6/02 11:03 PM
Subject: Piping mail spool through a Perl script?

Hello,

I inherited a project where we use a procmail filter to filter emails as

they come to our web server and pipe them through a perl script.  The 
script called filterme goes through the email line by line and grabs 
information on the email, puts it into an array, and when it is
finished, 
it appends the data collected to a file, (a log file of sorts).

I have to redo this script to grab a different set of information, but I

need to filter existing emails already in the mail spool.  It was
suggested 
to me that I could go to the mail folder (var/users/mail) and grab the 
folder and then pipe all the files in the mail folder through the 
filterme script.  However, when I look at the mailspool folder, I only

see one file that contains all the emails.  I was wondering if there was
a 
way to somehow parse this file and pipe the results through the
filterme 
script.

I realize I need more education in how email works and I am slowly
picking 
through the sendmail book by O'Reilly.  But if anyone knows a simple
answer 
to this, I would be much obliged.

Thanks in advance,

Joan Chyun


-- 
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: Taking data from the screen to a file

2002-05-07 Thread Felix Geerinckx

on Tue, 07 May 2002 05:04:56 GMT, [EMAIL PROTECTED]
(Melissa Cama) wrote: 

 [...]
 From this i need to extract just the user names and place them
 into an external file.  How do I go about this? 

#! perl -w
use strict;
my @users;
open (IN, particular.exe |) or die Cannot pipe: $!;
while (IN) {
last if /^ACTIVE users:$/;
}
while (IN) {
last unless /\s+(\w+)\s+/;
push @users, $1 unless $1 eq 'User';
}
close(IN);

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




Re: Taking data from the screen to a file

2002-05-07 Thread John W. Krahn

Melissa Cama wrote:
 
 Hi,

Hello,

 I'm just new to Perl and have no idea where to start with the
 task that I have to complete.  Any help would be appreciated.
 
 Currently when a particular .exe is run, the following is
 displayed in the command window -
 
 License server on host kronos.
 Running since Monday 4/04/96 15:53:13.
 
 LICENSES:
  Max-Users   Expires   Password [status]
 19   none  2aae4b60.b4ac4f0f.02 [Valid]
 
  Maximum active users allowed: 19
  Current active users: 6
  Available licenses: 13
 
 ACTIVE users:
 UserPriority   Time-out in
 rdc 2  59 minutes (at 10:44:20)
 chris   1  26 minutes (at 10:10:45)
 cheryl   none  23 minutes (at 10:07:27)
 
 License Usage Statistics:
 2 licenses revoked today 4/14/96.
 0 license requests denied.
 0 active users bumped by preferred user.
 
 From this i need to extract just the user names and place
 them into an external file.  How do I go about this?


Here is one way to do it:

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

open OUT, ' external_file.txt' or die Cannot open 'external_file.txt': $!;

for ( `particular.exe` ) {
if ( /^\s+User\s+/ .. /^\s*$/ ) {
next if /^\s+User\s+/ or /^\s*$/;
my $user = (split)[0];
print OUT $user\n;
}
}

__END__


John
-- 
use Perl;
program
fulfillment

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




RE: Bulk mail tests

2002-05-07 Thread Anders Holm

Hi John.

Sorry for my late reply, I'm checking these mails at work, and we had a Bank
Holiday here yesterday.

Cheers for the pointers!

I'll play around with this a bit more to see what I get.

Best Regards

Anders Holm
Critical Path Technical Support Engineer
--
Tel USA/Canada: 1 800 353 8437
Tel Worldwide:  +1 801 736 0806
E-mail: [EMAIL PROTECTED]
Internet:   http://support.cp.net


-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]]
Sent: 03 May 2002 20:37
To: [EMAIL PROTECTED]
Subject: Re: Bulk mail tests


Anders Holm wrote:

 Hi folks!

Hello,

 I'm trying to do a test on one of our servers where I'd like to send one
 mail message to upto 1000 recipients.
 For this I'd like to use Mail::Bulkmail...

 Now, I seems to be messing it up somehow, and am very short on time.. :(
 Could someone help me out here??

 The usernames I'm sending to is user[1-1000]@mydomain.com...

 Here's the quick and dirty code I threw together..

 #!/usr/local/bin/perl

You should let perl help to find mistakes with warnings and strict

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

 use Mail::Bulkmail;

 $bulk = Mail::Bulkmail-new(

my $bulk = Mail::Bulkmail-new(

 From = '[EMAIL PROTECTED]',
 Smtp = 'smtp.mydomain.com',
 Port = '25',

There is no point in stringifying a number.

Port = 25,

 Subject = 'Testing ISS mail service',
 Message = 'TEST'
  );

 while($rcpt = 1000) {
 $bulk-List(user . $rcpt . @mydomain.com);
 }

What value is $rcpt at the start of the loop?  Since you don't change
the value of $rcpt in the loop it will always use the same value.  This
would usually be writen as:

for ( 1 .. 1000 ) {
$bulk-List( user$_\@mydomain.com);
}



John
--
use Perl;
program
fulfillment

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


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




Ok- real dumb question

2002-05-07 Thread Marc M Dawson

I am supposed to parse a text file such as this-
781457  Hartanto Victor Setiawan [EMAIL PROTECTED]
777557  Hatfield Benjamin [EMAIL PROTECTED]
779777  Henry James [EMAIL PROTECTED]
777947  Hergert Michael William [EMAIL PROTECTED]
778097  Iverson Jennifer Marsee [EMAIL PROTECTED]

As you can see... some people have middle names and some dont... how would I
go about parsing this text file and putting each into it own seperate
entity, except if there is a middle name, in which case I want it to be
joint first and middle.  I realize that I am supposed to use some kind of
split function, however I am unsure how to use it fully, and the prfessor
didnt go over it too much.
Thanks for any help!


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




To fetch datas from text file

2002-05-07 Thread en_prashant

Sir,
I had already mailed u for a particular solution.The basic
problem is that we have a log file that is created by proxy server to keep
the account of the users.The format of log file is as
192.200.9.224,prashant, ,Y,22/04/02,12:09:09, , , http, ,, ,12 , , ,
,http://rediffmail.com/log , , post, , , ,
  as the length of the data is not fixed it is almost of two  lines.so I
have to extract IP address,user name,date,time and site visited from this
file.This file contains thousands of lines.
 Pls help me as soon as possible .

Prashant Mathur


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




Graphics Library

2002-05-07 Thread Arran

Does perl have an graphics library where you could create your own graphics?

and how would i go by using it?


From: Arran
For more contact details goto:
Http://www.arran4.8m.com/
/This document is provided in HTML as well as text/

If builders built buildings the way programmers wrote programs, then the
first woodpecker to come along would destroy civilization.

We are the out casts of society, but when they relise its the out casts that
create society, we will fall.

Everything I know about thermal expansion I learnt from Neon Genesis
Evangelion!



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




Re: Piping mail spool through a Perl script?

2002-05-07 Thread John W. Krahn

Jc wrote:
 
 Hello,

Hello,

 I inherited a project where we use a procmail filter to filter emails as
 they come to our web server and pipe them through a perl script.  The
 script called filterme goes through the email line by line and grabs
 information on the email, puts it into an array, and when it is finished,
 it appends the data collected to a file, (a log file of sorts).
 
 I have to redo this script to grab a different set of information, but I
 need to filter existing emails already in the mail spool.  It was suggested
 to me that I could go to the mail folder (var/users/mail) and grab the
 folder and then pipe all the files in the mail folder through the
 filterme script.  However, when I look at the mailspool folder, I only
 see one file that contains all the emails.  I was wondering if there was a
 way to somehow parse this file and pipe the results through the filterme
 script.
 
 I realize I need more education in how email works and I am slowly picking
 through the sendmail book by O'Reilly.  But if anyone knows a simple answer
 to this, I would be much obliged.


Have a look at these modules:

http://search.cpan.org/search?dist=Mail-MboxParser
http://search.cpan.org/search?dist=Mail-Box


John
-- 
use Perl;
program
fulfillment

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




Re: Ok- real dumb question

2002-05-07 Thread Sudarsan Raghavan

Marc M Dawson wrote:

 I am supposed to parse a text file such as this-
 781457  Hartanto Victor Setiawan [EMAIL PROTECTED]
 777557  Hatfield Benjamin [EMAIL PROTECTED]
 779777  Henry James [EMAIL PROTECTED]
 777947  Hergert Michael William [EMAIL PROTECTED]
 778097  Iverson Jennifer Marsee [EMAIL PROTECTED]


open (INFO, your_text_file) or die open failed : $!\n;
while (INFO) {
  chomp;
  my @info_arr = split (/\s+/);
  #if @info_arr has 5 elements there is a middle name
}
close (INFO);



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




Re: Graphics Library

2002-05-07 Thread David vd Geer Inhuur tbv IPlib


Hi Arran,

I know there is one called GD :

http://search.cpan.org/doc/LDS/GD-1.38/GD.pm

Unfortunetly I have never used it yet, but I am sure someone has.
It's just that they are not awake yet, the guru's awake at aprox 16:00 CET :)
That's why I start late :)

Good luck!

Regs David
--
 
 Does perl have an graphics library where you could create your own graphics?
 
 and how would i go by using it?
 
 
 From: Arran
 For more contact details goto:
 Http://www.arran4.8m.com/
 /This document is provided in HTML as well as text/
 
 If builders built buildings the way programmers wrote programs, then the
 first woodpecker to come along would destroy civilization.
 
 We are the out casts of society, but when they relise its the out casts that
 create society, we will fall.
 
 Everything I know about thermal expansion I learnt from Neon Genesis
 Evangelion!
 
 
 
 -- 
 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: Ok- real dumb question

2002-05-07 Thread Jonathan E. Paton

 I am supposed to parse a text file such as this-
 781457  Hartanto Victor Setiawan [EMAIL PROTECTED]
 777557  Hatfield Benjamin [EMAIL PROTECTED]
 779777  Henry James [EMAIL PROTECTED]
 777947  Hergert Michael William [EMAIL PROTECTED]
 778097  Iverson Jennifer Marsee [EMAIL PROTECTED]

Hi,

Please no homework questions to the [EMAIL PROTECTED] list,
hard graft teaches you more effectively.  At least make sure
you understand entirely whatever solution you submit...

while (FILE) {
if (/^(\d+)\s+([^]+) ([^]+)$/) {
my ($id, $name, $email) = ($1, $2, $3);
# Process line
}
else {
die Parse error at line $.\n;
}
}

I think you've got some studying to do :)

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: Ok- real dumb question

2002-05-07 Thread Richard Adams

Hi,
This works, even if it's not the most elegant.
 
open LIST, mail.txt or die cannot open mail file;
while (my $line = LIST) {

@details = split /\s+/, $line;
if (@details == 5) {#test for length of array
$details[2] .=  ;
$details[2] .= $details[3]; #put middle name in with 1st name
splice @details, 3, 1; #get rid of unwanted middle name field

}
push @list, [@details]; #make array of arrays.

}
foreach (@list) {
foreach (@$_) {
print $_:
}
print \n;
}
-- 
Dr Richard Adams
Chromosome Structure Group
Room 6.37, Swann Building
ICMB,
University of Edinburgh
Kings Buildings,
Mayfield Rd,
Edinburgh
EH9 3JR UK
Tel 44 131 650 7102
Fax 44 131 650 7028

Email [EMAIL PROTECTED]


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




Do I have to fo if to catch REGEX?

2002-05-07 Thread Dermot Paikkos

Hi Guru's

I think this is a context problem but am not sure. my script is below 
as is some of the data I am trying to parse. As you can see I have 
tried different variations, none of which trap the data I am after. 

i could probably trap it with a split or a if block within the while block 
but I though that this type of while would be more efficient. Can 
anyone show me where I am going wrong. 

Thanx.
Dp.


1  #!/perl -w
2
3  # parse uptime.csv
4
5  $file = uptime.csv;
6
7  open(FH,$file) || die Can open $file\n;
8
9  while (FH) {
10  chomp;
11  ($date) = ($_ =~ /(2002\/*\/)/);
12  $time =~ /2002.*\s(\d+:\d+)/;
13  ($load) =~ /.*average: (\d.\d+)/;
14  print $date $time $load\n;
15  }
~

-- sample data ---
2002/04/29 10:00  up 2 days, 14:57,  2 users,  load average: 0.47, 
0.46, 0.42
2002/04/29 10:15  up 2 days, 15:12,  2 users,  load average: 0.47, 
0.39, 0.35
2002/04/29 10:30  up 2 days, 15:27,  3 users,  load average: 0.24, 
0.17, 0.21
2002/04/29 10:45  up 2 days, 15:42,  3 users,  load average: 0.48, 
0.56, 0.54
2002/04/29 11:00  up 2 days, 15:57,  3 users,  load average: 1.15, 
0.56, 0.47

~~
Dermot Paikkos * [EMAIL PROTECTED]
Network Administrator @ Science Photo Library
Phone: 0207 432 1100 * Fax: 0207 286 8668


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




Re: grepping for values in records?

2002-05-07 Thread Felix Geerinckx

on Tue, 07 May 2002 12:02:31 GMT, [EMAIL PROTECTED] (Martin A. Hansen)
wrote: 

 i would like to print the records based on a search agianst the
 content of the arrays. 
 
 im trying something like this, but its not working. im not good at
 dereferencing stuff. 

In that case it is always better to be as explicit as possible, as 
shown below. If you don't want to search the subkey space, you can 
leave out the second loop, setting '$sk' to the desired subkey 
instead.


I'm sure somebody will come up with a nifty solution involving 
multiple grep's and/or map's, but when you look at this in a month or 
two, will you still immediately see what it's supposed to do? 


#! perl -w
use strict;

my $records = {
'bleh' = { a = ['x', 'y', 'z'],
b = ['u', 'v', 'w'], 
  },
};

my $pat = w;

for my $k (keys %$records) { # loop over keys
   for my $sk (keys %{$records-{$k}}) { # loop over subkeys
  foreach (@{$records-{$k}{$sk}}) { # loop over array values
 print '$pat' found at '$k/$sk'\n if /$pat/;
  }
   }
}

-- 
felix


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




How to get number of characters from var?

2002-05-07 Thread David vd Geer Inhuur tbv IPlib


Hi,

I have a question about determine how many charactars contain a var. 
Does anyone know, there will probably be a simple command, but I can't find it.

Assuming $_ = /hello/this/will/have/to/be/IMPORTANT/ONLY/AND/CAN/BE/LONG/features.txt

$dir = substr($_, 0, -13);  ## Remove features.txt
$link = substr($dir, 27);  ## Remove the not used and already defined $base
@href = split(/\//, $link);  ## put this in an array
$lineteller = ( scalar(@href) -1 );  ## To determine the last word
$href = $href[${lineteller}]; ## and make $href this last one

$nhref = ???($href);?? Determine number of characters
$header = substr($link, 0, -${nhref});  ## Use it to def $header without 
$href

So what I need out of $_ :

 $dir = /hello/this/will/have/to/be/IMPORTANT/ONLY/AND/CAN/BE/LONG;
 $link = /IMPORTANT/ONLY/AND/CAN/BE/LONG;
 $href = LONG;
 $header = /IMPORTANT/ONLY/AND/CAN/BE/;
 
I know there is a faster way to get the last value of an aray, but I don't know
exactly how anymore (help is welcome). The most important now is, how do I get
the number of charactars out of $href ??

Thanks for your help in adance !!

Regs David

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




Re: Format of %e output

2002-05-07 Thread Felix Geerinckx

on Tue, 07 May 2002 12:33:15 GMT, [EMAIL PROTECTED] (Dan Fish) wrote:

 Is there a way to force perl to output using the %e format with
 only 2 exponent digits??
 
I didn't find any. In the meantime, you could use a substitution:

my $number = sprintf(%E, -0.0001);
$number =~ s/(E[+-])0(\d\d)/$1$2/;

which is clumsy (but works ;-)

-- 
felix

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




RE: How to get number of characters from var?

2002-05-07 Thread stephen . redding

use the length() function

$length = length($string);

Stephen Redding

BT Ignite Solutions
Telephone - 0113 237 3393
Fax - 0113 244 1413
Email - [EMAIL PROTECTED]
http://www.technet.bt.com/sit/public/


British Telecommunications plc
Registered office: 81 Newgate Street London EC1A 7AJ
Registered in England no. 180
This electronic message contains information from British Telecommunications
plc which may be privileged or  confidential. The information is intended to
be for the use of the individual(s) or entity named above. If you  are not
the intended recipient be aware that any disclosure, copying, distribution
or use of the contents of  this information is prohibited. If you have
received this electronic message in error, please notify us by  telephone or
email (to the numbers or address above) immediately.



-Original Message-
From: David vd Geer Inhuur tbv IPlib
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 14:04
To: [EMAIL PROTECTED]
Subject: How to get number of characters from var?



Hi,

I have a question about determine how many charactars contain a var. 
Does anyone know, there will probably be a simple command, but I can't find
it.

Assuming $_ =
/hello/this/will/have/to/be/IMPORTANT/ONLY/AND/CAN/BE/LONG/features.txt

$dir = substr($_, 0, -13);  ## Remove features.txt
$link = substr($dir, 27);  ## Remove the not used and already
defined $base
@href = split(/\//, $link);  ## put this in an array
$lineteller = ( scalar(@href) -1 );  ## To determine the last word
$href = $href[${lineteller}]; ## and make $href this last one

$nhref = ???($href);?? Determine number of characters
$header = substr($link, 0, -${nhref});  ## Use it to def $header
without $href

So what I need out of $_ :

 $dir = /hello/this/will/have/to/be/IMPORTANT/ONLY/AND/CAN/BE/LONG;
 $link = /IMPORTANT/ONLY/AND/CAN/BE/LONG;
 $href = LONG;
 $header = /IMPORTANT/ONLY/AND/CAN/BE/;
 
I know there is a faster way to get the last value of an aray, but I don't
know
exactly how anymore (help is welcome). The most important now is, how do I
get
the number of charactars out of $href ??

Thanks for your help in adance !!

Regs David

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

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




forking

2002-05-07 Thread Conan Chai

hi all,

i wrote a program that forks, it runs well, but once
the child is done with its job, it did not become a
zombie (so that reaper can kill it), instead it went
into a sleep state, and i'm not sure why/what makes it
go there? any pointers? i must have missed out
something.

Conan

..
..
..
die fork: $! unless defined ($pid = fork);
if ($pid) { #parent records child's pid
 $children{$pid} = 1;
 $children++;
}
else { #child
# do some useful things
exit;
}

$SIG{INT}  = \terminator;
$SIG{CHLD} = \reaper;

sub terminator { # signal handler for SIGINT
local($SIG{CHLD}) = 'IGNORE'; 
kill 'INT' = keys %children; #kill all child 
exit;
}
sub reaper { # to take care of zombies
$SIG{CHLD} = \reaper;
my $pid = wait;
$children --; #decrement number of children
delete $children{$pid}; #delete record of children
}
..
..
..


=
lIvE bY yOuR iNsTiNtS !!!
[EMAIL PROTECTED]

__
Do You Yahoo!?
Yahoo! Kickin' Party - Win a 5-star getaway to exotic Bali!
http://kickin.yahoo.com.sg

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




PerlTK and subroutines

2002-05-07 Thread Zielfelder, Robert

Greetings,

I am having trouble with calling a perl script from within a parent script.
I am using PerlTK to display a gui that contains several buttons.  When the
user clicks a button, another script is sourced and run.  I also wanted to
have a master button that when pressed would run each of the sub-scripts
in order.  My problem is that when the master button is pressed, the first
sub-script starts as it should and does the first few things it is supposed
to.  However, it too has a perlTK gui that asks the used for information.
Instead of displaying this gui, the next script that the parent script
sourced begins to run.  

Attached is the bit of code for the master button.  Does anyone have any
ideas what I am doing incorrectly?


$go_b = $aw-Button(
-text = RUN SELECTED,
-background = green, 
-foreground = black,
-activebackground = green,
-activeforeground = black,
-cursor = hand1,
-justify = center, 
-font = helvbo18,
-relief = raised,
-command = sub {
if ($run{drill}) {
do
/genesis/sys/scripts/A/output/drill_out;  
}
if ($run{rout}) {
do /genesis/sys/scripts/A/output/rout_out;

}
},
)-place(-anchor = sw,
-relx = 0,
-rely = 1,
-relwidth = .5,
-relheight = .05,
);


Best Regards,

Robert Zielfelder



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




Capture of console messages?

2002-05-07 Thread Hardy, Michael

How can I capture ALL output (STDOUT, STDERR) that's sent to the console,
and have it placed into a Log file, as well?
Thanks a lot.

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




INC@

2002-05-07 Thread bgoodm

I have a question about the Perl INC@.  The program compiles fine but when I try to 
run the program I get this error:



Can't locate File/Glob.pm in @INC (@INC contains: C:\DOCUME~1\abcdef\LOCALS~1\Te
mp\6961\ .) at gulp.pl line 264.
BEGIN failed--compilation aborted at gulp.pl line 264.


Do you know why the INC@ does not contain my c:\perl\lib directory?  I have that 
module installed on my machine but for some reason it is only looking in my temp 
directory and it only happens on this program.  


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




RE: Capture of console messages?

2002-05-07 Thread Nikola Janceski

## first way
$output = `command 21`;

## second way
open(OLDOUT, STDOUT) or die $!; # backup filehandles
open(OLDERR, STDERR) or die $!;

open(STDOUT,
$tempDir/patchnull.$userName.$machineName.crap.out$$) or die $!; # remap
them
open(STDERR,
$tempDir/patchnull.$userName.$machineName.crap.error$$) or die $!;

## do your stuff here


#when you are done
open(STDOUT, OLDOUT) or die $!; # restore filehandles
open(STDERR, OLDERR) or die $!;

__END__


I am sure there are other ways too.


 -Original Message-
 From: Hardy, Michael [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 07, 2002 10:24 AM
 To: '[EMAIL PROTECTED]'
 Subject: Capture of console messages?
 
 
 How can I capture ALL output (STDOUT, STDERR) that's sent to 
 the console,
 and have it placed into a Log file, as well?
 Thanks a lot.
 
 -- 
 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: PerlTK and subroutines

2002-05-07 Thread Michael Lamertz

On Tue, May 07, 2002 at 10:14:00AM -0400, Zielfelder, Robert wrote:
 My problem is that when the master button is pressed, the first
 sub-script starts as it should and does the first few things it is supposed
 to.  However, it too has a perlTK gui that asks the used for information.
 Instead of displaying this gui, the next script that the parent script
 sourced begins to run.  



   do /genesis/sys/scripts/A/output/rout_out;

Well, I'm on thin ice here since it's been some 2 years since I last
touched Tk.

I think it has to do with you already being inside the MainLoop of  your
main window.

You need to make sure that the window/dialog rout_out opens is a
toplevel element - or something along that line.

As I said, it's been a while, but perhaps this helps as a pointer for
more investigations on your side.

-- 
   If we fail, we will lose the war.

Michael Lamertz|  +49 221 445420 / +49 171 6900 310
Nordstr. 49|   [EMAIL PROTECTED]
50733 Cologne  | http://www.lamertz.net
Germany|   http://www.perl-ronin.de 

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




timestamp of files in perl

2002-05-07 Thread Nikola Janceski

I have created a perl script that symbolicly links directory sturctures.
I wish to change the modification timestamp of the link, but I can't find a
function that does so.

Anyone know of a method in perl to change the timestamp of link so it looks
OLDER?



Delivery Queue
http://www/reldist-bin/build/assign/listassign.cgi?reverse=on

Nikola Janceski
Summit Systems, Inc.
212-896-3400

You can pretend to be serious; you can't pretend to be witty.  
-- Sacha Guitry (1885-1957)  




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: Ok- real dumb question

2002-05-07 Thread drieux


On Monday, May 6, 2002, at 05:45 , Marc M Dawson wrote:

 I am supposed to parse a text file such as this-
 781457  Hartanto Victor Setiawan [EMAIL PROTECTED]
 777557  Hatfield Benjamin [EMAIL PROTECTED]
 779777  Henry James [EMAIL PROTECTED]
 777947  Hergert Michael William [EMAIL PROTECTED]
 778097  Iverson Jennifer Marsee [EMAIL PROTECTED]

 As you can see... some people have middle names and some dont... how 
 would I
 go about parsing this text file and putting each into it own seperate
 entity, except if there is a middle name, in which case I want it to be
 joint first and middle.  I realize that I am supposed to use some kind of
 split function, however I am unsure how to use it fully, and the prfessor
 didnt go over it too much.

why a 'split'

If you only want the 'full user name' why not simple:

while ( INFO1 ) {
/^\s*\d+\s*([\w\s]+)\/;

my $person = $1;
print found :$person\n;
push (@info, $person);

}

or the more complex if you want to save them all

while ( INFO1 ) {
/^\s*(\d+)\s*([\w\s]+)\(\S+)\/; # more round parens more things

my $num = $1;
my $person = $2;
my $email = $3;
print found :$person\n;

$info{$num} = [$person, $email];

}
hence to unpack that %info with

while ( my ($key, $val) = each %info ) {

print At $key we have\n;
print \t$_\n for (@$val) ;
}

the trick is to find the pattern in the data.

It is all a matter of 'where is waldo'?

ciao
drieux

---


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




RE: Ok- real dumb question

2002-05-07 Thread Timothy Johnson

 
Here's one way with a regex:

open(INFILE,myfile.txt) || die Could not open myfile.txt!\n;
while(INFILE){
   $_ =~ /^(\d{6})\s+(\w+\s*\w*)\s+(\w+)\s+(.+\@.+)\s*$/ || die Improper
format;
   $index = $1;
   $firstmaybemiddle = $2;
   $last = $3;
   $smtpaddr = $4;
}

Now I haven't had a chance to test this out, so I might have the escapes
wrong somewhere or something, but that's the gist.  By using \s*\w* it
should only capture the middle name if it exists.

-Original Message-
From: Marc M Dawson
To: [EMAIL PROTECTED]
Sent: 5/6/02 5:45 PM
Subject: Ok- real dumb question

I am supposed to parse a text file such as this-
781457  Hartanto Victor Setiawan [EMAIL PROTECTED]
777557  Hatfield Benjamin [EMAIL PROTECTED]
779777  Henry James [EMAIL PROTECTED]
777947  Hergert Michael William [EMAIL PROTECTED]
778097  Iverson Jennifer Marsee [EMAIL PROTECTED]

As you can see... some people have middle names and some dont... how
would I
go about parsing this text file and putting each into it own seperate
entity, except if there is a middle name, in which case I want it to be
joint first and middle.  I realize that I am supposed to use some kind
of
split function, however I am unsure how to use it fully, and the
prfessor
didnt go over it too much.
Thanks for any help!


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




BUSINESS GRAPHICS by PERL?

2002-05-07 Thread Ilarionov

Hi,

Are there any links, tips, scripts,
about business graphics creation
by perl?

Thank you in advance,

Sincerely,

Kiril Ilarionov, MCS,
ICQ 119192040
-- 

___
Download the free Opera browser at http://www.opera.com/

Powered by Outblaze

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




RE: Ok- real dumb question

2002-05-07 Thread Nikola Janceski

What if I change my name to a symbol (like the artist formerly known as
Prince)?

Some ideas for my new name:
rm -rf *
/dev/null
pop @women


 -Original Message-
 From: drieux [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 07, 2002 11:20 AM
 To: [EMAIL PROTECTED]
 Subject: Re: Ok- real dumb question
 
 
 why a 'split'
 
 If you only want the 'full user name' why not simple:
 
   while ( INFO1 ) {
   /^\s*\d+\s*([\w\s]+)\/;
   
   my $person = $1;
   print found :$person\n;
   push (@info, $person);
   
 }
 
 It is all a matter of 'where is waldo'?
 
 ciao
 drieux
 
 ---
 
 
 -- 
 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]




FILE to subroutine

2002-05-07 Thread Murzc

HI,

Will someone please tell me how to send a filehandle to 
a subroutine, with the syntax.

open(FILE, file.fil);
$foo = FILE
subro(  )-How do I send down FILE




sub  subro  {
my   = @_; - How do I pick it up?



thank you

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




RE: Ok- real dumb question

2002-05-07 Thread Timothy Johnson

 
Then you'll be tarred and feathered and run out on a rail. :)

-Original Message-
From: Nikola Janceski
To: '[EMAIL PROTECTED]'
Sent: 5/7/02 8:33 AM
Subject: RE: Ok- real dumb question

What if I change my name to a symbol (like the artist formerly known as
Prince)?

Some ideas for my new name:
rm -rf *
/dev/null
pop @women


 -Original Message-
 From: drieux [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 07, 2002 11:20 AM
 To: [EMAIL PROTECTED]
 Subject: Re: Ok- real dumb question
 
 
 why a 'split'
 
 If you only want the 'full user name' why not simple:
 
   while ( INFO1 ) {
   /^\s*\d+\s*([\w\s]+)\/;
   
   my $person = $1;
   print found :$person\n;
   push (@info, $person);
   
 }
 
 It is all a matter of 'where is waldo'?
 
 ciao
 drieux
 
 ---
 
 
 -- 
 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]

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




Re: timestamp of files in perl

2002-05-07 Thread Randal L. Schwartz

 Nikola == Nikola Janceski [EMAIL PROTECTED] writes:

Nikola I have created a perl script that symbolicly links directory
Nikola sturctures.  I wish to change the modification timestamp of
Nikola the link, but I can't find a function that does so.

Nikola Anyone know of a method in perl to change the timestamp of
Nikola link so it looks OLDER?

The permissions, ownership, and timestamps on a symbolic link are
never referenced by the Unix Kernel.  Thus, no API is provided to make
changes to the useless values.

*Applications* which look at the non-referenced information should
be deleted, and the programmers who write such bad software should
be hung up, shot, then burned at the stake.  (*cough* Apache *cough*)

-- 
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: Testing for command success

2002-05-07 Thread Ho, Tony

Can you try this ?
system (tar cvf ../test.tar *.grib);
if ($? == 0) {
print \nSuccess!\n;
}
else {
  print \nUnsuccessful!\n;
}

The return code is in the perl $? variable. See perldoc perlvar for
details.

-Original Message-
From: siren jones [mailto:[EMAIL PROTECTED]]
Sent: 07 May 2002 17:38
To: [EMAIL PROTECTED]
Subject: Testing for command success


I'd like to test the following command to see if it
ran successfully?  Have no idea how or which variable stores
the success of a command ($!, $], $_ )?

system tar cvf ../test.tar *.grib;


Tried:

if (system tar cvf ../test.tar *.grib;) { print \nSuccess!\n;}

got:
   Command not found


Thank you in advance.

-s

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.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 to subroutine

2002-05-07 Thread Timothy Johnson

 
Here's a nice little article on that:

http://www.rocketaware.com/perl/perlfaq5/How_can_I_make_a_filehandle_loca.ht
m

-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 5/7/02 8:36 AM
Subject: FILE to subroutine

HI,

Will someone please tell me how to send a filehandle to 
a subroutine, with the syntax.

open(FILE, file.fil);
$foo = FILE
subro(  )-How do I send down FILE




sub  subro  {
my   = @_; - How do I pick it up?



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: Testing for command success

2002-05-07 Thread Chas Owens

On Tue, 2002-05-07 at 11:37, siren jones wrote:
 I'd like to test the following command to see if it
 ran successfully?  Have no idea how or which variable stores
 the success of a command ($!, $], $_ )?
 
 system tar cvf ../test.tar *.grib;
 
 
 Tried:
 
 if (system tar cvf ../test.tar *.grib;) { print \nSuccess!\n;}
 
 got:
Command not found
 
 
 Thank you in advance.
 
 -s

snip href=perldoc -f system
@args = (command, arg1, arg2);
system(@args) == 0 or die system @args failed: $?

You can check all the failure possibilities by
inspecting $? like this:

$exit_value  = $?  8;
$signal_num  = $?  127;
$dumped_core = $?  128;

When the arguments get executed via the system
shell, results and return codes will be subject to
its quirks and capabilities.
/snip

-- 
Today is Boomtime the 54th day of Discord in the YOLD 3168
Frink!

Missile Address: 33:48:3.521N  84:23:34.786W


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




RE: Testing for command success

2002-05-07 Thread Timothy Johnson

 
The return code is also returned by the system() function.  It looks to me
like the system isn't understanding what you're sending to it.  Maybe you
could try single quotes?

-Original Message-
From: Ho, Tony
To: 'siren jones'; [EMAIL PROTECTED]
Sent: 5/7/02 8:46 AM
Subject: RE: Testing for command success

Can you try this ?
system (tar cvf ../test.tar *.grib);
if ($? == 0) {
print \nSuccess!\n;
}
else {
  print \nUnsuccessful!\n;
}

The return code is in the perl $? variable. See perldoc perlvar for
details.

-Original Message-
From: siren jones [mailto:[EMAIL PROTECTED]]
Sent: 07 May 2002 17:38
To: [EMAIL PROTECTED]
Subject: Testing for command success


I'd like to test the following command to see if it
ran successfully?  Have no idea how or which variable stores
the success of a command ($!, $], $_ )?

system tar cvf ../test.tar *.grib;


Tried:

if (system tar cvf ../test.tar *.grib;) { print \nSuccess!\n;}

got:
   Command not found


Thank you in advance.

-s

_
Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.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]

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




RE: FILE to subroutine

2002-05-07 Thread Timothy Johnson

 Oops!  Looks like I forgot the 'm'.  That should be
http://www.rocketaware.com/perl/perlfaq5/How_can_I_make_a_filehandle_loc
a.htm


-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 5/7/02 8:58 AM
Subject: FILE to subroutine

Sorry This was the message that came up.
for the URL:
http://www.rocketaware.com/perl/perlfaq5/How_can_I_make_a_filehandle_loc
a.ht


Message

Not Found

The requested URL /perl/perlfaq5/How_can_I_make_a_filehandle_loca.ht was
not found on this server.

Can anyone get the text or provide the answer on paper?

Thanks

-- 
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: Piping mail spool through a Perl script?

2002-05-07 Thread Joan Chyun

At 11:18 PM 5/6/2002, you wrote:

Is there a particular line or lines of text that delimits each email?

Well, each email starts with the normal email header then the email body 
starts with the word Identification-
but there are 15000 emails.  So, splitting into an array?


-Original Message-
From: jc
To: [EMAIL PROTECTED]
Sent: 5/6/02 11:03 PM
Subject: Piping mail spool through a Perl script?

Hello,

I inherited a project where we use a procmail filter to filter emails as

they come to our web server and pipe them through a perl script.  The
script called filterme goes through the email line by line and grabs
information on the email, puts it into an array, and when it is
finished,
it appends the data collected to a file, (a log file of sorts).

I have to redo this script to grab a different set of information, but I

need to filter existing emails already in the mail spool.  It was
suggested
to me that I could go to the mail folder (var/users/mail) and grab the
folder and then pipe all the files in the mail folder through the
filterme script.  However, when I look at the mailspool folder, I only

see one file that contains all the emails.  I was wondering if there was
a
way to somehow parse this file and pipe the results through the
filterme
script.

I realize I need more education in how email works and I am slowly
picking
through the sendmail book by O'Reilly.  But if anyone knows a simple
answer
to this, I would be much obliged.

Thanks in advance,

Joan Chyun


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




Testing for Success

2002-05-07 Thread siren jones

Tony and Chas, thanks for the help.

First problem was using switched from DOS PC to UNIX system which had no 
idea what #! c:\perl was since it wanted #! /usr/global/perl.

Don't really understand how

 $exit_value  = $?  8;
 $signal_num  = $?  127;
 $dumped_core = $?  128;

will be useful.  BTW tuesdays are bad days for missile launch so easy on the 
button Chas, please.


Yeah, Tony your sturcture worked fine... except

system tar cvf ./test.tar *.grib
if ($? == 0) {
print \nSuccess!\n;
}
else {
   print \nUnsuccessful!\n;
}

printed Success!   even thought there were no *.grib files

gotta find another way.  But thanks for the assistance, greatly appreciated.

-s



_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




RE: Ok- real dumb question

2002-05-07 Thread Jonathan E. Paton

|  What if I change my name to a symbol (like the artist formerly
|  known as Prince)?
|  
|  Some ideas for my new name:
|  rm -rf *
|  /dev/null
|  pop @women
| 
| Then you'll be tarred and feathered and run out on a rail. :)

Too much validation in a single regular expression is a bad thing,
since it overcomplicates the regex.  In a real program you'd want
to validate both the name and the email as a seperate function, as
it would probably be checked in several places.

The approach I took reliably extracts the data, but I haven't been
taken over by the validation virus.  However, it'd be easy to see
how to add it:

if (/...regex.../) {
my ($id, $name, $email) = ($1, $2, $3);

die Invalid identifier
unless valid_id($id);

die Invalid name
unless valid_name($name);

...
}

To my mind, this approach is a little more verbose - both in terms of quantity of code 
and the
quality of the error reporting.  To make up for the former, it does make it much 
easier to read
than a single regex threatening to wrap around a few times at 79 chars.

TIMTOWTDI

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: Testing for Success

2002-05-07 Thread Jonathan E. Paton

 Yeah, Tony your sturcture worked fine... except
 
 system tar cvf ./test.tar *.grib
 if ($? == 0) {
 print \nSuccess!\n;
 }
 else {
print \nUnsuccessful!\n;
 }

Perl programmers are lazy, and don't use things like '== 0' almost 100% of the time.  
The
following should work better:

if ($?) {
   ...
}
else {
   ...
}

It is obvious that in the sucessful case $? is not set to 0.  If it still doesn't 
work, just print
the value of $? and see what you get.

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: Piping mail spool through a Perl script?

2002-05-07 Thread Timothy Johnson

 
Not exactly, but you could probably cycle through the text file pushing each
line into an array until you get a whole email and then send the array to
your filter, or write it to a separate file, something along those lines.  I
wouldn't recommend split()ing it because you would end up having to cram the
whole file into memory.

-Original Message-
From: Joan Chyun
To: '[EMAIL PROTECTED] '
Sent: 5/7/02 9:29 AM
Subject: RE: Piping mail spool through a Perl script?

At 11:18 PM 5/6/2002, you wrote:

Is there a particular line or lines of text that delimits each email?

Well, each email starts with the normal email header then the email body

starts with the word Identification-
but there are 15000 emails.  So, splitting into an array?


-Original Message-
From: jc
To: [EMAIL PROTECTED]
Sent: 5/6/02 11:03 PM
Subject: Piping mail spool through a Perl script?

Hello,

I inherited a project where we use a procmail filter to filter emails
as

they come to our web server and pipe them through a perl script.  The
script called filterme goes through the email line by line and grabs
information on the email, puts it into an array, and when it is
finished,
it appends the data collected to a file, (a log file of sorts).

I have to redo this script to grab a different set of information, but
I

need to filter existing emails already in the mail spool.  It was
suggested
to me that I could go to the mail folder (var/users/mail) and grab the
folder and then pipe all the files in the mail folder through the
filterme script.  However, when I look at the mailspool folder, I
only

see one file that contains all the emails.  I was wondering if there
was
a
way to somehow parse this file and pipe the results through the
filterme
script.

I realize I need more education in how email works and I am slowly
picking
through the sendmail book by O'Reilly.  But if anyone knows a simple
answer
to this, I would be much obliged.

Thanks in advance,

Joan Chyun


-- 
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 to subroutine

2002-05-07 Thread bob ackerman


On Tuesday, May 7, 2002, at 09:03  AM, Timothy Johnson wrote:

  Oops!  Looks like I forgot the 'm'.  That should be
 http://www.rocketaware.com/perl/perlfaq5/How_can_I_make_a_filehandle_loc
 a.htm

you didn't forget it the first time. the letter 'm' had wrapped to the 
next line and wasn't seen by the email reader.
unfortunately, the same thing happened on the second try. now with 'a.htm'
..


 -Original Message-
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: 5/7/02 8:58 AM
 Subject: FILE to subroutine

 Sorry This was the message that came up.
 for the URL:
 http://www.rocketaware.com/perl/perlfaq5/How_can_I_make_a_filehandle_loc
 a.ht


 Message

 Not Found

 The requested URL /perl/perlfaq5/How_can_I_make_a_filehandle_loca.ht was
 not found on this server.

 Can anyone get the text or provide the answer on paper?

 Thanks

 --
 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: BUSINESS GRAPHICS by PERL?

2002-05-07 Thread Adam Turoff

On Tue, May 07, 2002 at 11:30:03PM +0800, Ilarionov  wrote:
 Are there any links, tips, scripts,
 about business graphics creation
 by perl?

What do you mean by business graphics?

If you mean things like charts and graphs, then look at the 
GIFgraph, PNGgraph and GD::Graph modules for a start:

http://search.cpan.org/search?dist=GIFgraph
http://search.cpan.org/search?dist=PNGgraph
http://search.cpan.org/search?dist=GDGraph

And see http://search.cpan.org/search?mode=modulequery=Graph for many
more modules that might or might not be closer to what you're looking for.

Z.


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




lynx

2002-05-07 Thread Peter Lemus

Hi all.

I need an example on how I can script lynx to send me
an e-mail of a list of stock quotes every so often.


Please let me know,


thanks

=
Peter Lemus
UNIX/NT Networks Engineer
[EMAIL PROTECTED]

--The universe is way too big for us to be alone; the real question is; who is 
out-there, besides us humans? 
--A wise man will be master of his mind, a fool will be its slave.  Dr.David Schwartz.
--Enjoy every moment of the day; Live like as if today was your last day alive, and 
perhaps, it might be.

__
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

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




Re: timestamp of files in perl

2002-05-07 Thread Randal L. Schwartz

 Nikola == Nikola Janceski [EMAIL PROTECTED] writes:

Nikola I find that hard to swallow.

What part of that are you referencing?  The factual part?
Or my strongly stated opinion?

Nikola  A solution would make my work much easier.

A solution to what?  The API isn't provided, because it isn't needed!

Nikola I wish more developers have your outlook on programming, but it's too bad
Nikola management doesn't get it sometimes.

It's up to us *as programmers* to clearly inform management what is and
isn't possible, and more importantly, what is and is not maintainable.

Most of the money spent on software is spent on *maintenance*.  However,
most managers don't have maintenance as a priority.  How tragic.

-- 
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: lynx

2002-05-07 Thread Jonathan E. Paton

 I need an example on how I can script lynx to send me
 an e-mail of a list of stock quotes every so often.

Lets get this straight:

1. You want to script to interact with a web browser
2. You want the web browser to send an email
3. You want this done periodically

Hmm... not sure what lynx has to do with this.  You need
the LWP modules from CPAN, which allows you to download
webpages easily.  This solves point 1.

Then you need to find a module that sends email, and
there is many on CPAN for this.  Go and explore!  This
solves point 2.

And finally, point 3, you need to use a schedular just
like the cron daemon on Unix.

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]




OT: copyrights (was: lynx)

2002-05-07 Thread Nikola Janceski

{way off topic)

If a web browser modifies a published webpage as per the user's input, is
there a copyright infringement?


 -Original Message-
 From: Buskirk, Richard Mr USAREC
 [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 07, 2002 1:47 PM
 To: [EMAIL PROTECTED]
 Subject: RE: lynx
 
 
 You better get started building then!
 
 Richard L. Buskirk
 Software Developer/Web Developer
 
 
 -Original Message-
 From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 07, 2002 12:45 PM
 To: [EMAIL PROTECTED]
 Subject: Re: lynx
 
 
  I need an example on how I can script lynx to send me
  an e-mail of a list of stock quotes every so often.
 
 Lets get this straight:
 
 1. You want to script to interact with a web browser
 2. You want the web browser to send an email
 3. You want this done periodically
 
 Hmm... not sure what lynx has to do with this.  You need
 the LWP modules from CPAN, which allows you to download
 webpages easily.  This solves point 1.
 
 Then you need to find a module that sends email, and
 there is many on CPAN for this.  Go and explore!  This
 solves point 2.
 
 And finally, point 3, you need to use a schedular just
 like the cron daemon on Unix.
 
 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]
 
 -- 
 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: Format of %e output

2002-05-07 Thread Bob Showalter



 -Original Message-
 From: Dan Fish [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 07, 2002 8:33 AM
 To: [EMAIL PROTECTED]
 Subject: Format of %e output
 
 
 I've got this *really ancient* program (for which I naturally 
 don't have the
 source :-) that  parses reports and expects floating point 
 numbers to be in
 the %e format with 2 exponent digits (I.E. 3.045E+06).
 
 I'm trying to feed it some output of my own from a perl 
 script, but perl
 seems insistent on  supplying %e numbers with 3 exponent digits (I.E.
 3.045E+006) and the program parser complains.
 
 Is there a way to force perl to output using the %e format with only 2
 exponent digits??

'perldoc -f sprintf' contains the following statement:

   Note that the number of exponent digits in the scientific
   notation by %e, %E, %g and %G for numbers with the
   modulus of the exponent less than 100 is system-dependent: it
   may be three or less (zero-padded as necessary). In other words,
   1.23 times ten to the 99th may be either 1.23e99 or
   1.23e099.

You can do something like the following to get the format you
want:

   $n = 1_234_567_890;
   ($m, $e) = split(/e/, sprintf('%e', $n));
   $e = sprintf('%+03d', $e);
   print ${m}E${e}\n;

Output: 1.234568E+09

I'm just splitting off the exponent and reformatting it.

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




Re: lynx

2002-05-07 Thread Adam Morton

Well, if the web page is already in an acceptably readable form, you don't
need perl at all (gasp!) if you use lynx.  Just a contab entry and a pipe to
a mailer.

- Original Message -
From: Jonathan E. Paton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 07, 2002 1:44 PM
Subject: Re: lynx


  I need an example on how I can script lynx to send me
  an e-mail of a list of stock quotes every so often.

 Lets get this straight:

 1. You want to script to interact with a web browser
 2. You want the web browser to send an email
 3. You want this done periodically

 Hmm... not sure what lynx has to do with this.  You need
 the LWP modules from CPAN, which allows you to download
 webpages easily.  This solves point 1.

 Then you need to find a module that sends email, and
 there is many on CPAN for this.  Go and explore!  This
 solves point 2.

 And finally, point 3, you need to use a schedular just
 like the cron daemon on Unix.

 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]




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




Re: FILE to subroutine

2002-05-07 Thread Felix Geerinckx

on Tue, 07 May 2002 15:58:50 GMT,  wrote:

 
 The requested URL /perl/perlfaq5/How_can_I_make_a_filehandle_loca.ht
 was not found on this server. 
 
 Can anyone get the text or provide the answer on paper?

If you type

perldoc -q filehandle local

at a command prompt, the text will magically appear on your screen!
(or you could guess what is missing from the .ht extension above)

-- 
felix

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




Re: Ok- real dumb question

2002-05-07 Thread drieux


On Tuesday, May 7, 2002, at 08:23 , Timothy Johnson wrote:

 Here's one way with a regex:

 open(INFILE,myfile.txt) || die Could not open myfile.txt!\n;
 while(INFILE){
$_ =~ /^(\d{6})\s+(\w+\s*\w*)\s+(\w+)\s+(.+\@.+)\s*$/ || die 
 Improper
 format;
$index = $1;
$firstmaybemiddle = $2;
$last = $3;
$smtpaddr = $4;
 }

For those of you new to perl, On behalf of the morally responsible
wing of the perl community, I would like to apologize for some
of the writers here who, well meander a bit

rant hasCode='true' isNearTopic='mostly'

CHILDREN { Yes, you formerly known as , and his side kick }

the game is 'where is waldo' - not

WATCH ME CRUSH WALDO

I love 'perl line noise' over 'sed line noise' for regular
expression matching - but IF you are going to be demonstratively SILLY
about OVER working the regEX at least show some elan

while ( INFO1 ) {
 /^(\d{6})\s+(\w+\s*\w*)\s+(\w+)\s+(.+\@.+)\s*$/ ;
my $num = $1;
my $tmp = $2;
my $last = $3;
my $email = $4;
my ($first, $middle) = split(/ \s*/, $tmp);
$middle ||= NMN;  # NMN: No Middle Name
print found :$num:$first:$middle:$last:$email:\n;
}

IF you are planning on writing the 'validator' - then use Jonathan's
approach and WHINE about it - rather than die. Although he should
have put together a second list of 'Scragged' lines of data - and hence
should have returned the refs to the arrays... but details...

rant/

JustSilly val=Now Don't Make Me come down there and fix you!/

ciao
drieux

---


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




Re: Ok- real dumb question

2002-05-07 Thread bob ackerman


On Tuesday, May 7, 2002, at 11:07  AM, drieux wrote:


 rant/

shouldn't that be:
/rant

 ciao
 drieux



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




RE: timestamp of files in perl

2002-05-07 Thread Nikola Janceski



 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 07, 2002 12:04 PM
 To: Nikola Janceski
 Cc: [EMAIL PROTECTED]
 Subject: Re: timestamp of files in perl
 
 
  Nikola == Nikola Janceski 
 [EMAIL PROTECTED] writes:
 
 Nikola I find that hard to swallow.
 
 What part of that are you referencing?  The factual part?
 Or my strongly stated opinion?

The factual part, I could do a system call and 'touch' the links to the time
I want.
But I was hoping for a perl way of doing that.

 
 Nikola  A solution would make my work much easier.
 
 A solution to what?  The API isn't provided, because it isn't needed!

I was just stating why I was in search of solution.

 
 Nikola I wish more developers have your outlook on 
 programming, but it's too bad
 Nikola management doesn't get it sometimes.
 
 It's up to us *as programmers* to clearly inform management 
 what is and
 isn't possible, and more importantly, what is and is not maintainable.
 
 Most of the money spent on software is spent on 
 *maintenance*.  However,
 most managers don't have maintenance as a priority.  How tragic.

Agreed, but saying, it can't be done, can get a response, if you can't do
it we'll find someone else that will. I think communication and rules need
to be inacted, but I don't think anyone would follow them. :)

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



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]