Preserve line endings via ftp

2003-08-04 Thread Peter Fleck
Greetings,

I'm using Net::FTP to move a file from a Linux server to a Novell 
server. Before I move the file, I have perl change all the line 
endings from unix-based to DOS-based. The line endings seem to get 
lost during the ftp process and end up as unrecognized characters (at 
least when viewing the text file from my Mac).

Trying to figure out how to change this so I can preserve those endings.

Thanks.
--
Peter Fleck
Webmaster | University of Minnesota Cancer Center
Dinnaken Office Bldg.
925 Delaware St. SE
Minneapolis, MN  55414
612-625-8668 | [EMAIL PROTECTED] | www.cancer.umn.edu
Campus Mail: MMC 806
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Preserve line endings via ftp

2003-08-04 Thread wiggins


On Mon, 4 Aug 2003 10:47:42 -0500, Peter Fleck [EMAIL PROTECTED] wrote:

 Greetings,
 
 I'm using Net::FTP to move a file from a Linux server to a Novell 
 server. Before I move the file, I have perl change all the line 
 endings from unix-based to DOS-based. The line endings seem to get 
 lost during the ftp process and end up as unrecognized characters (at 
 least when viewing the text file from my Mac).
 
 Trying to figure out how to change this so I can preserve those endings.

Try setting the transfer type to binary. There is a 'binary' method...

http://danconia.org

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



Re: Mail::Send question

2003-08-04 Thread Camilo Gonzalez
Todd W. wrote:

Camilo Gonzalez [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

Definitely avoid this if possible, there are numerous mail message
modules, one of them is bound to provide what you need.
 

Why is sendmail held in such low regard by this group?

   

Most on this list will agree sendmail is one of the Internet's first killer
apps. But because interfacing directly with the sendmail binary can be
confusing and bug prone there are modules on the CPAN that use sendmail as
the transport mechanism. These modules abstract sendmail's intricacies from
the user, providing a simple API to send mail. Therefore, modules are the
preferred way to send mail from a perl program.
Todd W.



 

I sometimes wonder if all this shielding of intricacies is necessarly a 
good thing. Shouldn't I know how to use sendmail? I guess I'm a DIY kind 
of guy and I want to know how sendmail works. Fine, if a module makes it 
all easier, I'll certainly use it. But I want to know how the 
abstraction occurs. What happens if the module I'm using in lieu of 
sendmail is buggy and I have no idea why or how to circumvent the 
problem? Do I have control issues?

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


RE: Mail::Send question

2003-08-04 Thread Scot Robnett
Yep, if you want to bring that book home - drink some protein shakes, take
your vitamins, and work out for a month before you buy it.

-
Scot Robnett
inSite Internet Solutions
[EMAIL PROTECTED]


-Original Message-
From: Andrew Brosnan [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 11:20 AM
To: Camilo Gonzalez; [EMAIL PROTECTED]
Subject: Re: Mail::Send question


On 8/4/03 at 11:06 AM, [EMAIL PROTECTED] (Camilo Gonzalez) wrote:

 I sometimes wonder if all this shielding of intricacies is necessarly
 a good thing. Shouldn't I know how to use sendmail? I guess I'm a DIY
 kind of guy and I want to know how sendmail works. Fine, if a module
 makes it all easier, I'll certainly use it. But I want to know how
 the abstraction occurs. What happens if the module I'm using in lieu
 of sendmail is buggy and I have no idea why or how to circumvent the
 problem? Do I have control issues?


Fine, go get the SendMail book, rent a truck to bring it home in, spend
the next six years reading it, the next six after that trying to
understand it, an additional two years familiarizing yourself with any
updates, and then you will be ready to begin writing the code that
someone else has already written ;-)

Seriously, it has an arguably well earned reputation as being a bit,
uhmm...difficult to master, and unless you really *want* to be a
sendmail expert I think you will find one of the Mail:: modules will
work nicely.

Andrew


--
The box said 'Windows XP or better' so I chose Mac OS X.

--
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: Preserve line endings via ftp

2003-08-04 Thread Peter Fleck
Setting the transfer type to binary didn't work.

Reading perldoc Net::FTP did:

   ASCII is the default
   type, and indicates that the sender of files will
   translate the ends of lines to a standard representation
   which the receiver will then translate back into their
   local representation.
So I kept the unix line endings on the file and ftp'd to the Novell 
server and the DOS line endings appeared over there.

For the record, this worked with both 'binary' and 'ascii' translations.



On Mon, 4 Aug 2003 10:47:42 -0500, Peter Fleck [EMAIL PROTECTED] wrote:
 Greetings,

 I'm using Net::FTP to move a file from a Linux server to a Novell
 server. Before I move the file, I have perl change all the line
 endings from unix-based to DOS-based. The line endings seem to get
 lost during the ftp process and end up as unrecognized characters (at
 least when viewing the text file from my Mac).
 Trying to figure out how to change this so I can preserve those endings.
Try setting the transfer type to binary. There is a 'binary' method...

http://danconia.org

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


--
Peter Fleck
Webmaster | University of Minnesota Cancer Center
Dinnaken Office Bldg.
925 Delaware St. SE
Minneapolis, MN  55414
612-625-8668 | [EMAIL PROTECTED] | www.cancer.umn.edu
Campus Mail: MMC 806
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Mail::Send question

2003-08-04 Thread Kristofer Hoch
 Fine, go get the SendMail book, rent a truck to bring it home in,
A very large truck, OR the Abridged version.

The box said 'Windows XP or better' so I chose Mac OS X.
Must have been a trick requirement. Nearly everything is better.


=
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GIT d s+:++ a C++ UL++ US+ P+++ L++ 
W+++ w PS PE t++ b+ G e r+++ z
--END GEEK CODE BLOCK--

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

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



cookies with CGI and IE7

2003-08-04 Thread Andrew Brosnan

Anyone having trouble setting or retrieving cookies with CGI.pm and IE7?

I'm doing:
my $cookie = $q-cookie( -name= 'session',
 -value   = $session,
 -expires = '3h',
print $q-header( -cookie = $cookie);

I got some feedback that the cookie wasn't working in IE7.

I hate cookies.


Andrew

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



Re: cookies with CGI and IE7

2003-08-04 Thread Wiggins d'Anconia
Andrew Brosnan wrote:
Anyone having trouble setting or retrieving cookies with CGI.pm and IE7?

I'm doing:
my $cookie = $q-cookie( -name= 'session',
 -value   = $session,
 -expires = '3h',
print $q-header( -cookie = $cookie);
I got some feedback that the cookie wasn't working in IE7.

I hate cookies.

Have you tried printing the cookies after printing a standard header to 
make sure they are formatted correctly, are actually being set, and 
don't forget to check that the domain they are setting is the same as 
the domain sending them (caught me this weekend, grrr).

Don't hate cookies, hate IE instead ;-)

http://danconia.org

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


Perl line breaks

2003-08-04 Thread Mike Harrison
Hello all,
 
Well, I have spent the last few nights messing around trying to work out why
one of my PERL programs doesn't work.  If anybody can shed some light on
this, I might be able to get some sleep :)
 
I am using a hosting service to host my web site, and they use a Microsoft
NT-based server system (sorry, I don't know the nitty-gritty details).  They
allow user cgi programs (PERL, PHP etc.), and until now most of my PERL
programs have worked as expected.  I am using NTEmacs as a text editor for
my HTML  PERL programming.
 
With one program, I am getting an error message as follows:
 
CGI Error
The specified CGI application misbehaved by not returning a complete set
of HTTP headers. The headers it did return are:

 
(nothing else is printed to the screen after 'The headers it did return
are:')
 
My question is:  Are line breaks important with PERL programs, and if so,
any tips?  If line breaks are not likely to be the problem in this case,
does anybody know why I am getting this error?
 
Note that I have a similar PERL program in the same directory that works
fine.  So I think it is my program and not the web server...  It might be I
have overlooked an important detail that I can't see on the screen - such as
line breaks or other non-printable characters???
 
Thanks in advance for any help,
Mike.
 


Re: cookies with CGI and IE7

2003-08-04 Thread Todd W.

Andrew Brosnan [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 Anyone having trouble setting or retrieving cookies with CGI.pm and IE7?

 I'm doing:
 my $cookie = $q-cookie( -name= 'session',
  -value   = $session,
  -expires = '3h',
 print $q-header( -cookie = $cookie);

 I got some feedback that the cookie wasn't working in IE7.

I've never heard of IE7. I just checked the internet explorer home page and
it has a big 'ol 6 right in the top middle of the page.
http://www.microsoft.com/windows/ie/default.asp

Todd W.



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



Re: Perl line breaks

2003-08-04 Thread Andrew Brosnan
On 8/5/03 at 9:32 AM, [EMAIL PROTECTED] (Mike Harrison)
wrote:

 Hello all,
 
 Well, I have spent the last few nights messing around trying to work
 out why one of my PERL programs doesn't work. 

s/Perl/PERL/ 

 With one program, I am getting an error message as follows:
 
 CGI Error The specified CGI application misbehaved by not returning a
 complete set of HTTP headers. The headers it did return are:

How are you creating your headers? Perhaps you could show that here.

 
 My question is:  Are line breaks important with PERL programs

With headers they are:
print Content-Type: text/html\n\n #-- blank line required

 does anybody know why I am getting this error?

Maybe Perl does. Did you ask?:
use warnings;


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



Re: Mail::Send question

2003-08-04 Thread Wiggins d'Anconia


Camilo Gonzalez wrote:
Todd W. wrote:

Camilo Gonzalez [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

Definitely avoid this if possible, there are numerous mail message
modules, one of them is bound to provide what you need.

Why is sendmail held in such low regard by this group?

  


Most on this list will agree sendmail is one of the Internet's first 
killer
apps. But because interfacing directly with the sendmail binary can be
confusing and bug prone there are modules on the CPAN that use 
sendmail as
the transport mechanism. These modules abstract sendmail's intricacies 
from
the user, providing a simple API to send mail. Therefore, modules are the
preferred way to send mail from a perl program.

Todd W.



 

I sometimes wonder if all this shielding of intricacies is necessarly a 
good thing. Shouldn't I know how to use sendmail? I guess I'm a DIY kind 
of guy and I want to know how sendmail works. Fine, if a module makes it 
all easier, I'll certainly use it. But I want to know how the 
abstraction occurs. What happens if the module I'm using in lieu of 
sendmail is buggy and I have no idea why or how to circumvent the 
problem? Do I have control issues?


At the very least these are the right questions to be asking. It really 
depends on your situation if you are developing an application that is 
intimately tied to sending email then it is a good thing that you know 
how to call sendmail, and its intricacies. More important than that is 
probably how to build an RFC compliant mail message. If this is your 
situation then maybe a module is not right, however if your situation is 
doing computationally intensive queries on a bio/genetic database, then 
who cares how the message goes out that contains the output as long as 
it gets where it is going, in this case the algorithms for generating 
the content are far more important and time is better spent on them.

That is the other beautiful thing about Perl modules (at least the ones 
on CPAN) they are open source so you can see how they work if you have 
the time.

When we recently re-architected our app the first step I took was 
looking into mail sending modules, logging modules, and cryptography 
modules. I installed all of the variants I could find, became at least 
proficient with each so that I could accomplish the smallest task that 
mimiced my end goal and constructed a list of pros and cons for each. In 
the case of cryptography (gnupg/pgp) the modules that were available 
ranged from mediocre to very good, but none fit the specific 
requirements of *my* project, so I built my own, but for mail I found 
that there were at least two that provided all of the functionality (and 
much much more) I needed and so I used one of them.

In general I have found that there is a middle area where a module is 
least likely to fulfill my need, and by this I mean in complexity. The 
more or less complex a task then usually a module can be found that 
accomplishes the goal, it is the middle ground where a module may not be 
robust enough to accomplish the task or may have different requirements 
than mine that usually one can't be found that is just right. For the 
very complex (like mail) assuming a module exists at all, usually it is 
better than what I could accomplish in the span of time alotted so I 
will choose to use it.  Most often for simple tasks a module doesn't 
have to do much and may even be among the standard module base, for 
instance copying a file across filesystem boundaries. A relatively easy 
task that could be coded over and over, but with the File::Copy module 
so accessible why bother

Just some thoughts...

http://danconia.org

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


RE: Perl line breaks

2003-08-04 Thread Mike Harrison
Hi Andrew,

1. Yes, I am using the same headers as the perl program that works, so don't
think it is that - I will check that there is a blank line between the
'Content-Type:...' line and the next.

2. My first line in the perl program is: #!perl -w (being a Windows-based
server, it doesn't require the full path.  The -w to warn of errors/mistakes
etc.)

I will need to wait till tonight before sending some of the perl program and
header info...

Cheers,
Mike.


-Original Message-
From: Andrew Brosnan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 05 August, 2003 10:03 AM
To: Mike Harrison
Cc: [EMAIL PROTECTED]
Subject: Re: Perl line breaks


On 8/5/03 at 9:32 AM, [EMAIL PROTECTED] (Mike Harrison)
wrote:

 Hello all,
 
 Well, I have spent the last few nights messing around trying to work
 out why one of my PERL programs doesn't work. 

s/Perl/PERL/ 

 With one program, I am getting an error message as follows:
 
 CGI Error The specified CGI application misbehaved by not returning a
 complete set of HTTP headers. The headers it did return are:

How are you creating your headers? Perhaps you could show that here.

 
 My question is:  Are line breaks important with PERL programs

With headers they are:
print Content-Type: text/html\n\n #-- blank line required

 does anybody know why I am getting this error?

Maybe Perl does. Did you ask?:
use warnings;


MIME::Parser how to encapsulate a message in another multipart

2003-08-04 Thread Ramprasad
I am using MIME::Parser to add an attachment to every mail that hits an 
smtp server.

This script replaces whatever mime-type of the mail with multipart/mixed 
and adds new attachment

Works fine with text/plain or multipart/mixed incoming messages but the 
problem is when a multipart/alternative mail is received then the text 
as well as the html part of the message is displayed because I have 
removed the multipart/alternative line

Can anyone tell me How can I encapsulate this MIME::Entity so that only 
the multipart/alternative line is maintained

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


Re: connecting oracle

2003-08-04 Thread Ramprasad
Visu wrote:
Hi,
  Kindly guide me to connect oracle through 
perl.Any pointers and directions are welcome

Thanks,
SV 
Use a module like DBI

http://search.cpan.org/author/TIMB/DBI-1.37/DBI.pm

use DBI;

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


Re: Difficulties installing the Tk module

2003-08-04 Thread Ramprasad
John Burski wrote:
Greetings, All!

I was going to attempt to learn a bit of Perl/Tk, but I've run into a 
bit of trouble installing the Tk module.

Here's some information about my system:  Red Hat 8.0, Perl version 5.8.0.
I downloaded Tk-800.024.tar.gz from CPAN. I gunzipped and extracted 
everything OK.
The perl Makefile.PL command went off without a hitch.
However, I'm not certain that the make command is completing properly. 
Here's a snippet from the typescript file:
snip

Manifying blib/man1/ptked.1
make[1]: Entering directory `/usr/local/src/Tk/Tk800.024/pod'
Sorry no HTML building yet
make[1]: Leaving directory `/usr/local/src/Tk/Tk800.024/pod'
]0;[EMAIL PROTECTED]:/usr/local/src/Tk/[EMAIL PROTECTED] Tk800.024]# [EMAIL PROTECTED] Tk800.024]# [EMAIL PROTECTED] Tk800.024]# 
[EMAIL PROTECTED] Tk800.024]# [EMAIL PROTECTED] Tk800.024]# [EMAIL PROTECTED] 
Tk800.024]# [EMAIL PROTECTED] Tk800.024]# [EMAIL PROTECTED] Tk800.024]# [EMAIL PROTECTED] 
Tk800.024]# [EMAIL PROTECTED] Tk800.024]# exit


/snip

I searched through the typescript file, but I didn't find anything else 
that looked suspicious.

Thanks for your help.

If you havent done any fancy thing on your redhat (  like upgrading perl 
 or libc )
get perl-Tk rpms ( from rpmfind.net for eg.) and install them Save 
yourself the bother of compiling

Ram

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


RE: connecting oracle

2003-08-04 Thread NYIMI Jose (BMB)
use DBI module.
Here some usefull links:
http://dbi.perl.org/index.html
http://www.saturn5.com/~jwb/dbi-examples.html#connect

José.

-Original Message-
From: Visu [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 04, 2003 7:12 AM
To: [EMAIL PROTECTED]
Subject: connecting oracle


Hi,
  Kindly guide me to connect oracle through 
perl.Any pointers and directions are welcome

Thanks,
SV 

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



Re: Emacs and Perl syntax compile

2003-08-04 Thread Ramprasad
Douglas Harter wrote:
I am creating a good many perl scripts on a Unix using emacs. 

Can someone tell me what I need in my .emacs to do perl syntax compiles from
emacs?
.
This is available as a menu drop down in the X version

For the console version I couldnt figure that out , but I did a work around

M-x compile enter ... Takes you to a compile prompt
remove everything
now type in perl -c yourscript.pl enter
Thats it

Next time you just have to use the upper arrow key ( Dont have to type 
again )

M-x upper ... compile
upper
etc
Ram

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


RE: Line Numbering

2003-08-04 Thread johnstonp
Thank you everyone for your suggestions.

This is getting more and more interesting.  The script I am looking at 
actually worked once!! 

I tried to use dianostics to no avail.  I got the following message:

syntax error at sys:\perl\lib/diagnostics.pm line 171, near use 5.005_64

I then did a perl -v and got:

version 5.003_07 Netware build #338

Am I right in thinking I have a problem with versioning here??

After a bit of checking on www.novell.com I found a doc that suggested I 
use - perl -d script.pl
to debug.  That seemed to work well.  I now have some error messages I can 
work with.  I will have a punch at it over the next couple of days, and 
yell if I cant get anywhere




[EMAIL PROTECTED] wrote on 01/08/2003 18:29:05:

 write 
 
 use diagnostics;
 
 gives you more information about errors
 
 Marcos
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 01, 2003 8:15 AM
 To: [EMAIL PROTECTED]
 Subject: Line Numbering
 
 
 Hi all,
 
 I've been thrown in the deep end to try and work out what the problem 
with 
 a perl script running on Novell Bordermanager.  I'm probably going to 
have 
 a few stupid questions over the next few days.  Please forgive me before 

 hand, and dont laugh too much!   I am trying to bolster my knowledge via 

 the on-line library at learn.perl.org, perldoc, and a couple of online 
 tutorials I found.
 
 Whilst troubleshooting the script (using -w and -c) I get references to 
 line xxx..
 
 My stupid question number one is:  When Perl processes the script, how 
 does it identify the lines of code?  ie.. If an error occurs at line 
125, 
 is that the 125'th line of actual code, or does it count every single 
line 
 in the script from the beginning including remm'ed statements, blank 
lines 
 etc...??
 
 My reason for asking, is that with -w  I get use of uninitiaized value 
 at... errors which do not make much sense at the line numbers 
 mentioned...
 
 
 
 Peter A Johnston CLP
 Network Services Administrator
 
 Peters  Brownes Group
 22 Geddes Street, Balcatta, 6021,  WA,  Australia
 
 [EMAIL PROTECTED]
 
 There's no point in being grown up if you can't be childish sometimes.
 -- Dr. Who 


arrays

2003-08-04 Thread jonathan . musto
Hi there,
 
I've got an array of lines, split up by spaces as follows:
 
Sun-router rack1.2 leeds
Cisco-router rack3.2 skem
Sun-switch rack2.3 manchester
etc.
 
How can i add the following to the end of each line, P *NULL*?... e.g.
 
Sun-router rack1.2 leeds P *NULL*
Cisco-router rack3.2 skem P *NULL*
Sun-switch rack2.3 manchester P *NULL*
 
Any help would be much appreciated, thanks in advance!
 
Regards,
 
 
Jonathan Musto

 

BT Global Services
Telephone - 0113 237 3277
Fax - 0113 244 1413
E-mail -  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
http://www.technet.bt.com/sit/public http://www.technet.bt.com/sit/public 


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




 


RE: arrays

2003-08-04 Thread Marcos . Rebelo
@array = map {$_ P *NULL*} (@array);

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 12:18 PM
To: [EMAIL PROTECTED]
Subject: arrays


Hi there,
 
I've got an array of lines, split up by spaces as follows:
 
Sun-router rack1.2 leeds
Cisco-router rack3.2 skem
Sun-switch rack2.3 manchester
etc.
 
How can i add the following to the end of each line, P *NULL*?... e.g.
 
Sun-router rack1.2 leeds P *NULL*
Cisco-router rack3.2 skem P *NULL*
Sun-switch rack2.3 manchester P *NULL*
 
Any help would be much appreciated, thanks in advance!
 
Regards,
 
 
Jonathan Musto

 

BT Global Services
Telephone - 0113 237 3277
Fax - 0113 244 1413
E-mail -  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
http://www.technet.bt.com/sit/public http://www.technet.bt.com/sit/public 


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




 

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



Re: arrays

2003-08-04 Thread awarsd
Hi,

if we have @routers.
you can do this
my ($c, $line);
$c=0;
foreach $line(@routers){
   $line = $line. P *NULL*;
push @newrouters, $line;
}

or
to use the $c
foreach $line (@routers){
  @routers[$c] = $line. P *NULL*;
$c++;
}

Jonathan Musto [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi there,

 I've got an array of lines, split up by spaces as follows:

 Sun-router rack1.2 leeds
 Cisco-router rack3.2 skem
 Sun-switch rack2.3 manchester
 etc.

 How can i add the following to the end of each line, P *NULL*?... e.g.

 Sun-router rack1.2 leeds P *NULL*
 Cisco-router rack3.2 skem P *NULL*
 Sun-switch rack2.3 manchester P *NULL*

 Any help would be much appreciated, thanks in advance!

 Regards,


 Jonathan Musto



 BT Global Services
 Telephone - 0113 237 3277
 Fax - 0113 244 1413
 E-mail -  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 http://www.technet.bt.com/sit/public
http://www.technet.bt.com/sit/public


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









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



Re: arrays

2003-08-04 Thread awarsd
Hi,

sorry my last post
but actually this is quite good and better
@array = map {$_ P *NULL*} (@array);

Award



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



RE: Mail::Sender question

2003-08-04 Thread Dan Muey

 From: Dan Muey [EMAIL PROTECTED]
  If I do this:
  
  use Mail::Sender;
  
  my $sender = new Mail::Sender {smtp = $ip, from = $frm}; 
  $sender-Open({  to = $to,
   subject = $sb,
   priority = 5,
   cc = $cc,
   bcc = $bcc,
   confirm = $cfm,
  });
  $sender-SendLineEnc($msg);
  $sender-Close();
  
  If $cc, $bcc, or $cfm are empty will it still work (just 
 ignore them 
  or ???) or error out?
 
 It should ignore them. 
 It will definitely ignore them if they are undefined, I'm not 100% 
 sure what will it do if you set those to empty strings.
 
 Anyway ... try and see. And let me know if anything breaks :-)
 
 Jenda
Thanks Jenda,

Works great! If any of them are empty(not undefined) the mails zips through without a 
wimper.
Your module rocks!

Thanks

Dan 

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



RE: connecting oracle

2003-08-04 Thread Dan Muey

 Hi,

Howdy

   Kindly guide me to connect oracle through 
 perl.Any pointers and directions are welcome
 

I'm a mysql fellow myself but I'd start with DBI.pm.
It lets you connect to db and do queries.

perldoc DBI

HTH

DMuey

 Thanks,
 SV 

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



RE: Mail::Sender question

2003-08-04 Thread Dan Muey

  What I'd like to do is add headers if they are specifed, 
 after Open() 
  and SendLineEnc().
 
 No. When Open() or OpenMultipart() returns all headers have already 
 been sent and the message body is expected. There is no way to add 
 any more headers.
  
 Unlike MIME::Lite Mail::Sender doesn't prepare the whole message 
 before sending it. Mail::Sender connects to the server within the 
 Open()/OpenMultipart(), sends the headers and other stuff and then 
 continues sending anything you instruct it to immediately.
 
  Or if I specify them in Open and they are empty will Mail::Sender 
  simply ignore them?
 
 Yes it should
 
 Jenda

Thanks again!
Dan

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



RE: Mail::Sender question

2003-08-04 Thread Jenda Krynicky
From: Dan Muey [EMAIL PROTECTED]
 If I do this:
 
 use Mail::Sender;
 
 my $sender = new Mail::Sender {smtp = $ip, from = $frm};
 $sender-Open({
  to = $to,
  subject = $sb,
  priority = 5,
  cc = $cc,
  bcc = $bcc,
  confirm = $cfm,
 });
 $sender-SendLineEnc($msg);
 $sender-Close();
 
 If $cc, $bcc, or $cfm are empty will it still work (just ignore them
 or ???) or error out?

It should ignore them. 
It will definitely ignore them if they are undefined, I'm not 100% 
sure what will it do if you set those to empty strings.

Anyway ... try and see. And let me know if anything breaks :-)

Jenda
=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me


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



Re: a hash reference is not a hash- lesson learned the hard way...

2003-08-04 Thread Jenda Krynicky
From: West, William M [EMAIL PROTECTED]
 i tried for the longest time to get something like
 the following to work::
 
 foreach $section (keys %board){
 
 for my $a (1..19){
 for (1..19){
 $board-{Q1S1}-[$a]-[$_] and print \n$a$_;
 ...
   }
  }
 }
 
 
 well, it is supposed to repeat the inner loops several times over
 right? for each hashkey, do the following etc etc..
 
 if i got rid of the foreach $section (keys %board){
 the rest would work fine.  I was about to yell at you guys about it
 when, out of desperation, i tried one last thing :
 
 my $board = \%board; #first line in the whole thing
 
 and it WORKS
 
 
 It turns out that a reference to a hash that's created on the 'spur of
 the moment' and not explicitly made to refer to a %HASH doesn't work
 the same way as a real hash :P

If only you had
use strict;
on top of your script ...

To access the key 'foo' in hash %board you are supposed to use 
$board{foo}, $board-{foo} accesses the 'foo' key in the hash 
referenced by scalar $board.

Jenda
=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me


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



Re: Mail::Sender question

2003-08-04 Thread Jenda Krynicky
From: Dan Muey [EMAIL PROTECTED]
 For a simple plain text message I do new( with smtp and from) then
 Open (with to and subject) Since that is the minimal setup for me.
 
 What I'd like to do is add headers if they are specifed, after Open()
 and SendLineEnc().

No. When Open() or OpenMultipart() returns all headers have already 
been sent and the message body is expected. There is no way to add 
any more headers.
 
Unlike MIME::Lite Mail::Sender doesn't prepare the whole message 
before sending it. Mail::Sender connects to the server within the 
Open()/OpenMultipart(), sends the headers and other stuff and then 
continues sending anything you instruct it to immediately.

 Or if I specify them in Open and they are empty will Mail::Sender
 simply ignore them?

Yes it should

Jenda
=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me


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



RE: arrays

2003-08-04 Thread Charles K. Clarkson
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

: @array = map {$_ P *NULL*} (@array);

That solution makes a nice subroutine:

my @array = (
'Sun-router rack1.2 leeds',
'Cisco-router rack3.2 skem',
'Sun-switch rack2.3 manchester', );

concat_array( ' P *NULL*', [EMAIL PROTECTED] );

print Dumper [EMAIL PROTECTED];

sub concat_array {
my( $string, $array_ref ) = @_;
@$array_ref = map $_$string, @$array_ref;
}


HTH,

Charles K. Clarkson
-- 
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328


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



Re: connecting oracle

2003-08-04 Thread Rob Dixon

Visu wrote:
 Hi,
   Kindly guide me to connect oracle through
 perl.Any pointers and directions are welcome

You'll need to install the DBD::Oracle database driver
as well as the generic DBI interface module. After
that all databases (in theory) behave similarly.

HTH,

Rob



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



RE: Quick DBI connection

2003-08-04 Thread Dan Muey
  So what I need to know I guess is:
  1) in MYSuperModule.pm do I
  a) use DBI;
  b) sub DBI::db::myfunc {} or sub ???::Myfunc {}
  2) What is the best way to do that without causing namespace 
  problems?
  
  So answer a question with a question!
 
 Dan, you might want to have a look here for details right 
 from the horse's
 mouth: 
 http://search.cpan.org/author/TIMB/DBI-1.37/DBI.pm#Subclassing_the_DBI

Howdy all, 

Instead of screwing up name spaces and sub classing I think 
I'll just pass the $dbh as an argument to the routine like so:

Instead of : $dbh-myfunc();
I'll do : myfunc($dbh);


sub myfunc { # instead of sub DBI::db::myfunc {}
my $dbh = shift;
$dbh-...
}

That works very swell but I am wondering if there's anything about 
doing it that way that I'm missing, any drawbacks, insecurities, etc...

TIA

Dan

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



print HTML code; in NETSCAPE

2003-08-04 Thread mario kulka
I'm using the following to print HTML to the browser:

print HTML code;

my html here

HTML code

It works fine in IE but when I execute the script under Netscape it displays 
the source instead of loading the page based on the source. Please help.
Mariusz

_
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: print HTML code; in NETSCAPE

2003-08-04 Thread Li Ngok Lam
You are possibly missing this line :

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

HTH
- Original Message - 
From: mario kulka [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 2:32 AM
Subject: print HTML code; in NETSCAPE


 I'm using the following to print HTML to the browser:

 print HTML code;

 my html here

 HTML code

 It works fine in IE but when I execute the script under Netscape it
displays
 the source instead of loading the page based on the source. Please help.
 Mariusz

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





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



'use' and 'require'

2003-08-04 Thread Allison, Jason (JALLISON)
Hello all,

Is there a way to 'variablize' the version for a 'use' statement.  This way,
if I wanted to change version I could only change it in one place with those
changes cascading across all apps.

Usage would look something like this:

use $perl_version;

Thanks in advance,

Jason Allison
Principal Engineer
ARINC Incorporated
Office:  (410) 266-2006
FAX:  (410) 573-3026



RE: 'use' and 'require'

2003-08-04 Thread Bob Showalter
Allison, Jason (JALLISON) wrote:
 Hello all,
 
 Is there a way to 'variablize' the version for a 'use' statement. 
 This way, if I wanted to change version I could only change it in one
 place with those changes cascading across all apps.

Where would that one place be? Wherever that is, put the use VERSION
statement there.

 
 Usage would look something like this:
 
 use $perl_version;

Well, you can do:

   BEGIN {
  use MyCommonModule;   # exports $perl_version;
  eval require $perlversion or die $@ 
   }

But why bother? Just put the following in MyCommonModule.pm:

   use 5.6.1;

Or am I missing something?

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



RE: 'use' and 'require'

2003-08-04 Thread Allison, Jason (JALLISON)
The 'use' is giving me warning's against 5.6.1 code with 5.8.0:

v-string in use/require non-portable at /PATH line #.

I will need to update all of the 'use' statements from use 5.6.1; to use
5.006_001;

My question is: How are others implementing common 'use' clauses across the
applications so that changes in the perl version may be easily cascadable
across all apps? By means of Environment variables, other, etc?

Jason Allison
Principal Engineer
ARINC Incorporated
Office:  (410) 266-2006
FAX:  (410) 573-3026


-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 04, 2003 3:09 PM
To: 'Allison, Jason (JALLISON)'; '[EMAIL PROTECTED]'
Subject: RE: 'use' and 'require'


Allison, Jason (JALLISON) wrote:
 Hello all,
 
 Is there a way to 'variablize' the version for a 'use' statement.
 This way, if I wanted to change version I could only change it in one
 place with those changes cascading across all apps.

Where would that one place be? Wherever that is, put the use VERSION
statement there.

 
 Usage would look something like this:
 
 use $perl_version;

Well, you can do:

   BEGIN {
  use MyCommonModule;   # exports $perl_version;
  eval require $perlversion or die $@ 
   }

But why bother? Just put the following in MyCommonModule.pm:

   use 5.6.1;

Or am I missing something?

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



Re: I just work this out.. but seems no point to use it

2003-08-04 Thread Steve Grazzini
On Sun, Aug 03, 2003 at 03:04:00PM -0400, Todd W. wrote:
 Li Ngok Lam [EMAIL PROTECTED] wrote:
  $x = sub { $y = shift; print $y };

[ snip ]
 
  2. Any name for this kind of coding style ?
 
 I dont know of a name, but I guess I wouldnt call it a coding style.
 Storing code in variables is a language feature. When you dont need 
 the feature, you dont use it. Read perldoc perlref.

I would have said Functional Programming.

There's an FAQ about closures

% perldoc -q closure

With quite a bit of good information.  It's also worth mentioning
the fact that our grep() and map() come from FP -- and if you've
ever struggled with these, working one's way through a Scheme or
Haskell tutorial could be really helpful.

Or it might confuse you further; YMMV.

-- 
Steve

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



Re: print HTML code; in NETSCAPE

2003-08-04 Thread Ovid
--- mario kulka [EMAIL PROTECTED] wrote:
 I'm using the following to print HTML to the browser:
 
 print HTML code;
 
 my html here
 
 HTML code
 
 It works fine in IE but when I execute the script under Netscape it displays 
 the source instead of loading the page based on the source. Please help.
 Mariusz

Hi Mariusz,

You need to ensure that you are printing a proper header:

  use CGI ':standard';
  print header();
  print END_HTML;
  ...

The reason it's working in IE is because someone at Microsoft had the brilliant idea 
that when you
someone sends a content type, they might not send the right content type.  Rather than 
require
people to send the correct data, IE just guesses what the content type should be based 
upon the
first few lines of data.  Further, even if you forget the extra newline before your 
entity-body
and lump the content in with the headers, IE still tries to get things righ.  
Unfortunately, this
means that many things work with IE, but appear broken in other Web browsers.  The 
most common
problem is someone sending the wrong content type for an image, but IE getting it 
right and if the
person never tests with other browsers, they don't see that there's a problem.

It also means that if you want to show the source of a Web page, the following will no 
longer work
with IE:

  use CGI qw':standard';
  print header('text/plain');
  print 'END_HTML';
  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
  html xmlns=http://www.w3.org/1999/xhtml;
head
  titleSome Title/title
/head
body
  This is the body
/body
  /html
  END_HTML

Instead, you have to assign the HTML to a variable and then use something like 
HTML::Entities to
properly encode it and then print it out as HTML.  Many people have been bitten by 
Microsoft
deciding to second-guess us.  (It's also opened up some nasty security holes).

Cheers,
Ovid

=
Silence is Evilhttp://users.easystreet.com/ovid/philosophy/indexdecency.htm
Ovid   http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/

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

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



Re: arrays

2003-08-04 Thread John W. Krahn
Jonathan Musto wrote:
 
 Hi there,

Hello,

 I've got an array of lines, split up by spaces as follows:
 
 Sun-router rack1.2 leeds
 Cisco-router rack3.2 skem
 Sun-switch rack2.3 manchester
 etc.
 
 How can i add the following to the end of each line, P *NULL*?... e.g.
 
 Sun-router rack1.2 leeds P *NULL*
 Cisco-router rack3.2 skem P *NULL*
 Sun-switch rack2.3 manchester P *NULL*
 
 Any help would be much appreciated, thanks in advance!

my @array = (
'Sun-router rack1.2 leeds',
'Cisco-router rack3.2 skem',
'Sun-switch rack2.3 manchester',
);

$_ .= ' P *NULL*' for @array;

print $_\n for @array;



John
-- 
use Perl;
program
fulfillment

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



combinations

2003-08-04 Thread David Byrne
I am fairly new to Perl and haven't approached a scipt
this complex or computation this intensive.  So I
would certainly appreciate any advice.
 
I have successfully created a hash of arrays
equivalent to a 122 x 6152 matrix that I want to run
in 'pairwise combinations' and execute the 'sum of the
difference squares' for each combination.
 
In other words:
columns: y1...y122
rows:  x1...x6152
 
so...
comb(y1,y2): 
{( y1[x1] - y2[x1] ) ^2 + ( y1[x2] - y2[x2] ) ^2 + ...
+ ( y1[x122] - y2[x122] ) ^2};
 
comb(y1,y3): 
{( y1[x1] - y3[x1] ) ^2 + ( y1[x2] - y3[x2] ) ^2 + ...
+ ( y1[x122] - y3[x122] ) ^2};.
.
.
comb(y1,y6152)
comb(y2,y3)
.
.
comb(y2,y6152)
comb(y3,y4)
.
.
etc.
 
This is going to be very large.  According to the
combinations formula (nCk, n=6152, k=2), the output
will be a hash (with, for example, 'y1y2' key and
'd^2' value) of about 19 million records.  

I think my next step is to create a combinations
formula, but I'm having problems doing so.
 
Thank you in advance,
David

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

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



RE: Splitting a path

2003-08-04 Thread Gupta, Sharad
I may be missing something, but the doc for ENV says:
 
 Arrays are implemented in terms of split and join, using $Config::Config{path_sep} 
as the delimiter. 

Now if i split this:

Foo = C:\foo\bar:D:\foo\bar

using:

use Env qw(@Foo);
print $_\n foreach (@Foo);

i guess it would print the whole Foo instead of printing 2 elements C:\foo\bar and 
D:\foo\bar, because the $Config::Config(path_sep) is not : on windows.


-Sharad

 

 -Original Message-
 From: Steve Grazzini [mailto:[EMAIL PROTECTED]
 Sent: Saturday, August 02, 2003 4:22 PM
 To: Gupta, Sharad
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: Splitting a path
 
 
 On Sat, Aug 02, 2003 at 03:20:14PM -0700, Gupta, Sharad wrote:
  From: Casey West [mailto:[EMAIL PROTECTED]
  It was Saturday, August 02, 2003 when Gupta, Sharad took 
 the soap box, saying:
  : 
  : Hi,
  : 
  : I have a path which may look like:
  
use Env [EMAIL PROTECTED];
  
print $_\n foreach @PATH;
  
  I love the Perl core.  :-)
 
  I miscommunicated here, by path i did'nt meant the PATH env 
  variable.  By Path i meant any  string having some directories 
  seperated by : , say it could be
  
  FOO=E:\foo:D:\bar.
  
  And yes it can be in the %ENV.
 
 Then Casey's suggestion will work for you with just one tiny
 modification.
 
 use Env [EMAIL PROTECTED];
 
 print $_\n foreach @FOO;
 
  For more information read http://search.cpan.org/perldoc?Env
 
 This is still recommended.  ^_^
 
 And it would be great if you could arrange for your mail/news
 reader to quote the text of the original message rather than
 appending it unmodified at the end of your response.
 
 -- 
 Steve
 

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



Structuring Data in Perl

2003-08-04 Thread Smith Jeff D
This is a request for insight on structuring data from a log file for later
retrieval and stuffing into a mail message.
I'm having trouble trying to set up the proper form of references to store
this data.  Here's the source log file format(line numbers are shown for
clarification):

Line1:  StatusField Server Name Field   TimeStamp   OtherStuff
Line2   SUCCESS server01  Today's date  Other details...
Line3   WARNING server22  Today's date  Other details...:
Line4 SUCCESS   server22  Today's date  Still other
details...
Line5   WARNING server55   Today's date   Other
details
Line6   WARNING server01   Today's date Other
details



And so on

Each line can have the same server, timestamp and details are another line
with the same server name--there are no complete duplicates of any line but
lines could
Have the same server name and timestamp but differ on the status field for
certain detail items.

I want to associate all lines from a particular server together so that I
can mail copies of the lines in the log reports to particular addresses
based on reading another file that contains a servername--mailaddress
association.

I thought that I would read all the lines into an array, sort them by the
server name so that all the records (lines) for  a particular server are
next to each other, loop through the records one by one, splitting each line
into its individual columns, reading the other file of
servername-mailaddresses to grab the mailaddress and after the servername
changes, send the array of lines to a mailer.  I can do the latter part fine
if I only have one line per server.  But since there can be multiple lines
per server, I'm stumped how to set the data structure up.  

What I'm having a problem with is figuring out how to store the lines for a
particular server in a structure that I can use as the basis of the mail
message--I thought I wanted a hash of array references but can't figure out
to do that without having a hard reference to an array for each server
(that'd require hundreds of names and it appears to be a stupid approach to
associate the structure with the values in the data.  I think I want some
form of anonymous array that can be referenced by a hash based on servername
but can't seem to figure out how to get it set up correctly.  It must be a
mental block on the correct form of hash of arrays where the hash key is the
servername and the value is an array of all arrays/records that contain the
servername but...

Thanks in advance. 




Re: Splitting a path

2003-08-04 Thread Steve Grazzini
On Mon, Aug 04, 2003 at 02:00:03PM -0700, Gupta, Sharad wrote:
 I may be missing something, but the doc for ENV says:
  
  Arrays are implemented in terms of split and join,
 using $Config::Config{path_sep} as the delimiter. 
 
 Now if i split this:
 
 Foo = C:\foo\bar:D:\foo\bar
 
 using:
 
 use Env qw(@Foo);
 print $_\n foreach (@Foo);
 
 i guess it would print the whole Foo instead of printing
 2 elements C:\foo\bar and D:\foo\bar, because the
 $Config::Config(path_sep) is not : on windows.

That makes sense -- I didn't catch the Windows path
in your example.

-- 
Steve

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



extracting text

2003-08-04 Thread Bryan Irvine
I'm trying to build a script to automagically black-list spammers.  How
can I extract the ip address from between [ ]?

turn this: 

Received: from 24.60.195.149 (h00a0cce008a4.ne.client2.attbi.com
[24.60.195.149])
 Received: from 11.139.74.233 ([11.139.74.233]) by n7.groups.yahoo.com
with NNFMP; May, 17 2003 1:51:07 AM +0700
 Received: from 30.215.79.204 ([30.215.79.204]) by m10.grp.snv.yahoo.com
with SMTP; May, 17 2003 12:44:43 AM -0800

into this:

24.60.195.149
11.139.74.233
30.215.79.204



--Bryan


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



RE: Structuring Data in Perl

2003-08-04 Thread wiggins


On Mon, 4 Aug 2003 17:09:40 -0400 , Smith Jeff D [EMAIL PROTECTED] wrote:

 This is a request for insight on structuring data from a log file for later
 retrieval and stuffing into a mail message.
 I'm having trouble trying to set up the proper form of references to store
 this data.  Here's the source log file format(line numbers are shown for
 clarification):
 
 Line1:  StatusField   Server Name Field   TimeStamp   OtherStuff
 Line2 SUCCESS server01  Today's date  Other details...
 Line3 WARNING server22  Today's date  Other details...:
 Line4 SUCCESS server22  Today's date  Still other
 details...
 Line5 WARNING server55   Today's date   Other
 details
 Line6 WARNING server01   Today's date Other
 details
 
 
 
 And so on
 
 Each line can have the same server, timestamp and details are another line
 with the same server name--there are no complete duplicates of any line but
 lines could
 Have the same server name and timestamp but differ on the status field for
 certain detail items.
 
 I want to associate all lines from a particular server together so that I
 can mail copies of the lines in the log reports to particular addresses
 based on reading another file that contains a servername--mailaddress
 association.
 
 I thought that I would read all the lines into an array, sort them by the
 server name so that all the records (lines) for  a particular server are
 next to each other, loop through the records one by one, splitting each line
 into its individual columns, reading the other file of
 servername-mailaddresses to grab the mailaddress and after the servername
 changes, send the array of lines to a mailer.  I can do the latter part fine
 if I only have one line per server.  But since there can be multiple lines
 per server, I'm stumped how to set the data structure up.  
 
 What I'm having a problem with is figuring out how to store the lines for a
 particular server in a structure that I can use as the basis of the mail
 message--I thought I wanted a hash of array references but can't figure out
 to do that without having a hard reference to an array for each server
 (that'd require hundreds of names and it appears to be a stupid approach to
 associate the structure with the values in the data.  I think I want some
 form of anonymous array that can be referenced by a hash based on servername
 but can't seem to figure out how to get it set up correctly.  It must be a
 mental block on the correct form of hash of arrays where the hash key is the
 servername and the value is an array of all arrays/records that contain the
 servername but...
 


Sounds like you have a decent approach, I like your second idea better than storing 
everything to an array and then sorting by server name. Your hash idea will take care 
of that for you and you probably want to avoid the double memory usage of storing all 
data to an array first, and avoid the CPU intensive operation of sorting (not to 
mention you lose your date/time sequence)so having a look at your second option, 
something along the lines of:

my $servers = {};
while (my $line = READLOG) {
   my @line = split(/ /, $line);
   push @{$servers-{$line[1]}}, $line[2];
}

At this point you have a hash reference where the keys are the server names and the 
value is an array (reference) of lines from the log file.  The key is to recognize I 
start out with $servers being a hash reference. Then for each line of the file I 
append (push) to an array reference stored as the value of the hash key.

Then to access the contents of the servers:

while (my ($server, $array) = each(%$servers)) {
   # send message where $server is the server name
   # and $array is an array reference of log lines
   my $to = $config{$server};
   my @body = @$array;
}

This is just pseudo-code that you will need to flesh out with what you actually want 
and message code, etc. But it should give you idea of how to setup the structure. The 
following might help as well if you haven't already read them:

perldoc perlreftut
perldoc perlref
perldoc perllol
perldoc perldsc

And you may want to check out the Data::Dumper module to help you debug. It allows you 
to print a data structure in readable format to see if you really have what you want 
(though I suggest starting with a small sample of data in your case).

perldoc Data::Dumper

Then come back when you get frustrated or hit a snag.

http://danconia.org

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



RE: extracting text

2003-08-04 Thread wiggins


On 04 Aug 2003 14:08:29 -0700, Bryan Irvine [EMAIL PROTECTED] wrote:

 I'm trying to build a script to automagically black-list spammers.  How
 can I extract the ip address from between [ ]?
 
 turn this: 
 
 Received: from 24.60.195.149 (h00a0cce008a4.ne.client2.attbi.com
 [24.60.195.149])
  Received: from 11.139.74.233 ([11.139.74.233]) by n7.groups.yahoo.com
 with NNFMP; May, 17 2003 1:51:07 AM +0700
  Received: from 30.215.79.204 ([30.215.79.204]) by m10.grp.snv.yahoo.com
 with SMTP; May, 17 2003 12:44:43 AM -0800
 
 into this:
 
 24.60.195.149
 11.139.74.233
 30.215.79.204
 

Assuming there is only one set of brackets on a line, and you only want the IP address 
between them, and READLOG is an open handle to your log:

- Not Tested -
my @ips;
while (my $line = READLOG) {
   if ($line =~ /\[(.*)\]/) {
  push @ips, $1;
   }
   else {
  print STDERR no ip in line\n;
   }
}
print @ips\n;

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



Re: SQL/Win32::ODBC/MSAccess from Perl 5.6?

2003-08-04 Thread Jenda Krynicky
From: Richard Heintze [EMAIL PROTECTED]
 Is this an appropriate place to post questions on
 Win32::ODBC/MSAccess 2000/Perl 5.6 cgi/Apache HTTPD? 

Yes. For CGI related questions [EMAIL PROTECTED] would be 
better, but since this one is not related to CGI at all ...

 If not, can someone directe me to an appropriate FAQ
 or mailinglist or newsgroup?
 
 I've been struggling with specifying zero length
 strings in SQL. Nothing seems to work.
 
 I've tried 
 $Data-Sql(qq[UPDATE Suspect SET Name =  WHERE
 CaseNumber = $sCaseNumber AND  Number = 33]);
 
 and 
 
 $Data-Sql(qq[UPDATE Suspect SET Name = '' WHERE
 CaseNumber = $sCaseNumber AND  Number = 33]);
 
 These statements both give me syntax errors from the
 ODBC driver.

Are you sure the $sCaseNumber contains a number?
Try to print the SQL and see:

print qq[UPDATE Suspect SET Name = '' WHERE CaseNumber = $sCaseNumber 
AND  Number = 33];

Does this look correct?

 I've also tried using the prepare and bind_param
 functions apparently these are not implemented -- they
 are not in the documentation.

IMHO you'd better use DBI+DBD::ODBC.

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]



%EXPORT_TAGS question

2003-08-04 Thread Dan Muey
perldoc Exporter says:

%EXPORT_TAGS = (T1 = [qw(A1 A2 B1 B2)], T2 = [qw(A1 A2 B3 B4)]);

So I am wondering if I can do something like this wilst filling in tags:

%EXPORT_TAGS = (
T1 = [EMAIL PROTECTED],qw(A1 A2 B1 B2)], 
T2 = [qw(A1 A2 B3 B4)]),
T3 = ['joemama','bendover',@stuff,qw(fred wilma)],
T4 = [EMAIL PROTECTED]
);

And still be giving proper arrays as the value for the keys?

Also , say I wanted:

use Monkey;
to export $EXPORT_TAGS{'T2'} by default along with whatever is in @EXPORT, 
IE use Monkey would be the same as doing use Monkey qw(:T2);

Would I do it this way?
%EXPORT_TAGS = (
T2 = [qw(A1 A2 B3 B4)]),
DEFAULT = $EXPORT_TAGS{'T2'},
};

TIA 

Dan

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



Apache-Session Error

2003-08-04 Thread mmbodji
Hello: 

I am just testing with the following code that I copied from the web (module):

use Apache::Session::Store::MySQL;
 
 my $store = new Apache::Session::Store::MySQL;
 
 $store-insert($ref);
 $store-update($ref);
 $store-materialize($ref);
 $store-remove($ref);  

tie %hash, Apache::Session::MySQL, $id, {
DataSource = dbi:mysql:webdb,
UserName   = username,
Password   = password
};  

tie %hash, Apache::Session::MySQL, $id, {
Handle = $dbh
};  

and I got the following error message from the command line:

Can't connect (HASH (0x182559c)), no database driver specified and DBI_DSN 
env not set at c:/perl/site/lib/Apache/session/Store/Mysql.pm line 44

Here is what I have at line 44:

$self-{dbh} = DBI-connect(
$datasource,
$username,
$password,
{ RaiseError = 1, AutoCommit = 1 }
) || die $DBI::errstr;

How can I get pass this error message?

Thanks

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



RE: extracting text

2003-08-04 Thread Bryan Irvine

 
 Assuming there is only one set of brackets on a line, and you only want the IP 
 address between them, and READLOG is an open handle to your log:
 
 - Not Tested -
 my @ips;
 while (my $line = READLOG) {
if ($line =~ /\[(.*)\]/) {
   push @ips, $1;
}
else {
   print STDERR no ip in line\n;
}
 }
 print @ips\n;
 

I don't mean to sound stupid, but u *scratch-scratch* what's a
READLOG open handle? ;-)

I have about 7500+ messages in a spam folder on the mail server (in
Maildir) and I'm trying top parse them out.

Here's my stupid script so far:

#!/usr/bin/perl

@fileList = `ls -1`;
$filecount = 5;

#$makeIPList = `cat @fileList[$filecount]`;
@fileList[$filecount] =~ s/\]/\[/g;
@getIP = `grep Received\: @fileList[$filecount]`;
[EMAIL PROTECTED] =~ s/\]/\[/g;

@split = split (/\[/, $getIP);

print getIP  @getIP\n;
print filelist-  @fileList[filecount]\n;


and here's the output:

getIP  Received: from 24.60.195.149
(h00a0cce008a4.ne.client2.attbi.com [24.60.195.149])
 Received: from 11.139.74.233 ([11.139.74.233]) by n7.groups.yahoo.com
with NNFMP; May, 17 2003 1:51:07 AM +0700
 Received: from 30.215.79.204 ([30.215.79.204]) by m10.grp.snv.yahoo.com
with SMTP; May, 17 2003 12:44:43 AM -0800

filelist-  1053130715.9788_5.mail2.horvitznewspapers.net,S=15311:

I just set the counter at 5 as a test I will turn that into an
incrementing dealy when I can get it to work.  I'm trying to figure out
how to make a text file with all the IP's that the spam is coming from.



--Bryan


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



Re: %EXPORT_TAGS question

2003-08-04 Thread Jenda Krynicky
From: Dan Muey [EMAIL PROTECTED]
 perldoc Exporter says:
 
 %EXPORT_TAGS = (T1 = [qw(A1 A2 B1 B2)], T2 = [qw(A1 A2 B3 B4)]);
 
 So I am wondering if I can do something like this wilst filling in
 tags:
 
 %EXPORT_TAGS = (
  T1 = [EMAIL PROTECTED],qw(A1 A2 B1 B2)], 
  T2 = [qw(A1 A2 B3 B4)]),
  T3 = ['joemama','bendover',@stuff,qw(fred wilma)],
  T4 = [EMAIL PROTECTED]
 );
 
 And still be giving proper arrays as the value for the keys?

Sure you can :-)
 
 Also , say I wanted:
 
 use Monkey;
 to export $EXPORT_TAGS{'T2'} by default along with whatever is in
 @EXPORT, IE use Monkey would be the same as doing use Monkey qw(:T2);
 
 Would I do it this way?
 %EXPORT_TAGS = (
  T2 = [qw(A1 A2 B3 B4)]),
  DEFAULT = $EXPORT_TAGS{'T2'},
 };

No, you can't do this like that. The $EXPORT_TAGS{'T2'} is not there 
yet, the whole righthand side is evaluated before it's assigned to 
the variable on the lefthand side of the assignment. But you can do 
this:

 %EXPORT_TAGS = (
  T2 = [qw(A1 A2 B3 B4)]),
 );
 $EXPORT_TAGS{'DEFAULT'} = $EXPORT_TAGS{'T2'};

HTH, 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: CVS and Perl

2003-08-04 Thread denis
Jess,

Dont know/remeber if I thanked you for your input, but thanks..

Denis

On Wed, 30 Jul 2003, Balint, Jess wrote:

 You could make an rc file in your home directory, store the username and
 password, use 600 permissions and read the file when the script is run.
 
 --Jess--
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, July 30, 2003 4:49 PM
  To: [EMAIL PROTECTED]
  Subject: CVS and Perl
  
  
  Anyone using perl to access CVS? The CVS repository I need to 
  access does 
  not allow anonymous or just plain read-only access, So I need to hard 
  code a username and password. Yuk..
  
  Anyone have any idea's to get around this with perl?
  
  Thanks
  
  Denis 
  
  
  -- 
  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]