debugger

2003-08-03 Thread awarsd
Hi,

my web host does not offer a perl debugger and told me to use

use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
Is that it, how should i print the errors??

Thank You.
awards



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



Re: debugger

2003-08-03 Thread Todd W.

Awarsd [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 my web host does not offer a perl debugger and told me to use

 use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
 Is that it, how should i print the errors??


When you have a question about a module, please read the module's
documentation before posting here:

http://search.cpan.org/author/LDS/CGI.pm-2.99/CGI/Carp.pm

You are looking for the sections labeled:

MAKING PERL ERRORS APPEAR IN THE BROWSER WINDOW 

and

MAKING WARNINGS APPEAR AS HTML COMMENTS

Todd W.



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



Re: Mail::Send question

2003-08-03 Thread Todd W.

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.



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



Web solution help - server side v client side solution

2003-08-03 Thread Bruce Whealton, Jr.
Hi,
   I was looking for an idea of how I might accomplish something and if Perl/CGI is
going to handle what I have in mind.  I have a site that will list information with 
links to
another site or there may just be additional information available.  To include the 
more information with every listing would create a very large web page.  I'd
rather have something like the following:
Here is item one (more information on item one)
Here is item two (more information on item two)

  When the visitor clicks on more information... I'd like to have the contents of 
another file with
more details come in and display just below the item listing and prior to the next 
listing.  So, essentially
it's almost like a Server Side Include but the information doesn't get included except 
based on a 
selection by the visitor.
This might be handled better on the client side using Dynamic HTML, other than the 
fact that
this would open a very large file as to additional information for each item would 
have to be downloaded when
the page is loaded.  That's what I'm trying to avoid is having everything that makes 
up a large file - large 
html web page download and take an extensive amount of time.  Instead, I want to see 
if there is a way to 
download only what is needed and as it is needed.
Thanks,
Bruce

Bruce M. Whealton, Jr.
Publisher/Webmaster Co-Editor of
Word Salad - Literary Magazine at:
http://wordsalad.net/
ICQ # 15782569
MSN IM: [EMAIL PROTECTED]
Yahoo IM: brucewhealton
AIM: BruceMWhealton
Check out some charitable sites:
http://trianglesupport.net/
http://triangle-resources.no-ip.org/
http://savebruce.no-ip.org/


Procmail with ProcMail Module

2003-08-03 Thread Pablo Fischer
HI!

Has someone used or writed scripts to filter Mail with Procmail and the 
ProcMail Module?.

I need to catch each mail with procmail and send it to my perl script to 
determinate what to do with the mail (remove or save important info in a 
MySql DB).

I was reading Mail::ProcMail and looks good, but before using it, I would like 
to know the opinions of somebody, and how does the process works in the 
filter.

Thanks!
Pablo
-- 
Pablo Fischer Sandoval ([EMAIL PROTECTED])
http://www.pablo.com.mx
http://www.debianmexico.org
GPG FingerTip: 3D49 4CB8 8951 F2CA 8131  AF7C D1B9 1FB9 6B11 810C
Firma URL: http://www.pablo.com.mx/firmagpg.txt

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



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

2003-08-03 Thread Li Ngok Lam
$x = sub { $y = shift; print $y };
$X = $x;
$X - (123); # prints 123;
undef $X;
$Z = $x;
$Z - (234); # prints 234

Question : 
1. When will you use this kind of style in your code ?
2. Any name for this kind of coding style ?

TIA




Re: regex grep andING search words together

2003-08-03 Thread Alan C.
Jeff 'Japhy' Pinyan wrote:
On Aug 2, Alan C. said:

#!/perl/bin/perl -w
use strict;
#map  join from @ARGV into $pattern snipped
snip

#!/perl/bin/perl -w
#Win32 d:\perl\bin\perl.exe
use strict;
@ARGV=qw/doc sort/;
my $pattern;
# next is the original it's without word boundary
#$pattern=join('',map{(?=.*$_)[EMAIL PROTECTED]);
# next is foiled attempt to add word boundary
#$pattern=join('',map{(?=.*\b$_\b)[EMAIL PROTECTED]);
# next does makes the word boundary work
$pattern=join('',map{(?=.*\\b$_\\b)[EMAIL PROTECTED]);
print $pattern;
#directory files foreach file to be searched snipped
#if (s/^H=($pattern)/$1/io) {
# print $fil:$_ ;
# }
In the map and join line I tried \b

(?=.*\bdoc\b)

but the pattern got messed up, part of the pattern got cut off.


If the map  join line is the one you worked on, why did you omit it from
your code?
one them late in the day hiccup during the processing of the cpu that 
sits up atop my neck.  Temporary judgement error, etc.  I now enclosed 
the (problematic line of) code up above.

Chances are, that's where the problem lies.  Perhaps you used
doubled quotes around that part of the pattern?
Yes did have double quotes.

  my $pattern = join , map (?=.*\b$_\b), @ARGV;

Is that what your code looks like?
#code that messed up, chopped off part of regex pattern
my $pattern;
$pattern=join('',map{(?=.*\b$_\b)[EMAIL PROTECTED]);
If so, the problem is that \b, in
double quotes, means backspace.  In order to get around this, you'll
need to either double the backslash, or use different quoting:
  my $pattern = join , map (?=.*\\b$_\\b), @ARGV;
  my $pattern = join , map '(?=.*\b' . $_ . '\b)', @ARGV;
For reasons that are probably obvious, I prefer the first of those
approaches.
my $pattern;
$pattern=join('',map{(?=.*\\b$_\\b)[EMAIL PROTECTED]);
How about this?  It finds doc like I want, not document.  I don't know 
why, but it has 1 more set of parenthesis than yours and also has curly 
brackets that yours doesn't.

Now that you pointed it out, I (1st time 4 me) found backspace in the 
Programming Perl book.  Found in a table of Alphanumeric Regex 
Metasymbols

The context must a done it.  Otherwise, all that I (until now) knew was 
that \b signifies word boundary.  Thanks!

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


Re: Reference question

2003-08-03 Thread K. Parker
I have the Camel book, and while it doesn't go very far into detail
concerning XML, CGI or similar technologies, it does give a general idea. I
do hold to the fact that is the best reference book for the Perl language
itself.  If you want to go into the specifics I'd recommend one of the books
that are dedicated to a certain facet of Perl, such as those dedicated
solely to CGI with Perl, MySQL with Perl, etc.

And a piece of advice: Don't hesitate to deviate from your preferred
publisher.  There are a lot of other good computer book publishers out
there, my personal favorite being Sybex.

K. Parker

Paul Johnson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Mon, Apr 23, 2001 at 07:32:32PM -, Stout, Joel R wrote:

  Speaking of aging camels, is the Camel book still the best reference to
  have?  I am new to Perl and have the Llama book.  It's been a good
starting
  place but one day I see myself moving past it.  I would like something
that
  covers the language in more detail and deals with Data Munging, XML,
CGI,
  and DB updates.

 I'm sorry.  I wasn't quite as clear as I should have been.  I was
 assuming an older version of the Camel.  Camel 3 is recently out and I
 would suggest that it is probably _the_ book to get.  However, I don't
 own it personally.  I learnt Perl a long time ago from the man pages.

 Try

   perldoc -q book

 to see a list of recommended books.  If you have a recent Perl you'll
 get a recent list.  If not you can probably find the list on
 perldoc.com.

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



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



Re: Uploading files

2003-08-03 Thread K. Parker
Thanks, I found what I needed. I used the upload() function but failed to
save it, so the error wasn't a matter of not having uploaded right, it was
about correctly saving the uploaded file to the server. I'm getting to learn
the value of docs. :-)

Thanks again,

K. Parker

Mark Stosberg [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 In article [EMAIL PROTECTED], Li Ngok Lam wrote:
 
  - Original Message -
  From: K. Parker [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Saturday, August 02, 2003 12:00 PM
  Subject: Uploading files
 
 
  On a site I'm developing, I'm trying to create a script that uploads
  encrypted files and saves them in a particular directory.
 
  You will do in this way :
  1. Create a html form which have a file type input.
  2. Then write a CGI program to pick up the form
  3. Read the Data from what you get.
  4. Write the data to anywhere in your host as whatever file.
  5. Done

 In particular, check out the upload function of CGI.pm.

 Mark

 --
 http://mark.stosberg.com/




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



Re: What's Better?

2003-08-03 Thread Rob Dixon

Pablo Fischer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Hi

 I have 10 files, each file has 3000 lines. I have two options but I need to
 know which option is better in disk space and in cpu (the fastest one when I
 need th edata):

 1. Keep the 10 files in one Zip, and When its time to use them, unzip them,
 and start parsing and processing each one.

 2. Save each file in row of a table of my Database (using MySql, so I need to
 use DBI), and when Its time to use it, connect to the database, and retrieve
 row by row.

It depends.

On how you want to process the files' records when you have opened them.

- sequentially / at random
- frequently / infrequently
- read/write or read-only

and so on.

I would vote for option 1 unless you're doing it once a minute and need
read/write random access indexed by content, but even then there are
other ways. (3 .. 42) :)

How do you want to use this stuff Pablo?

Rob



-- 
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-03 Thread Todd W.

Li Ngok Lam [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 $x = sub { $y = shift; print $y };

$x is stores a code reference.

 $X = $x;

now $X and $x both contain references to the same block of code.

 $X - (123); # prints 123;

This dereferences the reference stored in $X and calls the subroutine stored
there.

 Question :
 1. When will you use this kind of style in your code ?

This feature is used frequently. On example I have used it for is debugging:

[EMAIL PROTECTED] trwww]$ perl
@subs = (
  sub { print('Entering: ', ( caller(2) )[3], \n) },
  sub { print('Message: ', $_[0], \n) },
  sub { print('Exiting: ', ( caller(2) )[3], \n) }
);

sub debug { $subs[ $_[0] ]-( $_[1] ); }

sub go {
  debug( 0 );
  # ...
  debug( 1, everything looks good... );
  do_some_work();
  # ...
  debug( 2 );
}

sub do_some_work {
  debug( 0 );
  # ...
  debug( 1, having a wonderful time... );
  # ...
  debug( 2 );
}

go();
Ctrl-D
Entering: main::go
Message: everything looks good...
Entering: main::do_some_work
Message: having a wonderful time...
Exiting: main::do_some_work
Exiting: main::go

Notice how the debug() subroutine is simply a dispatcher for the subroutines
stored in the @subs array? Of course my actual debugger is slightly more
complcated, but thats how it uses code refs.

There are countless other ways to use the feature. Passing subroutines as
arguments to other subroutines comes to mind.

 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.

Todd W.





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



Re: Why use symbolic refs?

2003-08-03 Thread Wiggins d'Anconia
Kipp, James wrote:

Or am i missing the point?
Yeah, I think you did.

This is the real point...

$x = foo;
$$x = 20;# this sets $foo
print $foo;  # prints 20
print $x;# still prints foo!.
But like I said, this is usually a bad way of doing things.  
It is better to
use a hash when you have dynamic names.

Rob



Thanks. I will continue on without them :) 


Hopefully  you haven't been able to because you are using 'use strict,' 
this is one of the features of Perl that use strict prevents you from 
using (aka it shortens the proverbial rope), which in most cases will 
prevent it from being used to generate bugs...

There is an occasion when it can be useful, so never using it is the 
wrong approach as well, it was added for a reason, the difficult part is 
knowing when it should be used rather than how to use it.

http://danconia.org

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


Re: Learning Perl vs. c ++

2003-08-03 Thread Wiggins d'Anconia
GregorioGonzalez wrote:
Hello:

I have heard that PERL is more valuable than learning C++ in terms of
IT, etc.
What is your view of the matter.

I'd like to offer up a different angle than the other posters so far, I 
would ask what is your learning environment?  If you are in school or in 
an environment where you are likely to get rigid training and 
preparation than go the C++ route, because IMO it will be harder to 
learn on your own and harder to apply.  If you have learned C++ then the 
jump to Perl should be fairly fluid and can be done on your own with 
relative ease, I don't believe the opposite can be said.  I consider 
myself a relatively advanced Perl programmer and a fairly clean 
designer/writer of code, but have not found it easy to move into C++.  I 
have limited true CS background as I was a business major and did not 
attend a college that specialized in technical fields, I am almost 
exclusively self taught and started in a web world (circa 1997 granted). 
 If you have the time and mentors available to learn C++ it will not be 
detrimental I guarantee, if not then you might consider Perl because it 
is something that can be self taught, especially because of the 
availability of resources like this list, and the ease of finding 
personal projects where Perl skills can be applied and quickly utilized.

http://danconia.org

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


Adding up multiple entries.

2003-08-03 Thread David J. Taylor
Hey guys,
I'm just starting to lean PERl and the first real job I have to
do with it is pull some stats from Netflow data.

The data comes in the form of a tab delimeted text file in the following
format

sourceIPDestIP  ProtocolDestPortSourcePort
Bytes   Packets

Eg

10.0.0.110.0.0.517  80  4521
204816

What I need to be able to do is take an address and a port and add up
the number of bytes eg
IP  PortBytes
10.0.0.180  16005
10.0.0.1443 5575876

Etc, I can see how I could use a hash to do this by using the address
port pair as a key then adding the bytes to that key for every instance
but I'm not sure how to exicute it.

D



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



Re: Adding up multiple entries.

2003-08-03 Thread Wiggins d'Anconia
David J. Taylor wrote:
Hey guys,
I'm just starting to lean PERl and the first real job I have to
do with it is pull some stats from Netflow data.
The data comes in the form of a tab delimeted text file in the following
format
sourceIPDestIP  ProtocolDestPortSourcePort
Bytes   Packets
Eg

10.0.0.110.0.0.517  80  4521
204816
What I need to be able to do is take an address and a port and add up
the number of bytes eg
IP  PortBytes
10.0.0.180  16005
10.0.0.1443 5575876
Etc, I can see how I could use a hash to do this by using the address
port pair as a key then adding the bytes to that key for every instance
but I'm not sure how to exicute it.
What have you tried? Where did you get stuck?  Probably you need to 
start with some sort of 'open' to get to the data,

perldoc perlopentut
perldoc -f open
Then you will need some way to divide each line up,

perldoc -f split

Then you will build your hash which it sounds like you know how to do, 
but specifically you are going to use the '.' (concatenate) operator and 
the '=' (assignment operator), and finally the '+' (addition) operator,

perldoc perlop

So you end up with in pseudo-code:

open file,
while read each line of file,
split line,
add bytes to entry in hash
close file
do whatever you want with the datawhich probably involves displaying it,

perldoc -f print

http://danconia.org

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


Difficulties installing the Tk module

2003-08-03 Thread John Burski
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.

--
John Burski
@HOME S.I.M.U. (Well, sometimes I am :)  )

... and still searching for the cheese!



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


connecting oracle

2003-08-03 Thread Visu
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]