Re: sorting thoughts

2003-01-30 Thread Janek Schleicher
On Wed, 29 Jan 2003 16:50:03 +, Steven Massey wrote:

> I have an array, each line contains fields seperated by ":"
> I want to sort the array numerically ascending by the last field.
> 
>  my thoughts are to split fields into seperate arrays, go through the last
> array in a comparing process, moving each row index in the original array
> to reflect the sort. ( I found this hard to explain)
> 
> Do any of you some tips as to how to approach this ??
> 
> eg
> contents of array1
> fred:lucy:24
> john:jane:10
> frank:mary:5
> 
> so I want to end up with
> frank:mary:5
> john:jane:10
> fred:lucy:24

Here's a solution exploiting the Sort::Fields module from CPAN. It has the
main advantage to be very readable and easy to program without errors. (Of
course for the price of a little speed penalty).

use Sort::Fields;

print fieldsort ':', ['3n'], @array;


Greetings,
Janek



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




Re: system call

2003-01-30 Thread km
Hi,

pls try
perldoc Shell
at the command prompt

KM

On 30 Jan 2003, simran wrote:

> not sure what you mean... but try:
>
>   perldoc perlsec
>
> as a starting point...
>
>
> On Thu, 2003-01-30 at 12:38, jdavis wrote:
> > hello,
> >   Could someont tell me the secure way
> > to get input from a system call
> > like...
> >
> > $date = `/bin/date`;
> >
> > or
> >
> > $client = `/usr/bin/finsmb`;
> >
> > TIA,
> > --
> > jd
> > [EMAIL PROTECTED]
> >
> > Bad spellers of the world untie!
>
>
>
>

-- 

+--+-+
| K.A.V.S.KrishnaMohan | Ph:91-452-459141|
| c/o Prof. S.Krishnaswamy | Fax:91-452-459105   |
| Bioinformatics Center| |
| School of Biotechnology  | Email:  |
| Madurai Kamaraj University(MKU)  |   [EMAIL PROTECTED] |
| MADURAI-625021 ,T.N, INDIA   |   [EMAIL PROTECTED] |
+--+-+





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




RE: A very annoying regex question.

2003-01-30 Thread Michael Hooten
> my @a = map {split (/\s*=\s*/, $_, 2)} split(/\r?\n/, );

Should not \s+ match \r?\n? Apparently not.

> Sometimes it's better to do one thing at a time :-)

Correct. Simplicity is a virtue. I was just curious because I know this
could be done.

> Jenda
> P.S.: Are you sure you do not want to
>   use Config::IniHash qw(ReadINI);
>   $config = ReadINI(\*DATA);
>   print $config->{DEFAULT}->{BASEURL},"\n";

No, I am not sure.
;-)

Thanks so much for the input.

-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 10:06 AM
To: [EMAIL PROTECTED]
Subject: Re: A very annoying regex question.


From: Zeus Odin <[EMAIL PROTECTED]>
> I have spent a very LONG time trying to determine why this script is
> not splitting properly only on lines that have equals marks and only
> on the first equals. This would be very easy if I didn't slurp in the
> entire file at once, but hey life usually isn't easy. The array @a
> should always have an equal number of elements. I have tried countless
> permutations with no luck. Thanks.
>
> In case the email formatting gets messed up, there are 8 lines beneath
> __DATA__.
>
> #!/usr/bin/perl -w
> use strict;
>
> undef $/;
> my @a = grep length, split /\[.*\]|^(?:[^=]+)=|\s+/i, ;

my @a = map {split (/\s*=\s*/, $_, 2)} split(/\r?\n/, );

> print "$_\n" for @a;
>
> __DATA__
> [DEFAULT]
> BASEURL=http://v4.windowsupdate.microsoft.com/en/default.asp
> [DOC#17#19#21]
> BASEURL=http://v4.windowsupdate.microsoft.com/en/splash.asp?page=3&x86
> =true&auenabled=false& ORIGURL=splash.asp?page=0&corporate=false&
> [InternetShortcut]
> URL=http://v4.windowsupdate.microsoft.com/en/default.asp
> Modified=B059DD590A4BC20157

Sometimes it's better to do one thing at a time :-)

Jenda
P.S.: Are you sure you do not want to
use Config::IniHash qw(ReadINI);
$config = ReadINI(\*DATA);
print $config->{DEFAULT}->{BASEURL},"\n";
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery




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




RE: Help installing Perl and Perl Modules on Mac OS X

2003-01-30 Thread David Brookes


> Sometimes the author knows what they are talking about ;-)...

Actually, if you read the article, he says both are ok and one may choose
either.

> Why?  What was the output and what errors were listed?  If you can give a better 
>explanation of "did not install properly" then someone here may be able to help you. 
>The other suggestion is to use the power of CPAN's ability to handle module 
>installation for you, by reading perldoc CPAN and then issuing:

When I ran make test it failed EVERYTHING.

D


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




Re: HTML::TokeParser and  

2003-01-30 Thread David Eason
I suppose   is a browser directive, but TokeParser returns an actual
character.

Will research HTML::Entities' relationship to HTML::TokeParser
later...probably much later, because now it's working.

Dave



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




Re: sorting thoughts

2003-01-30 Thread Steven_Massey

Thanks to all that offered help - much appreciated ..  examples work ..more
for me to learn...

Rob
If you could explain how this works, especially how $a $b are set with the
compare values


my @sorted = sort {
(split ':', $a)[-1] <=> (split ':', $b)[-1]
} @array;

Thanks



   

  "Rob Dixon"  

  <[EMAIL PROTECTED] To:  [EMAIL PROTECTED] 

  am.co.uk>cc: 

   Subject: Re: sorting thoughts   

  29/01/03 20:03   

   

   






"Steven Massey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
m...
> Hi
>
> just about to embark on a sorting routine, and I thought before I
spend
> ages(at my ability) I would see what thoughts you guys have on  this.
>
> I have an array, each line contains fields seperated by ":"
> I want to sort the array numerically ascending by the last field.
>

Hi Steven

This will work. Let us know if you want the code explaining.

Thanks to Ed for his people.

my @array = qw(
fred:lucy:24
john:jane:10
frank:mary:5
rupert:cindy:16
);

my @sorted = sort {
(split ':', $a)[-1] <=> (split ':', $b)[-1]
} @array;

print "$_\n" foreach @sorted;

Cheers,

Rob




--
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: still needing help

2003-01-30 Thread Todd W

"Jdavis" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i have not been following this thread...but it appears as if you just
> want a generic cgi scrip to work...I like to use  &ReadParse for
> most of my easy cgi interactions ...heer is a example..
>



Do not use. Broken form parameter parser below:

> #!/usr/bin/perl
>
> &ReadParse;
>
> print "$in{email}\n";
>
> #all you need to do is paste this at the bottom
> # of your cgi scrip and refer to the form vars by
> #ther name using the method above...
>
> # Adapted from cgi-lib.pl by [EMAIL PROTECTED]
> # Copyright 1994 Steven E. Brenner
> sub ReadParse {
>   local (*in) = @_ if @_;
>   local ($i, $key, $val);
>
>   if ( $ENV{'REQUEST_METHOD'} eq "GET" ) {
> $in = $ENV{'QUERY_STRING'};
>   } elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
> read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
>   } else {
> # Added for command line debugging
> # Supply name/value form data as a command line argument
> # Format: name1=value1\&name2=value2\&...
> # (need to escape & for shell)
> # Find the first argument that's not a switch (-)
> $in = ( grep( !/^-/, @ARGV )) [0];
> $in =~ s/\\&/&/g;
>   }
>
>   @in = split(/&/,$in);
>
>   foreach $i (0 .. $#in) {
> # Convert plus's to spaces
> $in[$i] =~ s/\+/ /g;
>
> # Split into key and value.
> ($key, $val) = split(/=/,$in[$i],2); # splits on the first =.
>
> # Convert %XX from hex numbers to alphanumeric
> $key =~ s/%(..)/pack("c",hex($1))/ge;
> $val =~ s/%(..)/pack("c",hex($1))/ge;
>
> # Associate key and value. \0 is the multiple separator
> $in{$key} .= "\0" if (defined($in{$key}));
> $in{$key} .= $val;
>   }
>   return length($in);
> }
>
>


Todd W.



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




Re: Help installing Perl and Perl Modules on Mac OS X

2003-01-30 Thread David Brookes
Hi again.

One suggestion was to use CPAN to install the modules.  Does anyone 
have any experience doing this on a Mac?  I tried to do this and when 
you log on for the first time, you have to answer a whole bunch of 
questions.  CPAN could not find certain programs it wanted (like ncftp) 
and I suspect that at the end of the day, the config was inadequate to 
make the whole thing work.  Anyone know how to configure it correctly 
so that it will install modules?

David


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



TimeStamp compare

2003-01-30 Thread alima
Hi there mates,

   I would like to Know If anyone of you have already tried to get the time and 
date a file was created from the OS. For example imagine I have a *.java file 
and I would like to compare the *.class file date of creation with the date of 
edition of the *.java file in other to make sure the *.class file was generated 
(compiled ) or not after the *.java new edition.

I hope I´ve made myself clear ,
Thks in advance. 



-
This mail sent through IMP: http://horde.org/imp/

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




Weekly list FAQ posting

2003-01-30 Thread casey
NAME
beginners-faq - FAQ for the beginners mailing list

1 -  Administriva
  1.1 - I'm not subscribed - how do I subscribe?

Send mail to <[EMAIL PROTECTED]>

You can also specify your subscription email address by sending email to
(assuming [EMAIL PROTECTED] is your email address):

<[EMAIL PROTECTED]>.

  1.2 -  How do I unsubscribe?

Now, why would you want to do that? Send mail to
<[EMAIL PROTECTED]>, and wait for a response. Once you
reply to the response, you'll be unsubscribed. If that doesn't work,
find the email address which you are subscribed from and send an email
like the following (let's assume your email is [EMAIL PROTECTED]):

<[EMAIL PROTECTED]>

  1.3 - There is too much traffic on this list. Is there a digest?

Yes. To subscribe to the digest version of this list send an email to:

<[EMAIL PROTECTED]>

To unsubscribe from the digest, send an email to:

<[EMAIL PROTECTED]>

This is a high traffic list (100+ messages per day), so please subscribe
in the way which is best for you.

  1.4 - Is there an archive on the web?

Yes, there is. It is located at:

http://archive.develooper.com/beginners%40perl.org/

  1.5 - How can I get this FAQ?

This document will be emailed to the list once a week, and will be
available online in the archives, and at http://learn.perl.org/

  1.6 - I don't see something in the FAQ, how can I make a suggestion?

Send an email to <[EMAIL PROTECTED]> with your suggestion.

  1.7 - Is there a supporting website for this list?

Yes, there is. It is located at:

http://beginners.perl.org/

  1.8 - Who owns this list?  Who do I complain to?

Casey West owns the beginners list. You can contact him at
[EMAIL PROTECTED]

  1.9 - Who currently maintains the FAQ?

Kevin Meltzer, who can be reached at the email address (for FAQ
suggestions only) in question 1.6

  1.10 - Who will maintain peace and flow on the list?

Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large,
yet padded, clue-sticks to maintain peace and order on the list. If you
are privately emailed by one of these folks for flaming, being
off-topic, etc... please listen to what they say. If you see a message
sent to the list by one of these people saying that a thread is closed,
do not continue to post to the list on that thread! If you do, you will
not only meet face to face with a XQJ-37 nuclear powered pansexual
roto-plooker, but you may also be taken off of the list. These people
simply want to make sure the list stays topical, and above-all, useful
to Perl beginners.

  1.11 - When was this FAQ last updated?

Sept 07, 2001

2 -  Questions about the 'beginners' list.
  2.1 - What is the list for?

A list for beginning Perl programmers to ask questions in a friendly
atmosphere.

  2.2 - What is this list _not_ for?

* SPAM
* Homework
* Solicitation
* Things that aren't Perl related
* Monkeys
* Monkeys solicitating homework on non-Perl related SPAM.
  2.3 - Are there any rules?

Yes. As with most communities, there are rules. Not many, and ones that
shouldn't need to be mentioned, but they are.

* Be nice
* No flaming
* Have fun
  2.4 - What topics are allowed on this list?

Basically, if it has to do with Perl, then it is allowed. You can ask
CGI, networking, syntax, style, etc... types of questions. If your
question has nothing at all to do with Perl, it will likely be ignored.
If it has anything to do with Perl, it will likely be answered.

  2.5 - I want to help, what should I do?

Subscribe to the list! If you see a question which you can give an
idiomatic and Good answer to, answer away! If you do not know the
answer, wait for someone to answer, and learn a little.

  2.6 - Is there anything I should keep in mind while answering?

We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the
beginner to the place in the FM they should R :)

Please do not quote the documentation unless you have something to add
to it. It is better to direct someone to the documentation so they
hopefully will read documentation above and beyond that which answers
their question. It also helps teach them how to use the documentation.

  2.7 - I don't want to post a question if it is in an FAQ. Where should I
look first?

Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it.
It can save everyone time if you look in the Perl FAQs first, instead of
having a list of people refer you to the Perl FAQs :) You can learn
about 'perldoc' by typing:

"perldoc perldoc"

At your command prompt. You can also view documentation online at:

http://www.perldoc.com and http://www.perl.com

  2.8 Is this a high traffic list?

YES! You have been warned! If you don't want to get ~100 emails per day
from this

Re: Help installing Perl and Perl Modules on Mac OS X

2003-01-30 Thread wiggins


On Thu, 30 Jan 2003 07:53:53 -0500, David Brookes <[EMAIL PROTECTED]> wrote:

> Hi again.
> 
> One suggestion was to use CPAN to install the modules.  Does anyone 
> have any experience doing this on a Mac?  I tried to do this and when 
> you log on for the first time, you have to answer a whole bunch of 
> questions.  CPAN could not find certain programs it wanted (like ncftp) 
> and I suspect that at the end of the day, the config was inadequate to 
> make the whole thing work.  Anyone know how to configure it correctly 
> so that it will install modules?
> 

I know I have used it, but I have fink installed and who knows what it provides that 
isn't standard ;-). Assuming you have teh Dev Tools installed you likely have 
everything you need.  Things like ncftp are optional to make things faster/easier for 
CPAN. It has numerous ways to get the modules/etc. off of the Net that it needs so 
missing any one particular program may not cause failure, especially since at the very 
least it will fall through to Net::FTP which should be base install.  Asking the 
questions is normal the first time you run it, which things in particular did you not 
have? Did you see if it would work properly, start with a very simple module that 
doesn't have a lot of pre-reqs and work your way up. As an aside it will tell you 
there is a new CPAN available, you shouldn't worry about installing it at the start, 
you can later if you want.

http://danconia.org

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




RE: TimeStamp compare

2003-01-30 Thread wiggins


On Thu, 30 Jan 2003 07:59:11 -0500, [EMAIL PROTECTED] wrote:

> Hi there mates,
> 
>I would like to Know If anyone of you have already tried to get the time and 
> date a file was created from the OS. For example imagine I have a *.java file 
> and I would like to compare the *.class file date of creation with the date of 
> edition of the *.java file in other to make sure the *.class file was generated 
> (compiled ) or not after the *.java new edition.
> 

Do you really want creation date? or last modified date?  In the former case it is 
system dependent and many systems do not provide it or it isn't reliable, in the 
latter case you should check out:

perldoc -f stat

One of the parameters it returns is the last modified date/time of the file.

http://danconia.org

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




What is the and operator in perl

2003-01-30 Thread dkumar
If I want to do something like

  if ($a=$b) and ($d=$e)
Is it possible?

because & is for bitwise AND operation.

Thanks



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




Perl OO - Dynamic method call

2003-01-30 Thread NYIMI Jose (BMB)
This is a little bit Out of Topic but if somebody can give input I will greatly 
appreciate!

I know that in Perl OO the name of a method can be a variable.
Which end up with code like this:

my $obj= new MyClass;
#here the thing
$obj->$method();

$method var holding the name of my method.

I would like to know if such feature exists in other OO languages like Java etc ...
Besides, is such way of programming an indication of a bad "Class Design" ?

Thanks in advance.

José.


 DISCLAIMER 

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

Thank you for your cooperation.

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




RE: What is the and operator in perl

2003-01-30 Thread Nigel Peck - MIS Web Design
you can use "and" or "&&".

if (($a==$b) && ($d==$e)) {
# code here
}

and has a lower precedence than &&.

For or there's "or" or "||"

HTH
Nigel

MIS Web Design
http://www.miswebdesign.com/


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 30 January 2003 13:55
> To: [EMAIL PROTECTED]
> Subject: What is the and operator in perl
> 
> 
> If I want to do something like
> 
>   if ($a=$b) and ($d=$e)
> Is it possible?
> 
> because & is for bitwise AND operation.
> 
> 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: What is the and operator in perl

2003-01-30 Thread Jenda Krynicky
From:   [EMAIL PROTECTED]

> If I want to do something like
> 
>   if ($a=$b) and ($d=$e)
> Is it possible?
> 
> because & is for bitwise AND operation.

if ($a==$b and $d==$e)
or
if (($a==$b) && ($d==$e))

Please note that I'm using ==. 

== is numerical comparison!
eq is string comparison!
= is assignment!

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


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




RE: What is the and operator in perl

2003-01-30 Thread Kipp, James
 && or and  both work
perldoc perlop


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 8:55 AM
> To: [EMAIL PROTECTED]
> Subject: What is the and operator in perl
> 
> 
> If I want to do something like
> 
>   if ($a=$b) and ($d=$e)
> Is it possible?
> 
> because & is for bitwise AND operation.
> 
> 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: Perl OO - Dynamic method call

2003-01-30 Thread Jenda Krynicky
From: "NYIMI Jose (BMB)" <[EMAIL PROTECTED]>
> This is a little bit Out of Topic but if somebody can give input I
> will greatly appreciate!
> 
> I know that in Perl OO the name of a method can be a variable.
> Which end up with code like this:
> 
> my $obj= new MyClass;
> #here the thing
> $obj->$method();
> 
> $method var holding the name of my method.
> 
> I would like to know if such feature exists in other OO languages like
> Java etc ... 

I guess you could do something similar in 
JavaScript/JScript/ECMAScript

> Besides, is such way of programming an indication of a
> bad "Class Design" ?

Well ... you should not have to do that. 

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


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




Re: sorting thoughts

2003-01-30 Thread Rob Dixon

"Steven Massey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
m...
>
> If you could explain how this works, especially how $a $b are set with
the
> compare values
>
> my @sorted = sort {
> (split ':', $a)[-1] <=> (split ':', $b)[-1]
> } @array;

The block is evaluated for each pair of list elements that
'sort' needs to compare to do its job. The block must return
a value less than, equal to, or greater than zero, according
to whether $a is to be considered less than, equal to, or
greater than $b. $a and $b are implicitly set by the sort
command to the pair of list elements that it wants compared.

'split' turns a scalar into a list by splitting at the given regex.
Here we are splitting on colons. Indexing the list with [-1]
returns the last element (negative indices are relative to
the end of the list). Finally we compare the values
numerically. <=> and 'cmp' have the same effect but compare
numbers and strings respectively. They return exactly the
values that 'sort' needs: -1, 0 and +1 if the left operand is
less than , equal to, or greater the right.

Overall, sort is sorting the array in numerical order of the
last field of each element, where fields are delimited by
the colon character.

HTH,

Rob




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




RE: TimeStamp compare

2003-01-30 Thread wiggins


On Thu, 30 Jan 2003 08:49:00 -0500, [EMAIL PROTECTED] wrote:

> Ok , I see what you mean but How Can I compare the dates once They aren´t 
> numeric?
> 

Remember to group reply so the list can help/benefit as well.

Not sure what you mean?  If you stat both files then you are left with seconds from 
the epoch, then it is just a matter of checking to see if one is greater than the 
other, if so then a recompile is needed, if not skip it.  Where do you get non-numeric 
dates?

http://danconia.org

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




RE: Perl OO - Dynamic method call

2003-01-30 Thread NYIMI Jose (BMB)
> -Original Message-
> From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, January 30, 2003 3:12 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Perl OO - Dynamic method call
> 
> 
> From: "NYIMI Jose (BMB)" <[EMAIL PROTECTED]>
> > This is a little bit Out of Topic but if somebody can give input I 
> > will greatly appreciate!
> > 
> > I know that in Perl OO the name of a method can be a 
> variable. Which 
> > end up with code like this:
> > 
> > my $obj= new MyClass;
> > #here the thing
> > $obj->$method();
> > 
> > $method var holding the name of my method.
> > 
> > I would like to know if such feature exists in other OO 
> languages like 
> > Java etc ...
> 
> I guess you could do something similar in 
> JavaScript/JScript/ECMAScript

Any idea, if this is possible in Java ?

> 
> > Besides, is such way of programming an indication of a
> > bad "Class Design" ?
> 
> Well ... you should not have to do that. 
> 
> Jenda
> = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
> When it comes to wine, women and song, wizards are allowed 
> to get drunk and croon as much as they like.
>   -- Terry Pratchett in Sourcery
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


 DISCLAIMER 

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

Thank you for your cooperation.

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


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




Data Structure

2003-01-30 Thread Paul Kraus
As a project I have to generate an excel file based on the output of a
text file.
I need to generate an excel file that is going to have a separate sheet
for each vendor. Then that sheet would be divided into 4 sections one
for each year. The excel part I can do. The problem is I can figure out
what data structure to build. It would need to contain the year, the
item code description sales and qty I thought I would name the
structures after the vendor. So all BAUE00 would be in one structure. 

I am just learning how to build anything beyond an array of arrays or an
array of hashes.
I can complete this job without any help but I thought this would be a
good exercise on data structures. Any suggestions would be deeply
appreciated.

I am reading it like this to start.
while (){
chomp;
@temp = split /\|/,$_;
$_=~s/\s+$//g foreach (@temp);

Here is a sample of the source.

Source
--
Year item   desc
vendsaleqty   unused
2001|000611|Pylon 30" Sht Tit w/Angular adaptor|BAUE00
|  203.00 |3.00 |ENDO
2002|000632|Pyramid Adapter|BAUE00
|  314.00 |6.00 |ENDO
2002|000650|Sach Foot Adapter Titanium |BAUE00
|  155.00 |3.00 |ENDO
2002|000656|Tube Clamp Adaptor 30mm Titanium   |BAUE00
| 1451.00 |   18.00 |ENDO
2002|008567|AK Foam Cover Blank MD |BAUE00
|   75.00 |1.00 |ENDO
2002|008568|AK Foam Cover Blank XLG|BAUE00
| 1852.00 |   24.00 |ENDO
1999|008582|Foam Block A/K F/Machine Medium|BAUE00
|  285.00 |7.00 |ENDO
2000|008582|Foam Block A/K F/Machine Medium|BAUE00
|  893.00 |   22.00 |ENDO
2001|008582|Foam Block A/K F/Machine Medium|BAUE00
| 1750.00 |   45.00 |ENDO




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




Re: TimeStamp compare

2003-01-30 Thread John Baker



On Thu, 30 Jan 2003 [EMAIL PROTECTED] wrote:

> Date: Thu, 30 Jan 2003 07:59:11 -0500
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: TimeStamp compare
>
> Hi there mates,
>
>I would like to Know If anyone of you have already tried to get the time and
> date a file was created from the OS. For example imagine I have a *.java file
> and I would like to compare the *.class file date of creation with the date of
> edition of the *.java file in other to make sure the *.class file was generated
> (compiled ) or not after the *.java new edition.
>
> I hope I´ve made myself clear ,
> Thks in advance.
>
#-- This module is a must-have:
use Date::Manip;

 # Get properly formatted modify time of file from epoch
 my $fmodtime  = (stat($fh))[9];
 my $mod_parse = &ParseDateString("epoch $fmodtime");

 # Check for GMT, if not, convert
 my ($dnow, $secs, $now_parse, $delta_string);
 if   ($tz !~ /^GMT$/) { $dnow = Date_ConvTZ($now,"","GMT"); }
 else { $dnow = $now; }

 # Get properly formatted current time from epoch
 my ($m,$d,$y,$h,$mn,$s) = (split(/,/ ,$dnow));
 $secs  = &Date_SecsSince1970GMT($m,$d,$y,$h,$mn,$s);
 $now_parse = &ParseDateString("epoch $secs");

 $delta_string = DateCalc($mod_parse,$now_parse,\$err);

---
This is code I've extracted from an application I wrote and
maintain.  It's comparing the current time with the last
mod time.  I'm interested in this delta in order to determine
whether to update a file or not (if older than 3 hours update,
if not, don't).

So the point is, stat() and Date::Manip is one way to solve your
problem.

jab

 perldoc -f stat
 perldoc /path/to/perl5/site_perl/5.6.1/Date/Manip.pod



Be straight and to the point. Don't waste others' time.
Do your homework before you ask for help.

--Unknown


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




System() function in 5.8

2003-01-30 Thread Ravinder Chauhan
After installing Perl 5.8 my @files = system("dir bex*.* /od /b") function
has started behaving strange. Under 5.6 this function used to return the
list of files for matching files, however now in place of file list it is
returning a number "65280". I would appreciate if someone could help me in
this.
 
Thanks,
Ravinder
 



RE: TimeStamp compare

2003-01-30 Thread Bob Showalter
[EMAIL PROTECTED] wrote:
> Hi there mates,
> 
>I would like to Know If anyone of you have already tried to get
> the time and date a file was created from the OS. 

The stat() function will do that. But read on...

> For example imagine
> I have a *.java file and I would like to compare the *.class file
> date of creation with the date of edition of the *.java file in other
> to make sure the *.class file was generated (compiled ) or not after
> the *.java new edition. 

If you just want to compare two files to see if one is newer, use the -M
operator:

   $need_recompile = 1 if -M 'foo.java' < -M 'foo.class';

-M gives you the age in days of a file, measured from the time your script
was started (stored in the special $^T variable). The specific value
returned from -M isn't important in this case, but two -M returns can be
compared to see which file is newer.

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




Re: TimeStamp compare

2003-01-30 Thread wiggins


On Thu, 30 Jan 2003 09:34:12 -0500 (EST), John Baker <[EMAIL PROTECTED]> wrote:


> #-- This module is a must-have:
> use Date::Manip;
> 
>  # Get properly formatted modify time of file from epoch
>  my $fmodtime  = (stat($fh))[9];
>  my $mod_parse = &ParseDateString("epoch $fmodtime");
> 
>  # Check for GMT, if not, convert
>  my ($dnow, $secs, $now_parse, $delta_string);
>  if   ($tz !~ /^GMT$/) { $dnow = Date_ConvTZ($now,"","GMT"); }
>  else { $dnow = $now; }
> 
>  # Get properly formatted current time from epoch
>  my ($m,$d,$y,$h,$mn,$s) = (split(/,/ ,$dnow));
>  $secs  = &Date_SecsSince1970GMT($m,$d,$y,$h,$mn,$s);
>  $now_parse = &ParseDateString("epoch $secs");
> 
>  $delta_string = DateCalc($mod_parse,$now_parse,\$err);
> 
> ---
> This is code I've extracted from an application I wrote and
> maintain.  It's comparing the current time with the last
> mod time.  I'm interested in this delta in order to determine
> whether to update a file or not (if older than 3 hours update,
> if not, don't).
> 
> So the point is, stat() and Date::Manip is one way to solve your
> problem.
> 
> jab
> 
>  perldoc -f stat
>  perldoc /path/to/perl5/site_perl/5.6.1/Date/Manip.pod
> 

I agree that Date::Manip is a great module for complex date manipulations, but for 
what you are doing it is major overkill no?  Why not just take 'time()' which is now, 
subtract 3 hours worth of seconds... 60*60*3 ... and then compare that integer to the 
stat[9] time that you get? If it is greater you need to reprocess the file...

http://danconia.org

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




get pixel color from image using X,Y

2003-01-30 Thread Alex
hi all,

I'd like to get color using coordinates.
it's better like "FF" and image format doesn't matter

--
Alex mailto:[EMAIL PROTECTED]


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




RE: TimeStamp compare

2003-01-30 Thread John Baker
On Thu, 30 Jan 2003, Bob Showalter wrote:

> If you just want to compare two files to see if one is newer, use the -M
> operator:
>
>$need_recompile = 1 if -M 'foo.java' < -M 'foo.class';
>
> -M gives you the age in days of a file, measured from the time your script
> was started (stored in the special $^T variable). The specific value
> returned from -M isn't important in this case, but two -M returns can be
> compared to see which file is newer.
>
That's a really elegant solution. I like that. =)

jab


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




Re: Help installing Perl and Perl Modules on Mac OS X

2003-01-30 Thread Chris

On Wednesday, January 29, 2003, at 01:25  PM, David Brookes wrote:

Sometimes the author knows what they are talking about ;-)...

Actually, if you read the article, he says both are ok and one may
choose
either.


Trying to make a mod_perl with 5.8 was too much for me to get working,
and then your Apple-included modules don't work because 5.8's stuff
isn't binary compatible with 5.6.0 ... the author knew what he was
talking about.  OTOH, I also installed over the default position ...




Why?  What was the output and what errors were listed?  If you can
give a better explanation of "did not install properly" then someone
here may be able to help you. The other suggestion is to use the
power of CPAN's ability to handle module installation for you, by
reading perldoc CPAN and then issuing:


When I ran make test it failed EVERYTHING.


Look at the articles at http://www.oreillynet.com/pub/au/1059 for MacOS
X installation of Perl 5.8, then take questions to [EMAIL PROTECTED]
where people who've traveled your road before can be found in numbers.

Take care,
	Chris


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




RE: Data Structure

2003-01-30 Thread Kipp, James
>The problem is I can 
> figure out
> what data structure to build. It would need to contain the year, the
> item code description sales and qty I thought I would name the
> structures after the vendor. So all BAUE00 would be in one structure. 
> 
> I am just learning how to build anything beyond an array of 
> arrays or an
> array of hashes.
> I can complete this job without any help but I thought this would be a
> good exercise on data structures. Any suggestions would be deeply
> appreciated.
> 
> I am reading it like this to start.
> while (){
>   chomp;
>   @temp = split /\|/,$_;
>   $_=~s/\s+$//g foreach (@temp);

Hi Paul
So you have a simple pipe delimted file. I don't think you need much more
than an MD array. Here is what you can do (note I left out the regex stuff):

while () {
#chomp;
  # push each line of data onto the array using a ref 
push (@data, [ split(/\|/,$_) ] );
}

# just to show what is in the matrix now
for $row (@data) {
print @$row;
---

from here you can parse it out into insert into your excel file. like  row1
-> col2. 
Is this what you were looking for. Let me know if you need help parsing out
the elements of the data structure to insert into excel

HTH,
Jim





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




Compound if statement.

2003-01-30 Thread Duane Koble
I am working on a program that requires that three statement be true in order to set a 
hash.  The problem I am having is getting the if statement to work correctly.  I seems 
to me that if two of the statements are true it proceeds through the if statement.  I 
need all three to be true before it proceeds through the statement.
I have copied the if statement below.
Any help will be appreciated.

Thanks
Duane 

  if ($HOUR_24 => $PRIME_TIMEFRAME &&
$HOUR_24 < $OFF_HOURS_TIMEFRAME &&
$PRIME_THRESHOLD <= $ELAPSTIME) {
$STATUS_DB{$C_EWAY_NAME} = "THRESHOLD ERROR,Minimun prime message 
threshold not met,".
"$CRITICALITY".","."$TIMESTAMP";
print PROGRAM_LOG "Ran thru day prime M-F \n";
 }elsif ($OFF_HOURS_THRESHOLD <=  $ELAPSTIME) {
$STATUS_DB{$C_EWAY_NAME} = "THRESHOLD ERROR,Minimun off hours message 
threshold not met,".
"$CRITICALITY".","."$TIMESTAMP";
print PROGRAM_LOG "Ran thru day off hours M-F \n";
 
 }



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




RE: Data Structure

2003-01-30 Thread Paul Kraus
Perfect thanks!

-Original Message-
From: Kipp, James [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 30, 2003 10:28 AM
To: '[EMAIL PROTECTED]'; Perl
Subject: RE: Data Structure


>The problem is I can
> figure out
> what data structure to build. It would need to contain the year, the
> item code description sales and qty I thought I would name the
> structures after the vendor. So all BAUE00 would be in one structure. 
> 
> I am just learning how to build anything beyond an array of
> arrays or an
> array of hashes.
> I can complete this job without any help but I thought this would be a
> good exercise on data structures. Any suggestions would be deeply
> appreciated.
> 
> I am reading it like this to start.
> while (){
>   chomp;
>   @temp = split /\|/,$_;
>   $_=~s/\s+$//g foreach (@temp);

Hi Paul
So you have a simple pipe delimted file. I don't think you need much
more than an MD array. Here is what you can do (note I left out the
regex stuff):

while () {
#chomp;
  # push each line of data onto the array using a ref 
push (@data, [ split(/\|/,$_) ] );
}

# just to show what is in the matrix now
for $row (@data) {
print @$row;
---

from here you can parse it out into insert into your excel file. like
row1
-> col2.
Is this what you were looking for. Let me know if you need help parsing
out the elements of the data structure to insert into excel

HTH,
Jim





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




taking lines from a file

2003-01-30 Thread Marcelo
Hi everybody...
How I can take lines from a file like this ...

line1=A
line2
line3

line1=B
line2
line3

line1=A
line2
line3

I want to take the followin 2 lines to the line1 when line1=A and write 
them to another file

Thanks...


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



Re: Compound if statement.

2003-01-30 Thread Christopher D. Lewis
On Thursday, January 30, 2003, at 09:33  AM, Duane Koble wrote:


I am working on a program that requires that three statement be true 
in order to set a hash.  The problem I am having is getting the if 
statement to work correctly.  I seems to me that if two of the 
statements are true it proceeds through the if statement.  I need all 
three to be true before it proceeds through the statement.

You could use a nested if statement, right? The innermost "if" would 
set the variable if true, and it would never be evaluated if the prior 
two were not true.
While I'm sure a more elegant solution exists, I've used nested if 
clauses for this purpose.  Since my Perl repertoire is mostly hammers, 
I mostly beat Perl things with hammers 

Take care,
	Chris


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



RE: Compound if statement.

2003-01-30 Thread Le Blanc, Kerry (Kerry)
You would most likely get better results if you tried a While loop instead of an if 
else block. Would be a bit easier to set up as well.
IMHO

Kerry LeBlanc 
Materials Auditor 
Process Owner 
75 Perseverence Way 
Hyannis, MA. 02601 
1-508-862-3082 
http://www.vsf.cape.com/~bismark 



-Original Message-
From: Duane Koble [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 10:34 AM
To: [EMAIL PROTECTED]
Subject: Compound if statement.


I am working on a program that requires that three statement be true in order to set a 
hash.  The problem I am having is getting the if statement to work correctly.  I seems 
to me that if two of the statements are true it proceeds through the if statement.  I 
need all three to be true before it proceeds through the statement.
I have copied the if statement below.
Any help will be appreciated.

Thanks
Duane 

  if ($HOUR_24 => $PRIME_TIMEFRAME &&
$HOUR_24 < $OFF_HOURS_TIMEFRAME &&
$PRIME_THRESHOLD <= $ELAPSTIME) {
$STATUS_DB{$C_EWAY_NAME} = "THRESHOLD ERROR,Minimun prime message 
threshold not met,".
"$CRITICALITY".","."$TIMESTAMP";
print PROGRAM_LOG "Ran thru day prime M-F \n";
 }elsif ($OFF_HOURS_THRESHOLD <=  $ELAPSTIME) {
$STATUS_DB{$C_EWAY_NAME} = "THRESHOLD ERROR,Minimun off hours message 
threshold not met,".
"$CRITICALITY".","."$TIMESTAMP";
print PROGRAM_LOG "Ran thru day off hours M-F \n";
 
 }



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

2003-01-30 Thread alima
Ok mate and where can I download that module?

Quoting John Baker <[EMAIL PROTECTED]>:

> 
> 
> 
> On Thu, 30 Jan 2003 [EMAIL PROTECTED] wrote:
> 
> > Date: Thu, 30 Jan 2003 07:59:11 -0500
> > From: [EMAIL PROTECTED]
> > To: [EMAIL PROTECTED]
> > Subject: TimeStamp compare
> >
> > Hi there mates,
> >
> >I would like to Know If anyone of you have already tried to get the time
> and
> > date a file was created from the OS. For example imagine I have a *.java
> file
> > and I would like to compare the *.class file date of creation with the date
> of
> > edition of the *.java file in other to make sure the *.class file was
> generated
> > (compiled ) or not after the *.java new edition.
> >
> > I hope I´ve made myself clear ,
> > Thks in advance.
> >
> #-- This module is a must-have:
> use Date::Manip;
> 
>  # Get properly formatted modify time of file from epoch
>  my $fmodtime  = (stat($fh))[9];
>  my $mod_parse = &ParseDateString("epoch $fmodtime");
> 
>  # Check for GMT, if not, convert
>  my ($dnow, $secs, $now_parse, $delta_string);
>  if   ($tz !~ /^GMT$/) { $dnow = Date_ConvTZ($now,"","GMT"); }
>  else { $dnow = $now; }
> 
>  # Get properly formatted current time from epoch
>  my ($m,$d,$y,$h,$mn,$s) = (split(/,/ ,$dnow));
>  $secs  = &Date_SecsSince1970GMT($m,$d,$y,$h,$mn,$s);
>  $now_parse = &ParseDateString("epoch $secs");
> 
>  $delta_string = DateCalc($mod_parse,$now_parse,\$err);
> 
> ---
> This is code I've extracted from an application I wrote and
> maintain.  It's comparing the current time with the last
> mod time.  I'm interested in this delta in order to determine
> whether to update a file or not (if older than 3 hours update,
> if not, don't).
> 
> So the point is, stat() and Date::Manip is one way to solve your
> problem.
> 
> jab
> 
>  perldoc -f stat
>  perldoc /path/to/perl5/site_perl/5.6.1/Date/Manip.pod
> 
> 
> 
> Be straight and to the point. Don't waste others' time.
> Do your homework before you ask for help.
> 
> --Unknown
> 
> 
> 




-
This mail sent through IMP: http://horde.org/imp/

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




Re: TimeStamp compare

2003-01-30 Thread John Baker



On Thu, 30 Jan 2003 [EMAIL PROTECTED] wrote:

> Date: Thu, 30 Jan 2003 10:49:27 -0500
> From: [EMAIL PROTECTED]
> To: John Baker <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: TimeStamp compare
>
> Ok mate and where can I download that module?
>
http://search.cpan.org/author/SBECK/DateManip-5.40/

jab



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




RE: A very annoying regex question.

2003-01-30 Thread Zeus Odin
No, regex is not a requirement. I was originally trying to test on a
difficult example something I read in Programming Perl--Chap 5.7.2
Clustering, p 185:

-
In the remainder of the chapter, we'll see many more regex extensions, all
of which cluster without capturing, as well as doing something else. The
(?:PATTERN) extension is just special in that it does nothing else. So if
you say:

@fields = split(/\b(?:a|b|c)\b/)
it's like:
@fields = split(/\b(a|b|c)\b/)
but doesn't spit out extra fields. (The split operator is a bit like m//g in
that it will emit extra fields for all the captured substrings within the
pattern. Ordinarily, split only returns what it didn't match. For more on
split see Chapter 29, "Functions".)
-

It seems to me that 'split /a/' and 'split /(?:a)/' both split on and do not
emit 'a'; whereas, 'a' should be part of the split result in the latter
case.

Thanks again.

-Original Message-
From: Robert Citek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 11:21 PM
To: Zeus Odin
Cc: [EMAIL PROTECTED]
Subject: Re: A very annoying regex question.



Hello Zeus,

At 11:55 AM 1/29/2003 -0500, Zeus Odin wrote:
>An even shorter version of yours is:
>-
>my @a;
>while(){
>   next unless /=/ && chomp;
>   push @a, split /=/, $_, 2;
>}
>print "$_\n" for @a;
>-

This is even shorter, eliminates all uses of variables, and slurps in the
data all at once:

#!/usr/bin/perl -w0
print join("\n", map({split(/=/,$_,2)} grep(/=/, split(/\n/, ;

The only thing it does not do is use the regex.  Is the regex a requirement?

Regards,
- Robert




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




Re: Help installing Perl and Perl Modules on Mac OS X

2003-01-30 Thread wiggins
Please be sure to always group reply.


On Thu, 30 Jan 2003 09:12:15 -0600, Eduardo Cancino <[EMAIL PROTECTED]> wrote:

> As I recall installing Perl Modules in Mac 10.2.3, using de CPAN module 
> that comes with perl (5.8.0, source, I think with the perl 5.xx that 
> comes with Jaguar), with this written in the terminal,  "perl -MCPAN -e 
> shell", you just choose the defaults and the only part you have to be 
> careful, is the mirrors part so your downloads are faster.
> 
> Most of the configuration is done by the CPAN module.
> 
> I just wrote:
> 
> cpan> install ncftp
> 
> and it is downloading it.
> 
> And it is downloading from ftp://cpan.azc.uam.mx, that is very 
> convenient
> for me, since I live in Mexico City.
> 
> hope this helps.
> 
> 
> On Thursday, January 30, 2003, at 07:23 AM, [EMAIL PROTECTED] wrote:
> 
> >
> > 
> > On Thu, 30 Jan 2003 07:53:53 -0500, David Brookes 
> > <[EMAIL PROTECTED]> wrote:
> >
> >> Hi again.
> >>
> >> One suggestion was to use CPAN to install the modules.  Does anyone
> >> have any experience doing this on a Mac?  I tried to do this and when
> >> you log on for the first time, you have to answer a whole bunch of
> >> questions.  CPAN could not find certain programs it wanted (like 
> >> ncftp)
> >> and I suspect that at the end of the day, the config was inadequate to
> >> make the whole thing work.  Anyone know how to configure it correctly
> >> so that it will install modules?
> >>
> >
> > I know I have used it, but I have fink installed and who knows what it 
> > provides that isn't standard ;-). Assuming you have teh Dev Tools 
> > installed you likely have everything you need.  Things like ncftp are 
> > optional to make things faster/easier for CPAN. It has numerous ways 
> > to get the modules/etc. off of the Net that it needs so missing any 
> > one particular program may not cause failure, especially since at the 
> > very least it will fall through to Net::FTP which should be base 
> > install.  Asking the questions is normal the first time you run it, 
> > which things in particular did you not have? Did you see if it would 
> > work properly, start with a very simple module that doesn't have a lot 
> > of pre-reqs and work your way up. As an aside it will tell you there 
> > is a new CPAN available, you shouldn't worry about installing it at 
> > the start, you can later if you want.
> >
> > http://danconia.org
> >
> > -- 
> > 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: get pixel color from image using X,Y

2003-01-30 Thread wiggins


On Thu, 30 Jan 2003 18:05:26 +0300, Alex <[EMAIL PROTECTED]> wrote:

> hi all,
> 
> I'd like to get color using coordinates.
> it's better like "FF" and image format doesn't matter
> 

I am not a graphics expert so don't know if there is a way to do this directly. But 
you should check out the GD modules or Image::Magick from CPAN.  They require outside 
C libraries, so don't know what system you are on but they should/might be available 
for your system.

There is a list of most/all image related modules available on:
http://search.cpan.org/modlist/Graphics

http://danconia.org

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




Re: Compound if statement.

2003-01-30 Thread Rob Dixon
Duane Koble wrote:
> I am working on a program that requires that three statement be true
> in order to set a hash.  The problem I am having is getting the if
> statement to work correctly.  I seems to me that if two of the
> statements are true it proceeds through the if statement.  I need all
> three to be true before it proceeds through the statement.
> I have copied the if statement below.
> Any help will be appreciated.
>
>   if ($HOUR_24 => $PRIME_TIMEFRAME &&

There's your problem. You need >=, => is just a comma operator.

> $HOUR_24 < $OFF_HOURS_TIMEFRAME &&
> $PRIME_THRESHOLD <= $ELAPSTIME) {
> $STATUS_DB{$C_EWAY_NAME} = "THRESHOLD ERROR,Minimun
> prime message threshold not met,".
> "$CRITICALITY".","."$TIMESTAMP";
> print PROGRAM_LOG "Ran thru day prime M-F \n";
>  }elsif ($OFF_HOURS_THRESHOLD <=  $ELAPSTIME) {
> $STATUS_DB{$C_EWAY_NAME} = "THRESHOLD ERROR,Minimun off
> hours message threshold not met,".
> "$CRITICALITY".","."$TIMESTAMP";
> print PROGRAM_LOG "Ran thru day off hours M-F \n";
>
>  }

You'd do yourself (and us!) a few favours by laying out your code
better.
Also, most people expect local variable names to be all lower-case.

HTH,

Rob






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




Re: taking lines from a file

2003-01-30 Thread Rob Dixon
Marcelo wrote:
> Hi everybody...
> How I can take lines from a file like this ...
>
> line1=A
> line2
> line3
>
> line1=B
> line2
> line3
>
> line1=A
> line2
> line3
>
> I want to take the followin 2 lines to the line1 when line1=A and
> write them to another file

I'm not clear exactly what your file looks like, but the following will
output the two lines immediately following a line exactly matching
'line1=A'.

@ARGV = 'file.txt';

my $print;

while (<>) {
if ($print and $print--) { print }
else { $print = 2 if /^line1=A$/ }
}

HTH,

Rob




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




Problem with Getopt::Std

2003-01-30 Thread Pedro Antonio Reche
Hi all, I using the code below that uses the Getopt::Std to process the
arguments from the command line (init subroutine).  However, for some
reason I do not get the  arguments from the switches. If anyone sees
what is the mistake I will be happy to hear about it. 

#!/usr/sbin/perl -w
use Getopt::Std;

&init;

open(F, "$FILE") || die  "I could not open $FILE\n";
while(){
if (! /ATOM/) {
print $_;
}
else{
if ( substr($_, $21,1) =~ $A ){
substr ($_, $21, 1, $B);
print $_;
}
else{
print $_;
}
}
}
close(F);

sub usage {
my $program = `basename $0`;
chop($program);
print STDERR "
  $program [-p pdb ] [-a  ] [-b ] [
-h ]

  Rename chain id from pdb

  -p : pdb file
  -a : chain to rename
  -b : new chain name

 
";

}
sub init {
getopts('pab');
if ($opt_p) {
$FILE = $opt_p;
print "$FILE\n";
} else {
&usage;
exit;
}
if ($opt_a) {
$A = $opt_a;
chomp($A);
} 
else {
&usage;
exit;
}
if ($opt_b) {
$B = $opt_b;
chomp($B);
} 
else {
&usage;
exit;
}
}

-- 
***
PEDRO A. RECHE , pHDTL: 617 632 3824
Bioinformatics Research Scientist   FX: 617 632 4569
Dana-Farber Cancer Institute,   EM: [EMAIL PROTECTED]
Molecular Immunology Foundation,EM: [EMAIL PROTECTED]
Harvard Medical School, W3: http://www.mifoundation.org 
44 Binney Street, D1510A,
Boston, MA 02115
***

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




Re: Help installing Perl and Perl Modules on Mac OS X

2003-01-30 Thread David Brookes

> Trying to make a mod_perl with 5.8 was too much for me to get working,
> and then your Apple-included modules don't work because 5.8's stuff
> isn't binary compatible with 5.6.0 ... the author knew what he was
> talking about.  OTOH, I also installed over the default position ...

Yes, I see.  You are talking about things I don't understand. :)
 
> Look at the articles at http://www.oreillynet.com/pub/au/1059 for MacOS
> X installation of Perl 5.8, then take questions to [EMAIL PROTECTED]
> where people who've traveled your road before can be found in numbers.

Thanks for the pointers.  I will head over there and see if I can find
help.  I'll stay  subscribed here.  Hopefully I will get it all working in
the near future and be able to really call my self a "beginner" and try
and pick up some coding tips. ;)

David B


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




Re: taking lines from a file

2003-01-30 Thread John Baker

On Thu, 30 Jan 2003, Rob Dixon wrote:

> Date: Thu, 30 Jan 2003 16:40:13 -
> From: Rob Dixon <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: taking lines from a file
>
> Marcelo wrote:
> > Hi everybody...
> > How I can take lines from a file like this ...
> >
> > line1=A
> > line2
> > line3
> >
> > line1=B
> > line2
> > line3
> >
> > line1=A
> > line2
> > line3
> >
> > I want to take the followin 2 lines to the line1 when line1=A and
> > write them to another file
>
> I'm not clear exactly what your file looks like, but the following will
> output the two lines immediately following a line exactly matching
> 'line1=A'.
>
> @ARGV = 'file.txt';
>
> my $print;
>
> while (<>) {
> if ($print and $print--) { print }
> else { $print = 2 if /^line1=A$/ }
> }
>
>
I like that. Nice. =)

Or if there are n-number of lines below "line1=A" and each block is
_only_ ever delimited by an empty line, ie:

   .
   .
   line3

   line1=B
   .
   .

...this would work:

@ARGV = 'file.txt';

my $print;

while (<>) {
if (m/^(line1=A\n)$/.../^\n$/) { s/$1//; print;}
}


jab


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




RE: Problem with Getopt::Std

2003-01-30 Thread Bob Showalter
Pedro Antonio Reche wrote:
> Hi all, I using the code below that uses the Getopt::Std to process
> the arguments from the command line (init subroutine).  However, for
> some reason I do not get the  arguments from the switches. 
> ...
> getopts('pab');

If the options take arguments, you need to put a colon after them.

   getopts('p:a:b:') or exit 1;   # exit if invalid argument

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




problem with bioperl

2003-01-30 Thread Prachi Shah

Hi Everyone!

Is anyone familiar with Bio::Perl? I just started using it and my first 
little 'Hello world' quality script failed with the following error:

Can't locate object method "new" via package "Bio::DB::Query::GenBank" 
(perhaps you forgot to load "Bio::DB::Query::GenBank"?) at C:\tryBioPerl.pl 
line 5.

I checked the GenBank.pm and the code looks ok. And of course, I did not 
forget to load "Bio::DB::Query::GenBank". I am using Active state Perl 5.6.1 
for Win32 and BioPerl 1.2 on Windows 2000 system.
Any ideas on this are appreciated.

Thanks,
Prachi.

# Code starts here. #

#! perl -w

use strict;
use Bio::Perl;

my $query_string = 'Gallus gallus[Organism] AND ATP';
my $query = Bio::DB::Query::GenBank->new(-db=>'nucleotide',
	  -query=>$query_string);
my $count = $query->count;
my @ids   = $query->get_Ids;

print "COUNT $count\n";
print " IDS \n @ids";

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail


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



Sorting Help!!!

2003-01-30 Thread kevin r
Hello,

I am having problems with the sort routine.  I am writing a script that 
parses very large firewall logs.  At one point during the script I end up 
with a very large array containing all of the destination udp and tcp port 
numbers.  This array can be up being over 100,000 entries.  I am trying to 
sort with the following:

@sortedPortArray = sort(@portArray);

It works, but I could crawl up under my desk and take a nap before it will 
finish.  Is there a faster way to sort?  Thank you in advance for your help.


Kevin




_
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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



RE: Sorting Help!!!

2003-01-30 Thread Beau E. Cox
Hi -

> -Original Message-
> From: kevin r [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 8:06 AM
> To: [EMAIL PROTECTED]
> Subject: Sorting Help!!!
>
>
> Hello,
>
> I am having problems with the sort routine.  I am writing a script that
> parses very large firewall logs.  At one point during the script I end up
> with a very large array containing all of the destination udp and
> tcp port
> numbers.  This array can be up being over 100,000 entries.  I am
> trying to
> sort with the following:
>
> @sortedPortArray = sort(@portArray);
>
> It works, but I could crawl up under my desk and take a nap
> before it will
> finish.  Is there a faster way to sort?  Thank you in advance for
> your help.
>
>
> Kevin
>

It looks as though you may be thrashing in memory - the swap
file on disk. The quick fix might be to upgrade your processor
memory.

The REAL fix is to load the entries into a database (like mysql)
and proceed with SQL queries. I don't think the perl sort
was ever designed to handle millions and millions of bytes of data...

Aloha => Beau.



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




RE: problem with bioperl

2003-01-30 Thread wiggins


On Thu, 30 Jan 2003 12:45:13 -0500, "Prachi Shah" <[EMAIL PROTECTED]> wrote:

> 
> Hi Everyone!
> 
> Is anyone familiar with Bio::Perl? I just started using it and my first 
> little 'Hello world' quality script failed with the following error:
> 
> Can't locate object method "new" via package "Bio::DB::Query::GenBank" 
> (perhaps you forgot to load "Bio::DB::Query::GenBank"?) at C:\tryBioPerl.pl 
> line 5.
> 
> I checked the GenBank.pm and the code looks ok. And of course, I did not 
> forget to load "Bio::DB::Query::GenBank". I am using Active state Perl 5.6.1 
> for Win32 and BioPerl 1.2 on Windows 2000 system.
> Any ideas on this are appreciated.
> 

I trust you 'installed' Bio::Perl but do you need to 'load' Bio::DB::Query::Genbank?? 
in other words do you need:

use Bio::DB::Query::Genbank;

or the like?  Couldn't determine duing a cursory look at the docs for Bio::Perl that 
it did (or didn't) load the module for you, but something tells me I doubt it.

> 
> # Code starts here. #
> 
> #! perl -w
> 
> use strict;
> use Bio::Perl;
> 
> my $query_string = 'Gallus gallus[Organism] AND ATP';
> my $query = Bio::DB::Query::GenBank->new(-db=>'nucleotide',
> -query=>$query_string);
> my $count = $query->count;
> my @ids   = $query->get_Ids;
> 
> print "COUNT $count\n";
> print " IDS \n @ids";
> 
> 

http://danconia.org

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




FW: Perl OO - Dynamic method call

2003-01-30 Thread NYIMI Jose (BMB)
Below, an input I have got from dbi-users forum.

José.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 30, 2003 5:39 PM
To: NYIMI Jose (BMB); [EMAIL PROTECTED]
Subject: RE: Perl OO - Dynamic method call


IMHO:  This is not bad design, is using a flexible dynamically binding language.  We 
use this EXTENSIVELY in some major enterprise servers we have written in perl. As long 
as you trap your exceptions (when the function does not exist in the class, this 
results far cleaner code, than a long if elsif elsif elsif block, that in the end 
requires you to type the same name in the if statement, and in the execution 
statement.  This allows perl to do all that for you.

Lincoln


-Original Message-
From: NYIMI Jose (BMB) [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 30, 2003 11:30 AM
To: [EMAIL PROTECTED]
Subject: Perl OO - Dynamic method call

This is a little bit Out of Topic but if somebody can give input I will greatly 
appreciate!

I know that in Perl OO the name of a method can be a variable. Which end up with code 
like this:

my $obj= new MyClass;
#here the thing
$obj->$method();

$method var holding the name of my method.

I would like to know if such feature exists in other OO languages like Java etc ... 
Besides, is such way of programming an indication of a bad "Class Design" ?

Thanks in advance.

José.


 DISCLAIMER 

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

Thank you for your cooperation.

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


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




still needing help

2003-01-30 Thread Ron Geringer
JD:

Thanks - really appreciate the help. Some of this looks like I can maybe
translate it.

Couple of questions though. I set up an html doc (see below) and took input
called email and ip and posted it to the name of the cgi form (testxx.pl). I
also changed your email address to mine (just cut and pasted). Figuring that
the individual who will complete the form - why do we collect the ip address
(since most won't know theirs anyway). I see that you've indicated an ENV
argument with the ip -- do I need to do something with the environment on
their side??

Finally - I set the two scripts up on my wife's remote server and ran it - I
received the following error in her error log:

Undefined subroutine &main::ReadParse called at
/www/tightweb/tightweb.com/cgi-bin/testxx.pl line 8.
[Thu Jan 30 12:36:37 2003] [error] [client 68.13.40.38] Premature end of
script headers:


I then set it up on my own linux box and received the following error:

Thu Jan 30 12:46:36 2003] [error] (8)Exec format error: exec of
/var/www/cgi-bin/testxx.pl failed
[Thu Jan 30 12:46:36 2003] [error] [client 192.168.0.193] Premature end of
script headers: /var/www/cgi-bin/testxx.pl

This is the html doc I put together for this test



Untitled Document


http://mainserver/cgi-bin/testxx.pl";>
Email Address: 
IP Address: 





This is your script - which I put in the cgi-bin

/usr/bin/perl

#basically...just like the example i sent this is gets the vars
#that get sent from the web-page. $in{content} == the content
# the senders is anonamus...there we get there ip and they must supply a
# return email address

&ReadParse;

##Did this to vars so perl would not interep @ and "." in ipaddr
$email = "\'$in{email}\'";
$ip = "\'$ENV{'REMOTE_ADDR'}\'";

##test for @ to make sure ther is a return address if not give other
#html this is a very lame test
unless ($email =~ /\@/){
print "Content-type: text/html\n\n";
print "hi";
print "You forgot to include your email address\n";
print "Please click back on your browser and try again";
print "";
}
else{
##pipe to sendmail and send mail with return email and ip
open(MAIL, "|/bin/mail -s WEB_REPLY geringer2\@cox.net");
print MAIL "$in{content}\n";
print MAIL "email address: $email\n";
print MAIL "ip: $ip\n";
close(MAIL);
##make confirm page
 print "Content-type: text/html\n\n";
 print "hi";
 print "your mail has been sent all replies will be sent to:";
 print "$in{email}\n";
 print "";
}

Other than changing the email address, nothing else was altered - I cut and
pasted it from your email.

Any help you can give me on these - I would appreicate. thanks

Ron




Re: Sorting Help!!!

2003-01-30 Thread Rob Dixon
Kevin R wrote:
> Hello,
>
> I am having problems with the sort routine.  I am writing a script
> that parses very large firewall logs.  At one point during the script
> I end up with a very large array containing all of the destination
> udp and tcp port numbers.  This array can be up being over 100,000
> entries.  I am trying to sort with the following:
>
> @sortedPortArray = sort(@portArray);
>
> It works, but I could crawl up under my desk and take a nap before it
> will finish.  Is there a faster way to sort?  Thank you in advance
> for your help.

Perhaps the answer lies in not sorting the data at all :-?

If you explain the problem that you're solving with a sort, perhaps
we can suggest an alternative.

Cheers,

Rob




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




RE: Perl OO - Dynamic method call

2003-01-30 Thread NYIMI Jose (BMB)
Just find out that Java provides something similar but not simple (for me :) )
For those who are interested:
http://java.sun.com/j2se/1.3/docs/guide/reflection/proxy.html

Ok, I stop bothering you all those Java stuff, sorry ;)

José.

> -Original Message-
> From: NYIMI Jose (BMB) 
> Sent: Thursday, January 30, 2003 3:29 PM
> To: Jenda Krynicky; [EMAIL PROTECTED]
> Subject: RE: Perl OO - Dynamic method call
> 
> 
> > -Original Message-
> > From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, January 30, 2003 3:12 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Perl OO - Dynamic method call
> > 
> > 
> > From: "NYIMI Jose (BMB)" <[EMAIL PROTECTED]>
> > > This is a little bit Out of Topic but if somebody can give input I
> > > will greatly appreciate!
> > > 
> > > I know that in Perl OO the name of a method can be a
> > variable. Which
> > > end up with code like this:
> > > 
> > > my $obj= new MyClass;
> > > #here the thing
> > > $obj->$method();
> > > 
> > > $method var holding the name of my method.
> > > 
> > > I would like to know if such feature exists in other OO
> > languages like
> > > Java etc ...
> > 
> > I guess you could do something similar in
> > JavaScript/JScript/ECMAScript
> 
> Any idea, if this is possible in Java ?
> 
> > 
> > > Besides, is such way of programming an indication of a
> > > bad "Class Design" ?
> > 
> > Well ... you should not have to do that.
> > 
> > Jenda
> > = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it 
> > comes to wine, women and song, wizards are allowed to get drunk and 
> > croon as much as they like.
> > -- Terry Pratchett in Sourcery
> > 
> > 
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
>  DISCLAIMER 
> 
> "This e-mail and any attachment thereto may contain 
> information which is confidential and/or protected by 
> intellectual property rights and are intended for the sole 
> use of the recipient(s) named above. 
> Any use of the information contained herein (including, but 
> not limited to, total or partial reproduction, communication 
> or distribution in any form) by other persons than the 
> designated recipient(s) is prohibited. 
> If you have received this e-mail in error, please notify the 
> sender either by telephone or by e-mail and delete the 
> material from any computer".
> 
> Thank you for your cooperation.
> 
> For further information about Proximus mobile phone services 
> please see our website at http://www.proximus.be or refer to 
> any Proximus agent.
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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




Re: Sorting Help!!!

2003-01-30 Thread kevin r
Rob,

I believe that you are correct in that there is an alternative answer.  
Without posting a long script, here is the premise:

while logfile {
if (certain conditions are met)
push @portArray, $_  ## pushes certain elements of the $_ into array, 
protocol and port number

The array will look like the following:

80 TCP
443 TCP
137 UDP
80 TCP
80 TCP
25 TCP
.
.
.

This becomes a very long list.  From here I would sort and then sequentially 
step through the array.  If the current line does not look like the last 
line the print the last line and the number of times it was counted.  The 
output looks as follows:

TCP 80  -  25
TCP 443 -  32
TCP 25 -   837
UDP 137 -  23

That logic was based on the sort function.  Any help would be great, I have 
a couple of ideas to make it faster that I am going to try.

Kevin




From: "Rob Dixon" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: Sorting Help!!!
Date: Thu, 30 Jan 2003 18:34:11 -

Kevin R wrote:
> Hello,
>
> I am having problems with the sort routine.  I am writing a script
> that parses very large firewall logs.  At one point during the script
> I end up with a very large array containing all of the destination
> udp and tcp port numbers.  This array can be up being over 100,000
> entries.  I am trying to sort with the following:
>
> @sortedPortArray = sort(@portArray);
>
> It works, but I could crawl up under my desk and take a nap before it
> will finish.  Is there a faster way to sort?  Thank you in advance
> for your help.

Perhaps the answer lies in not sorting the data at all :-?

If you explain the problem that you're solving with a sort, perhaps
we can suggest an alternative.

Cheers,

Rob




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



_
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail


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



RE: Sorting Help!!!

2003-01-30 Thread Wagner, David --- Senior Programmer Analyst --- WGO
kevin r wrote:
> Rob,
> 
> I believe that you are correct in that there is an alternative answer.
> Without posting a long script, here is the premise:
> 
> while logfile {
> if (certain conditions are met)
> push @portArray, $_  ## pushes certain elements of the $_ into array,
> protocol and port number
> 
> The array will look like the following:
> 
> 80 TCP
> 443 TCP
> 137 UDP
> 80 TCP
> 80 TCP
> 25 TCP
> .
> .
> .
> 
> This becomes a very long list.  From here I would sort and then
> sequentially step through the array.  If the current line does not
> look like the last line the print the last line and the number of
> times it was counted.  The output looks as follows:
> 
> TCP 80  -  25
> TCP 443 -  32
> TCP 25 -   837
> UDP 137 -  23
> 
> That logic was based on the sort function.  Any help would be great,
> I have a couple of ideas to make it faster that I am going to try.
> 
> Kevin
> 
> 
> 
> 
>> From: "Rob Dixon" <[EMAIL PROTECTED]>
>> To: [EMAIL PROTECTED]
>> Subject: Re: Sorting Help!!!
>> Date: Thu, 30 Jan 2003 18:34:11 -
>> 
>> Kevin R wrote:
>>> Hello,
>>> 
>>> I am having problems with the sort routine.  I am writing a script
>>> that parses very large firewall logs.  At one point during the
>>> script I end up with a very large array containing all of the
>>> destination udp and tcp port numbers.  This array can be up being
>>> over 100,000 entries.  I am trying to sort with the following:
>>> 
>>> @sortedPortArray = sort(@portArray);
>>> 
>>> It works, but I could crawl up under my desk and take a nap before
>>> it will finish.  Is there a faster way to sort?  Thank you in
>>> advance for your help.
>> 
>> Perhaps the answer lies in not sorting the data at all :-?
>> 
>> If you explain the problem that you're solving with a sort, perhaps
>> we can suggest an alternative.
>> 
>> Cheers,
>> 
>> Rob
  If you are just reading and generating counts for ports on either UDP or
TCP, then you should be able to use a hash with the port as key and either
tie in [u]dp and [t]cp, so you would have t80 or u80 as the key and then
sort of the key.  Should be able to so this on the fly and quite quickly.

Wags ;)


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



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




RE: Sorting Help!!!

2003-01-30 Thread Bob Showalter
kevin r wrote:
> Rob,
> 
> I believe that you are correct in that there is an
> alternative answer.
> Without posting a long script, here is the premise:
> 
> while logfile {
> if (certain conditions are met)
> push @portArray, $_  ## pushes certain elements of the $_ into array,
> protocol and port number 
> 
> The array will look like the following:
> 
> 80 TCP
> 443 TCP
> 137 UDP
> 80 TCP
> 80 TCP
> 25 TCP
> .
> .
> .
> 
> This becomes a very long list.  From here I would sort and then
> sequentially step through the array.  If the current line does not
> look like the last line the print the last line and the number of
> times it was counted.  The output looks as follows:
> 
> TCP 80  -  25
> TCP 443 -  32
> TCP 25 -   837
> UDP 137 -  23
> 
> That logic was based on the sort function.  Any help would be great,
> I have a couple of ideas to make it faster that I am going to try.

Use a hash to accumulate the statistics. Something along these lines:

   my %stats;
   while() {
  my ($proto, $port) = ... extract protocol and port from $_ somehow ...
  $stats{"$proto $port"}++;
   }
   print "$_ = $stats{$_}\n" for sort keys %stats;

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




RE: Need help

2003-01-30 Thread Ron Geringer
Hi:

I got the information - but I'm confused about the ppm stuff. It appears to
set a path variable (ppm?) and then to redirect the variable to "install
MAIL::sendmail". However, if I run it like that it errors out all over the
place. Could you give me a little direction on how to place it in the cgi or
perl script.

Thanks

-Original Message-
From: R. Joseph Newton [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 12:23 AM
To: Ron Geringer
Cc: [EMAIL PROTECTED]
Subject: Re: Need help


Ron Geringer wrote:

> I'm pretty much used to scripting sendmail applications in tcl - and I'm
> very new to perl so this may be a dumb question. I'm working with a
sendmail
> script that I got off the internet.

path>ppm

ppm>install Mail::sendmail


The following was posted within the last three days, I believe, though I
added a couple line to the message part:

#!/usr/bin/perl5 -w

use strict;
#use warnings;
use Mail::sendmail("sendmail");

my %mail =  (
  To  => '[EMAIL PROTECTED]',
  From=> '[EMAIL PROTECTED]',
  Subject => "Message to self--Test",
  Message => <


RE: Sorting Help!!!

2003-01-30 Thread kevin r
You guys are the best.  It now works, and fast too.  Thank you.

Kevin



From: Bob Showalter <[EMAIL PROTECTED]>
To: 'kevin r' <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
Subject: RE: Sorting Help!!!
Date: Thu, 30 Jan 2003 14:20:09 -0500

kevin r wrote:
> Rob,
>
> I believe that you are correct in that there is an
> alternative answer.
> Without posting a long script, here is the premise:
>
> while logfile {
> if (certain conditions are met)
> push @portArray, $_  ## pushes certain elements of the $_ into array,
> protocol and port number
>
> The array will look like the following:
>
> 80 TCP
> 443 TCP
> 137 UDP
> 80 TCP
> 80 TCP
> 25 TCP
> .
> .
> .
>
> This becomes a very long list.  From here I would sort and then
> sequentially step through the array.  If the current line does not
> look like the last line the print the last line and the number of
> times it was counted.  The output looks as follows:
>
> TCP 80  -  25
> TCP 443 -  32
> TCP 25 -   837
> UDP 137 -  23
>
> That logic was based on the sort function.  Any help would be great,
> I have a couple of ideas to make it faster that I am going to try.

Use a hash to accumulate the statistics. Something along these lines:

   my %stats;
   while() {
  my ($proto, $port) = ... extract protocol and port from $_ somehow 
...
  $stats{"$proto $port"}++;
   }
   print "$_ = $stats{$_}\n" for sort keys %stats;

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


_
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus


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



Re: still needing help

2003-01-30 Thread jdavis
whatever it gets text where it needs to go... and if all you need is
text the form parser below is fine.. also...if your not offering any
real help...maybe you can keep your comments to yourself :)
I hate people who answer questions with no or you cant do that or
the like..it freakin lame...maybe you could tell him why you think this
form parser is broken and actully really help someone...ok
so maybe stop being so freakin cool for just a sec and try to help

On Thu, 2003-01-30 at 05:19, Todd W wrote:
> "Jdavis" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > i have not been following this thread...but it appears as if you just
> > want a generic cgi scrip to work...I like to use  &ReadParse for
> > most of my easy cgi interactions ...heer is a example..
> >
> 
> 
> 
> Do not use. Broken form parameter parser below:
> 
> > #!/usr/bin/perl
> >
> > &ReadParse;
> >
> > print "$in{email}\n";
> >
> > #all you need to do is paste this at the bottom
> > # of your cgi scrip and refer to the form vars by
> > #ther name using the method above...
> >
> > # Adapted from cgi-lib.pl by [EMAIL PROTECTED]
> > # Copyright 1994 Steven E. Brenner
> > sub ReadParse {
> >   local (*in) = @_ if @_;
> >   local ($i, $key, $val);
> >
> >   if ( $ENV{'REQUEST_METHOD'} eq "GET" ) {
> > $in = $ENV{'QUERY_STRING'};
> >   } elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
> > read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
> >   } else {
> > # Added for command line debugging
> > # Supply name/value form data as a command line argument
> > # Format: name1=value1\&name2=value2\&...
> > # (need to escape & for shell)
> > # Find the first argument that's not a switch (-)
> > $in = ( grep( !/^-/, @ARGV )) [0];
> > $in =~ s/\\&/&/g;
> >   }
> >
> >   @in = split(/&/,$in);
> >
> >   foreach $i (0 .. $#in) {
> > # Convert plus's to spaces
> > $in[$i] =~ s/\+/ /g;
> >
> > # Split into key and value.
> > ($key, $val) = split(/=/,$in[$i],2); # splits on the first =.
> >
> > # Convert %XX from hex numbers to alphanumeric
> > $key =~ s/%(..)/pack("c",hex($1))/ge;
> > $val =~ s/%(..)/pack("c",hex($1))/ge;
> >
> > # Associate key and value. \0 is the multiple separator
> > $in{$key} .= "\0" if (defined($in{$key}));
> > $in{$key} .= $val;
> >   }
> >   return length($in);
> > }
> >
> >
> 
> 
> Todd W.
-- 
jd
[EMAIL PROTECTED]

Bad spellers of the world untie!



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




RE: help me please

2003-01-30 Thread Aimal Pashtoonmal
Dear folks,

Can you please recommend possible pointers to my problem.

I have a number of perl programs which worked on a large set of txt
files, each program producing its own output for each of the files. I
then put together a summary file of worth while results from these
output files. All this took a very long time and cannot be repeated due
to data size. Unfortunately due to an omission each unit of result in
the summary file has an extension missing from its corresponding ID,
(carried over from the output files).

So in other words I have an input file with bits of data each with an ID
and one of three extensions (making them uniq). Then there are 7 output
files from 7 different programs with the ID and extn carried over for
each bit of output. These 7 files are then parsed into a summary file
where each line holds  an ID, WITHOUT the extn, followed by its output
results. For each of the programs that has an entry in the summary file,
I am trying to attach to the ID its corresponding extn from the 7 output
files, but things are go so bad that I have decided to start from
scratch with some direction from you folks. The problem is the 7 output
files take up different formats.

If anyone understands what I am talking about and can help please mail
soon. If it helps I can put together small representations of the files.

Cheers folks. amal


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




Re: still needing help

2003-01-30 Thread Todd W

"Jdavis" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> whatever it gets text where it needs to go... and if all you need is
> text the form parser below is fine.. also...if your not offering any
> real help...maybe you can keep your comments to yourself :)
> I hate people who answer questions with no or you cant do that or
> the like..it freakin lame...maybe you could tell him why you think this
> form parser is broken and actully really help someone...ok
> so maybe stop being so freakin cool for just a sec and try to help

sure =0)..

Im no Randal Schwartz:

http://groups.google.com/groups?q=author:+Randal+L.+Schwartz

but I'd say I do my part.

I dont think the parser is broken, I KNOW it is ;0). Among other things,
this:

> > >   @in = split(/&/,$in);

is 'bad, bad, bad, bad, ' x 100_000_000

I cant even use programs that use that parser on my RH konquerer or Mozilla
:0(.

please use CGI.pm or another lighter weight parser from CPAN

Todd W.





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




RE: Perl OO - Dynamic method call

2003-01-30 Thread david
Nyimi Jose wrote:
 
>> I guess you could do something similar in
>> JavaScript/JScript/ECMAScript
> 
> Any idea, if this is possible in Java ?
> 

i don't think this's possible with Java. during compilation time, Java must 
resolve all method calls or it won't compile.

but then you might be asking, "well, Java is a strong OO language and 
support polymorphism so some method calls are delayed until run time". 
that's true but Java still checks for type compatability during compilation 
time to make sure all method calls are compatable with the objects they are 
involved with.

of course, i am not a Java expert and there are many aspects (RMI for 
example might have something that you are interested in) of the Java 
language that i might have over look.

david

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




Sorting a 2dim array / Spreadsheet::WriteExcel

2003-01-30 Thread Paul Kraus
I am dumping rows of an array into an excel file. I would like those
rows to be sorted. If I wanted them to be sorted by the first elements
how would I do it?

Code

#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
open IN, ($ARGV[0]);
my @AoA;
while (){
  chomp;
  push (@AoA,[(split /\|/,$_)]);
}

my $workbook = Spreadsheet::WriteExcel->new("perl.xls");
my $endo=$workbook->addworksheet('ENDO00');
my $baue=$workbook->addworksheet('BAUE00');
my $fore=$workbook->addworksheet('FORE00');
my $fill=$workbook->addworksheet('FILL00');
my $hosm=$workbook->addworksheet('HOSM00');
my $ipos=$workbook->addworksheet('IPOS00');
my $ohio=$workbook->addworksheet('OHIO00');
my $seat=$workbook->addworksheet('SEAT00');

for my $i (0 .. $#AoA){
  for my $j (0 .. $#{$AoA[$i]}) {
$AoA[$i][$j]=~s/\s+$//g;
$AoA[$i][$j]=~s/^\s+//g;
  }
}

my @count = (0,0,0,0,0,0,0,0);

foreach (@AoA){
  if (@$_[3] eq 'ENDO00'){
$endo->write_row($count[0],0,\@$_);
$count[0]++;}
  if (@$_[3] eq 'BAUE00'){
$baue->write_row($count[1],0,\@$_);
$count[1]++;}
  if (@$_[3] eq 'FORE00'){
$fore->write_row($count[2],0,\@$_);
$count[2]++;}
  if (@$_[3] eq 'FILL00'){
$fill->write_row($count[3],0,\@$_);
$count[3]++;}
  if (@$_[3] eq 'HOSM00'){
$hosm->write_row($count[4],0,\@$_);
$count[4]++;}
  if (@$_[3] eq 'IPOS00'){
$ipos->write_row($count[5],0,\@$_);
$count[5]++;}
  if (@$_[3] eq 'OHIO00'){
$ohio->write_row($count[6],0,\@$_);
$count[6]++;}
  if (@$_[3] eq 'SEAT00'){
$seat->write_row($count[7],0,\@$_);
$count[7]++;}
}


Output (excel file) - I would like each sheet sorted by year.
---
Year  item  description vend
sale  qtyprod code
199910011   Knee Platform Assy KT Univ Mark V   SEAT00  266
4   ENDO
200010011   Knee Platform Assy KT Univ Mark V   SEAT00  71
1   ENDO
200110011   Knee Platform Assy KT Univ Mark V   SEAT00  216
3   ENDO
200210011   Knee Platform Assy KT Univ Mark V   SEAT00  72
1   ENDO
200010073   Knee Platform Assembly for Mark V   SEAT00  82
2   ENDO
200110073   Knee Platform Assembly for Mark V   SEAT00  87
2   ENDO


In fact if I could sort it by year and then decending order within year
for sales that would be perfect or better yet sorted and then each year
having a total line and then a space before the next year. Thanks!!


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




getopt::std problem ignoring options

2003-01-30 Thread Jayesh Patel
Hi all,
 
 Just wondering how some of you are handling this issue that I have.
I am using the getopt::std.  When I pass in parameters to my script with
a possible mistake, the getopts ignores the rest of my switches.
For example:
 
script.pl -a something -b something else -c another_one -d etc
 
when getopts gets to the else, it doesn't proceed and populate my hash
for c or d.  Just populates a and b.  Anyone have any idea ?
 
I'm using Active Perl 5.6.1   &   Getopt/Std.pm 1.02
 
I looked at other getopt modules on CPAN - too many to look thru.  Any
recommendations ??
 
Thanks in advance,

Jayesh Patel  @  
Sr. Software Configuration Engineer 
* Tel: 732-483-3406 
* Fax: 732-483-3012 
* E-mail: [EMAIL PROTECTED] 

 

 

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


SendMail Help Needed!

2003-01-30 Thread Palm Optins
Hello Everyone,

Can someone tell me how to get sendmail to return bounced email to my address.

EMAMPLE OF SENDMAIL MAILER

open(MAIL,"|$sendmail -t");
print MAIL "From: $email ($first $last)\n";
print MAIL "To: $admin\n";
print MAIL "Reply-To: $email ($first $last)\n";
print MAIL "Subject: Help/Inquiry ($listname)\n\n";

print MAIL "Message From Member: $username\n";
print MAIL 
"\n\n";
print MAIL "$message\n\n";
print MAIL 
"\n";
close (MAIL);



Thanks and God Bless
Linda
ICQ #: 179542247

¤§¤=¤§¤=¤§¤¤§¤=¤§¤=¤§¤

For God so loved the world, that He gave his only begotten
Son, that whosoever believeth in him should not perish, but
have everlasting life.

¤§¤=¤§¤=¤§¤¤§¤=¤§¤=¤§¤


RE: Sorting a 2dim array / Spreadsheet::WriteExcel

2003-01-30 Thread Timothy Johnson

how about:

foreach(sort {$a->[0] cmp $b->[0]} @AoA){
#sort by the first element of the array created
#by dereferencing each element of @AoA


-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 1:32 PM
To: 'Perl'
Subject: Sorting a 2dim array / Spreadsheet::WriteExcel


I am dumping rows of an array into an excel file. I would like those
rows to be sorted. If I wanted them to be sorted by the first elements
how would I do it?

Code

#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
open IN, ($ARGV[0]);
my @AoA;
while (){
  chomp;
  push (@AoA,[(split /\|/,$_)]);
}

my $workbook = Spreadsheet::WriteExcel->new("perl.xls");
my $endo=$workbook->addworksheet('ENDO00');
my $baue=$workbook->addworksheet('BAUE00');
my $fore=$workbook->addworksheet('FORE00');
my $fill=$workbook->addworksheet('FILL00');
my $hosm=$workbook->addworksheet('HOSM00');
my $ipos=$workbook->addworksheet('IPOS00');
my $ohio=$workbook->addworksheet('OHIO00');
my $seat=$workbook->addworksheet('SEAT00');

for my $i (0 .. $#AoA){
  for my $j (0 .. $#{$AoA[$i]}) {
$AoA[$i][$j]=~s/\s+$//g;
$AoA[$i][$j]=~s/^\s+//g;
  }
}

my @count = (0,0,0,0,0,0,0,0);

foreach (@AoA){
  if (@$_[3] eq 'ENDO00'){
$endo->write_row($count[0],0,\@$_);
$count[0]++;}
  if (@$_[3] eq 'BAUE00'){
$baue->write_row($count[1],0,\@$_);
$count[1]++;}
  if (@$_[3] eq 'FORE00'){
$fore->write_row($count[2],0,\@$_);
$count[2]++;}
  if (@$_[3] eq 'FILL00'){
$fill->write_row($count[3],0,\@$_);
$count[3]++;}
  if (@$_[3] eq 'HOSM00'){
$hosm->write_row($count[4],0,\@$_);
$count[4]++;}
  if (@$_[3] eq 'IPOS00'){
$ipos->write_row($count[5],0,\@$_);
$count[5]++;}
  if (@$_[3] eq 'OHIO00'){
$ohio->write_row($count[6],0,\@$_);
$count[6]++;}
  if (@$_[3] eq 'SEAT00'){
$seat->write_row($count[7],0,\@$_);
$count[7]++;}
}


Output (excel file) - I would like each sheet sorted by year.
---
Year  item  description vend
sale  qtyprod code
199910011   Knee Platform Assy KT Univ Mark V   SEAT00  266
4   ENDO
200010011   Knee Platform Assy KT Univ Mark V   SEAT00  71
1   ENDO
200110011   Knee Platform Assy KT Univ Mark V   SEAT00  216
3   ENDO
200210011   Knee Platform Assy KT Univ Mark V   SEAT00  72
1   ENDO
200010073   Knee Platform Assembly for Mark V   SEAT00  82
2   ENDO
200110073   Knee Platform Assembly for Mark V   SEAT00  87
2   ENDO


In fact if I could sort it by year and then decending order within year
for sales that would be perfect or better yet sorted and then each year
having a total line and then a space before the next year. 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: Sorting a 2dim array / Spreadsheet::WriteExcel

2003-01-30 Thread Kipp, James
> 
> I am dumping rows of an array into an excel file. I would like those
> rows to be sorted. If I wanted them to be sorted by the first elements
> how would I do it?

Try this:

@AoA = sort { $a->[0] cmp $b->[0] } @Aoa;

> 
> Code
> 
> #!/usr/bin/perl -w
> use strict;
> use Spreadsheet::WriteExcel;
> open IN, ($ARGV[0]);
> my @AoA;
> while (){
>   chomp;
>   push (@AoA,[(split /\|/,$_)]);
> }
> 


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




RE: Sorting a 2dim array / Spreadsheet::WriteExcel

2003-01-30 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Paul Kraus wrote:
> I am dumping rows of an array into an excel file. I would like those
> rows to be sorted. If I wanted them to be sorted by the first elements
> how would I do it?
> 
> Code
> 
> #!/usr/bin/perl -w
> use strict;
> use Spreadsheet::WriteExcel;
> open IN, ($ARGV[0]);
> my @AoA;
> while (){
>   chomp;
>   push (@AoA,[(split /\|/,$_)]);
> }
> 
> my $workbook = Spreadsheet::WriteExcel->new("perl.xls");
> my $endo=$workbook->addworksheet('ENDO00');
> my $baue=$workbook->addworksheet('BAUE00');
> my $fore=$workbook->addworksheet('FORE00');
> my $fill=$workbook->addworksheet('FILL00');
> my $hosm=$workbook->addworksheet('HOSM00');
> my $ipos=$workbook->addworksheet('IPOS00');
> my $ohio=$workbook->addworksheet('OHIO00');
> my $seat=$workbook->addworksheet('SEAT00');
> 
> for my $i (0 .. $#AoA){
>   for my $j (0 .. $#{$AoA[$i]}) {
> $AoA[$i][$j]=~s/\s+$//g;
> $AoA[$i][$j]=~s/^\s+//g;
>   }
> }
> 
> my @count = (0,0,0,0,0,0,0,0);
> 
> foreach (@AoA){
>   if (@$_[3] eq 'ENDO00'){
> $endo->write_row($count[0],0,\@$_);
> $count[0]++;}
>   if (@$_[3] eq 'BAUE00'){
> $baue->write_row($count[1],0,\@$_);
> $count[1]++;}
>   if (@$_[3] eq 'FORE00'){
> $fore->write_row($count[2],0,\@$_);
> $count[2]++;}
>   if (@$_[3] eq 'FILL00'){
> $fill->write_row($count[3],0,\@$_);
> $count[3]++;}
>   if (@$_[3] eq 'HOSM00'){
> $hosm->write_row($count[4],0,\@$_);
> $count[4]++;}
>   if (@$_[3] eq 'IPOS00'){
> $ipos->write_row($count[5],0,\@$_);
> $count[5]++;}
>   if (@$_[3] eq 'OHIO00'){
> $ohio->write_row($count[6],0,\@$_);
> $count[6]++;}
>   if (@$_[3] eq 'SEAT00'){
> $seat->write_row($count[7],0,\@$_);
> $count[7]++;}
> }
> 
> 
> Output (excel file) - I would like each sheet sorted by year.
> ---
> Year  item  description   vend
> sale  qtyprod code
> 1999  10011   Knee Platform Assy KT Univ Mark V   SEAT00  266
> 4 ENDO
> 2000  10011   Knee Platform Assy KT Univ Mark V   SEAT00  71
> 1 ENDO
> 2001  10011   Knee Platform Assy KT Univ Mark V   SEAT00  216
> 3 ENDO
> 2002  10011   Knee Platform Assy KT Univ Mark V   SEAT00  72
> 1 ENDO
> 2000  10073   Knee Platform Assembly for Mark V   SEAT00  82
> 2 ENDO
> 2001  10073   Knee Platform Assembly for Mark V   SEAT00  87
> 2 ENDO
> 
> 
> In fact if I could sort it by year and then decending order within
> year for sales that would be perfect or better yet sorted and then
> each year having a total line and then a space before the next year.
> Thanks!! 

  Could I see what the data looks like coming in?  It should not be that
hard to do, but as they say a picture is worth a 1000 words. So a small file
would be worth plenty.

Wags ;)


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



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




WTF Naver-Mailer - WHAT IS THIS

2003-01-30 Thread Paul Kraus
Everytime I send a message to the perl list
I get a message like this form some Naver mailer. What is this and how
do I stop it.

Header
--
Received: from [211.218.150.104] by meemail1.pelsupply.com (NTMail 7.00.
0018/NU0133.02.dab8b08b) with ESMTP id przslaaa for
[EMAIL PROTECTED]; Thu, 30 Jan 2003 16:42:34 -0500
Received: (qmail 10615 invoked from network); 30 Jan 2003 21:35:22 -
Received: from naver333.naver.com (HELO naver333) (211.218.150.13)
  by 0 with SMTP; 30 Jan 2003 21:35:22 -
MIME-Version: 1.0
Message-Id: <[EMAIL PROTECTED]>
Content-Type: Multipart/Mixed;
  boundary="Boundary-00=_XMQJPWYXFQQMYJ0CCJD0"
From: <[EMAIL PROTECTED]>
Date: Fri, 31 Jan 2003 06:35:21 +0900 (KST)
To: <[EMAIL PROTECTED]>
Subject: =?ks_c_5601-
1987?B?uN7AzyDA/LzbIL3HxtAgvsu4siA8cHJvdGJnQG5hdmVyLmNvbT4=?=
X-Mailer: NAVER Mailer 1.0
X-VSMLoop: pelsupply.com

 
¹ÚÁ¾Å (protbg) ´Ô²² º¸³»½Å ¸ÞÀÏ  ÀÌ ´ÙÀ½°ú °°Àº ÀÌÀ¯·Î Àü¼Û ½ÇÆÐÇß½À´Ï´Ù.  
 
 
¼ö½ÅÀÚÀÇ ¸ÞÀÏ º¸°ü ¿ë·®ÀÌ °¡µæÂ÷ ÀÖ½À´Ï´Ù. ³ªÁß¿¡ ´Ù½Ã ½ÃµµÇϽʽÿÀ.  
 
 


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




RE: Perl OO - Dynamic method call

2003-01-30 Thread david
Nyimi Jose wrote:

> Just find out that Java provides something similar but not simple (for me
> :) ) For those who are interested:
> http://java.sun.com/j2se/1.3/docs/guide/reflection/proxy.html
> 
> Ok, I stop bothering you all those Java stuff, sorry ;)
> 

good reading! i wasn't aware of the Dynamic Proxy mechanism in Java. that's 
exactly what i was referring to in another post where Java must resolve all
method calls during compile time. apparently, with dynamic proxy, this is no 
longer the case.

david

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




an EXPR question

2003-01-30 Thread justino berrun
hello amigos

how would i express some where before/first and some where after/later in a string
for example, if (match this "-key" before this "5L" ){ do the rest... }
on a string that look like so: $string="-key 3345 -door 3432 -5L";


thank you... 
-- 
__
http://www.linuxmail.org/
Now with e-mail forwarding for only US$5.95/yr

Powered by Outblaze

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




RE: still needing help

2003-01-30 Thread Westgate, Jared
Warning: opinionated text follows, so please don't take offense :)



> > whatever it gets text where it needs to go... and if 
> all you need is
> > text the form parser below is fine.. also...if your not offering any
> > real help...maybe you can keep your comments to yourself :)
> > I hate people who answer questions with no or you cant do that or
> > the like..it freakin lame...maybe you could tell him why 
> you think this
> > form parser is broken and actully really help someone...ok
> > so maybe stop being so freakin cool for just a sec and try to help
> 
> sure =0)..
> 
> Im no Randal Schwartz:

I kept telling myself that I wasn't going to get involved...  Oh well.  Although I 
think "Jdavis" was a little too harsh, I have to agree with him (although, not as 
adamantly).  First off, I also admit I'm no Perl guru, but I'm learning.  I think 
"Jdavis" was saying that _reasons_ why something is "broken" (or doesn't work, or is 
bad, or whatever), are helpful to beginners.  
 
In fact, I occasionally find myself frustrated with the brevity of many responses to 
people's questions.  I think a lot of people are using this list to learn, not just to 
be told what to do.  I'm not saying to write a novel out of each response, but a 
little detail can be nice.  You have to remember, a lot of people who are learning 
Perl (and even many who are learning English) are using this list.

> I dont think the parser is broken, I KNOW it is ;0). Among 
> other things,
> this:
> 
> > > >   @in = split(/&/,$in);
> 
> is 'bad, bad, bad, bad, ' x 100_000_000

Why is this bad?  Don't get me wrong... I'm not saying you are incorrect, because 
frankly I don't know.  Is it because he is using a scalar with the same name as the 
array he is assigning it to?  Oh well, I don't even remember the rest of the code that 
was posted :)
 
> I cant even use programs that use that parser on my RH 
> konquerer or Mozilla

Why does it cause problems with Konquerer or Mozilla?
 
I guess I've always been the type to question someone else's opinions. :)  There is 
really no offense intended.  I'm just hoping to keep people's minds open and ease 
tensions.  Lets try to keep this list as helpful as possible.



Jared



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




RE: getopt::std problem ignoring options

2003-01-30 Thread Toby Stuart


> -Original Message-
> From: Jayesh Patel [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 31, 2003 8:15 AM
> To: '[EMAIL PROTECTED]'
> Subject: getopt::std problem ignoring options
> 
> 
> Hi all,
>  
>  Just wondering how some of you are handling this issue 
> that I have.
> I am using the getopt::std.  When I pass in parameters to my 
> script with
> a possible mistake, the getopts ignores the rest of my switches.
> For example:
>  
> script.pl -a something -b something else -c another_one -d etc
>  
> when getopts gets to the else, it doesn't proceed and populate my hash
> for c or d.  Just populates a and b.  Anyone have any idea ?
>  
> I'm using Active Perl 5.6.1   &   Getopt/Std.pm 1.02
>  
> I looked at other getopt modules on CPAN - too many to look thru.  Any
> recommendations ??
>  

Just quote the offending ones eg.

script.pl -a something -b "something else" -c another_one

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




Re: getopt::std problem ignoring options

2003-01-30 Thread kevin r
I am just a newbie here and this probably is not the best solution, but have 
you considered placing the argument in quotes.  It works for me.


script.pl -a something -b "something else" -c another_one -d etc

Kevin


From: Jayesh Patel <[EMAIL PROTECTED]>
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
Subject: getopt::std problem ignoring options
Date: Thu, 30 Jan 2003 16:14:44 -0500

Hi all,

 Just wondering how some of you are handling this issue that I have.
I am using the getopt::std.  When I pass in parameters to my script with
a possible mistake, the getopts ignores the rest of my switches.
For example:

script.pl -a something -b something else -c another_one -d etc

when getopts gets to the else, it doesn't proceed and populate my hash
for c or d.  Just populates a and b.  Anyone have any idea ?

I'm using Active Perl 5.6.1   &   Getopt/Std.pm 1.02

I looked at other getopt modules on CPAN - too many to look thru.  Any
recommendations ??

Thanks in advance,

Jayesh Patel  @
Sr. Software Configuration Engineer
* Tel: 732-483-3406
* Fax: 732-483-3012
* E-mail: [EMAIL PROTECTED]




<< Tellium_logo.gif >>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail


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



Re: an EXPR question

2003-01-30 Thread Rob Dixon
Justino Berrun wrote:
> hello amigos
>
> how would i express some where before/first and some where
> after/later in a string for example, if (match this "-key" before
> this "5L" ){ do the rest... }
> on a string that look like so: $string="-key 3345 -door 3432 -5L";

Hello Justino.

I think I understand. You want to check that a string starts with
'-key' and ends with '-5L'. You'll need a regular expression with
these ingredients:

^ - matches only at the start of a string
$ - matches only at the end of a string
. - matches any character

putting these together within a regular expression 'match'
operation:

m/^-key.*-5L$/

(the * lets the . match any number of characters)

You can test your string like this:

if ($string =~ m/^-key.*-5L$/) {
:
}

Hope this helps,

Rob




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




Re: still needing help

2003-01-30 Thread Paul Johnson
On Thu, Jan 30, 2003 at 03:25:00PM -0700, Westgate, Jared wrote:

> Warning: opinionated text follows, so please don't take offense :)

I didn't see anything from which anyone should take any offence, unless
you were talking about the length of your lines :-)

> In fact, I occasionally find myself frustrated with the brevity of
> many responses to people's questions.  I think a lot of people are
> using this list to learn, not just to be told what to do.  I'm not
> saying to write a novel out of each response, but a little detail can
> be nice.  You have to remember, a lot of people who are learning Perl
> (and even many who are learning English) are using this list.

Whilst I don't disagree with anything you say, you also have to remember
that a lot of people who frequently reply to messages are very busy and
may not have the time to go into details which may or may not have been
required.  Of course, posters can help here:

  http://perl.plover.com/Questions.html
  http://catb.org/~esr/faqs/smart-questions.html

But the very nature of this list almost dictates that many questions
will not be in an ideal format.  And we try to accommodate all comers.

I usually try to do as many as appropriate of:

  - answer the question
  - provide a little commentary, general suggestions or other ideas to
consider
  - give pointers to additional sources of information

Appearances to the contrary notwithstanding, I also like to consider the
question, prepare an accurate reply and test any code I provide.  All
this can take a surprising amount of time.

So what I suppose I'm saying, in a rather long winded manner, is that if
you (all) would like more information about anything in particular,
please ask.  I imagine that most of those who regularly answer questions
here do it because they enjoy helping others to learn.

With respect to the specific questions you did ask, I'm afraid I don't
know the answers ;-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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




RE: still needing help

2003-01-30 Thread Jenda Krynicky
From: "Westgate, Jared" <[EMAIL PROTECTED]>
> In fact, I occasionally find myself frustrated with the brevity of
> many responses to people's questions.  I think a lot of people are
> using this list to learn, not just to be told what to do.  I'm not
> saying to write a novel out of each response, but a little detail can
> be nice.  You have to remember, a lot of people who are learning Perl
> (and even many who are learning English) are using this list.

Than what's easier than to speak up and ask for more details and 
longer explanation? :-)

It's hard to guess how verbose do you need to be so if you find 
someone too verbose let us all know.
 
> > I dont think the parser is broken, I KNOW it is ;0). Among 
> > other things,
> > this:
> > 
> > > > >   @in = split(/&/,$in);
> > 
> > is 'bad, bad, bad, bad, ' x 100_000_000
> 
> Why is this bad?  Don't get me wrong... I'm not saying you are
> incorrect, because frankly I don't know.  Is it because he is using a
> scalar with the same name as the array he is assigning it to?  Oh
> well, I don't even remember the rest of the code that was posted :)

I don't rememer what did the rest of the parser look like, but I 
don't see anything wrong about this line per-se. (They do declare the 
@in with my() somewhere above right?)

I occasionaly use the same name for scalars, arrays and hashes  
myself if it makes sense.

The problem with parsing CGI query oneself instead of using a module 
is that the task is a little more complex that it looks at the first 
glance. And it's easy to think you are safe while you are not.

I don't remember the exact problems myself but a little search turned 
out this: http://www.perlmonks.org/index.pl?node_id=34089

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


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




Re: TimeStamp compare

2003-01-30 Thread Paul Johnson
On Thu, Jan 30, 2003 at 10:23:14AM -0500, John Baker wrote:
> On Thu, 30 Jan 2003, Bob Showalter wrote:
> 
> > If you just want to compare two files to see if one is newer, use the -M
> > operator:
> >
> >$need_recompile = 1 if -M 'foo.java' < -M 'foo.class';
> >
> > -M gives you the age in days of a file, measured from the time your script
> > was started (stored in the special $^T variable). The specific value
> > returned from -M isn't important in this case, but two -M returns can be
> > compared to see which file is newer.
> >
> That's a really elegant solution. I like that. =)

In that case, you'll love this one :-)

  $need_recompile = -M 'foo.java' < -M 'foo.class';

This has the advantage of always setting $need_recompile to something,
rather than relying on the previous value where a compile was not
necessary (which was, at least, fail safe).

It also has the advantage of allowing you to say

  my $need_recompile = ...

which would have had surprising effects with the initial example, due to
the "if".

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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




Re: an EXPR question

2003-01-30 Thread Jeff 'japhy' Pinyan
On Jan 30, Rob Dixon said:

>Justino Berrun wrote:
>> hello amigos
>>
>> how would i express some where before/first and some where
>> after/later in a string for example, if (match this "-key" before
>> this "5L" ){ do the rest... }
>> on a string that look like so: $string="-key 3345 -door 3432 -5L";
>
>I think I understand. You want to check that a string starts with
>'-key' and ends with '-5L'. You'll need a regular expression with
>these ingredients:

He may not want the ^ and $ anchors, so /-key.*5L/ might suffice.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
 what does y/// stand for?   why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


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




Re: getopt::std problem ignoring options

2003-01-30 Thread Wiggins d'Anconia


Jayesh Patel wrote:

Hi all,
 
 Just wondering how some of you are handling this issue that I have.
I am using the getopt::std.  When I pass in parameters to my script with
a possible mistake, the getopts ignores the rest of my switches.
For example:
 
script.pl -a something -b something else -c another_one -d etc
 
when getopts gets to the else, it doesn't proceed and populate my hash
for c or d.  Just populates a and b.  Anyone have any idea ?
 
I'm using Active Perl 5.6.1   &   Getopt/Std.pm 1.02
 
I looked at other getopt modules on CPAN - too many to look thru.  Any
recommendations ??

This is I believe known and expected behavior, and a fault with getopt 
from the c lib or the regular shells, or somewhere in the bowels of Unix 
history.  Essentially before long options came along programs only 
recognized short options, and as soon as they came upon a non-option 
then they assumed everything thereafter was an argument, or a file list, 
etc.  the module is just parsing everything that is in @ARGV up until it 
hits a value but not a recognized option, and then assumes you will 
handle the rest of ARGV on your own.

To the best of my knowledge which is obviously not all encompassing 
there is no way to force Getopt::Std into the mindset to work around 
this little problem, however there is Getopt::Long which does in fact 
cure this ailment, from the Getopt::Long docs:

"Mixing command line option with other arguments

Usually programs take command line options as well as other arguments,
for example, file names. It is good practice to always specify the
options first, and the other arguments last. Getopt::Long will, how-
ever, allow the options and arguments to be mixed and ’filter out’ all
the options before passing the rest of the arguments to the program. To
stop Getopt::Long from processing further arguments, insert a double
dash "--" on the command line:
   --size 24 -- --all

In this example, "--all" will not be treated as an option, but passed
to the program unharmed, in @ARGV."

perldoc Getopt::Long

For those of the GNU generation like myself this will better match the 
behavior you are used to

http://danconia.org


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



Re: getopt::std problem ignoring options

2003-01-30 Thread Wiggins d'Anconia
p.s. for those interested I have a cheat sheet I made a while ago at the 
following (I am sure I will clean it up at some point and make it harder 
to print ;-) but for now it is at least useful):

http://danconia.org/online/GetOpt_QuickRef.txt


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



Installing Win32::AdminMisc

2003-01-30 Thread Andrew Gilchrist
I have been trying to step AdminMisc with Perl v5.8.0 from ActiveState.  I have 
tried putting the pm and dll files in the places specified by the readme's 
however I have had no success with using ppm & install the win32-adminmisc.ppd
file.  Anyone have any luck with installing this module and can maybe point me 
in the right direction Do I have to change my version of Perl?

-Drew
-- 
Andrew Gilchrist IV
Asset President - Northeastern University Chapter

"Life moves pretty fast. If you don't stop and look around once in awhile, you 
could miss it."




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




Re: Installing Win32::AdminMisc

2003-01-30 Thread Jenda Krynicky
From: Andrew Gilchrist <[EMAIL PROTECTED]>
> I have been trying to step AdminMisc with Perl v5.8.0 from
> ActiveState.  I have tried putting the pm and dll files in the places
> specified by the readme's however I have had no success with using ppm
> & install the win32-adminmisc.ppd file.  Anyone have any luck with
> installing this module and can maybe point me in the right
> direction Do I have to change my version of Perl?

ppm install http://Jenda.Krynicky.cz/perl/Win32-AdminMisc.ppd

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


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




Re: Need help

2003-01-30 Thread R. Joseph Newton
Ron Geringer wrote:

> "install
> MAIL::sendmail". However, if I run it like that it errors out all over the
> place. Could you give me a little direction on how to place it in the cgi or
> perl script.

Sorry for the misdirection.  I noticed on review that I had used Mail::sendmail rather 
than Mail::Sendmail in my use command.  Because I use Windows, it slipped right by me, 
since Windows fienames are not caase sensitive.

The installation process should not be part of the Perl script.  It's something you 
want to do on your server (or workstation--it works equally well) beofre running the 
script.  I think that the [case-sensitive in Unix] Mail::Sendmail library will serve 
you better than using the shell snecmail utility.

Directory paths should not be hard-coded into a program, unless the program is 
intended to serve as an adapter for a given environment.  In that case, the code 
containing such local low-level details should be isolated and modularized, so that it 
does not pollute your programming logic.  Within the main body of any program, it is a 
sure-fire guarantee that that program will become incompatible throwaway code.

Mail::Sendmail does not require such irelevant detail, nor does it require the buffer 
variables you use.  Given the billions of e-mails that have gone out over the net over 
the years, there is very little engaging about the bare-bones process of printing each 
line to a file handle representing mail.  Instead, just fill in the blanks within a 
packaged object, and let that take care of the crudge-work.  You should have more 
interesting problems to deal with, such as content.

Joseph


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




MS Active Directory

2003-01-30 Thread Scott, Joshua
Good evening,

I'm looking for advice or ideas on querying MS Active Directory.  There is a
module on CPAN but it appears to only run on Windows.  I was wondering if
there is any module or method to query from a Linux system.  All of my other
scripts are housed on a single Linux box and I'd really like to avoid having
to require a Windows machine just for this.  Am I better off just doing this
from a Windows box?  

Thanks you in advance for any assistance.

Joshua Scott
Security Systems Analyst, CISSP
626-568-7024


==
NOTICE - This communication may contain confidential and privileged 
information that is for the sole use of the intended recipient. Any viewing,
copying or distribution of, or reliance on this message by unintended
recipients is strictly prohibited. If you have received this message in
error, please notify us immediately by replying to the message and deleting
it from your computer.

==



RE: getopt::std problem ignoring options

2003-01-30 Thread Jayesh Patel
Wiggins,

Thanks for the reply.  This is what I understood as well. 

The is the reason why I didn't have:

script.pl -a something -b "something else" -c another_one -d etc

is because I really wanted to say:

script.pl -a something -b something -e else -c another_one -d etc

I found out that in another script I did a similar thing where I had my
options
that it ignored as optional (meaning -c and -d were optional).  This caused
the
script to succeed, but gave different results - something that I would see
after a long time has passed and results would cause other problems.

Since my scripts are used by everyone in my organization, this could cause
undesired
results for them (if they did not understand the impact of getting the
syntax
right).

So to make my script dummy proof, I am trying to find easy ways of parsing
the input the getopts ignores.  I guess what I am looking for is a
getopt::std
that saves the part that it ignores in a special variable.  Does anyone do
this ?

I don't like the getopt::long because I use many options.  Also with the
-- & something=something, things look ugly and the developers like things
simple.

Thanks in advance,
Jayesh


-Original Message-
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 7:12 PM
To: Jayesh Patel
Cc: '[EMAIL PROTECTED]'
Subject: Re: getopt::std problem ignoring options




Jayesh Patel wrote:
> Hi all,
>  
>  Just wondering how some of you are handling this issue that I have.
> I am using the getopt::std.  When I pass in parameters to my script with
> a possible mistake, the getopts ignores the rest of my switches.
> For example:
>  
> script.pl -a something -b something else -c another_one -d etc
>  
> when getopts gets to the else, it doesn't proceed and populate my hash
> for c or d.  Just populates a and b.  Anyone have any idea ?
>  
> I'm using Active Perl 5.6.1   &   Getopt/Std.pm 1.02
>  
> I looked at other getopt modules on CPAN - too many to look thru.  Any
> recommendations ??

This is I believe known and expected behavior, and a fault with getopt 
from the c lib or the regular shells, or somewhere in the bowels of Unix 
history.  Essentially before long options came along programs only 
recognized short options, and as soon as they came upon a non-option 
then they assumed everything thereafter was an argument, or a file list, 
etc.  the module is just parsing everything that is in @ARGV up until it 
hits a value but not a recognized option, and then assumes you will 
handle the rest of ARGV on your own.

To the best of my knowledge which is obviously not all encompassing 
there is no way to force Getopt::Std into the mindset to work around 
this little problem, however there is Getopt::Long which does in fact 
cure this ailment, from the Getopt::Long docs:

"Mixing command line option with other arguments

Usually programs take command line options as well as other arguments,
for example, file names. It is good practice to always specify the
options first, and the other arguments last. Getopt::Long will, how-
ever, allow the options and arguments to be mixed and 'filter out' all
the options before passing the rest of the arguments to the program. To
stop Getopt::Long from processing further arguments, insert a double
dash "--" on the command line:
--size 24 -- --all

In this example, "--all" will not be treated as an option, but passed
to the program unharmed, in @ARGV."

perldoc Getopt::Long

For those of the GNU generation like myself this will better match the 
behavior you are used to

http://danconia.org

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




RE: getopt::std problem ignoring options

2003-01-30 Thread Jayesh Patel
Never mind.  I found that ARGUE has exactly what I'm looking for.

dumb mistake.

Thanks,
Jayesh


-Original Message-
From: Jayesh Patel 
Sent: Thursday, January 30, 2003 7:59 PM
To: 'Wiggins d'Anconia'; Jayesh Patel
Cc: '[EMAIL PROTECTED]'
Subject: RE: getopt::std problem ignoring options


Wiggins,

Thanks for the reply.  This is what I understood as well. 

The is the reason why I didn't have:

script.pl -a something -b "something else" -c another_one -d etc

is because I really wanted to say:

script.pl -a something -b something -e else -c another_one -d etc

I found out that in another script I did a similar thing where I had my
options
that it ignored as optional (meaning -c and -d were optional).  This caused
the
script to succeed, but gave different results - something that I would see
after a long time has passed and results would cause other problems.

Since my scripts are used by everyone in my organization, this could cause
undesired
results for them (if they did not understand the impact of getting the
syntax
right).

So to make my script dummy proof, I am trying to find easy ways of parsing
the input the getopts ignores.  I guess what I am looking for is a
getopt::std
that saves the part that it ignores in a special variable.  Does anyone do
this ?

I don't like the getopt::long because I use many options.  Also with the
-- & something=something, things look ugly and the developers like things
simple.

Thanks in advance,
Jayesh


-Original Message-
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 7:12 PM
To: Jayesh Patel
Cc: '[EMAIL PROTECTED]'
Subject: Re: getopt::std problem ignoring options




Jayesh Patel wrote:
> Hi all,
>  
>  Just wondering how some of you are handling this issue that I have.
> I am using the getopt::std.  When I pass in parameters to my script with
> a possible mistake, the getopts ignores the rest of my switches.
> For example:
>  
> script.pl -a something -b something else -c another_one -d etc
>  
> when getopts gets to the else, it doesn't proceed and populate my hash
> for c or d.  Just populates a and b.  Anyone have any idea ?
>  
> I'm using Active Perl 5.6.1   &   Getopt/Std.pm 1.02
>  
> I looked at other getopt modules on CPAN - too many to look thru.  Any
> recommendations ??

This is I believe known and expected behavior, and a fault with getopt 
from the c lib or the regular shells, or somewhere in the bowels of Unix 
history.  Essentially before long options came along programs only 
recognized short options, and as soon as they came upon a non-option 
then they assumed everything thereafter was an argument, or a file list, 
etc.  the module is just parsing everything that is in @ARGV up until it 
hits a value but not a recognized option, and then assumes you will 
handle the rest of ARGV on your own.

To the best of my knowledge which is obviously not all encompassing 
there is no way to force Getopt::Std into the mindset to work around 
this little problem, however there is Getopt::Long which does in fact 
cure this ailment, from the Getopt::Long docs:

"Mixing command line option with other arguments

Usually programs take command line options as well as other arguments,
for example, file names. It is good practice to always specify the
options first, and the other arguments last. Getopt::Long will, how-
ever, allow the options and arguments to be mixed and 'filter out' all
the options before passing the rest of the arguments to the program. To
stop Getopt::Long from processing further arguments, insert a double
dash "--" on the command line:
--size 24 -- --all

In this example, "--all" will not be treated as an option, but passed
to the program unharmed, in @ARGV."

perldoc Getopt::Long

For those of the GNU generation like myself this will better match the 
behavior you are used to

http://danconia.org

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




Re: getopt::std problem ignoring options

2003-01-30 Thread Wiggins d'Anconia


Jayesh Patel wrote:



So to make my script dummy proof, I am trying to find easy ways of parsing
the input the getopts ignores.  I guess what I am looking for is a
getopt::std
that saves the part that it ignores in a special variable.  Does anyone do
this ?

I don't like the getopt::long because I use many options.  Also with the
-- & something=something, things look ugly and the developers like things
simple.



Agreed, though Getopt::Long still allows for the short options, so it is 
really a matter of preference, you can even alias a long and a short 
option to the same resulting value so that if at some point in your 
organization one of your people like long options while most of the rest 
like short, then they can both be happy.  Long and short can also be 
intermixed on the same command line. And key=val can also be replaced 
with just --key val or even -k val or in a bundle, -kvalmval2... etc. 
Its also a standard module, which means you are about 98% (or more) 
guaranteed to have it everywhere

Just some thoughts,

http://danconia.org


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



Re: A very annoying regex question.

2003-01-30 Thread John W. Krahn
Michael Hooten wrote:
> 
> > my @a = map {split (/\s*=\s*/, $_, 2)} split(/\r?\n/, );
> 
> Should not \s+ match \r?\n? Apparently not.

\s matches \n and \r and \f and \t and ' '.  Apparently the OP only
wanted to match \r and \n.  :-)



John
-- 
use Perl;
program
fulfillment

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




qmail

2003-01-30 Thread Ron Geringer
Is anyone familiar with qmail enough to help me set up a script in perl
using qmail to redirect form information to a hardcoded email address. About
the only thing I need would be the line specifically regarding the qmail
command.

thanks

Ron


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




Re: System() function in 5.8

2003-01-30 Thread John W. Krahn
Ravinder Chauhan wrote:
> 
> After installing Perl 5.8 my @files = system("dir bex*.* /od /b") function
> has started behaving strange. Under 5.6 this function used to return the
> list of files for matching files, however now in place of file list it is
> returning a number "65280". I would appreciate if someone could help me in
> this.

>From Perl version 5.6.0:

   system LIST

   system PROGRAM LIST
[snip]
   The return value is the exit status of the program
   as returned by the `wait' call.  To get the actual
   exit value divide by 256.  See also the exec entry
   elsewhere in this document.  This is not what you
   want to use to capture the output from a command,
   for that you should use merely backticks or
   `qx//', as described in the section on "`STRING`"
   in the perlop manpage.  Return value of -1
   indicates a failure to start the program (inspect
   $! for the reason).


>From Perl version 2.0:

   system LIST
   Does exactly the same thing as "exec LIST"  except
   that  a fork is done first, and the parent process
   waits for the child  process  to  complete.   Note
   that  argument  processing varies depending on the
   number of arguments.  The return value is the exit
   status  of  the  program as returned by the wait()
   call.  To get the actual exit value divide by 256.
   See also exec.


If you want to get a list of files from the current directory
use either:

opendir my $dh, '.' or die "Cannot open the current directory: $!";
my @files = grep /^bex/, readdir $dh;
closedir $dh;

Or:

my @files = glob 'bex*';



John
-- 
use Perl;
program
fulfillment

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




Re: taking lines from a file

2003-01-30 Thread John W. Krahn
Rob Dixon wrote:
> 
> Marcelo wrote:
> > Hi everybody...
> > How I can take lines from a file like this ...
> >
> > line1=A
> > line2
> > line3
> >
> > line1=B
> > line2
> > line3
> >
> > line1=A
> > line2
> > line3
> >
> > I want to take the followin 2 lines to the line1 when line1=A and
> > write them to another file
> 
> I'm not clear exactly what your file looks like, but the following will
> output the two lines immediately following a line exactly matching
> 'line1=A'.
> 
> @ARGV = 'file.txt';
> 
> my $print;
> 
> while (<>) {
> if ($print and $print--) { print }
> else { $print = 2 if /^line1=A$/ }
> }

Or use paragraph mode:

( $/, $\, @ARGV ) = ( '', "\n", 'file.txt' );

while ( <> ) {
s/^line1=A\n// and print;
}



John
-- 
use Perl;
program
fulfillment

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




program logic not right

2003-01-30 Thread Eri Mendz
Good day all,

Have here a temperature conversion program im trying to "perfect" but no
chance, its not working right. The input validation portion is fine, im
satisfied likewise with the conversion to celsius.  My problem is
conversion to fahrenheit: the answer is not right so is the temp unit
during printout. The problem must be obvious but i pick-up slow.  Can
you help me out and guide me :-)

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

print "This is a temperature conversion program.\n";
print "Enter temperature to convert(e.g., 100C, 212F): ";
chomp(my $input = );
if ($input =~ m/^([+-]?\d+)(\.{1}\d+)?[ ]?([cCfF])$/){  #validate input format
my $real_num = $1;  
my $temp_unit = $3; 
my ($in_c, $in_f) = ($real_num, $real_num);
if ($temp_unit eq 'C' or 'c'){
$in_f = ($real_num * 9 / 5) + 32;
printf "%.2f C is %.2f F\n", $real_num, $in_f;
} else {#it must be F if not C
$in_c = ($real_num - 32) * 5 / 9;
printf "%.2f C is %.2f F\n", $real_num, $in_c;
}
} else {
#input failed validation check
print "Error is detected in input\n";
print "input format is number, optional space then letter C or F, case
insensitive, in exact order\n"; 
print "Please check your input and try again.\n";
}
Staring at the code trying to debug i realize is no nice exercise.
But i want to learn, so no excuse. TIA.

-- 
Regards,
Eri Mendz
Using Perl, v5.8.0
Linux 2.4.19-16mdk i686


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




Re: still needing help

2003-01-30 Thread R. Joseph Newton
Ron Geringer wrote:

> This is your script - which I put in the cgi-bin
>
> /usr/bin/perl

No, it is not.  His script had a script header of:

#!/usr/bin/perl

Which is a comment only on a Windows machine.  On a Linux box, it is a critical 
direction to the OS as to how to process the rest of the file.  It must have the #! 
p[lus the exact path from root to the perl exectable.  Do not uncomment, ever!  It is 
harmless in Windows, and critical on 'Nix

Joseph



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




RE: still needing help

2003-01-30 Thread Ron Geringer
Actually I saw that after I sent it. I did a copy and past and apparently
didn't catch the '#'. It was in the script --- it didn't appear in the copy
I placed in the email. I actually tested it on both a Freebsd server and on
a linux server with the same results.

Sorry for the confusion.

ron

-Original Message-
From: R. Joseph Newton [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 11:58 PM
To: Ron Geringer
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: still needing help


Ron Geringer wrote:

> This is your script - which I put in the cgi-bin
>
> /usr/bin/perl

No, it is not.  His script had a script header of:

#!/usr/bin/perl

Which is a comment only on a Windows machine.  On a Linux box, it is a
critical direction to the OS as to how to process the rest of the file.  It
must have the #! p[lus the exact path from root to the perl exectable.  Do
not uncomment, ever!  It is harmless in Windows, and critical on 'Nix

Joseph




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




Re: Problem with Getopt::Std

2003-01-30 Thread John W. Krahn
Pedro Antonio Reche wrote:
> 
> Hi all, I using the code below that uses the Getopt::Std to process the
> arguments from the command line (init subroutine).  However, for some
> reason I do not get the  arguments from the switches. If anyone sees
> what is the mistake I will be happy to hear about it.
> 
> #!/usr/sbin/perl -w

use strict;

> use Getopt::Std;
> 
> &init;

perldoc -q "What's the difference between calling a function as &foo and foo()"

Found in /usr/lib/perl5/5.6.0/pod/perlfaq7.pod
   What's the difference between calling a function as &foo
   and foo()?


> open(F, "$FILE") || die  "I could not open $FILE\n";
  ^ ^
perldoc -q quoting

Found in /usr/lib/perl5/5.6.0/pod/perlfaq4.pod
   What's wrong with always quoting "$vars"?

You should include the $! variable in the error message so you know why open failed.


> while(){
> if (! /ATOM/) {
> print $_;
> }
> else{
> if ( substr($_, $21,1) =~ $A ){
  ^  ^^
That dollar sign shouldn't be there.  You want to use 'eq' instead of '=~' to compare 
strings.


> substr ($_, $21, 1, $B);
> print $_;
> }
> else{
> print $_;
> }
> }

You _always_ "print $_;" so why is used three times?

substr $_, 21, 1, $B if /ATOM/ and substr $_, 21, 1 eq $A;
print;


> }
> close(F);
> 
> sub usage {
> my $program = `basename $0`;

use File::Basename;

  my $program = basename( $0 );


> chop($program);

Why are you removing the last character from $program?


> print STDERR "
>   $program [-p pdb ] [-a  ] [-b ] [
> -h ]
> 
>   Rename chain id from pdb
> 
>   -p : pdb file
>   -a : chain to rename
>   -b : new chain name
> 
> 
> ";
> 
> }
> sub init {
> getopts('pab');

perldoc Getopt::Std

SYNOPSIS
   use Getopt::Std;

   getopt('oDI');# -o, -D & -I take arg.  Sets opt_* as a side effect.
   
   getopt('oDI', \%opts);# -o, -D & -I take arg.  Values in %opts
   
   getopts('oif:');  # -o & -i are boolean flags, -f takes an argument
  
 # Sets opt_* as a side effect.
   getopts('oif:', \%opts);  # options as above. Values in %opts



> if ($opt_p) {
> $FILE = $opt_p;
> print "$FILE\n";
> } else {
> &usage;
> exit;
> }
> if ($opt_a) {
> $A = $opt_a;
> chomp($A);

Unless your shell or the user is doing something really weird there is no way that a 
command
line option will have a terminating newline.


> }
> else {
> &usage;
> exit;
> }
> if ($opt_b) {
> $B = $opt_b;
> chomp($B);
> }
> else {
> &usage;
> exit;
> }
> }

Why not just use $opt_p, $opt_a and $opt_b in the program?



John
-- 
use Perl;
program
fulfillment

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




Re: TimeStamp compare

2003-01-30 Thread R. Joseph Newton
John Baker wrote:

> #-- This module is a must-have:
> use Date::Manip;

Hi John,

I'm not so sure about your suggestion.  You might wish to re-read the section 
concerning whether usage is appropriate in the doc for this module.  The author 
explicitly recommends that the module be used only in programs which make heavy use of 
dates in a wide variety of formats.  He indicates that there are other modules with 
much less overhead for more modest date-related tasks.

I'm not sure if it was you, but I got this same recommendation on my first post here 
some 3000+ messages back.  I ended up just writing five or six functions for the 
boilerplate processing of locatime() output and putting them in a pm file.

As an aside, my first work in C, about eight years ago, was an attempt to do something 
like Date Manip--called it calendar.h.  I had it to where it could crunch formulations 
such as "The twenty-sixth day of March, in the year of our lord Nineteen hundred and 
niety-five".  I blew it off, though, when I realized that, for all my effort, there 
was no way to know whether a numeric date was in American or world format.  This is 
when I first came to passionately despise gratuitously numerical codings for values 
that had perfectly usable string descriptors.

Joseph


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




RE: program logic not right

2003-01-30 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Eri Mendz wrote:
> Good day all,
> 
> Have here a temperature conversion program im trying to "perfect" but
> no chance, its not working right. The input validation portion is
> fine, im satisfied likewise with the conversion to celsius.  My
> problem is conversion to fahrenheit: the answer is not right so is
> the temp unit during printout. The problem must be obvious but i
> pick-up slow.  Can you help me out and guide me :-)
> 
> #!/usr/bin/perl -w
> use strict;
> 
> print "This is a temperature conversion program.\n";
> print "Enter temperature to convert(e.g., 100C, 212F): ";
> chomp(my $input = );
> if ($input =~ m/^([+-]?\d+)(\.{1}\d+)?[ ]?([cCfF])$/){#validate
> input format my $real_num = $1;
> my $temp_unit = $3;
> my ($in_c, $in_f) = ($real_num, $real_num);
> if ($temp_unit eq 'C' or 'c'){
>   $in_f = ($real_num * 9 / 5) + 32;
>   printf "%.2f C is %.2f F\n", $real_num, $in_f;
> } else {  #it must be F if not C
>   $in_c = ($real_num - 32) * 5 / 9;
>   printf "%.2f C is %.2f F\n", $real_num, $in_c;
> }
> } else {
> #input failed validation check
> print "Error is detected in input\n";
> print "input format is number, optional space then letter C or F,
> case insensitive, in exact order\n";
> print "Please check your input and try again.\n";
> }
> Staring at the code trying to debug i realize is no nice exercise.
> But i want to learn, so no excuse. TIA.

I changed two points in your code:

m/^([+-]?\d+)(\.{1}\d+)?[ ]?([cCfF])$/
 to
m/^([+-]{0,1}\d+(\.\d{0,2}){0,1})\s*([CF])$/i
  ^--- make it case
insensitive
^^
   |--- either CF
 ^-^
|- Zero or more spaces
^---^
  |-- You can have one set of .nn one or two
digits
 ^-^
^---^ |---One or more digits
  |you can have one of them or none
Then I switched in portion for calculation of F to C:

 printf "%.2f C is %.2f F\n", $real_num, $in_c
to
 printf "%.2f F is %.2f C\n", $real_num, $in_c;

You also were not picking up the portion to the right of decimal point if
any was put in.

See what you think.

I will send you the code I ran ( w2k  ActivePerl 5.6.1 build 623)

Wags ;)


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



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




Re: Perl OO - Dynamic method call

2003-01-30 Thread R. Joseph Newton
"NYIMI Jose (BMB)" wrote:

> I know that in Perl OO the name of a method can be a variable.
> Which end up with code like this:
>
> my $obj= new MyClass;
> #here the thing
> $obj->$method();

ObjectInstanceName.Method(param1, param2,...);

I would not try to extrapolate Perl hacks to any language with true class definition 
capabilities.  It wpould be the equivalent of tinkering with a brand-new Lexus to give 
it the look and feel of a '62 Falcon.

Generally, high-end OO languages will provide features to allow for actual class 
definitions.  In C++, only declarations [function signatures] are required within the 
class for functions.  In Java, any class functions must be fully defined within the 
body of the class definition.  I much prefer the C++ approach, as it provides a 
greater modularity, seperating interface [declarations and function signatures] from 
implementation code.  Implementations can be freely interchangeable, as long as the 
fulfill the interface "contract" contained in the functions signature.

When in Rome ... I don't mean to put down Perl OO.  It obviously works for those who 
use it.  I just think that, if you are going to start doing OO in other, 
better-equipped languages, you should start fresh.

Joseph


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




  1   2   >