Flushing output buffer under mod_perl

2006-07-10 Thread Ibrahim Dawud

Hello,

The following code works great using normal perl but does not work
under mod_perl:

#!/usr/bin/perl

use CGI;
my $cgi = new CGI;
print $cgi-header();
print $cgi-start_html();
$| = 1;
print $cgi-h2(test1);
sleep 1;
$| = 1;
print $cgi-h2(test2);
sleep 1;
$| = 1;
print $cgi-h2(test3);
print $cgi-end_html();

The purpose of the code is print periodic messages to the browser
during long processing. Can someone please explain or show an example
of how I can flush the output buffer when running the same code under
mod_perl. According to my understanding, I have to do this at the
level of the Apache API using rflush. The problem is that I don't know
how to write such a handler and even if i did, i don't know how to
call it into my existing CGI code in place of $|=1.

Suggestions are highly appreciated.

Thanks

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Flushing output buffer under mod_perl

2006-07-10 Thread Mr. Shawn H. Corey
Ibrahim Dawud wrote:
 Hello,
 
 The following code works great using normal perl but does not work
 under mod_perl:
 
 #!/usr/bin/perl
 
 use CGI;
 my $cgi = new CGI;
 print $cgi-header();
 print $cgi-start_html();
 $| = 1;
 print $cgi-h2(test1);
 sleep 1;
 $| = 1;
 print $cgi-h2(test2);
 sleep 1;
 $| = 1;
 print $cgi-h2(test3);
 print $cgi-end_html();
 
 The purpose of the code is print periodic messages to the browser
 during long processing. Can someone please explain or show an example
 of how I can flush the output buffer when running the same code under
 mod_perl. According to my understanding, I have to do this at the
 level of the Apache API using rflush. The problem is that I don't know
 how to write such a handler and even if i did, i don't know how to
 call it into my existing CGI code in place of $|=1.
 
 Suggestions are highly appreciated.
 
 Thanks
 

$| sets autoflush for the selected filehandle, default is STDOUT. You
need only set it once, before any output.

See:
  perldoc -q flush
  perldoc perlvar (and search for $|)
  perldoc IO::handle


-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

For the things we have to learn before we can do them, we learn by
doing them.
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Flushing output buffer under mod_perl

2006-07-10 Thread Mr. Shawn H. Corey
Mr. Shawn H. Corey wrote:
 Ibrahim Dawud wrote:
 
Hello,

The following code works great using normal perl but does not work
under mod_perl:


Oops, I overlooked the fact that you are using mod_perl. I haven't use
it for years but I seem to recall that STDOUT is redirected to the
socket. If that is the case (check your reference manual for mod_perl)
you would have to use the socket flush method. See `perldoc Socket` and
`perldoc IO::Socket` for details.

Also note that some web servers disable setting autoflush on their
sockets. This is because they may be handling more than one request at a
time and sending full buffers is more efficient.


-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

For the things we have to learn before we can do them, we learn by
doing them.
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




error message

2006-07-10 Thread Geetha Weerasooriya
Dear All,
 
In my perl code for MapMatching, I have following while loop. When I run
the program I get the following two error messages(for each data line in
the data file)
But the out put file is created.
 
Use of uninitialized value in int at filename.pl lineNo, DATA line ..
Use of unititialized value in multiplication(*) at filename.pl lineNo,
DATA line ..
 
The errors refer to the lines  in bold in the code
 
Can you please  teach me where the error is?
 
Kind regards,
 
Geetha
 
 
 
while(DATA)  {
chop;
s/\s//g;
 
/\d+\/\d+\/\d+,\d+:\d+:\d+,\d+,(\d+\.*\d*),(\d+\.*\d*),\d+,\d+,\d+,\d+\.
*\d*,\d+$/
or die Error in mtchSq2Route.pl! bad format in
SQ record.\n$_\n;
$lngi_bgn = $1;
$lati_bgn = $2;
   
 my ($rt1,$dist1,$pos1) = getFootPointDistToRoot($lngi_bgn,
$lati_bgn);

 $pos1 = int($pos1);
 $dist1 = int($dist1*100)/100;
  
print $_,$rt1-{ID},$pos1,$dist1\n;
 


Re: error message

2006-07-10 Thread Owen Cook

On Mon, 10 Jul 2006, Geetha Weerasooriya wrote:
  
 In my perl code for MapMatching, I have following while loop. When I run
 the program I get the following two error messages(for each data line in
 the data file)
 But the out put file is created.
  
 Use of uninitialized value in int at filename.pl lineNo, DATA line ..
 Use of unititialized value in multiplication(*) at filename.pl lineNo,
 DATA line ..


You don't show the data under __DATA__ but I suspect that you will find
that the program is reading a blank line.

Put your program in a text editor, go to the bottom of the file and
backspace to the last character in data, then save it

I think they are warnings and more annoying than anything else



  
 The errors refer to the lines  in bold in the code


Can't read bold in Pine!  



 Can you please  teach me where the error is?
  



  
  
 while(DATA)  {
 chop;

try chomp; there


 s/\s//g;
  
 /\d+\/\d+\/\d+,\d+:\d+:\d+,\d+,(\d+\.*\d*),(\d+\.*\d*),\d+,\d+,\d+,\d+\.
 *\d*,\d+$/
 or die Error in mtchSq2Route.pl! bad format in
 SQ record.\n$_\n;
 $lngi_bgn = $1;
 $lati_bgn = $2;

  my ($rt1,$dist1,$pos1) = getFootPointDistToRoot($lngi_bgn,
 $lati_bgn);
 
  $pos1 = int($pos1);
  $dist1 = int($dist1*100)/100;
   
 print $_,$rt1-{ID},$pos1,$dist1\n;
  
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




error message

2006-07-10 Thread Geetha Weerasooriya
Dear All,
 
In my perl code for MapMatching, I have following while loop. When I run
the program I get the following two error messages(for each data line in
the data file)
But the out put file is created.
 
Use of uninitialized value in int at filename.pl lineNo, DATA line ..
Use of unititialized value in multiplication(*) at filename.pl lineNo,
DATA line ..
 
The errors refer to the lines  in bold in the code
 
Can you please  teach me where the error is?
 
Kind regards,
 
Geetha
 
 
 
while(DATA)  {
chop;
s/\s//g;
 
/\d+\/\d+\/\d+,\d+:\d+:\d+,\d+,(\d+\.*\d*),(\d+\.*\d*),\d+,\d+,\d+,\d+\.
*\d*,\d+$/
or die Error in mtchSq2Route.pl! bad format in
SQ record.\n$_\n;
$lngi_bgn = $1;
$lati_bgn = $2;
   
 my ($rt1,$dist1,$pos1) = getFootPointDistToRoot($lngi_bgn,
$lati_bgn);

 $pos1 = int($pos1);
 $dist1 = int($dist1*100)/100;
  
print $_,$rt-{ID},$pos1,$dist1\n;
 


Re: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread Rob Dixon

Alan_C wrote:
 [ . . ]

 Hi,

 my @new = grep /[^.]/, readdir DIR;

 (on Linux I tried it) that eliminates . and .. from the catch.

 *But the next code prints all 8 lines of data it does not eliminate . and ..
 from the catch, print*

 Isn't that a character class that says not a dot

 So, why the difference (readdir line above versus the next code)?  Is it a
 difference of list context (the grep) versus scalar context (ea. line of DATA
 is a string) ???

 #!/usr/bin/perl
 use strict;
 use warnings;

 while ( DATA ) {
 print if /[^.]/;
 #print $_\n if grep /[^.]/, $_;
 #print unless /\./;
 #print if /star/;
 }
 __DATA__
 star.txt
 things
 .dotfile
 aft
 .
 ..
 filename.htm
 stuff

Hi Alan

Your code doesn't filter out any of the lines because they still contain the
line terminator \n from the read, which will match /[^.]/. Changing the loop
to:

  while ( DATA ) {
chomp;
print $_\n if /[^.]/;
  }

will give the results you expect. The chomp was unnecessary in the previous case
becuase readdir() returns the actual filenames without any line terminator.

By the way, Randal has pointed out in a private mail that my construct is
unworkable because it filters out the possibly valid filename '...' as well as
the current and parent directory names '.' and '..'. I will leave it to you to
decide whether you think this is a risk worth taking.

HTH,

Rob




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: error message

2006-07-10 Thread Rob Dixon

Geetha Weerasooriya wrote:

 In my perl code for MapMatching, I have following while loop. When I run
 the program I get the following two error messages(for each data line in
 the data file)
 But the out put file is created.

 Use of uninitialized value in int at filename.pl lineNo, DATA line ..
 Use of unititialized value in multiplication(*) at filename.pl lineNo,
 DATA line ..

 The errors refer to the lines  in bold in the code

 Can you please  teach me where the error is?

 Kind regards,

 Geetha



 while(DATA)  {
 chop;
 s/\s//g;

 /\d+\/\d+\/\d+,\d+:\d+:\d+,\d+,(\d+\.*\d*),(\d+\.*\d*),\d+,\d+,\d+,\d+\.
 *\d*,\d+$/
 or die Error in mtchSq2Route.pl! bad format in
 SQ record.\n$_\n;
 $lngi_bgn = $1;
 $lati_bgn = $2;

  my ($rt1,$dist1,$pos1) = getFootPointDistToRoot($lngi_bgn,
 $lati_bgn);

  $pos1 = int($pos1);
  $dist1 = int($dist1*100)/100;

 print $_,$rt1-{ID},$pos1,$dist1\n;

Hello Geetha

Don't forget that we can't see bold emphasis on the mailing list: the posts are
converted to plain text by the server. But your errors must be on the lines

   $pos1 = int($pos1);
   $dist1 = int($dist1*100)/100;

and are because $pos1 and $dist1 are undefined, so you should look at function
getFootPointDistToRoot() which is returning this value. Despite the warnings,
the undefined variables will evaluate as zero and so may be giving you the
results you expect. Nevertheless these should clearly be numeric values and
either the function needs correcting or, if you have no access to make changes
there, the returned values should be explicitly forced to zero with

  $pos1 != '0';
  $dist1 != '0';

But please do this as a last resort and be sure that it is what you mean.

HTH,

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Which line?

2006-07-10 Thread John W. Krahn
Ryan Dillinger wrote:
 Hello,

Hello,

 I have a script here, I have been going over and over.
 Every time I run it I get several errors, and I have tried to fix them
 to no avail.
 Can someone tell me what line I missed, please?
 Thanks for your help!
 
 #!usr/bin/perl
 use warnings;
 use strict;
 
 %names = ();
 @raw = ();
 $fn = ;
 $in = '';
 @keys = ();
 @n = ();
 $search = '';

Because of the strict pragma you have to declare your variables before using
them.  Also the only variable you need at this scope is %names.


 while () {
chomp;
@raw = split( , $_);
if ($#raw == 1) { # regular case
   $names{$raw[1]} = $raw[0];
} else {  # build a first names
   $fn = ;
   for ($i = 0; $i  $#raw; $i++) {
  $fn .= $raw[$i] .  ;
  }
  $names{$raw[$#raw]} = $fn;
 }
 }

That is way too complicated.  :-)

my %names;
while (  ) {
my @raw = split;
$names{ $raw[ -1 ] } = @raw[ 0 .. $#raw - 1 ];
}

But that still has the same two problems that the original does, if the input
line has zero or one field and if you have two or more lines with the same
last name.


 while () {
 print \n1. Sort names by last name\n;
 print 2. Sort names by first name\n;
 print 3. Search for a name\n;
 print 4. Quit\n\n;
 print Choose a number: ;

  chomp( my $in = STDIN );


 if ($in eq '1') {
foreach $name (sort keys %names) {

 foreach my $name ( sort keys %names ) {


   print $name, $names{$name}\n;
}
 
  } elsif ($in eq '2') {
 @keys = sort { $names{$a} cmp $names{$b} } keys %names;

  my @keys = sort { $names{$a} cmp $names{$b} } keys %names;


 foreach $name (@keys) {

  foreach my $name ( @keys ) {


print $names{$name} $name\n;
 }
 } elsif ($in eq '3') {
  print Search for what? ;
  chomp($search = STDIN);

   chomp( my $search = STDIN );

   my @keys;

Because you had @keys in file scope if you ran menu item '2' and then menu
item '3' the @keys array would have the left-over values from menu '2' and
would print out the complete list no matters what was in $search.


  while (@n = each %names) {

   while ( my @n = each %names ) {


   if (grep /$search/, @n) {
 $keys[++$#keys] = $n[0];

  push @keys, $n[ 0 ];


}
  }
 if (@keys) {
   print Names matched: \n;
   foreach $name (sort @keys) {

foreach my $name ( sort @keys ) {


  print$names{$name} $name\n;
   }
   } else {
   print None found.\n;
   }
 
   @keys = ();

Not required with the my @keys; line above.


 } elsif ($in eq '4') {#quit
last;
 } else {
print Not a good answer. 1 to 4 please.\n;
 }
 }


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




How to use Perl for API testing

2006-07-10 Thread Suja Emmanuel

Hi,

I want to use PERL for API testing, i.e., I want to call
different URLs through the browser. How much is possin




The information contained in, or attached to, this e-mail, contains 
confidential information and is intended solely for the use of the individual 
or entity to whom they are addressed and is subject to legal privilege. If you 
have received this e-mail in error you should notify the sender immediately by 
reply e-mail, delete the message from your system and notify your system 
manager. Please do not copy it for any purpose, or disclose its contents to any 
other person. The views or opinions presented in this e-mail are solely those 
of the author and do not necessarily represent those of the company. The 
recipient should check this e-mail and any attachments for the presence of 
viruses. The company accepts no liability for any damage caused, directly or 
indirectly, by any virus transmitted in this email.

www.aztecsoft.com

backslash on windows

2006-07-10 Thread Mahdi A Sbeih

Hello all,

I am testing a perl script on windows platforms, but i am facing an 
issue with the path using \ such as:


myscript.pl -cfg D:\users\config.txt

inside the script, when capturing the config file mentioned above, the 
\ is treated as escape character.



How can i get around this problem?


Thanks,
Mahdi.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




nohup using perl

2006-07-10 Thread Mahdi A Sbeih

Hi all,

I am porting a shell script written in korn shell to perl, and i want to 
see what is the best way to port the nohup shell command in perl, 
anyone knows?



Thanks,
Mahdi.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: nohup using perl

2006-07-10 Thread Jeff Peng

Hello,

It's so easy to simulate 'nohup' command in perl script.Usually you just 
fork a child,then parent die,go into child,call setsid to get child become 
the session leader,re-open the STDIN,STDOUT,STDERR to a null device (for 
example '/dev/null'),last call 'exec' or 'system' to do the things for you.

The sample codes are shown as follow:

   use strict;
   use POSIX qw/setsid/;
   my $pid = fork();
   die can't fork: $! unless defined $pid;
   exit 0 if $pid;
   setsid();
   open (STDIN, /dev/null);
   open (STDOUT, /dev/null);
   open (STDERR,STDOUT);
   exec some_system_command;



and i want to see what is the best way to port the nohup shell command in 
perl, anyone knows?




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: How to use Perl for API testing

2006-07-10 Thread Jeff Peng

Have you took a look at CPAN?for example,LWP::UserAgent.




I want to use PERL for API testing, i.e., I want to call
different URLs through the browser. How much is possin





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: backslash on windows

2006-07-10 Thread Mr. Shawn H. Corey
Mahdi A Sbeih wrote:
 Hello all,
 
 I am testing a perl script on windows platforms, but i am facing an
 issue with the path using \ such as:
 
 myscript.pl -cfg D:\users\config.txt
 
 inside the script, when capturing the config file mentioned above, the
 \ is treated as escape character.


No, the backslash is not an escape character inside a string, it's an
escape character for string literals. String literals are the thingies
inside quotes:

  this is a string literal
  'this is a string literal'
  qq(this is a string literal)

Once inside a string, the backslash character is only the backslash
character (unless you're using the sting as a regular expression).


-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

For the things we have to learn before we can do them, we learn by
doing them.
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: nohup using perl

2006-07-10 Thread Prabu

Hello Mahdi,

I Don't know whether this is your requirement.But you can run the nohup 
command using system() in perl.


system(nohup YourCommand);

Sorry,if this is not what you expected.

--
Prabu.M.A
When I was born I was so surprised
I didnt talk for a period and half
 -Gracie Allen


Mahdi A Sbeih wrote:

Hi all,

I am porting a shell script written in korn shell to perl, and i want 
to see what is the best way to port the nohup shell command in perl, 
anyone knows?



Thanks,
Mahdi.






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: How to use Perl for API testing

2006-07-10 Thread Matt Johnson

You might want to consider
Test::WWW::Mechanize http://search.cpan.org/author/PETDANCE/Test-WWW- 
Mechanize-1.12/Mechanize.pm
or WWW-Mechanize http://search.cpan.org/~petdance/WWW-Mechanize-1.18/ 
lib/WWW/Mechanize.pm


-- MattJ


On Jul 9, 2006, at 10:13 PM, Suja Emmanuel wrote:



Hi,

I want to use PERL for API testing, i.e., I want to call
different URLs through the browser. How much is possin




The information contained in, or attached to, this e-mail, contains  
confidential information and is intended solely for the use of the  
individual or entity to whom they are addressed and is subject to  
legal privilege. If you have received this e-mail in error you  
should notify the sender immediately by reply e-mail, delete the  
message from your system and notify your system manager. Please do  
not copy it for any purpose, or disclose its contents to any other  
person. The views or opinions presented in this e-mail are solely  
those of the author and do not necessarily represent those of the  
company. The recipient should check this e-mail and any attachments  
for the presence of viruses. The company accepts no liability for  
any damage caused, directly or indirectly, by any virus transmitted  
in this email.


www.aztecsoft.com



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: error message

2006-07-10 Thread Dr.Ruud
Geetha Weerasooriya schreef:

 while(DATA)  {
 chop;

You must hate DOS.

 s/\s//g;

That already removes any CR or LF, so no chomp (or chop) was necessary.

-- 
Affijn, Ruud

Gewoon is een tijger.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




regex and parsing config file directives..

2006-07-10 Thread Gregory Machin

Hi
I'm writing a script to pass a config file and put the values in a hash,
with the key being the directive and the value bing the options,
but some directives don't have options, so in that case i want to store the
directive as the value so that for completeness..

i'm using the follwing regex /(.+)[\s+\n](.+)/where $1 is the directive
and $2 is the option for the directive

user nobody
group nobody
persist-key
persist-tun

this is the logic that is suposed to do the work.
if ($_ =~ /^persist-key/){ /(.+)[\s+\n](.+)/ ; if ( $2 == '' ) { $_ = $1} ;
$directive{persist_key} = $_; }

but I still end up with an empty field ...

Any ideas..


--
Gregory Machin
[EMAIL PROTECTED]
www.linuxpro.co.za


Re: regex and parsing config file directives..

2006-07-10 Thread Mr. Shawn H. Corey
Gregory Machin wrote:
 Hi
 I'm writing a script to pass a config file and put the values in a hash,
 with the key being the directive and the value bing the options,
 but some directives don't have options, so in that case i want to store the
 directive as the value so that for completeness..
 
 i'm using the follwing regex /(.+)[\s+\n](.+)/where $1 is the directive
 and $2 is the option for the directive
 
 user nobody
 group nobody
 persist-key
 persist-tun
 
 this is the logic that is suposed to do the work.
 if ($_ =~ /^persist-key/){ /(.+)[\s+\n](.+)/ ; if ( $2 == '' ) { $_ = $1} ;

The contents of $2 is undef if the match fails. Try:
  { /(.+)\s+(.+)/; $_ = $1 unless $2; }


 $directive{persist_key} = $_; }
 
 but I still end up with an empty field ...
 
 Any ideas..
 
 


-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

For the things we have to learn before we can do them, we learn by
doing them.
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




excel conditional format

2006-07-10 Thread Ed Panni
Hi,  This is my first post and I am not really a highly skilled
programmer . I just hack some..

 

Anyway I have written a script in perl to use OLE and scan some
performance log files that I created and place them into an excel spread
sheet and do performance comparisons. I have gotten most of the stuff to
work but am trying to set up a conditional formatted cell to be green if
it is = 2% and red if it is =2%. 

 

I have trolled examples and don't see anything that points me in the
right direction. 

 

I have attached the portion of the script that sets up my spreadsheet. I
have been able to make the text turn red if it is less than the
comparison number. However, like I stated above I want a conditional
format of the cell for the +-2% change

 

Any help would be appreciated

 

 

Regards,

 

Ed Panni

 

# Setup spreadsheet 

 

$column = 'A';

# Set column with for Column A

$ex-Columns($column:$column)-{'ColumnWidth'} = 26.0;

# Change to Arial Font

$ex-Range($column:$column)-Font-{'Name'} = Arial;

# Size 8 

$ex-Range($column:$column)-Font-{'Size'} = 8;

 

$column = 'B';

# Set column with for Column B

$ex-Columns($column:$column)-{'ColumnWidth'} = 13.0;

# Change to Arial Font

$ex-Range($column:$column)-Font-{'Name'} = Arial;

# Size 8 

$ex-Range($column:$column)-Font-{'Size'} = 8;

# Color Column

# $ex-Range($column:$column)-Interior-{ColorIndex} = 36; # 36
== LtYelllow

# set data format

$ex-Range($column:$column)-{'NumberFormat'} = 0.00;

 

$column = 'C';

# Set column with for Column C

$ex-Columns($column:$column)-{'ColumnWidth'} = 8.43;

# Change to Arial Font

$ex-Range($column:$column)-Font-{'Name'} = Arial;

# Size 8 

$ex-Range($column:$column)-Font-{'Size'} = 8;

# Color Column

$ex-Range($column:$column)-Interior-{ColorIndex} = 15; # 15 ==
LtGrey

# set percentage Color and format

$ex-Range($column:$column)-{'NumberFormat'} =
0.00%;[Red]0.00%;

#$ex-Range($column:$column)-{'NumberFormat'} =
[Green]0.00%;0.00%;

#$ex-Range($column:$column)-Borders-{'Style'} = 2;

 

$column = D;

# Set column with for Column D

$ex-Columns($column:$column)-{'ColumnWidth'} = 13.0;

# Change to Arial Font

$ex-Range($column:$column)-Font-{'Name'} = Arial;

# Size 8 

$ex-Range($column:$column)-Font-{'Size'} = 8;

# Set the Font color of the Data Column to blue

#$ex-Columns($column:$column)-Font-{'ColorIndex'} = 5;

# Color Column

#$ex-Range($column:$column)-Interior-{ColorIndex} = 40; # 6 ==
yellow

# set data format

$ex-Range($column:$column)-{'NumberFormat'} = 0.00;



Re: regex and parsing config file directives..

2006-07-10 Thread Mumia W.

Gregory Machin wrote:

Hi
I'm writing a script to pass a config file and put the values in a hash,
with the key being the directive and the value bing the options,
but some directives don't have options, so in that case i want to store the
directive as the value so that for completeness..

i'm using the follwing regex /(.+)[\s+\n](.+)/where $1 is the directive


What is the purpose of \n?


and $2 is the option for the directive

user nobody
group nobody
persist-key
persist-tun

this is the logic that is suposed to do the work.
if ($_ =~ /^persist-key/){ /(.+)[\s+\n](.+)/ ; if ( $2 == '' ) { $_ = $1} ;

 $directive{persist_key} = $_; }

You should always test if the match operator succeeded before you use $1 
and $2, or you'll get incorrect results sometimes. Also, the '==' 
operator is for numbers; use 'eq' for strings.


if ($_ =~ /^persist-key/) {
if (/(.+)[\s+\n](.+)/) {
if ( $2 eq '' ) { $_ = $1 }
}
$directive{persist_key} = $_;
}



but I still end up with an empty field ...

Any ideas..




Yes, try this:

if (m/^([\w-]+)(?: +(.*))?$/) {
$directive{$1} = $2 || $1;
}




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread Randal L. Schwartz
 Rob == Rob Dixon [EMAIL PROTECTED] writes:

Robmy @new = grep /[^.]/, readdir DIR;

This is still the wrong regex.  While it's narrow enough for windows, it will
*break* on Unix.  No reason not to do the right thing here:

grep { $_ ne . and $_ ne .. } readdir DIR;

Rob, I'm surprised you still posted this even after our private email
exchange.  You were *told* in email that this regex is broken.

Therefore, I will warn others to please discount Rob's postings in the future,
and watch carefully for his postings for errors.  He appears to be someone who
*wants* to help but actually *distracts* rather than helping.

{sigh}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com 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]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: efficiently keeping a short list

2006-07-10 Thread Mr. Shawn H. Corey
Mr. Shawn H. Corey wrote:
 Your solution will only work if $element is unique. Otherwise you will
 have multiple copies of $element on the list, and not the $maximum
 (unique) number of items.
 
 Try:
 
   @recent = grep { ! /^$element$/ } @recent;
   unshift @recent, $element;
   $#recent = $maximum;
 
 Notice how things became even slower?
 
 

OK, here's a solution that might be faster. The problem with it is
as_array() which has to scan the list every time. There is not simpler
way for it to work.

#!/usr/bin/perl

use strict;
use warnings;

my $maximum = 20;  # minimum maximum == 2
my $head = 0;
my $tail = 0;
my %unique = ();
my $count = 0;

sub add_element {
  my $element = shift @_;
  my $node = {
next = 0,
back = 0,
data = $element,
  };

  if( exists $unique{$element} ){
if( $unique{$element} eq $head ){
  $head = $unique{$element}-{next};
}else{
  $unique{$element}-{back}-{next} = $unique{$element}-{next};
}
if( $unique{$element} eq $tail ){
  $tail = $unique{$element}-{back};
}else{
  $unique{$element}-{next}-{back} = $unique{$element}-{back};
}
  }

  if( ref( $head )){
$node-{next} = $head;
$head-{back} = $node;
  }else{
$tail = $node;
  }
  $head = $node;

  $unique{$element} = $node;
  $count ++;

  if( $count  $maximum ){
my $item = $tail-{data};
$tail = $tail-{back};
$tail-{next} = 0;
delete $unique{$item};
  }
}

sub as_array {
  my @array = ();
  my $node = $head;

  while( ref( $node )){
push @array, $node-{data};
$node = $node-{next};
  }

  return @array;
}

for my $n ( qw( a b c  b a a b c d e f g h i j k l m n o p q r s t u v w
x y z ) ){
  add_element( $n );
  print join(   , as_array ), \n;
}



-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

For the things we have to learn before we can do them, we learn by
doing them.
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: efficiently keeping a short list

2006-07-10 Thread Mr. Shawn H. Corey
Mr. Shawn H. Corey wrote:
 Mr. Shawn H. Corey wrote:
 
Your solution will only work if $element is unique. Otherwise you will
have multiple copies of $element on the list, and not the $maximum
(unique) number of items.

Try:

  @recent = grep { ! /^$element$/ } @recent;
  unshift @recent, $element;
  $#recent = $maximum;

Notice how things became even slower?


 
 
 OK, here's a solution that might be faster. The problem with it is
 as_array() which has to scan the list every time. There is not simpler
 way for it to work.
 
 #!/usr/bin/perl
 
 use strict;
 use warnings;
 
 my $maximum = 20;  # minimum maximum == 2
 my $head = 0;
 my $tail = 0;
 my %unique = ();
 my $count = 0;
 
 sub add_element {
   my $element = shift @_;
   my $node = {
 next = 0,
 back = 0,
 data = $element,
   };
 
   if( exists $unique{$element} ){
 if( $unique{$element} eq $head ){
   $head = $unique{$element}-{next};
 }else{
   $unique{$element}-{back}-{next} = $unique{$element}-{next};
 }
 if( $unique{$element} eq $tail ){
   $tail = $unique{$element}-{back};
 }else{
   $unique{$element}-{next}-{back} = $unique{$element}-{back};
 }
   }
 
   if( ref( $head )){
 $node-{next} = $head;
 $head-{back} = $node;
   }else{
 $tail = $node;
   }
   $head = $node;
 
   $unique{$element} = $node;
   $count ++;
 
   if( $count  $maximum ){
 my $item = $tail-{data};
 $tail = $tail-{back};
 $tail-{next} = 0;
 delete $unique{$item};

# Oops, forgot a line:
$count = $maximum;

   }
 }
 
 sub as_array {
   my @array = ();
   my $node = $head;
 
   while( ref( $node )){
 push @array, $node-{data};
 $node = $node-{next};
   }
 
   return @array;
 }
 
 for my $n ( qw( a b c  b a a b c d e f g h i j k l m n o p q r s t u v w
 x y z ) ){
   add_element( $n );
   print join(   , as_array ), \n;
 }
 
 
 


-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

For the things we have to learn before we can do them, we learn by
doing them.
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: regex and parsing config file directives..

2006-07-10 Thread Mumia W.

Mumia W. wrote:

[...]
if (m/^([\w-]+)(?: +(.*))?$/) {
$directive{$1} = $2 || $1;
}



This is much more readable:

my ($key, $value) = split /\s+/, $_, 2;
$directive{$key} = $value || $key;




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread Mumia W.

Randal L. Schwartz wrote:

Rob == Rob Dixon [EMAIL PROTECTED] writes:


Robmy @new = grep /[^.]/, readdir DIR;

This is still the wrong regex.  While it's narrow enough for windows, it will
*break* on Unix.  No reason not to do the right thing here:

grep { $_ ne . and $_ ne .. } readdir DIR;

Rob, I'm surprised you still posted this even after our private email
exchange.  You were *told* in email that this regex is broken.

Therefore, I will warn others to please discount Rob's postings in the future,
[...]


Not quite. Rob's program works for rational input data. I'm on *nux, and 
I consider a filename of only periods to be invalid. All that's needed 
is a comment in the code that warns people that files consisting of only 
periods, including '...', are excluded.


Your attack on Rob is uncalled-for.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread Ryan Frantz


 -Original Message-
 From: Mumia W. [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 10, 2006 11:55 AM
 To: Beginners List
 Subject: Re: write out filenames of files existing on a filesystem
into
 afile
 
 Randal L. Schwartz wrote:
  Rob == Rob Dixon [EMAIL PROTECTED] writes:
 
  Robmy @new = grep /[^.]/, readdir DIR;
 
  This is still the wrong regex.  While it's narrow enough for
windows, it
 will
  *break* on Unix.  No reason not to do the right thing here:
 
  grep { $_ ne . and $_ ne .. } readdir DIR;
 
  Rob, I'm surprised you still posted this even after our private
email
  exchange.  You were *told* in email that this regex is broken.
 
  Therefore, I will warn others to please discount Rob's postings in
the
 future,
  [...]
 
 Not quite. Rob's program works for rational input data. I'm on *nux,
and
 I consider a filename of only periods to be invalid. All that's needed
 is a comment in the code that warns people that files consisting of
only
 periods, including '...', are excluded.

The regex that Rob put forth does not match only files consisting
entirely of periods, it matches any file that _starts_ with a period.
On a *nix system, a file such as '.bash_profile' would be matched.
Randal is correct.

 
 Your attack on Rob is uncalled-for.

I don't believe that Mr. Schwartz attacked the OP; he merely stated that
others should check Rob's responses for accuracy.  In fact, given that
this is a beginner's list, that probably holds true in other instances.
And the fact the Randal has written a little on the subject of Perl,
inclines me to trust his judgement.

ry

 
 
 
 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/ http://learn.perl.org/first-response
 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: perl + ncurses turtorial ?

2006-07-10 Thread Stuart Adams

Hi Greg,

Curses::UI comes with a nice variety of example applications, as part
of it's tutorial. I am writing a movie rental app, but I don't feel
ready to have others scrutinize my work...
If you do find a working perl app done with curses, please share it, I
would love to take a look at how others are implementing curses.

Good luck!

On 7/7/06, Gregory Machin [EMAIL PROTECTED] wrote:

Thanks for the input ...  The first place I looked was on cpan for the
modules, and then for the related docs and then googled ... then I posted on
this list then I googled more ... m

So I have had a better Idea, do you know of a working perl application (GPL
/ BSD) that I can view the source code.. with menus and windows and popups
etc ...

Thanks

On 7/7/06, JupiterHost.Net [EMAIL PROTECTED] wrote:



 Gregory Machin wrote:
  Hi

 Hello,

  I'm looking for an perl ncuses tutorial so I can write a remote admin
  app to
  work via ssh ..

 Not really a tutorial but

   Curses::UI

 is what you will want to use

 HTH


 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/ http://learn.perl.org/first-response





--
Gregory Machin
[EMAIL PROTECTED]
www.linuxpro.co.za




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread Jay Savage

On 7/10/06, Mumia W. [EMAIL PROTECTED] wrote:

Randal L. Schwartz wrote:
 Rob == Rob Dixon [EMAIL PROTECTED] writes:

 Robmy @new = grep /[^.]/, readdir DIR;

 This is still the wrong regex.  While it's narrow enough for windows, it will
 *break* on Unix.  No reason not to do the right thing here:

 grep { $_ ne . and $_ ne .. } readdir DIR;

 Rob, I'm surprised you still posted this even after our private email
 exchange.  You were *told* in email that this regex is broken.

 Therefore, I will warn others to please discount Rob's postings in the future,
 [...]

Not quite. Rob's program works for rational input data. I'm on *nux, and
I consider a filename of only periods to be invalid. All that's needed
is a comment in the code that warns people that files consisting of only
periods, including '...', are excluded.

Your attack on Rob is uncalled-for.



I'm not sure how this thread took this turn over a simple invalid
regex, but Randall's attack isn't at all uncalled-for. This list is
here to help people learn how to do things, learn why what they're
doing doesn't work, and learn why the suggestions they're given do
work. Rob's regex does none of that. It doesn't solve the your problem
(although it appears to). It doesn't work as advertised. And
persisting in pushing an obvious kuldge doesn't help anyone learn
anything except how to take shortcuts that will bite them in the @ss
later.

Trying to force an unsound answer on a newbie is completely
unacceptable, especially when a correct answer--from JWK, no less--is
on offer. That's like giving someone who has never fired a gun before
a rifle and saying here you go, it's all loaded, and I even took the
safety off to make it easy for you.

Being wrong is fine. Defending your wrongness repeatedly and
continuing to force it on newbies and clutter up the group with it in
the face of reasoned explanations from two of the world's foremost
PH's is not only silly, it looks incredibly troll-like. The goal of
this list is to give advice that not only seems to work on limited
test cases, but is logically sound and just generally good
programming. Rob, it seems, doesn't agree with that approach. And
that's what RS took him, justly, to task over.

HTH,

-- jay
--
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

values of β will give rise to dom!


... is a valid filename

2006-07-10 Thread Aaron Priven
For what it's worth, ... is indeed a valid filename. Back in  
Ancient Days of Yore, when I was a young undergrad at UC Santa Cruz  
playing on the open-access timeshare Unix system, we all had read  
access to each others' home directories, and it was somewhat common  
for people to put semi-secret stuff in a directory ... and mark it  
readable/searchable by the user only. The name gave no indication of  
what was actually in there, and if you did ls -a, it was easily  
overlooked next to . and .., which is a really pathetic form of  
security by obscurity but better than nothing, especially in 1989.


So unless you have made a decision that you want to exclude files or  
directories that are ... and  and ., you need  
to not just block everything that's made up entirely of periods.


Somebody sent in something just now saying that the regular  
expression posted had to start with a period. That's not true. The  
expression posted was


[^.]

Because it's in brackets, this is a character class. See Using  
character classes in the perlretut manpage (perldoc perlretut).  
Within a character class, ^  doesn't mean start, it means  
negated character class. From perlretut:


The special character ^ in the first position of a character  
class denotes a negated character class, which matches any  
character but those in the brackets.


And, within a character class, . doesn't have its other meaning for  
any character but newline (unless you've used the s modifier, in  
which case it matches that too), but instead is an ordinary  
character signifying itself.


So [^.] matches a string that has at least one character that's not a  
period in it.


.abc
abc.def
abc
abc

all match because the character class finds the first a in each  
string, and that's a character other than a period. But


...

does not match, because the character class can't find anything  
that's not a period in it. Similarly, . and .. won't  
match.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: backslash on windows

2006-07-10 Thread Timothy Johnson
-Original Message-
From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 10, 2006 5:02 AM
To: beginners@perl.org
Subject: Re: backslash on windows

snip
 
 myscript.pl -cfg D:\users\config.txt
 
 inside the script, when capturing the config file mentioned above,
the
 \ is treated as escape character.



snip

 Once inside a string, the backslash character is only the backslash
 character (unless you're using the sting as a regular expression).



If you are using the string in a regular expression, then you can avoid
this problem by using \Q and \E

   $fullpath =~ /\Q$path\E/

See perldoc perlop under the section entitled Quotes and Quote-like
Operators

If you're using ActiveState, I recommend using the HTML documentation at
Start--All Programs --ActivePerl--Documentation so that you can
search through the documentation.  The perldocs are all under Core
Documentation.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: nohup using perl

2006-07-10 Thread John W. Krahn
Mahdi A Sbeih wrote:
 Hi all,

Hello,

 I am porting a shell script written in korn shell to perl, and i want to
 see what is the best way to port the nohup shell command in perl,
 anyone knows?

Basically the nohup program ignores the HUP signal so:

$SIG{ HUP } = 'IGNORE';

is probably all you need.

http://www.openbsd.org/cgi-bin/man.cgi?query=nohupsektion=1apropos=0manpath=OpenBSD+Current



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: error message

2006-07-10 Thread Rob Dixon

Rob Dixon wrote:

 Don't forget that we can't see bold emphasis on the mailing list: the
 posts are
 converted to plain text by the server. But your errors must be on the lines

 $pos1 = int($pos1);
 $dist1 = int($dist1*100)/100;

 and are because $pos1 and $dist1 are undefined, so you should look at function
 getFootPointDistToRoot() which is returning this value. Despite the  warnings,
 the undefined variables will evaluate as zero and so may be giving you the
 results you expect. Nevertheless these should clearly be numeric values and
 either the function needs correcting or, if you have no access to make
 changes there, the returned values should be explicitly forced to zero with

   $pos1 != '0';
   $dist1 != '0';

My apologies. That should be

  $pos1 ||= '0';
  $dist1 ||= '0';

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: ... is a valid filename

2006-07-10 Thread Chasecreek Systemhouse

On 7/10/06, Aaron Priven [EMAIL PROTECTED] wrote:

For what it's worth, ... is indeed a valid filename. Back in


FWIW the Linux command touch   makes a valid 'space' for a filename;
sorts on top of all other files when executing ls -l

--
WC (Bill) Jones -- http://youve-reached-the.endoftheinternet.org/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread Rob Dixon

Ryan Frantz wrote:

Randal L. Schwartz wrote:

Rob == Rob Dixon [EMAIL PROTECTED] writes:

 Robmy @new = grep /[^.]/, readdir DIR;

 This is still the wrong regex.  While it's narrow enough for
 windows, it will *break* on Unix.  No reason not to do the right thing here:

grep { $_ ne . and $_ ne .. } readdir DIR;

 Rob, I'm surprised you still posted this even after our private
 email exchange.  You were *told* in email that this regex is broken.
 Therefore, I will warn others to please discount Rob's postings in
 the future,

[...]

 Not quite. Rob's program works for rational input data. I'm on *nux,
 and I consider a filename of only periods to be invalid. All that's needed
 is a comment in the code that warns people that files consisting of
 only periods, including '...', are excluded.

 The regex that Rob put forth does not match only files consisting
 entirely of periods, it matches any file that _starts_ with a period.
 On a *nix system, a file such as '.bash_profile' would be matched.
 Randal is correct.

No it doesn't. I don't see why there's so much confusion about this regex.
Randal wrote:

:: But certainly not for correctness!  It's easy to look pretty if you don't
:: care about the right answer.  Your regex rejects *any* filename that contains
:: *any* dot.  On a windows system, that'd be just about any file.  :)

and that's wrong too. The character class [^.] matches any character that isn't
a dot, so the grep will passs through all files that contain any non-dot
character.

Your attack on Rob is uncalled-for.

 I don't believe that Mr. Schwartz attacked the OP; he merely stated that
 others should check Rob's responses for accuracy. In fact, given that
 this is a beginner's list, that probably holds true in other instances.

I wasn't the OP, but I assume you mean me. Randal didn't just say my responses
should be checked for accuracy, he said (above):

:: I will warn others to please discount Rob's postings in the future,

which is much more inflammatory. Randal certainly knows his Perl, but he was
simply wrong in this case and put his point over less than politely. I am sure
the thread would never have taken this turn if the only mistake he saw in my
post was that filenames with just dots would be rejected. Indeed, that post was
in reply to a Windows user who could not have had such files anyway. Instead
Randal saw a mistake in the regex that wasn't there and went ahead and rubbished
the whole post without grounds. It is only since I pointed out his mistakes that
he adopted the alternative 'three-dot filename' in what seems to be a weak
attempt to prove that at least something was wrong with my post - even though he
didn't see it in the first place. Yes, there is a hole in my code, but I don't
consider it a huge yawning one that deserves a court martial. I would go as far
as to say that it remains a useful construct - certainly on Windows, and usually
on *nix where files with such unprincipled names just don't exist. By all means
disagree with me and don't use it, but it is there if you want it.

 And the fact the Randal has written a little on the subject of Perl, inclines
 me to trust his judgement.

Just because Randal has publications to his name doesn't make him any less prone
to mistakes, as we have seen in his original post on this thread. That he is
more aggressive and vociferous than most don't to me make him more worth
reading. To me he is just a regular guy who is sharp at Perl but needs to
control his language a bit better. Again, whether you agree with me is up to
you.

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: perl + ncurses turtorial ?

2006-07-10 Thread Jay Savage

On 7/6/06, Gregory Machin [EMAIL PROTECTED] wrote:

Hi
I'm looking for an perl ncuses tutorial so I can write a remote admin app to
work via ssh ..
Many Thanks

--
Gregory Machin
[EMAIL PROTECTED]
www.linuxpro.co.za




I haven't done much work with curses in a while, but I remember the
Perl Cookbook having a pretty decent introduction to Curses.pm.

HTH,

-- jay
--
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

values of β will give rise to dom!


Perl directory traversal and file operation

2006-07-10 Thread Ed

I'm having a difficult time finding a way to traverse a directory structure
and then perform some simple operations on files in the directories.

I want to traverse a directory structure and then remove the oldest file in
each subdirectory. Something like this:

## traverse the directories and in each directory, if there are at least N
files in the directory, in remove the oldest file in that directory.
##
foreach($dir (@dirs) )
{
  ## if $dir has  N files of *.ext
  ## unlink the oldest one.
}

I've been Looking at File::Find but I'm baffled by the examples and usage
and the wanted function.

Where can I look to find some modules and functions for this?

Thanks,

--
Ed


Re: regex and parsing config file directives..

2006-07-10 Thread Dr.Ruud
Gregory Machin schreef:


 i'm using the follwing regex /(.+)[\s+\n](.+)/where $1 is the
 directive and $2 is the option for the directive

What is [\s+\n] supposed to mean?

The \n is already in \s, so it is a characterset that holds everything
\s holds, plus a plus sign. The construct still  matches just a single
character.

ITYM: \s+

-- 
Affijn, Ruud

Gewoon is een tijger.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread Mr. Shawn H. Corey
Rob Dixon wrote:
 Just because Randal has publications to his name doesn't make him any
 less prone
 to mistakes, as we have seen in his original post on this thread. That
 he is
 more aggressive and vociferous than most don't to me make him more worth
 reading. To me he is just a regular guy who is sharp at Perl but needs to
 control his language a bit better. Again, whether you agree with me is
 up to
 you.
 
 Rob
 

Good for you, Rob.

I think Randal owes you a public apology.


-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

For the things we have to learn before we can do them, we learn by
doing them.
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: efficiently keeping a short list

2006-07-10 Thread Mr. Shawn H. Corey
Charles K. Clarkson wrote:
 Mr. Shawn H. Corey wrote:
 
 : OK, here's a solution that might be faster. The problem with
 : it is as_array() which has to scan the list every time. There
 : is not simpler way for it to work.
 
 We could do a unique check only when the array is accessed
 instead of every time a value is added. Then we used the cached
 result until another element is added.
 
 use strict;
 use warnings;
 
 use Tie::Array::Unique;
 
(rest of message deleted)

The problem with this module is that both its version of push() and
unshift() do not add elements if they are already in the array. That
means the array will not keep the order of most recent to oldest. It
could also mean that the most-recent element may be dropped when the
list is pruned to $maximum elements.

In order to keep the array in order of most recent to oldest, you either
have to:

* Scan the array every time you add an element and remove it if found.

or

* Find a way to keep track of where every element is and pluck it out of
the array if it's a duplicate.

The former method is good if you are reading the array more often than
you are adding elements. The latter is good if you are adding elements
more often than reading the array.


-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

For the things we have to learn before we can do them, we learn by
doing them.
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread John W. Krahn
Jay Savage wrote:
 On 7/10/06, Mumia W. [EMAIL PROTECTED] wrote:
 Randal L. Schwartz wrote:
  Rob == Rob Dixon [EMAIL PROTECTED] writes:
 

Just to (hopefully) put an end to this thread :-) the OP said:

Nishi Bhonsle wrote:

 Can you please tell me how to modify the above program to ignore the .
 and .., so that they donot get printed in C:/filelist.txt ?

And I used the match /^\.\.?$/ which is the traditional idiom and Rob used the
match /[^.]/ both of which do not do exactly what the OP requested however
Randal's example matched this spec. exactly.  (My example could more correctly
be written as /\A\.\.?\z/.)

This all assumes of course that the file system containing these file names
has the '.' directory which points to the current directory and the '..'
directory which points to the parent directory.  (Some file systems do not
have these so '.' and '..' could just be ordinary files.)


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread Rob Dixon

Mr. Shawn H. Corey wrote:

 Rob Dixon wrote:

 Just because Randal has publications to his name doesn't make him any less
 prone to mistakes, as we have seen in his original post on this thread. That
 he is more aggressive and vociferous than most don't to me make him more
 worth reading. To me he is just a regular guy who is sharp at Perl but needs
 to control his language a bit better. Again, whether you agree with me is up
 to you.

 Good for you, Rob.

 I think Randal owes you a public apology.

Not much chance of that I'm afraid Shawn. I can do without the apology, I just
wish he'd confirm that his original critique was wrong instead of banging on
about filenames with three dots. I think leaving people with that misinformation
uncorrected is a lot more important.

Anyway, nice to know I'm not completely off track :)

Cheers,

Rob


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: efficiently keeping a short list

2006-07-10 Thread Jay Savage

On 7/10/06, Charles K. Clarkson [EMAIL PROTECTED] wrote:

Mr. Shawn H. Corey wrote:




We could do a unique check only when the array is accessed
instead of every time a value is added. Then we used the cached
result until another element is added.



I'd be inclined to to flip that around: check for uniqueness on add,
sort and do something like :

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

  my %recent;
  my $limit = 10;

  sub get_list {
  my @sorted = sort {$recent{$b} = $recent{$a}} keys %recent;
  foreach (@sorted[$limit..$#sorted]){
 delete $recent{$_};
  }
  return @sorted[0..$limit-1];
  }

  # example usage:

  foreach ('a'..'z') {
 $recent{$_} = time;
 sleep 1;
  }

  print get_list(), \n;

  while (my ($k, $v) = each %recent) {
 print $k: $v\n;
  }


HTH,

-- jay
--
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

values of β will give rise to dom!


Re: efficiently keeping a short list

2006-07-10 Thread Jay Savage

On 7/10/06, Jay Savage [EMAIL PROTECTED] wrote:

On 7/10/06, Charles K. Clarkson [EMAIL PROTECTED] wrote:
 Mr. Shawn H. Corey wrote:


 We could do a unique check only when the array is accessed
 instead of every time a value is added. Then we used the cached
 result until another element is added.


I'd be inclined to to flip that around: check for uniqueness on add,
sort and do something like :

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

   my %recent;
   my $limit = 10;

   sub get_list {
   my @sorted = sort {$recent{$b} = $recent{$a}} keys %recent;
   foreach (@sorted[$limit..$#sorted]){
  delete $recent{$_};
   }
   return @sorted[0..$limit-1];
   }

   # example usage:

   foreach ('a'..'z') {
  $recent{$_} = time;
  sleep 1;
   }

   print get_list(), \n;

   while (my ($k, $v) = each %recent) {
  print $k: $v\n;
   }



Lost a little bit of the message there somehow. should be:

  check for uniqueness on add, sort and truncate on use.

I also meant to say something about this not keeping the list at a
fixed length. If the time between calls to get_list is long relative
to the number of items being added, the hash could potentially grow
quite large, which will also decrease the efficiency of the sort. On
the whole, though, it should be pretty speedy. It will also yield
unpredicatable results where intervals between adds are less than a
second, but you can get around the with Time::HiRes::gettimeofday();

--
--
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

values of β will give rise to dom!


Re: Perl directory traversal and file operation

2006-07-10 Thread John W. Krahn
Ed wrote:
 I'm having a difficult time finding a way to traverse a directory structure
 and then perform some simple operations on files in the directories.
 
 I want to traverse a directory structure and then remove the oldest file in
 each subdirectory. Something like this:
 
 ## traverse the directories and in each directory, if there are at least N
 files in the directory, in remove the oldest file in that directory.
 ##
 foreach($dir (@dirs) )
 {
   ## if $dir has  N files of *.ext
   ## unlink the oldest one.
 }
 
 I've been Looking at File::Find but I'm baffled by the examples and usage
 and the wanted function.
 
 Where can I look to find some modules and functions for this?

This may help get you started:

#!/usr/bin/perl
use warnings;
use strict;
use File::Find;

# Get the directory from the command line
# or use the current directory
my $search = shift || '.';

# Get an array of all subdirectories
my @dirs;
find sub { push @dirs, $File::Find::name if -d }, $search;

for my $dir ( @dirs ) {
opendir my $dh, $dir or do {
warn Cannot open '$dir' $!;
next;
};
my ( $name, $time ) = ( '', ~0 );
while ( my $file = readdir $dh ) {
my $mtime = ( stat $dir/$file )[ 9 ] or do {
warn Cannot stat '$dir/$file' $!;
last;
};
( $name, $time ) = ( $file, $mtime ) if -f _ and $time  $mtime;
}
unlink $dir/$name or warn Cannot unlink '$dir/$name' $!;
}

__END__




John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Perl directory traversal and file operation

2006-07-10 Thread Mr. Shawn H. Corey
Ed wrote:
 I'm having a difficult time finding a way to traverse a directory structure
 and then perform some simple operations on files in the directories.
 
 I want to traverse a directory structure and then remove the oldest file in
 each subdirectory. Something like this:
 
8 snip
 I've been Looking at File::Find but I'm baffled by the examples and usage
 and the wanted function.
 
 Where can I look to find some modules and functions for this?

You should learn to use File::Find since it handles special cases for
you. In it simplest form:

  find( \wanted, @list_of_directories );

The subroutine wanted() is one you write, so elsewhere in your script is:

sub wanted {
  # $_ is the name of the file
  # $File::Find::name is the path
  # $File::Find::dir is the directory the file is in
  # In *NIX, $File::Find::name eq $File::Find::dir . '/' . $_

  # your code goes here
}

To do what you want, you will have to record information in global
variables as File::Find traverses the directories and perform any
removal after it is finished:

#!/usr/bin/perl

use strict;
use warnings;

use File::Find;
use File::Basename;

my %Count = ();  # $Count{$directory}{$extension} = $count_of_files
my %Oldest = (); # $Oldest{$directory}{$extension} = $path_to_file

sub wanted {

  # ignore everything but regular files
  return unless -f $File::Find::name;

  my ( $name, undef, $ext ) = fileparse( $_, qr{\.[^.]*} );
  $Count{$File::Find::dir}{$ext} ++;

  if( exists $Oldest{$File::Find::dir}{$ext} ){
if( (stat($File::Find::name))[9] 
(stat($Oldest{$File::Find::dir}{$ext}))[9] ){
  $Oldest{$File::Find::dir}{$ext} = %File::Find::name;
}
  }else{
$Oldest{$File::Find::dir}{$ext} = %File::Find::name;
  }
}

my @list_of_directories = ();
# insert code to populate @list_of_directories

find( \wanted, @list_of_directories );

for my $dir ( keys %Count ){
  for my $ext ( keys %{ $Count{$dir} } ){
if( $Count{$dir}{$ext}  $N ){
  # change to a real unlink command when script is debugged
  print unlink $Oldest{$dir}{$ext};\n;
}
  }
}

__END__

BTW, you should defined by what you mean by oldest. In the above, oldest
 means oldest last modified.


-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

For the things we have to learn before we can do them, we learn by
doing them.
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




How to use Perl for API testing

2006-07-10 Thread Suja Emmanuel

Hi,

I want to use PERL for API testing, i.e., I want to call
different URLs through the browser. I am new to Perl. Can you help me to
write a script to call many URLs through browser.



Thanks in advance,

Suja Emmanuel.








The information contained in, or attached to, this e-mail, contains 
confidential information and is intended solely for the use of the individual 
or entity to whom they are addressed and is subject to legal privilege. If you 
have received this e-mail in error you should notify the sender immediately by 
reply e-mail, delete the message from your system and notify your system 
manager. Please do not copy it for any purpose, or disclose its contents to any 
other person. The views or opinions presented in this e-mail are solely those 
of the author and do not necessarily represent those of the company. The 
recipient should check this e-mail and any attachments for the presence of 
viruses. The company accepts no liability for any damage caused, directly or 
indirectly, by any virus transmitted in this email.

www.aztecsoft.com

Re: efficiently keeping a short list

2006-07-10 Thread Mr. Shawn H. Corey
Jay Savage wrote:
   foreach ('a'..'z') {
  $recent{$_} = time;
  sleep 1;
   }

Ouch. The OP did mention his limit was 200. So he must have more than
200 elements to scan. This algorithm will takes at least 3m20s, so it's
hardly fast (which was one of the points of this exercise).

Try:

my $id = 0;
for ( 'a' .. 'z' ){
  $recent{$_} = $id++;
}

Of course, this assumes you have enough memory for everything. These
days, this is normally true for a personal computer but web servers can
run out of memory because they have so much else to do to.


-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

For the things we have to learn before we can do them, we learn by
doing them.
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: write out filenames of files existing on a filesystem into a file

2006-07-10 Thread Dr.Ruud
Nishi Bhonsle schreef:

 Can you please tell me how to modify the above program to ignore the
 . and .., so that they donot get printed in C:/filelist.txt ?

Since you want only files, see perldoc -f -f.

-- 
Affijn, Ruud

Gewoon is een tijger.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: How to use Perl for API testing

2006-07-10 Thread Timothy Johnson
Are you testing on IE? 

There is an Win32::IEAutomation module that should be able to handle
what you want if IE is the browser you want to test.



-Original Message-
From: Suja Emmanuel [mailto:[EMAIL PROTECTED] 
Sent: Sunday, July 09, 2006 10:16 PM
To: beginners@perl.org
Subject: How to use Perl for API testing


Hi,

I want to use PERL for API testing, i.e., I want to call
different URLs through the browser. I am new to Perl. Can you help me to
write a script to call many URLs through browser.

snip really long disclaimer


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread Mr. Shawn H. Corey
Rob Dixon wrote:
 Not much chance of that I'm afraid Shawn. I can do without the apology,
 I just
 wish he'd confirm that his original critique was wrong instead of
 banging on
 about filenames with three dots. I think leaving people with that
 misinformation
 uncorrected is a lot more important.

I think he owes you an apology, regardless of whether he was right or
wrong, regardless of whether you were right or wrong.

Not everyone who reads this mailing list posts to it. What impression
would his comments leave on them? How can we encourage people to use
Perl if they think they will receive harsh criticism? The fact that the
criticism was to a response and not an original post is unimportant; the
fact that is was done is.

That's why I think he owes you an apology and a public one. After all,
we don't want people frighten into learning that other language that
starts with P ;)


-- 
__END__

Just my 0.0002 million dollars worth,
   --- Shawn

For the things we have to learn before we can do them, we learn by
doing them.
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread Chad Perrin
On Mon, Jul 10, 2006 at 06:34:48PM -0400, Mr. Shawn H. Corey wrote:
 
 I think he owes you an apology, regardless of whether he was right or
 wrong, regardless of whether you were right or wrong.
 
 Not everyone who reads this mailing list posts to it. What impression
 would his comments leave on them? How can we encourage people to use
 Perl if they think they will receive harsh criticism? The fact that the
 criticism was to a response and not an original post is unimportant; the
 fact that is was done is.
 
 That's why I think he owes you an apology and a public one. After all,
 we don't want people frighten into learning that other language that
 starts with P ;)

I think it's about time to drop the subject.  This is getting
ridiculous.  Talk about Perl, not finger-pointing, please.

By the way, Python's a good language.  Sure, it makes my eyes bleed, and
it can't even do proper lexical closures, but it serves a lot of people
very well.  I don't really see how it would be such a bad thing for some
more people to use it.  Python and Perl need not compete as bitter
enemies.

How about we have a nice, rousing discussion about the value of
developing a new Perl 5.x object model using lexical closures as the
basis for it rather than the bless() function and a cantankerous,
unwieldy syntax?  There's a discussion that would be much less tedious
than who's to blame for what indiscretions.

Either Mr. Schwartz will apologize for his tone, or he won't.  Either
Rob will admit that his solution wasn't ideal, or he won't.  At this
point, I think the one thing we can really aim for, and hope to get, as
a positive end to this is for you to stop slinging mud after others have
pretty much shut up about it (with minor exceptions).  This is a Perl
list, and not a Miss Manners list, after all.

How much do you think people who watch without participating might be
turned off by this discussion being dragged out even further by your
calls for public apologies?  Personally, I'd like any apologies to
happen off-list so we don't have to endure them.

How about that object model topic?  Does anyone have anything to say
about that?

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
It's just incredible that a trillion-synapse computer could actually
spend Saturday afternoon watching a football game. - Marvin Minsky

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: How to use Perl for API testing

2006-07-10 Thread Jason Trebilcock
 
 -Original Message-
 From: Suja Emmanuel [mailto:[EMAIL PROTECTED]
 Sent: Sunday, July 09, 2006 10:16 PM
 To: beginners@perl.org
 Subject: How to use Perl for API testing
 
 
 Hi,
 
 I want to use PERL for API testing, i.e., I want to call
 different URLs through the browser. I am new to Perl. Can you 
 help me to
 write a script to call many URLs through browser.
 
 snip really long disclaimer
 
 


In addition to what has been posted previously, there is also SAMIE.
http://samie.sourceforge.net/

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.10/383 - Release Date: 7/7/2006
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: write out filenames of files existing on a filesystem into afile

2006-07-10 Thread Rob Dixon

Mr. Shawn H. Corey wrote:

 After all, we don't want people frighten into learning that other language
 that starts with P ;)

Why? I like Pascal. :)

R

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Curses::UI: No definition found for ' Yes '

2006-07-10 Thread Mumia W.
I'm trying to learn to use Curses::UI, and I read the top of perldoc 
Curses::UI and found some example code. Unfortunately, it doesn't work. 
This is my program:


#!/usr/bin/perl

use strict;
use warnings;
use Curses::UI;

my $cui = new Curses::UI (-color_support = 1);
my $my = $cui-dialog(
-message = 'Hello World.',
-buttons = [' Yes ', ' No '],
-values = [1, 0],
-title = 'First Dialog',
);

__END__

When I run this program, I get this error message:


Fatal program error:
--
process_buttondefs(): Invalid button type.
No definition found for ' Yes '
--
Press any key to exit...


But when I comment out the line containing -buttons..., the program 
works. Does anyone know how I get this to work with the -buttons... 
line active?



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Curses::UI: No definition found for ' Yes '

2006-07-10 Thread Chasecreek Systemhouse

On 7/10/06, Mumia W. [EMAIL PROTECTED] wrote:

I'm trying to learn to use Curses::UI, and I read the top of perldoc
Curses::UI and found some example code. Unfortunately, it doesn't work.


The Curses::UI refers you to a more appropriate example. The example's syntax:

use FindBin;
use lib $FindBin::RealBin/../lib;

use strict;
use Curses::UI;

$Curses::UI::debug = 0;

my $cui = new Curses::UI( -color_support = 1 );

my $win1 = $cui-add(
'win1', 'Window',
-border = 1,
-y= 1,
-bfg  = 'red',
);

$win1-add(box1, Buttonbox,
  -buttons = [ {
  -label =  ADD ,
   }, {
   -label =  FOO  }] ,

);

$win1-add(box2, Buttonbox,
  -y = 10,
  -vertical = 1,
  -buttons = [ {
  -label =  ADD ,
   }, {
   -label =  FOO  }] ,

);

$cui-set_binding( sub {exit 0;}, q);
$cui-MainLoop;

__END__

In other words, the  Yes  was supposed to be the label of a button;
not a button itself...

HTH/Sx
--
WC (Bill) Jones -- http://youve-reached-the.endoftheinternet.org/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Curses::UI: No definition found for ' Yes '

2006-07-10 Thread Mumia W.
Mumia W. wrote:
 I'm trying to learn to use Curses::UI, and I read the top of perldoc 
 Curses::UI and found some example code. [...]

No, I mean I. I found some example code.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response