How to send "Net Send" messages from a Linux Server

2004-05-24 Thread LRMK
I want to write a Perl script to send net send messages to the windows based
computers but my scripts are running on Linux computer.
So I can't use

$results = `NET SEND $IP_ADDR blah blah blah blah `;

how to do this on a linux computer

I think that I will have to connect to the receivers port 135 and send the
message manualy using perl sockets
but I dont know the low level format of the message

Can someone help me on this

If there is a module to do this that will be great.



Rakhitha Karunarathne
Web Master
www.Ad-Man.tk - Free Unlimited Banner Rotators





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




RE: matrix solving

2004-05-24 Thread Boon Chong Ang
Hi,
Can some one provide an example sample on how to use it? 

Thank you & best regards,
ABC


-Original Message-
From: Jose Alves de Castro [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 21, 2004 6:24 PM
To: Boon Chong Ang
Cc: [EMAIL PROTECTED]
Subject: Re: matrix solving

Try using Math::Matrix (you can find it on CPAN)


On Fri, 2004-05-21 at 11:18, Boon Chong Ang wrote:
> Hi,
> I want to use perl to do the matrix solving such as matrix inversion and and matrix 
> multiplication, matrix addition and matrix substraction. However, i have no idea how 
> to do it in perl. Any there anyone who can give me some suggestion how to solve this?
>  
> 
> Thank you & best regards,
> 
> ABC
> 
>  
-- 
José Alves de Castro <[EMAIL PROTECTED]>
Telbit - Tecnologias de Informação


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




Re: Determine Email Headers

2004-05-24 Thread Mike Blezien
Wiggins d'Anconia wrote:
Definitely more clear.  See if my comments help, if not fire off some 
more questions :-).  This is why I (and others) are so adamant about not 
handling mail directly, amazing that such a complex beast can be made to 
seem so simple *most* of the time...

http://danconia.org
Ok, problem solved! :) The 'resend' method did the trick!! thanks for pointing 
that out, I guess I missed that when reading the doc on the module... I knew it 
had to be really something simple. ;)

again, appreciate all your help.
Mike

Message Body content:
 This is a multi-part message in MIME format.
  --=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/plain;
  charset="US-ASCII"
  Content-Transfer-Encoding: 7bit
  *Sent from [EMAIL PROTECTED] to [EMAIL PROTECTED]
  --=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/html;
  charset="US-ASCII"
  Content-Transfer-Encoding: quoted-printable
  
 Message


 Sent from 

 href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED] 
to =
 
 href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]<=
  /SPAN>

  --=_NextPart_000_0013_01C4419E.02807DF0--
End of the message
TIA,
Mike





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



Re: Determine Email Headers

2004-05-24 Thread Mike Blezien
Wiggins d'Anconia wrote:
Mike Blezien wrote:
Read below

[snip]

Basically what we have is a piped forwarding script that when a "fake" 
email address, IE "[EMAIL PROTECTED]" is recieved it's piped to 
script:

#!/usr/bin/perl
##
use Mail::Audit;
use DBI;
use strict;
alarm(30);
#
# some other sub routines and MySQL database coding to extract
# the real email address and name.
#  coding... continues
#
my $mail = Mail::Audit->new();
my $from = $mail->from();
my $fwdto= $mail->to();
my $subject  = $mail->subject();
my $body = $mail->body();
my @mailbody = defined($body) ? @{$body} : "No Message Received";
open(MAIL,"|$mailprog") or die $!;
print MAIL "To: \"$name\" <$sendto>\n";
print MAIL "From: $from\n";
print MAIL "Reply-to: $from\n";
print MAIL "Subject: $subject\n\n";
print MAIL [EMAIL PROTECTED];
  close(MAIL) or die $!;
exit();
##
Now the $fwdto is matched agaisnt the data in the database, and we 
extract the real address: $sendto and $name... The @mailbody array has 
the entire body of the email message. If it's a plain text message, 
the body of the email is fine and is displayed in the client's email 
reader without all those HTML characters, like below (Message Body 
content).. but if it's HTML formatted email message, then the body of 
the email contains all the garabage below. So what I am trying to do 
is either attempt to somehow extract the actual text content of the 
message or how to send it as the HTML formatted message properly so 
it's displayed correctly when received. If I where able to extract 
just the actual message content of the message content below, we would 
have something like this:

Ok I believe the problem is that you are stripping out portions of the 
header that you shouldn't be, specifically the portion that says that it 
is a multi-part message. So when your second reader gets the message it 
no longer states that the message is multipart.  What through me is your 
use of Mail::Audit. You don't seem to be using any of its true 
functionality, only that you can read a message through it, which to my 
knowledge makes its use overkill since you could use one of the mime 
parsers directly.

Is there a particular reason why you not using the 'resend' method 
provided with Mail::Audit?  This will allow the complete message to be 
intact and allow you to set the address to forward to.  If you still 
insist on piping to $mailprog there is the 'pipe' method, again will 
allow the message to remain complete, but if $mailprog is just sendmail 
or the sort you are better off using a module's method to do this rather 
than piping directly to sendmail.


"Sent from [EMAIL PROTECTED] - [EMAIL PROTECTED]"
I'm sure there is a simplier way to do and I hope I'm making my self 
clear here.
:)

Definitely more clear.  See if my comments help, if not fire off some 
more questions :-).  This is why I (and others) are so adamant about not 
handling mail directly, amazing that such a complex beast can be made to 
seem so simple *most* of the time...

http://danconia.org

well this my problem, with this particular project I can only pipe it to the 
$mailprog "sendmail" in this case. I'm really not sure if there is a better way 
to do this an still retain and send the message correctly no matter what 
content-type the message is sent, plain text or HTML formatted message body...

How would I utilize the 'resend' method or 'pipe' method,... and would that make 
a difference ??

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



Re: Determine Email Headers

2004-05-24 Thread Wiggins d'Anconia
Mike Blezien wrote:
Read below
[snip]

Basically what we have is a piped forwarding script that when a "fake" 
email address, IE "[EMAIL PROTECTED]" is recieved it's piped to script:

#!/usr/bin/perl
##
use Mail::Audit;
use DBI;
use strict;
alarm(30);
#
# some other sub routines and MySQL database coding to extract
# the real email address and name.
#  coding... continues
#
my $mail = Mail::Audit->new();
my $from = $mail->from();
my $fwdto= $mail->to();
my $subject  = $mail->subject();
my $body = $mail->body();
my @mailbody = defined($body) ? @{$body} : "No Message Received";
open(MAIL,"|$mailprog") or die $!;
print MAIL "To: \"$name\" <$sendto>\n";
print MAIL "From: $from\n";
print MAIL "Reply-to: $from\n";
print MAIL "Subject: $subject\n\n";
print MAIL [EMAIL PROTECTED];
  close(MAIL) or die $!;
exit();
##
Now the $fwdto is matched agaisnt the data in the database, and we 
extract the real address: $sendto and $name... The @mailbody array has 
the entire body of the email message. If it's a plain text message, the 
body of the email is fine and is displayed in the client's email reader 
without all those HTML characters, like below (Message Body content).. 
but if it's HTML formatted email message, then the body of the email 
contains all the garabage below. So what I am trying to do is either 
attempt to somehow extract the actual text content of the message or how 
to send it as the HTML formatted message properly so it's displayed 
correctly when received. If I where able to extract just the actual 
message content of the message content below, we would have something 
like this:

Ok I believe the problem is that you are stripping out portions of the 
header that you shouldn't be, specifically the portion that says that it 
is a multi-part message. So when your second reader gets the message it 
no longer states that the message is multipart.  What through me is your 
use of Mail::Audit. You don't seem to be using any of its true 
functionality, only that you can read a message through it, which to my 
knowledge makes its use overkill since you could use one of the mime 
parsers directly.

Is there a particular reason why you not using the 'resend' method 
provided with Mail::Audit?  This will allow the complete message to be 
intact and allow you to set the address to forward to.  If you still 
insist on piping to $mailprog there is the 'pipe' method, again will 
allow the message to remain complete, but if $mailprog is just sendmail 
or the sort you are better off using a module's method to do this rather 
than piping directly to sendmail.


"Sent from [EMAIL PROTECTED] - [EMAIL PROTECTED]"
I'm sure there is a simplier way to do and I hope I'm making my self 
clear here.
:)
Definitely more clear.  See if my comments help, if not fire off some 
more questions :-).  This is why I (and others) are so adamant about not 
handling mail directly, amazing that such a complex beast can be made to 
seem so simple *most* of the time...

http://danconia.org

Message Body content:
 This is a multi-part message in MIME format.
  --=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/plain;
  charset="US-ASCII"
  Content-Transfer-Encoding: 7bit
  *Sent from [EMAIL PROTECTED] to [EMAIL PROTECTED]
  --=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/html;
  charset="US-ASCII"
  Content-Transfer-Encoding: quoted-printable
  
 Message


 Sent from 

 href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED] 
to =
 
 href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]<=
  /SPAN>

  --=_NextPart_000_0013_01C4419E.02807DF0--
End of the message
TIA,
Mike


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



Re: Determine Email Headers

2004-05-24 Thread Mike Blezien
Read below
Wiggins d'Anconia wrote:
Please bottom post...
Mike Blezien wrote:
This is what comes in the body of the email message if it's not plain 
text message and need to pass the email with the right headers so it's 
displayed correctly when received:

Right, but the message itself is MIME and multipart. So I don't 
understand from your original question why you would be dropping either 
part? Shouldn't both parts continue on to their destination?  I am still 
not understanding why you would need to know what the content type is of 
either part, since it is still just a single message.  If the 
destination is MIME compliant it will read one, if not then it will read 
the preamble (and display it all), seems like you would still want them 
both?  If you are trying to have it decide which then you would need to 
know apriori what the client can handle, and in the case of non-MIME you 
would drop everything not text, but that depends on knowing the client.

Which still gets back to the original point that only you can tell us if 
you want to drop the HTML or not.

I don't have specific sample code, can look into it but still trying to 
understand specifically what you are looking for.  Maybe stepping back 
and looking at the problem as a whole, again, would help?

http://danconia.org

Basically what we have is a piped forwarding script that when a "fake" email 
address, IE "[EMAIL PROTECTED]" is recieved it's piped to script:

#!/usr/bin/perl
##
use Mail::Audit;
use DBI;
use strict;
alarm(30);
#
# some other sub routines and MySQL database coding to extract
# the real email address and name.
#  coding... continues
#
my $mail = Mail::Audit->new();
my $from = $mail->from();
my $fwdto= $mail->to();
my $subject  = $mail->subject();
my $body = $mail->body();
my @mailbody = defined($body) ? @{$body} : "No Message Received";
open(MAIL,"|$mailprog") or die $!;
print MAIL "To: \"$name\" <$sendto>\n";
print MAIL "From: $from\n";
print MAIL "Reply-to: $from\n";
print MAIL "Subject: $subject\n\n";
print MAIL [EMAIL PROTECTED];
  close(MAIL) or die $!;
exit();
##
Now the $fwdto is matched agaisnt the data in the database, and we extract the 
real address: $sendto and $name... The @mailbody array has the entire body of 
the email message. If it's a plain text message, the body of the email is fine 
and is displayed in the client's email reader without all those HTML characters, 
like below (Message Body content).. but if it's HTML formatted email message, 
then the body of the email contains all the garabage below. So what I am trying 
to do is either attempt to somehow extract the actual text content of the 
message or how to send it as the HTML formatted message properly so it's 
displayed correctly when received. If I where able to extract just the actual 
message content of the message content below, we would have something like this:

"Sent from [EMAIL PROTECTED] - [EMAIL PROTECTED]"
I'm sure there is a simplier way to do and I hope I'm making my self clear here.
:)
TIA,
Mike
Message Body content:
 This is a multi-part message in MIME format.
  --=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/plain;
  charset="US-ASCII"
  Content-Transfer-Encoding: 7bit
  *Sent from [EMAIL PROTECTED] to [EMAIL PROTECTED]
  --=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/html;
  charset="US-ASCII"
  Content-Transfer-Encoding: quoted-printable
  
 Message


 Sent from 
 href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED] 
to =
 
 href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]<=
  /SPAN>

  --=_NextPart_000_0013_01C4419E.02807DF0--
End of the message
TIA,
Mike

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



Re: Determine Email Headers

2004-05-24 Thread Wiggins d'Anconia
Please bottom post...
Mike Blezien wrote:
This is what comes in the body of the email message if it's not plain 
text message and need to pass the email with the right headers so it's 
displayed correctly when received:
Right, but the message itself is MIME and multipart. So I don't 
understand from your original question why you would be dropping either 
part? Shouldn't both parts continue on to their destination?  I am still 
not understanding why you would need to know what the content type is of 
either part, since it is still just a single message.  If the 
destination is MIME compliant it will read one, if not then it will read 
the preamble (and display it all), seems like you would still want them 
both?  If you are trying to have it decide which then you would need to 
know apriori what the client can handle, and in the case of non-MIME you 
would drop everything not text, but that depends on knowing the client.

Which still gets back to the original point that only you can tell us if 
you want to drop the HTML or not.

I don't have specific sample code, can look into it but still trying to 
understand specifically what you are looking for.  Maybe stepping back 
and looking at the problem as a whole, again, would help?

http://danconia.org
Message Body content:
 This is a multi-part message in MIME format.
  --=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/plain;
  charset="US-ASCII"
  Content-Transfer-Encoding: 7bit
  *Sent from [EMAIL PROTECTED] to [EMAIL PROTECTED]
  --=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/html;
  charset="US-ASCII"
  Content-Transfer-Encoding: quoted-printable
  
 Message

 Sent from mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED] to =
 mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]<=
  /SPAN>
  --=_NextPart_000_0013_01C4419E.02807DF0--
End of the message
TIA,
Mike
Wiggins d Anconia wrote:
Hello,
we're currently using the Mail::Audit module to process a perl script

that pipes
email sent to "fake" forward emails address, then send it's to a real 
address,... all works fine except if it's a HTML formatted email. My

question
is, is it possible with this module to determine if it's HTML or plain

test
email... or would it be better to simple strip out all the HTML 
elements.


It appears that Mail::Audit provides a wrapper to a message, if that
message is of a MIME format (which most if not all HTML messages will
be) then you can check the type of the message, and process its various
parts using the MIME::Entity methods.
Only you can tell us whether or not your users want their HTML e-mail. I
know I would be more than a little pissed if my HTML e-mail ended up in
the bit bucket, not because I am any big fan of HTML e-mail (I am not)
but (much to my dismay ;-)) I don't control everyone elses mail clients
or sending habits...
What do you mean by "all works fine unless it has HTML"... the module,
your program, or something down the line?
http://danconia.org


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



Re: Determine Email Headers

2004-05-24 Thread Mike Blezien
This is what comes in the body of the email message if it's not plain text 
message and need to pass the email with the right headers so it's displayed 
correctly when received:
Message Body content:

 This is a multi-part message in MIME format.
  --=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/plain;
  charset="US-ASCII"
  Content-Transfer-Encoding: 7bit
  *Sent from [EMAIL PROTECTED] to [EMAIL PROTECTED]
  --=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/html;
  charset="US-ASCII"
  Content-Transfer-Encoding: quoted-printable
  
 Message

 Sent from mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED] to =
 mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]<=
  /SPAN>
  --=_NextPart_000_0013_01C4419E.02807DF0--
End of the message
TIA,
Mike
Wiggins d Anconia wrote:
Hello,
we're currently using the Mail::Audit module to process a perl script
that pipes 

email sent to "fake" forward emails address, then send it's to a real 
address,... all works fine except if it's a HTML formatted email. My
question 

is, is it possible with this module to determine if it's HTML or plain
test 

email... or would it be better to simple strip out all the HTML elements.

It appears that Mail::Audit provides a wrapper to a message, if that
message is of a MIME format (which most if not all HTML messages will
be) then you can check the type of the message, and process its various
parts using the MIME::Entity methods. 

Only you can tell us whether or not your users want their HTML e-mail. I
know I would be more than a little pissed if my HTML e-mail ended up in
the bit bucket, not because I am any big fan of HTML e-mail (I am not)
but (much to my dismay ;-)) I don't control everyone elses mail clients
or sending habits...
What do you mean by "all works fine unless it has HTML"... the module,
your program, or something down the line?
http://danconia.org


--
MikeBlezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Quality Web Hosting
http://www.justlightening.net
MSN Messager: [EMAIL PROTECTED]
Cell:1.985.320.1191 - Office:1.712.737.2548
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Determine Email Headers

2004-05-24 Thread Mike Blezien
What I was getting at, is a email is sent as a standard plain text message, the 
body content of the message is sent with no problems, but if the message is sent 
as HTML formatted email, then all the HTML elements, tags...etc are included in 
the body of the message so I was wondering, when using the Mail::Audit 
module what is the best way to determine which email header "content-type" to 
pass, IE "Content-type: text/html\n" or "Content-Type: text/plain\n" to be 
included in the email message that is then sent to the real email address.

If you happen to have any example coding, it would be much appreciate if you can 
share it :)

TIA
Mike
Wiggins d Anconia wrote:
Hello,
we're currently using the Mail::Audit module to process a perl script
that pipes 

email sent to "fake" forward emails address, then send it's to a real 
address,... all works fine except if it's a HTML formatted email. My
question 

is, is it possible with this module to determine if it's HTML or plain
test 

email... or would it be better to simple strip out all the HTML elements.

It appears that Mail::Audit provides a wrapper to a message, if that
message is of a MIME format (which most if not all HTML messages will
be) then you can check the type of the message, and process its various
parts using the MIME::Entity methods. 

Only you can tell us whether or not your users want their HTML e-mail. I
know I would be more than a little pissed if my HTML e-mail ended up in
the bit bucket, not because I am any big fan of HTML e-mail (I am not)
but (much to my dismay ;-)) I don't control everyone elses mail clients
or sending habits...
What do you mean by "all works fine unless it has HTML"... the module,
your program, or something down the line?
http://danconia.org


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



Re: Question of memory management in Perl

2004-05-24 Thread Wiggins d Anconia
> 
> Hi all,
> I have question with respect to memory utilization using perl. I am
reading a huge file close to 786432 lines of hex values & am storing in
an array. I do a data reformatting using the data in these array & in
the sequence of process generate a number of arrays & eventually write
into a file at the end of the subroutine. The problem I get is in the
middle of subroutine execution I get "Out of memory" indication & I have
used close to 2 Gigs of memory. So inorder to avoid this Out of memory
issue what I did was, after I send the array elements to a different
array, I initialize the original array with null. For eg: this is what I
do with one of the array,
>  
> for ($init_cnt=0;$init_cnt<=$#out_array_bin;$init_cnt++) {
> $out_array_bin[$init_cnt] = "";
> }
>  
> I followd the same approach with other arrays in my subroutine.
> I thought this would solve my Out of memory problem but it did not.
> Can some one tell me what could be an alternative solution for this
problem or kindly suggest me if sometning I should need to correct in my
existing solution.
>  
> Thanks for the help in advance,
> Hari
> 

Do you need to read the whole file initially?  This is a pretty common
beginner mistake, don't know your expertise so will suggest it first. 
If possible read only the parts that you are acting on.

Are you doing,

use strict;
use warnings; 

In your script?  Using strict will force proper (or at least better)
variable scoping which should allow earlier garabage collection on
memory that can be reused.

This sounds more like a design problem and you have shown only a trivial
piece of code, so our help is somewhat constrained.  If this doesn't
help, show us some more code...

http://danconia.org


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




Question of memory management in Perl

2004-05-24 Thread Hari Krishnaan
Hi all,
I have question with respect to memory utilization using perl. I am reading a huge 
file close to 786432 lines of hex values & am storing in an array. I do a data 
reformatting using the data in these array & in the sequence of process generate a 
number of arrays & eventually write into a file at the end of the subroutine. The 
problem I get is in the middle of subroutine execution I get "Out of memory" 
indication & I have used close to 2 Gigs of memory. So inorder to avoid this Out of 
memory issue what I did was, after I send the array elements to a different array, I 
initialize the original array with null. For eg: this is what I do with one of the 
array,
 
for ($init_cnt=0;$init_cnt<=$#out_array_bin;$init_cnt++) {
$out_array_bin[$init_cnt] = "";
}
 
I followd the same approach with other arrays in my subroutine.
I thought this would solve my Out of memory problem but it did not.
Can some one tell me what could be an alternative solution for this problem or kindly 
suggest me if sometning I should need to correct in my existing solution.
 
Thanks for the help in advance,
Hari
 
 



-
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

Re: Question of memory management in Perl

2004-05-24 Thread Eric Walker
off the top of my head I would suggest you slice off the slice off the pieces 
that you have used already when pulling data from the original array. That 
way the array gets smaller as you finish modifiying its info and transferring 
it somewhere else.

BassFool


On Monday 24 May 2004 02:57 pm, Hari Krishnaan wrote:
> Hi all,
> I have question with respect to memory utilization using perl. I am reading
> a huge file close to 786432 lines of hex values & am storing in an array. I
> do a data reformatting using the data in these array & in the sequence of
> process generate a number of arrays & eventually write into a file at the
> end of the subroutine. The problem I get is in the middle of subroutine
> execution I get "Out of memory" indication & I have used close to 2 Gigs of
> memory. So inorder to avoid this Out of memory issue what I did was, after
> I send the array elements to a different array, I initialize the original
> array with null. For eg: this is what I do with one of the array,
>
> for ($init_cnt=0;$init_cnt<=$#out_array_bin;$init_cnt++) {
> $out_array_bin[$init_cnt] = "";
> }
>
> I followd the same approach with other arrays in my subroutine.
> I thought this would solve my Out of memory problem but it did not.
> Can some one tell me what could be an alternative solution for this problem
> or kindly suggest me if sometning I should need to correct in my existing
> solution.
>
> Thanks for the help in advance,
> Hari
>
>
>
> -
> Do you Yahoo!?
> Friends.  Fun. Try the all-new Yahoo! Messenger

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




Re: Determine Email Headers

2004-05-24 Thread Wiggins d Anconia
> Hello,
> 
> we're currently using the Mail::Audit module to process a perl script
that pipes 
> email sent to "fake" forward emails address, then send it's to a real 
> address,... all works fine except if it's a HTML formatted email. My
question 
> is, is it possible with this module to determine if it's HTML or plain
test 
> email... or would it be better to simple strip out all the HTML elements.
> 

It appears that Mail::Audit provides a wrapper to a message, if that
message is of a MIME format (which most if not all HTML messages will
be) then you can check the type of the message, and process its various
parts using the MIME::Entity methods. 

Only you can tell us whether or not your users want their HTML e-mail. I
know I would be more than a little pissed if my HTML e-mail ended up in
the bit bucket, not because I am any big fan of HTML e-mail (I am not)
but (much to my dismay ;-)) I don't control everyone elses mail clients
or sending habits...

What do you mean by "all works fine unless it has HTML"... the module,
your program, or something down the line?

http://danconia.org

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




Question of memory management in Perl

2004-05-24 Thread Hari Krishnaan
Hi all,
I have question with respect to memory utilization using perl. I am reading a huge 
file close to 786432 lines of hex values & am storing in an array. I do a data 
reformatting using the data in these array & in the sequence of process generate a 
number of arrays & eventually write into a file at the end of the subroutine. The 
problem I get is in the middle of subroutine execution I get "Out of memory" 
indication & I have used close to 2 Gigs of memory. So inorder to avoid this Out of 
memory issue what I did was, after I send the array elements to a different array, I 
initialize the original array with null. For eg: this is what I do with one of the 
array,
 
for ($init_cnt=0;$init_cnt<=$#out_array_bin;$init_cnt++) {
$out_array_bin[$init_cnt] = "";
}
 
I followd the same approach with other arrays in my subroutine.
I thought this would solve my Out of memory problem but it did not.
Can some one tell me what could be an alternative solution for this problem or kindly 
suggest me if sometning I should need to correct in my existing solution.
 
Thanks for the help in advance,
Hari



-
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

Determine Email Headers

2004-05-24 Thread Mike Blezien
Hello,
we're currently using the Mail::Audit module to process a perl script that pipes 
email sent to "fake" forward emails address, then send it's to a real 
address,... all works fine except if it's a HTML formatted email. My question 
is, is it possible with this module to determine if it's HTML or plain test 
email... or would it be better to simple strip out all the HTML elements.

TIA
--
MikeBlezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Quality Web Hosting
http://www.justlightening.net
MSN Messager: [EMAIL PROTECTED]
Cell:1.985.320.1191 - Office:1.712.737.2548
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: multiple pages results

2004-05-24 Thread JupiterHost.Net

Cristi Ocolisan wrote:
Hello everybody,
 

While interrogating a MySQL database, I'm trying to split the results into
multiple pages.
 

I don't know where I'm going wrong. When I run the script below, only the
number of pages is printed on screen.
 

Can anyone help?
You may want to check out Data::Page and/or Data::Pageset
HTH:)
Lee.M - JupiterHost.Net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Modify $0 in Perl embedded in C

2004-05-24 Thread JupiterHost.Net
Just a note: I also tried $main::0 as well as $0
 (as in
 perl -e '$0 = "foo";print "$0\n";'
 perl -e '$main::0 = "foo";print "$0\n";')
after I used caller() to make sure it was in main::.
Any ideas?
JupiterHost.Net wrote:
Hello group!
Maybe a bit much for a beginners list (I looked and looked and couldn't 
find any specific lists) but Perhaps a guru or two will know the answer :)

I've been playing with embedding Perl code into a C program that can
interpret the code.
 (as per http://www-h.eng.cam.ac.uk/help/mjg17/perldoc/pod/perlembed.html
http://search.cpan.org/~krishpl/pod2texi-0.1/perlembed.pod
http://search.cpan.org/~nwclark/perl-5.8.4/pod/perlembed.pod
)
This example works great: (I realize @ARGV is clobbered but that isn't 
the point right now, its for another sleepless night ;p)

  (compiled with: gcc -o compiled_version simple.c `perl
-MExtUtils::Embed -e ccopts -e ldopts`)
#include 
#include 
static PerlInterpreter *my_perl;
main (int argc, char **argv, char **env)
{
char *embedding[] = { "", "-e", "0" };
my_perl = perl_alloc();
perl_construct(my_perl);
perl_parse(my_perl, NULL, 3, embedding, NULL);
perl_run(my_perl);
perl_eval_pv("print qq(Hello World - I come from the planet
C and i am -$0-\n);", TRUE);
perl_destruct(my_perl);
perl_free(my_perl);
}
But the problems I've found is:
 1) $0 is -e since we're not making just another copy of perl but
running internal code internally by specifying -e
   1.a) If I change -e to the file name (IE C's argv[0]), it errors out 
because it tries to open the file to execute as perl code like doing 
perl file.pl
   1.b) If i try to set $0 myself I get a bus error (Try it :add $0 =
'actual_file.name';) Which, while a bad idea generally, still works with
regular Perl.

#include 
#include 
static PerlInterpreter *my_perl;
main (int argc, char **argv, char **env)
{
char *embedding[] = { "", "-e", "0" };
my_perl = perl_alloc();
perl_construct(my_perl);
perl_parse(my_perl, NULL, 3, embedding, NULL);
perl_run(my_perl);
perl_eval_pv("print qq(Zero is -$0-\n);$0 =
'realnamefromargv[0]here';print qq(Zero is -$0-\n);", TRUE);
perl_destruct(my_perl);
perl_free(my_perl);
}
So does anyone have any insigth as to why it flops and/or how to set $0 
with another value in those examples?

TIA
Lee.M - JupiterHost.Net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Modify $0 in Perl embedded in C

2004-05-24 Thread JupiterHost.Net
Just a note: I also tried $main::0 as well as $0
 (as in
 perl -e '$0 = "foo";print "$0\n";'
 perl -e '$main::0 = "foo";print "$0\n";')
after I used caller() to make sure it was in main::.
Any ideas?
JupiterHost.Net wrote:
Hello group!
Maybe a bit much for a beginners list (I looked and looked and couldn't 
find any specific lists) but Perhaps a guru or two will know the answer :)

I've been playing with embedding Perl code into a C program that can
interpret the code.
 (as per http://www-h.eng.cam.ac.uk/help/mjg17/perldoc/pod/perlembed.html
http://search.cpan.org/~krishpl/pod2texi-0.1/perlembed.pod
http://search.cpan.org/~nwclark/perl-5.8.4/pod/perlembed.pod
)
This example works great: (I realize @ARGV is clobbered but that isn't 
the point right now, its for another sleepless night ;p)

  (compiled with: gcc -o compiled_version simple.c `perl
-MExtUtils::Embed -e ccopts -e ldopts`)
#include 
#include 
static PerlInterpreter *my_perl;
main (int argc, char **argv, char **env)
{
char *embedding[] = { "", "-e", "0" };
my_perl = perl_alloc();
perl_construct(my_perl);
perl_parse(my_perl, NULL, 3, embedding, NULL);
perl_run(my_perl);
perl_eval_pv("print qq(Hello World - I come from the planet
C and i am -$0-\n);", TRUE);
perl_destruct(my_perl);
perl_free(my_perl);
}
But the problems I've found is:
 1) $0 is -e since we're not making just another copy of perl but
running internal code internally by specifying -e
   1.a) If I change -e to the file name (IE C's argv[0]), it errors out 
because it tries to open the file to execute as perl code like doing 
perl file.pl
   1.b) If i try to set $0 myself I get a bus error (Try it :add $0 =
'actual_file.name';) Which, while a bad idea generally, still works with
regular Perl.

#include 
#include 
static PerlInterpreter *my_perl;
main (int argc, char **argv, char **env)
{
char *embedding[] = { "", "-e", "0" };
my_perl = perl_alloc();
perl_construct(my_perl);
perl_parse(my_perl, NULL, 3, embedding, NULL);
perl_run(my_perl);
perl_eval_pv("print qq(Zero is -$0-\n);$0 =
'realnamefromargv[0]here';print qq(Zero is -$0-\n);", TRUE);
perl_destruct(my_perl);
perl_free(my_perl);
}
So does anyone have any insigth as to why it flops and/or how to set $0 
with another value in those examples?

TIA
Lee.M - JupiterHost.Net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Connecting to Oracle over network

2004-05-24 Thread jason corbett
Hello. I am using Windows 2000 to connect to an Oracle database over the company 
network. I have the DBI/DBD drivers installed on my computer. I want to connect using 
the script below. When i run the script, it doesn't come back with anything. It just 
goes to the command prompt. Can someone tell me how to do this, and what env variables 
need to be set and where? I am not using any proxies btw.
 
Regards,
JC
 
#!perl -w
use strict; 
use DBI; 
#  $ENV{"ORACLE_HOME"}="what goes here??"; 
my $dbh = DBI->connect('DBI:Oracle:','[EMAIL PROTECTED]','passwd' 
 ) or die "Can't connect to Oracle database: \n $DBI::errstr\n"; 
my $msg = 
  $dbh->selectrow_array( 
 "SELECT SYSDATE || ' Hello Cygwin DBI! :-)' message FROM DUAL" 
   ); 
# Let's have some formatting fun! :-) 
my $msg_len = length( $msg ); 
my $underline = '=' x ($msg_len + 6); 
print "\n", $underline, "\n", 
"|| ", ' ' x $msg_len, " ||", "\n", 
"|| ", $msg, " ||", "\n", 
"|| ", ' ' x $msg_len, " ||", "\n", 
$underline, "\n\n"; 
$dbh->disconnect;



-
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year

Returned eMail: User Unknown

2004-05-24 Thread Bouncer
Your Mail has been bounced from the OutPost/1.800eMail Server
Because "[EMAIL PROTECTED]" is not a valid username


Original message, less any attachments, follows:

--- Begin Message ---
--As of Monday, May 24, 2004 8:43 AM +0600, LRMK is alleged to have said:

> By the way is PostgreSQL  free and if yes where can I get a copy to
> practise myself.

--As for the rest, it is mine.

Yes: 

Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---

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



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


Re: String issue?

2004-05-24 Thread Jeff 'japhy' Pinyan
On May 24, Werner Otto said:

>   system("ping -s localhost 56 1");
>
>This will echo:
>
>   64 bytes from localhost (127.0.0.1): icmp_seq=0. time=0. ms
>
>How do I get this echo'd value as a string value? I will be splitting this
>string up into segments to fill my fields in my database table.

You don't, at least, not with system().  system() doesn't return its
output, it returns its exit value.  If you want to capture the output of a
program, use backticks (``) or the qx() operator.  Or consider using
open() like so:

  open PING, "ping -s localhost 56 1 |"
or die "can't spawn ping: $!";
  while () {
print "got: $_";
  }
  close PING;

As someone mentioned, make sure you tell ping to stop after a certain
count, if it doesn't do so automatically.  If you don't, then you won't be
able to stop it (unless you use the open() method above, and put a 'last'
in the while loop somewhere).

But have you considered using the Net::Ping module?

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


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




Re: Missing Component

2004-05-24 Thread Jeff 'japhy' Pinyan
On May 24, [EMAIL PROTECTED] said:

>I have a program with some ftp code in it. This is working fine on a Unix
>machine but is giving the following error on a Windows machine.
>
>>Can't locate Net/FTP.pm in @INC at
>\\mmpapp01\nal_sd\gxsftp\programs\get-edi.pl line 17.

You appear to be missing the Net::FTP module on your windows machine.

I'd suggest using PPM to install it (that should have come with Perl).

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


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




Re: array output

2004-05-24 Thread DBSMITH
this will work!  thanks!
one more question...

I am setting an array up to be the output of a system app command like 
this

my @ftapes = system (evmvol -w label_state=3|grep barcode");
print $ftapes[0];

it prints everything...meaning 5 lines. Or when I say print $ftapes[0,1] 
it errors saying 

"my" variable @ftapes masks earlier declaration in same scope at 
foreign_tape_ck.pl
Multidimensional syntax $ftapes[0,1] not supported at foreign_tape_ck.pl 
line 2.
Use of uninitialized value in print at foreign_tape_ck.pl line 26.
foreign_tape_ck.pl syntax OK


 
what I want is for each element to hold 1 line.  Will the diamond operator 
work here? 


derek





"Paul D. Kraus" <[EMAIL PROTECTED]>
05/21/2004 04:39 PM

 
To: [EMAIL PROTECTED]
cc: [EMAIL PROTECTED]
Subject:Re: array output


Not completely sure what you are trying to do but you can join all the
elements like this 

my $mystring = join " ", @myarray;
this will join each elements into one string seperated by a space. 

Paul
On Fri, May 21, 2004 at 02:07:56PM -0400, [EMAIL PROTECTED] wrote:
> All, 
> 
> I have an array of 40 elements and I want to run a system app command 
> against all the elements simultaneously ...well not line by line as in a 

> for loop.
> I have tried 
> 
> 
> does anyone know how to spit out all 40 elements so the app command does 

> not eject tapes one by one?
> thanks
> 
> Derek B. Smith
> OhioHealth IT
> UNIX / TSM / EDM Teams
> 

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






perl.beginners Weekly list FAQ posting

2004-05-24 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 do I complain to?
You can send complaints to <[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?
Feb 04, 2004

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 list, consider subscribing to the digest.

  2.9 Other tips before posti

Manfred Beilfuß/DVAG ist außer Haus.

2004-05-24 Thread Manfred . Beilfuss
Ich werde ab  13.05.2004 nicht im Büro sein. Ich kehre zurück am
04.06.2004.

Ich werde Ihre Nachricht nach meiner Rückkehr beantworten. In dringenden
Fällen die DB-Administration betreffend, bitte eine entsprechende Note an
die Adresse dba-intel bzw. dba-host senden



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




Re: A MySQL Question

2004-05-24 Thread Daniel Staal
--As of Monday, May 24, 2004 8:43 AM +0600, LRMK is alleged to have said:
By the way is PostgreSQL  free and if yes where can I get a copy to
practise myself.
--As for the rest, it is mine.
Yes: 
Daniel T. Staal
---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: String issue?

2004-05-24 Thread Mandar Rahurkar
one way to do this is to cat the output of ping to a file..or simply..

@u_there=`ping -s localhost 56 1`; # watch the quotes

Mandar

 Original message 
>Date: Mon, 24 May 2004 11:58:18 +0100
>From: Werner Otto <[EMAIL PROTECTED]>  
>Subject: String issue?  
>To: [EMAIL PROTECTED]
>
>Hi There,
>
>I am having trouble with string creation.
>
>I need to do something like:
>
>   system("ping -s localhost 56 1");
>
>This will echo:
>
>   64 bytes from localhost (127.0.0.1): icmp_seq=0. time=0. ms
>
>How do I get this echo'd value as a string value? I will be splitting this 
>string up into segments to fill my fields in my database table.
>
>Regards
>Otto
>
>-- 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
> 
>
>
---
Mandar Rahurkar
ECE,   UIUC
---

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




Re: get hash from array

2004-05-24 Thread James Edward Gray II
On May 24, 2004, at 8:06 AM, [EMAIL PROTECTED] wrote:
I had the idea that something like:
sub xpto {
   my %a;
   [EMAIL PROTECTED] = ();
@[EMAIL PROTECTED] = ();
   return \%a;
}
should work.
Make the inline change above and it will.
James
Obviuslly this idea will be used in major subroutines.
Thanks

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



Re: get hash from array

2004-05-24 Thread Jose Alves de Castro
On Mon, 2004-05-24 at 14:09, Jose Alves de Castro wrote:
> On Mon, 2004-05-24 at 13:46, [EMAIL PROTECTED] wrote:
> > sub xpto {
> >my %a = map {$_ => undef} (@_);
> >return \%a;
> > }
> > 
> > or 
> > 
> > sub xpto {
> >return {map {$_ => undef} (@_)};
> > }
> > 
> > 
> > I'm using this code but shall exist someting clearner without map. Can you
> > help me?
> 
> If what you want is to clean that, try
> 
> sub xpto {
>   map {$_ => undef} @_
> }

sub xpto {
  { map {$_ => undef} @_ }
}

> That'll do the trick
> 
> If you want to get rid of the map, try this instead:
> 
> sub xpto {
>   my %b;
>   @[EMAIL PROTECTED] = ();
>   %b
> }

sub xpto {
  my %b;
  @[EMAIL PROTECTED] = ();
  \%b
}

Oops... :-) I misread your mail and didn't notice you were looking for a
reference; hence, this update :-)

> > Thanks
> 
> HTH
> 
> jac
> 
> -- 
> Josà Alves de Castro <[EMAIL PROTECTED]>
> Telbit - Tecnologias de InformaÃÃo
-- 
Josà Alves de Castro <[EMAIL PROTECTED]>
Telbit - Tecnologias de InformaÃÃo


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




Re: get hash from array

2004-05-24 Thread Jose Alves de Castro
On Mon, 2004-05-24 at 13:46, [EMAIL PROTECTED] wrote:
> sub xpto {
>my %a = map {$_ => undef} (@_);
>return \%a;
> }
> 
> or 
> 
> sub xpto {
>return {map {$_ => undef} (@_)};
> }
> 
> 
> I'm using this code but shall exist someting clearner without map. Can you
> help me?

If what you want is to clean that, try

sub xpto {
  map {$_ => undef} @_
}

That'll do the trick

If you want to get rid of the map, try this instead:

sub xpto {
  my %b;
  @[EMAIL PROTECTED] = ();
  %b
}

> Thanks

HTH

jac

-- 
Josà Alves de Castro <[EMAIL PROTECTED]>
Telbit - Tecnologias de InformaÃÃo


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




Missing Component

2004-05-24 Thread Satya_Devarakonda
Hi,

I have a program with some ftp code in it. This is working fine on a Unix 
machine but is giving the following error on a Windows machine.

>Can't locate Net/FTP.pm in @INC at 
\\mmpapp01\nal_sd\gxsftp\programs\get-edi.pl line 17.
>BEGIN failed--compilation aborted at 
\\mmpapp01\nal_sd\gxsftp\programs\get-edi.pl line 17.

My directory containing the perl program has components from from 
ActiveInternet corp.
03/22/1997  08:42 AM81,408 Perl.exe
03/22/1997  08:42 AM   569,344 Perl300.dll

How can I fix this.

Regards,
Satya

RE: get hash from array

2004-05-24 Thread Marcos . Rebelo
> -Original Message-
> From: James Edward Gray II [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 24, 2004 3:00 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: get hash from array
> 
> 
> On May 24, 2004, at 7:46 AM, [EMAIL PROTECTED] wrote:
> 
> > sub xpto {
> >my %a = map {$_ => undef} (@_);
> >return \%a;
> > }
> >
> > or
> >
> > sub xpto {
> >return {map {$_ => undef} (@_)};
> > }
> >
> >
> > I'm using this code but shall exist someting clearner 
> without map. Can 
> > you
> > help me?
> 
> I find map() to be the ideal solution.  That's exactly what it's for.
> 
> You could of course always roll your own loop.
> 
> What exactly are you trying to fix?
> 
> James
> 


I had the idea that something like:

sub xpto {
   my %a;
   [EMAIL PROTECTED] = ();
   return \%a;
}

should work.

Obviuslly this idea will be used in major subroutines.

Thanks

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




Re: get hash from array

2004-05-24 Thread James Edward Gray II
On May 24, 2004, at 7:46 AM, [EMAIL PROTECTED] wrote:
sub xpto {
   my %a = map {$_ => undef} (@_);
   return \%a;
}
or
sub xpto {
   return {map {$_ => undef} (@_)};
}
I'm using this code but shall exist someting clearner without map. Can 
you
help me?
I find map() to be the ideal solution.  That's exactly what it's for.
You could of course always roll your own loop.
What exactly are you trying to fix?
James
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



get hash from array

2004-05-24 Thread Marcos . Rebelo
sub xpto {
   my %a = map {$_ => undef} (@_);
   return \%a;
}

or 

sub xpto {
   return {map {$_ => undef} (@_)};
}


I'm using this code but shall exist someting clearner without map. Can you
help me?

Thanks


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




Re: How get a special value of an arrayfield stored in an hash?

2004-05-24 Thread Jan Eden
Hi Bastian,

Bastian Angerstein wrote on 24.05.2004:

>I tought:
>$index = 1
>
>$var = ${$myhash{mykey}}[$index];
>
>would do the trick.
>
>But it don´t.
>
>
>Any suggestions?
>
>
Your syntax implies that there already is an anonymous array stored as value of 
$myhash{mykey}. You assign the second value within that array to $var. In this case, a 
more readable version could utilize arrow dereferencing:

$var = $myhash{mykey}->[$index];

But what you are trying to do (according to youzr subject line) is

$myhash{mykey}->[$index] = $var;

Or did I get you wrong?

- Jan
-- 
Hanlon's Razor: Never attribute to malice that which can be adequately explained by 
stupidity.

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




Re: How get a special value of an arrayfield stored in an hash?

2004-05-24 Thread Ricardo SIGNES
* Bastian Angerstein <[EMAIL PROTECTED]> [2004-05-24T08:07:37]
> $index = 1
> $var = ${$myhash{mykey}}[$index];

$var = $myhash{mykey}[$index]
$var = $myhash{mykey}->[$index]

Either will do.

-- 
rjbs


pgpc308dwTSbR.pgp
Description: PGP signature


How get a special value of an arrayfield stored in an hash?

2004-05-24 Thread Bastian Angerstein

I tought:
$index = 1

$var = ${$myhash{mykey}}[$index];

would do the trick.

But it don´t.


Any suggestions?


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




Re: String issue?

2004-05-24 Thread Ramprasad A Padmanabhan
Werner Otto wrote:
Hi There,
I am having trouble with string creation.
I need to do something like:
system("ping -s localhost 56 1");
This will echo:
 64 bytes from localhost (127.0.0.1): icmp_seq=0. time=0. ms
How do I get this echo'd value as a string value? I will be splitting 
this string up into segments to fill my fields in my database table.

Regards
Otto
when you want the output of one process in your perl script run it with 
a pipe or backticks

like 
@lines  = `ping -c 5 -s localhost 56 1`;#dont forget  -c  or on unix 
like systems you will be inside an infinite loop

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



Re: String issue?

2004-05-24 Thread Anders Holm
Hi Otto.

Sounds like you are rolling your own monitor applicaiton?

Without having tested this, I'd say:

my $result = system("ping -s localhost 56 1");

Or, do you wish to receive multiple results for that one command?

I'm wondering, is this really the optimail solution to your problem.
What is the end product you are writing? May well be that there is
somehting there already.

If it is a monitoring application, I'd highly recommend
http://www.nagios.org/

Then you don't have to roll your own.. ;)

Enjoy!

//Anders//

On Mon, 2004-05-24 at 11:58, Werner Otto wrote:
> Hi There,
> 
> I am having trouble with string creation.
> 
> I need to do something like:
> 
>   system("ping -s localhost 56 1");
> 
> This will echo:
> 
>   64 bytes from localhost (127.0.0.1): icmp_seq=0. time=0. ms
> 
> How do I get this echo'd value as a string value? I will be splitting this 
> string up into segments to fill my fields in my database table.
> 
> Regards
> Otto


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




String issue?

2004-05-24 Thread Werner Otto
Hi There,
I am having trouble with string creation.
I need to do something like:
system("ping -s localhost 56 1");
This will echo:
64 bytes from localhost (127.0.0.1): icmp_seq=0. time=0. ms
How do I get this echo'd value as a string value? I will be splitting this 
string up into segments to fill my fields in my database table.

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



Re: using environment proxy variables for LWP::Simple

2004-05-24 Thread Beau E. Cox
On Sunday 23 May 2004 08:25 pm, Ramprasad A Padmanabhan wrote:
> I have got a simple script that is straight out of the man page for
> Tie::Google. My problem is the script simply hangs.  I bet this is
> because it is not able to use the environment proxy variables
>
> I have set my proxy ( requires no auth ) as
> export http_proxy=http://myproxy:80
> ( I am using a linux machine .. I dont think that matters )
>
>
> #!/usr/bin/perl
> #
> #
> use strict;
> use Tie::Google;
>
> my $KEYFILE = glob "~/.googlekey";
> my ($g, @g, %g);
> print $ENV{http_proxy};  # works fine
> # Tied scalar interface: I Feel Lucky
> use LWP::Simple qw(getprint);
> tie $g, "Tie::Google", $KEYFILE, "perl";
> getprint($g->{'URL'});
>
>
>
>
> This script simply hangs
> Any clues ?
> Thanks
> Ram

Yes, I think you are right Ram, neither Net::Google nor Tie::Google
seem to look at the evironment for an http proxy. You can use Net::Google
directly and pass it the 'http->proxy => ' as an option to new,
or apply this simple patch to Tie::Google:

--- Tie-Google-0.03/Google.pm   2003-04-01 04:48:34.0 -1000
+++ Tie-Google-0.03-patched/Google.pm   2004-05-24 00:09:14.310060890 -1000
@@ -105,7 +105,8 @@
 $options->{'max_results'} ||= $DEFAULT_BATCH_SIZE;
 
 $self->[GOOGLE] = Net::Google->new(key => $self->[KEY],
-   debug => $options->{'debug'} || 0);
+   debug => $options->{'debug'} || 0,
+   http_proxy => $ENV{http_proxy} || '');
 
 # * If called from TIEHASH, then store the results keyed by
 #   search terms, otherwise keyed by $KEY

I have tested it on Linux and it works fine (both when http_proxy is in
the environment and when not).

Darren - would you consider applying something like the above patch to
specify http proxies in a future release of Tie::Google ?

Aloha => Beau;


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




Thread::Pool

2004-05-24 Thread Anders Holm
Hi Folks.

I've got a question regarding Thread::Pool. Basicaly, I'll be migrating
a rather large user base over one weekend. I've so far got everything
sorted out so that I can parse out all the data into flat text files,
and can then start doing the migration.

So, my next worry then is to ensure every user actuallt gets migrated,
and within as short a timespan as possible, of course.

Now, for this I figured I'd use threading, and a pool of threads. Also
means I'm running Perl 5.8.1 on Linux.. ;)

So, my question then, if I hit the maxjobs limit, the doc's just say
that 

 The maxjobs method can be called to set the maximum number
 of jobs that may be on the belt before job submission will
 be halted.



Would that then mean any further jobs that may want to end up in the
pool may get lost, or will they sit there and wait until they can be
submitted? A slight difference, which the doc's doesn't quite mention,
and which may have a potentially large impact.

So, anybody present which would have had experience with this? Just want
to know if I need to change my approach or not..

Cheers!

//Anders//



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




multiple pages results

2004-05-24 Thread Cristi Ocolisan
Hello everybody,

 

While interrogating a MySQL database, I'm trying to split the results into
multiple pages.

 

I don't know where I'm going wrong. When I run the script below, only the
number of pages is printed on screen.

 

Can anyone help?

 

 

 

#!/usr/bin/perl

 

use CGI ":all";

use DBI;

my $query = new CGI;

print $query->header;

my $user = "root";

my $pass = "";

my $source = "DBI:mysql:chestie";

my $dbh=DBI->connect($source, $user, $pass, {RaiseError => 1});

 

my $sql = qq{SELECT parola FROM parole};

my $sth = $dbh->prepare($sql);

$sth->execute;

 

$count = 0;

while (my @row = $sth->fetchrow_array()){

 

push(@nume,$row[0]);

 

$count++;

}

$sth->finish;

 

my @results = @nume;

#print "@results ";

$result_count = $count;

#print "result_count = $result_count";

 

$pagesize = 2;

$reqpage = 1;

 

if ($result_count != 0) {

$pagecount = int($result_count / $pagesize);

if (($pagecount * $pagesize) != $result_count) {

$pagecount++;

}

}

 

$firstresult = (($reqpage - 1) * $pagesize) + 1;

$lastresult = $firstresult + $pagesize - 1;

if ($lastresult > $result_count) {

$lastresult = $result_count;

}

 

$prev_page = $reqpage - 1;

$next_page = $reqpage + 1;

if ($reqpage == 1) {

$prev_link = "";

} else {

$prev_link = " http://www.wiq.ro/cgi-bin/rointera/gigi1.cgi?reqpage=$prev_page&pages
ize=$pagesize\">" . "PREVIOUS" . "";

}

if ($reqpage == $pagecount) {

$next_link = "";

} else {

$next_link = " http://www.wiq.ro/cgi-bin/rointera/gigi1.cgi?reqpage=$next_page&pages
ize=$pagesize\">" . "NEXT" . "";

}

 

if ($pagecount > 1) {

$pagelinks = $prev_link;

$pageno = 0;

while ($pageno < $pagecount) {

$pageno++;

if ($pageno == $reqpage) {

$thislink = " $pageno ";

} else {

$thislink = " http://www.wiq.ro/cgi-bin/rointera/gigi1.cgi?reqpage=$pageno&pagesize
=$pagesize\">" . $pageno . "";

}

$pagelinks = $pagelinks . $thislink;

}

$pagelinks = $pagelinks . "   " . $next_link;

} else {

$pagelinks = "";

}

#print "pagina este $reqpage";

print "$pagelinks";

 

_

Cristi Ocolisan