Line Numbering

2003-08-01 Thread johnstonp
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 


Re: Learning Perl vs. c ++

2003-08-01 Thread Gabor Urban
From: "GregorioGonzalez" <[EMAIL PROTECTED]>
Subject: Learning Perl vs. c ++
Date: Thu, 31 Jul 2003 14:10:28 -0400

> Hello:
> 
> I have heard that PERL is more valuable than learning C++ in terms of
> IT, etc.
> 
> What is your view of the matter.
> 
> Regards, 
> 
> GREGORIO GONZALEZ:  Internet Business Developer

Hi,

as a seasond C/C++ developer AND a Perl fan I think it is not the good
question. The two languages are so different.

Perl is a highly flexible and relatively easy to learn SCRIPT
language. You can develop pretty fast using it, and it's no problem
for a skilled system operator or webmaster. Your scripts will be
portable with some restrictions. But be prepared, to master
the deeps may wait for a couple of months, or years.

C++ (or Java) is high level, compiled programming language. The
development takes more time, for sure, but gives you generally more
speed and efficiency on the given hardware. Learning C++ is not easy,
and may be suggested to a smaller audience, only. 

To be short: the difference is like a full-automatic car on the roads
compared to a highly tuned Formula-1 racing machine.

The decision is up to you, but if you have time enough try both :-))

Gabaux
Linux is like a wigwam: no gates, no windows, and an apache
inside!


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



Re: What's Better?

2003-08-01 Thread Janek Schleicher
Pablo Fischer wrote at Thu, 31 Jul 2003 18:52:20 +:

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


And your Perl question is ... ?


Cheerio,
Janek

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



Re: [solved but..] Push first 9 elements

2003-08-01 Thread Janek Schleicher
John W. Krahn wrote at Thu, 31 Jul 2003 00:22:04 -0700:

> If you are just removing one element then you can use shift instead. 
> And you are not really using $i it seems.
> 
> for ( 0 .. @archivo - 4 ) {
>   push @lista_final, shift @correos_p;
>   push @lista_final, shift @correos_h;
>   push @lista_final, shift @correos_y;
>   push @lista_final, shift @correos_l;
>   push @lista_final, shift @correos_t;
>   push @lista_final, shift @correos_s;
>   push @lista_final, shift @correos_o;
> }

Let's shorten that a bit :-)

for ( 0 .. @archivo - 4 ) {
   push @lista_final, shift @{"correos_$_"} for qw/p h y l t s o/;
}

That might be one of the rare moments where it could be correct to use
symbolic references. Here it avoids having multiplied the code and logic 7
times. And IMHO it makes the code more readable as it is easier to follow
the main idea :-)


Cheerio,
Janek

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



Re: Line Numbering

2003-08-01 Thread Janek Schleicher
johnston wrote at Fri, 01 Aug 2003 14:15:18 +0800:

> 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...??

Perl counts in most cases the lines like your editor does too. (Including
comments, heredocs and so on). Only evaled parts of your code get their
own counting, but I assume (hope) that beginners don't work often with
eval.

Sometimes the line is not what we humans might expect. E.g. if
if (...) {

} elsif { ... } {

}
has a runtime error or warning in the elsif condition part, Perl might
show the line nr of the if.

But compared to other languages, Perl is very correct finding the right
error or warning line.

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

Show us the code and the warning and we'll explain.


Greetings,
Janek

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



RE: Line Numbering

2003-08-01 Thread Marcos . Rebelo
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 

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



RE: Mime::Parser starter

2003-08-01 Thread Stephen Gilbert
MIME::Parser will parse out any file attacements also the message portion into 
separate files. If you wish to then view the files you can examine the dir it creates.

-Original Message-
From: awarsd [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 31, 2003 9:11 AM
To: [EMAIL PROTECTED]
Subject: Re: Mime::Parser starter


Hi,
Thank you for the code.
But one thing i really do not understand, is that i think mime::parser can
not decode an entire message in its pure format.
if I have the following from a message with an attachment
--=_NextPart_000_00E9_01C35775.1AE10310
Content-Type: image/gif;
name="bar.gif"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="bar.gif"
R0lGODlhHgAQAIcAgBAQiBMTjCYmmScolDo6pj9AoE1Ns1dYrHd5vWRkwsbJ5sPD/QAA












ACH5BP8ALAAeABAA
AAiBAAEIHEiwoMGDCBMqLBigocOHECNKbEigosWLGDNqrGigo8ePIEOK7IigpMmTKFOqLJmgpcuX
MGPKbLmgps2bOHPqrMmgp8+fQIMK7amgqNGjSJMqLXqgqdOnUKNKbVqgqtWrWLNqrTqgq9evYMOK
7SqgrNmzaNOqLbuwrdu3CgMCADs=
--=_NextPart_000_00E9_01C35775.1AE10310--

I just want to be able to display the attachment or recreate the attachment,
so I can download it or view it.
Maybe I should look at other modules than Mime, because I can easily get the
message with Net::POP3  with regex.
Any help to bring me on the correct paht is more than appreciated



-Original Message-
From: awarsd [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 30, 2003 8:06 AM
To: [EMAIL PROTECTED]
Subject: Mime::Parser starter


Hi,

i just need someone to guide me please
I'm retrieving from my host email(with attachment) using Net::Pop3
I print the message content- where we can see
Charsert ="iso-8869-1"
--- =_NextPart_001
to, subject
etc
now i see on the bottom of this message
Content-type: image/gif;
name = "image.gif";
content-trasfer-encodeing:base 64;
Content-disposition: attachment;
filename = "image.gif";

r01Gid1jhasdffsd897sdfa87dfas897asdfasdf  A LONG CODE

My question is that should i retrieve this 'LONG CODE' Save it in a file or
save the entire message content where it has subject content-type etc.?

thanx for any advice



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



Hello,

you could, using Net::POP3 write the message out to a file and then using
MIME::Parser parse each component such as:

$server = "mail_server";
$user = "account_name";
$pass = "password";
$pop = Net::Pop3->new($server) or die "Unable to connect to server $server:
$!\n";
$pop->login($user, $pass) or die "unable to login with User: $user Pass;
$pass $!\n";
@popstat = $pop-popstat();
if ($popstat[0] > 0) {
$msgs = pop->list;
foreach $msgid (keys %$msgs) {
open(CURRMSG, ">currmsg.msg") or die "Cannot open message: $!\n";
$pop->get($msgid, \*CURRMSG);
close CURRMSG;
$parser = new MIME::Parser;
$parser->extract_nested_messages(1);
$parser->parse_open("currmsg.msg") or die "Unable to parse message
$msgid $!\n";
# do something with message/parts

# clean up
unlink("currmsg.msg") or die "Unable to delete temp message: $!\n");
$parser->filer->purge or die "Unable to delete message parts: $!\n";
} # Move to next message or end if none left
}

Please do your homework and verify this as I have type it mainly off the top
of my head. Also, it's important to familiarize yourself with the
documentation for MIME::Parser and Net::POP3. There are a bunch off things
you should do in terms of error checking and other coding before this is a
usefull program. Don't use this as is! Always remember that there is more
than one way to do it!

Steve



-- 
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: Learning Perl vs. c ++

2003-08-01 Thread David Winters
On Thu, 31 Jul 2003, Bruce Whealton, Jr. wrote:

>Which one of these would be best equipped for SQL database work/designs?  If

Of these two, I think Perl is better-equipped.  I amused myself a couple of 
times with trying basic Perlesque stuff in C++ and it's painful; Java is 
even worse.  I didn't think I learned anything useful from the experience -- 
other than "don't bother" -- so I stopped.

>one is a
>webmaster or webmaster in training, which language would have the best means
>for creating
>and marinating a dynamic database driven web site?  I'm thinking in
>particular of a mysql database to
>create a dynamic database driven web site and application.
>
>I could use some tools/tutorials for learning about Perl Modules... also how
>to use perl for the above mentioned
>tasks, specifically mysql.

If you're planning to use Linux and Apache, http://www.onlamp.com/ (which 
also explores PHP or Python in place of Perl).


D.


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



Raghupathy wrote:

2003-08-01 Thread Rob Dixon
Raghupathy wrote:
> Rob wrote:
> > Raghupathy wrote:
> > > Hi All,
> > >
> > >   I have a text file as shown below. How do I match
> > > patterns like the following:
> > >
> > > Pattern to be matched:
> > > =
> > > #ifndef def
> > > ..   (anything except #if)
> > > #else def
> > > ...  (anything except #if)
> > > #endif def
> > >
> > >
> > > My Input Data:
> > >
> > =
> > > #ifndef def
> > > DELETE sys1..tbl1
> > > #endif def
> > >
> > > SELECT col1, col2, col3
> > > #ifndef def
> > >FROMsys1..tbl1
> > > #else def
> > >FROMsys1..tbl2
> > > #endif def
> > > WHERE  schdid is not null
> > >
> > >
> > =
> > >
> > > What I tried is below (but did not work since it
> > > captured patterns which had "#if" nested within the
> > > main pattern).
> > >
> > > $line1 =~
> > > m/#ifndef\s+def(.*?)#else\s+def(.*?)#endif\s+def/isg
> > >
> >
> > I thought I knew what you meant, but then I changed my
> > mind!
> >
> > If your input file is, say
> >
> > statement1;
> > #ifdef def1
> > statement2;
> > #ifdef def2
> > statement3;
> > #else
> > statement4;
> > #endif
> > statement5;
> > #else
> > statement6;
> > #ifdef def3
> > statement7;
> > #else
> > statement8;
> > #endif
> > statement9;
> > #endif
> >
> > What is it that you want to capture?
>
>
>The input file you described is not correct, since
> it has
> #ifdef def2
> statement3;
> #else
> statement4;
> #endif
> nested within another #ifdef ... #else ... #endif.
>
>  My input file is the output of
> "diff -D def file1 file2" (on unix). This will
> generate a file which has the following patterns and
> none of the patterns can be nested within the other:
>
> #ifdef  #else ... #endif
> #ifndef  #else ... #endif
> #ifdef  #endif
> #ifndef  #endif
>
>I need to substitute the above patterns to be read
> by a home grown program.
>
>I encountered a problem due to the following
> reason.
> There was:
>
> #ifndef def  #endif def-  Call it sentence1
> #ifndef def ... #else def ... #endif def   - Call it
> sentence2
>
>I tried the following line but it matched sentence1
> and sentence2 together. I need to match sentence1 and
> sentence2 seperately.
> $line1 =~
> m/#ifndef\s+def(.*?)#else\s+def(.*?)#endif\s+def/isg
>
> For this
> #ifndef def (...1...) #else def (...2...) #endif def
>
> should be matched only if #if is not there within
> (...1...) and (...2...).
>
>   Hopefully I have conveyed it more clearly.

After a lot of thought I think I know what you mean. The 'nested'
in your subject threw me off, as there's no nesting involved!

Essentially, you want to grab an undefined, defined pair of strings
in sequences like this.

#ifdef def
  defstring
#endif

#ifndef def
  undefstring
#endif

#ifdef def
  defstring
#else
  undefstring
#endif

#ifndef def
  undefstring
#else
  defstring
#endif

That's what the program below does. It captures 'ifdef' or 'ifndef'
into $1, the first string into $2 and the second string (if any)
into $3. It then uses $2 and $3 (defaulted to the null string if it
is undefined) to set up scalars $def and $undef. It does this for
every #if .. #endif in the supplied string.

BTW please post your replies at the bottom of the messages. This
is a complex thread and it gets very difficult to understand if
we are responding at opposite ends of the text!

I hope this helps.

Rob



use strict;
use warnings;

my $code = <

RE: Learning Perl vs. c ++

2003-08-01 Thread Marcos . Rebelo
The import is not the language, is the work.

I would not do a web site with C++, but I would not do a real-time
aplication on Perl.

So where do you want to work? 
What do you need to do?

Marcos

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



RE: Name msg from Mime::Parser

2003-08-01 Thread Stephen Gilbert


-Original Message-
From: awarsd [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 31, 2003 6:54 PM
To: [EMAIL PROTECTED]
Subject: Name msg from Mime::Parser


Hi,

I finally got what i wanted. Anyways I would like to know how does
Mime::Parser decides of the name of the folder
here is my code (it is rough)

open(CURRMSG,">c:\\message.msg");
$pop3->get($msg_id, \*CURRMSG);
close CURRMSG;
$parser = new MIME::Parser;

$parser->output_under("C:\\mail\\pop3\\info");
$parser->output_prefix("$msg_id");

open(CURRMSG, "C:\\message.msg") or die "Cannot open message: $!\n";
my $ent = $parser->parse(\*CURRMSG);
close CURRMSG;


if ($ent->effective_type eq "multipart/alternative" and $ent->parts == 2 and
$ent->parts(0)->effective_type eq "text/plain" and
$ent->parts(1)->effective_type eq "text/html") {
my $newent = MIME::Entity->build(Data =>
$ent->parts(0)->body_as_string . "\n\n[[HTML alternate version
deleted]]\n");
$ent->parts([$newent]);
$ent->make_singlepart;
$ent->sync_headers(Length => 'COMPUTE', Nonstandard => 'ERASE');
}
$ent->print;

as above I put the mails files in
$parser->output_under("C:\\mail\\pop3\\info");
I often get a file name such as
msg-1059691621-2628-4
I would like to know how mime::parser gives a name to the folder and if
there is a way to name it our way or at least get the name of the folder.







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




Hi 

I know it has the process id and the message id in  it, but I have not found away to 
determine what the actual dir name is or how to control the naming of the dir. 
Personally, I use Net::Find to get at my files. Let me know if you find out the naming 
scheme of the dir.

Steve

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



RE: Learning Perl vs. c ++

2003-08-01 Thread Lodewijks, Jeroen
Hi Bruce,

It's not unusual to see glowing reports about Perl on a Perl mailing list.
However, I like to share a couple of points I think Perl has a problem with.

a) Huge projects/programs. 
Perl is not an easy beast to keep on a leash. Perl doesn't really force you
to keep your code tidy and IMHO the more your code grows the more difficuly
it becomes to maintain.
The famous Perl adagium, TIMTOWTDI (There is more than one way to do it)
often works against you and if you work with more than 1 programmer on the
same code, style differences rapidly creep in, leading to bugs and
hard-to-maintain code

b) Perl loose way of type checking, namespaces, and OOP (all more or less
added as a kludge) often leads to funny or unexpected results. It's syntax
for references and contexts can be very hard to read or crasp.

That said, I think Perl is a *lot* better than C++ for web design. I think
you will have a hard time using C++ for webpages.

Maybe it's better to use Java and Java Server Pages for your web server.
C# or ASP.NET are good alternatives too. They all are much easier to
maintain IMO

My 2 cents,

Jeroen

I am pretty sure if you post on C++ list you C++ is THE WAY to go.
And Python on the Python list.

Maybe you should try alt.comp.languages :)


> 
> 
> Which one of these would be best equipped for SQL database 
> work/designs?  If
> one is a
> webmaster or webmaster in training, which language would have 
> the best means
> for creating
> and marinating a dynamic database driven web site?  I'm thinking in
> particular of a mysql database to
> create a dynamic database driven web site and application.
> 
> I could use some tools/tutorials for learning about Perl 
> Modules... also how
> to use perl for the above mentioned
> tasks, specifically mysql.
> Thanks so much,
> Bruce
> 
> > It was Thursday, July 31, 2003 when Michael Muratet took 
> the soap box,
> saying:
> > : On Thu, 31 Jul 2003 14:15:17 -0400
> > : Casey West <[EMAIL PROTECTED]> wrote:
> > :
> > : > It was Thursday, July 31, 2003 when GregorioGonzalez 
> took the soap
> > : > box, saying:: 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 agree.
> > : >
> > : > I'm a case-in-point.  In university I learnt C++ in the 
> classroom,
> > : > Perl on my own time.  I've never once found a decent 
> C++ gig, and have
> > : > been working steady using Perl ever since.
> > : >
> > : > Your milage may vary, however.
> > : >
> > : >   Casey West
> > :
> > : Greetings
> > :
> > : There's an excellent article by Lincoln Stein called "How 
> perl saved the
> > : human genome project" or something like that. I'm sure it 
> would be easy
> > : to find with a google search. Perl has the reputation 
> (deserved IMHO) of
> > : being the easiest language for the non-computer scientist 
> to learn.
> >
> > http://www.samag.com/documents/s=1283/sam01020001/
> >
> >   Casey West
> >
> > -- 
> > If you don't double-click me, I can't do anything.
> >   -- John Aniston, on how computers have taken over his life
> >
> >
> > -- 
> > 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]
> 

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



RE: Learning Perl vs. c ++

2003-08-01 Thread Stephen Gilbert


-Original Message-
From: GregorioGonzalez [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 31, 2003 2:10 PM
To: [EMAIL PROTECTED]
Subject: Learning Perl vs. c ++


Hello:

I have heard that PERL is more valuable than learning C++ in terms of
IT, etc.

What is your view of the matter.

Regards, 

GREGORIO GONZALEZ:  Internet Business Developer
VERIO:  An NTT Communications Company
TOLL FREE:  877-273-3190 EXT 4672
INTERNATIONAL:  011-561-999-8599 ext: 4672 
EMAIL:  [EMAIL PROTECTED]
TECH SUPPORT: 800-339-4929 option 4
WEBSITE: http://hosting.verio.com/index.php/vps_vpscompare.html


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


Hi Gregorio,

The question is not is perl more or less valuable than C++, but are you more valuable 
to an IT team with one (either) or both languages. Perl is a great programming tool 
for small non-cpu intensive applications, and great for rapid development of large 
processes as a prototype. More times than not perl is also quite adequate for larger 
applications. However if you are presenting yourself to an IT team for consideration 
it best suites you to have c++ as a tool in you toolbelt. Some very cpu intensive 
processes are not really practical in perl and require a low level language such as 
c++. Also real-time processes such as device drivers and low-level system work are 
best left to c++ or even assembly. 
Remember perl is not written in perl but C++.
If your seriously considering a career in IT don't limit yourself.

Good luck

Steve

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



Re: Line Numbering

2003-08-01 Thread Rob Dixon
[EMAIL PROTECTED] wrote:
> 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...

Take note of the source file that the line number refers to it will say
something like

  at myfile.pl line 99

but a mistake in your program can cause errors in the module files it uses.
Also, if you have a file open for reading Perl will also report the number
of the record you last read from the file. Don't confuse this with a source
file line number which will also be in the message.

HTH,

Rob



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



RE: Learning Perl vs. c ++

2003-08-01 Thread Dan Muey
> Which one of these would be best equipped for SQL database 
> work/designs?  If one is a webmaster or webmaster in 
> training, which language would have the best means for 
> creating and marinating a dynamic database driven web site?  
> I'm thinking in particular of a mysql database to create a 
> dynamic database driven web site and application.
> 

Perl by a land slide! Perl land mysql are great bed fellows, I use them everyday!


> I could use some tools/tutorials for learning about Perl 
> Modules... also how to use perl for the above mentioned 
> tasks, specifically mysql. Thanks so much, Bruce

 perldoc DBI will help tons!!!

Here's a simple example, it doesn't do any error/input checking so you'll want to do 
that.

#!/usr/bin/perl -w

 use strict;
 use DBI;
 use CGI qw(:standard);

 print header();

 my $dbh = DBI->connect('mysql:database:localhost','user','pass');

 my $name = $dbh->quote(param('name'));
 my $email = $dbh->quote(param('email'));

 if($dbh->do("INSERT INTO mytable VALUES(NULL,NOW(),$name,$email")) {
print "Added record ok";
 } else { print "Couldn't add the record"; }

 $dbh->diconnect;


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



RE: What's Better?

2003-08-01 Thread Dan Muey
> Hi

Howdy!

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

# 2 would seem to me to be a zillion times better. For instance if you want everythign 
just do:

SELECT ... FROM table

Done

But with # 1

Unzip files
Open files
Read files
Do somthign with each line
Close files

Now what if you want to grab specific data, say all of them with foo as the bar?

SELECT ... FROM table WHERE foo='bar'

Done

But with number one:

Unzip files
Open files
Read files
Look at eahc line 
Decide what to do witht the liine
Do that with the line
Close files

Flat files are ok for tiny tiny databases but for 3 records mysql will be tons 
easier to develop, easier to manage, and easier to use, faster (by a lot) etcc...

HTH

DMuey

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



RE: Learning Perl vs. c ++

2003-08-01 Thread Dan Muey
> Hi Bruce,
> 
> It's not unusual to see glowing reports about Perl on a Perl 

True :)

> mailing list. However, I like to share a couple of points I 
> think Perl has a problem with.
> 
> a) Huge projects/programs. 
> Perl is not an easy beast to keep on a leash. Perl doesn't 

Interesting illustartion, it's because it's a powerful beast!

> really force you to keep your code tidy and IMHO the more 

Uh, ever use warnings, strict, or any modules?
Also a *good* programmer will make it look nice and readable.

> your code grows the more difficuly it becomes to maintain. 

As with anything...

> The famous Perl adagium, TIMTOWTDI (There is more than one 
> way to do it) often works against you and if you work with 

Usually if you work with a development team they have standards to go by.

> more than 1 programmer on the same code, style differences 
> rapidly creep in, leading to bugs and hard-to-maintain code

Again 'as with anything' and bad programmer. I have code that lots of people maintain
And maintain coed written by other people with no problem.

> 
> b) Perl loose way of type checking, namespaces, and OOP (all 
> more or less added as a kludge) often leads to funny or 

Aren't you talking about PHP and ASP/anythign Microsoft here?

> unexpected results. It's syntax for references and contexts 
> can be very hard to read or crasp.
> 

Yes but once you grasp it you can do lots more and better 
including some of those "Huge projects/programs".

Kind of like calculus, yeah it may be hard but once oyu know it you can fly to the 
moon.

> That said, I think Perl is a *lot* better than C++ for web 
> design. I think you will have a hard time using C++ for webpages.

Definitely! C++ would make a great webserver but is a gludge for web programming.

> 
> Maybe it's better to use Java and Java Server Pages for your 
> web server. C# or ASP.NET are good alternatives too. They all 
> are much easier to maintain IMO

Java yes, C# maybe, ASP.NET  no, are you an MSCx by chance? :)

Any thing is easy to maintain if you know it. And anything is difficult 
for someone else to maintain at first since they can't read your mind 
and have to figure what you're doing. Good programming practice is an essential 
Skill for any language to make it mor euseful to other people.

So basically saying Perl is a bug prone, hard to maintain kludge is 
ignorance based on inexperience. As is my saying not to use ASP.NET.
I say that based on limited experience with ASP crap, the fact that 
Microsoft sucks and I'd rather die than rely on microsoft to handle my web sites. 
And the fact that I use Perl for 99% of my administrative, database, and webdev tasks
And I havn't found a job it wouldn't do for me yet!

> 
> My 2 cents,
> 
> Jeroen
> 
> I am pretty sure if you post on C++ list you C++ is THE WAY 
> to go. And Python on the Python list.

Also True!

Ok I'm done ranting now!

Dan

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



RE: Learning Perl vs. c ++

2003-08-01 Thread Lodewijks, Jeroen
Hi Dan,

The point I was trying to make, is that Perl itself does not stimulate
readability, 
type checking, managability, etc.

Of course, a good programmer does not care much about as he or she will
write 
'good' code anyway. Using that philosophy, it wouldn't matter in which
language a good programmer would write.
A language can be accomodating though, and I think Perl is often not.

An example: Modula 2 will force you to think about your API much more than
Perl 
as in Perl all is visible by default.
In Modula 2 you have to specify explicitly what you import and export.

Perl was written originally to be used as quick and dirty glue - and I think
it shows.

I am certainly not a MSCx, but have worked with MS tools.
In general, they are an order of magnitude better than anything else.
I normally work on *NIX. 

I don't like MS that much either, but that doesn't mean I can't appreciate
what they produce.
I think chosing your language should not be influenced by irrational hatred
for MS.

ASP is indeed not an accommodating language, I have to admit, 
but I heard they managed to keep much of the web content and ASP code apart
in the new .NET version.
(I thought that was one of the major flaws)

I personally think that C# as a language is a bit better than Java, 
C# is almost Java but because they nicked a lot from it and it is from a
later date,
it has all what Java can do + a few good extra's.

And it could be me, but webpages done in JSP seem to be the slowest of them
all.
(On a similar note: webpages done with Perl seem to be the quickest!)

But I am wandering off, the question was: what to use for web development?
Java, C#, Perl, PHP all seem to do the trick.

Jeroen

> 
> > Hi Bruce,
> > 
> > It's not unusual to see glowing reports about Perl on a Perl 
> 
> True :)
> 
> > mailing list. However, I like to share a couple of points I 
> > think Perl has a problem with.
> > 
> > a) Huge projects/programs. 
> > Perl is not an easy beast to keep on a leash. Perl doesn't 
> 
> Interesting illustartion, it's because it's a powerful beast!
> 
> > really force you to keep your code tidy and IMHO the more 
> 
> Uh, ever use warnings, strict, or any modules?
> Also a *good* programmer will make it look nice and readable.
> 
> > your code grows the more difficuly it becomes to maintain. 
> 
> As with anything...
> 
> > The famous Perl adagium, TIMTOWTDI (There is more than one 
> > way to do it) often works against you and if you work with 
> 
> Usually if you work with a development team they have 
> standards to go by.
> 
> > more than 1 programmer on the same code, style differences 
> > rapidly creep in, leading to bugs and hard-to-maintain code
> 
> Again 'as with anything' and bad programmer. I have code that 
> lots of people maintain
> And maintain coed written by other people with no problem.
> 
> > 
> > b) Perl loose way of type checking, namespaces, and OOP (all 
> > more or less added as a kludge) often leads to funny or 
> 
> Aren't you talking about PHP and ASP/anythign Microsoft here?
> 
> > unexpected results. It's syntax for references and contexts 
> > can be very hard to read or crasp.
> > 
> 
> Yes but once you grasp it you can do lots more and better 
> including some of those "Huge projects/programs".
> 
> Kind of like calculus, yeah it may be hard but once oyu know 
> it you can fly to the moon.
> 
> > That said, I think Perl is a *lot* better than C++ for web 
> > design. I think you will have a hard time using C++ for webpages.
> 
> Definitely! C++ would make a great webserver but is a gludge 
> for web programming.
> 
> > 
> > Maybe it's better to use Java and Java Server Pages for your 
> > web server. C# or ASP.NET are good alternatives too. They all 
> > are much easier to maintain IMO
> 
> Java yes, C# maybe, ASP.NET  no, are you an MSCx by chance? :)
> 
> Any thing is easy to maintain if you know it. And anything is 
> difficult 
> for someone else to maintain at first since they can't read your mind 
> and have to figure what you're doing. Good programming 
> practice is an essential 
> Skill for any language to make it mor euseful to other people.
> 
> So basically saying Perl is a bug prone, hard to maintain kludge is 
> ignorance based on inexperience. As is my saying not to use ASP.NET.
> I say that based on limited experience with ASP crap, the fact that 
> Microsoft sucks and I'd rather die than rely on microsoft to 
> handle my web sites. 
> And the fact that I use Perl for 99% of my administrative, 
> database, and webdev tasks
> And I havn't found a job it wouldn't do for me yet!
> 
> > 
> > My 2 cents,
> > 
> > Jeroen
> > 
> > I am pretty sure if you post on C++ list you C++ is THE WAY 
> > to go. And Python on the Python list.
> 
> Also True!
> 
> Ok I'm done ranting now!
> 
> Dan
> 

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



Re: [solved but..] Push first 9 elements

2003-08-01 Thread David K. Wall
Janek Schleicher <[EMAIL PROTECTED]> wrote:
John W. Krahn wrote at Thu, 31 Jul 2003 00:22:04 -0700:

If you are just removing one element then you can use shift instead.
And you are not really using $i it seems.
for ( 0 .. @archivo - 4 ) {
  push @lista_final, shift @correos_p;
  push @lista_final, shift @correos_h;
  push @lista_final, shift @correos_y;
  push @lista_final, shift @correos_l;
  push @lista_final, shift @correos_t;
  push @lista_final, shift @correos_s;
  push @lista_final, shift @correos_o;
}
Let's shorten that a bit :-)

for ( 0 .. @archivo - 4 ) {
   push @lista_final, shift @{"correos_$_"} for qw/p h y l t s o/;
}
That might be one of the rare moments where it could be correct to use
symbolic references. Here it avoids having multiplied the code and logic 7
times. And IMHO it makes the code more readable as it is easier to follow
the main idea :-)
You don't need symbolic references.

for ( 0 .. @archivo - 4 ) {
   push @lista_final, shift @$_ for (
   [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
   [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
   );
}
I agree with Steve Grazzini, though, and suspect there may be a better way 
to represent the data.  But since we don't know what the data is, we can't 
suggest anything.

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


RE: Learning Perl vs. c ++

2003-08-01 Thread Bakken, Luke
I hate to add to what is quickly degenerating thread, but as I develop
C/C++ and perl professionally for one of the largest financial
corporations in the world, I think I can add something to the
discussion.

> The point I was trying to make, is that Perl itself does not stimulate
> readability, 

That's the programmer's and management's responsibility, not the
language's.

> type checking

Nope, no type checking. And how is that a problem, when you have regular
expressions? I've come to find that a feature.

> managability, etc.

See two points above. Not the language's responsibility. And really, how
does the whole header file mess involved in programming with C or C++
help managibility?
 
> 'good' code anyway. Using that philosophy, it wouldn't matter in which
> language a good programmer would write.

Exactly. Good programmers write good, understandable code in ANY
language.

> An example: Modula 2 will force you to think about your API 
> much more than
> Perl 
> as in Perl all is visible by default.
> In Modula 2 you have to specify explicitly what you import and export.

Use the Export module in your modules. If you need strict public/private
items in your module, you can do it.
 
> Perl was written originally to be used as quick and dirty 
> glue - and I think
> it shows.

OK, now my troll detector is beginning to blip. Have you ever looked at
Perl 4? The language has come a looong way since the 'ol "quick and
dirty" days.

> I am certainly not a MSCx, but have worked with MS tools.
> In general, they are an order of magnitude better than anything else.

You know, I could say just the opposite and have it be just as true:

"I have worked with GNU tools. In general, they are an order of
magnitude better than anything else."

I find working with make, vim, autoconf, etc etc etc far far more
intuitive, configurable and controllable than any of the hold-your-hand
GUI offerings from Microsoft. Why? Because that's what I'm most familiar
with.

As to "better", I think working with vim is 1000% more productive than
any other editor/IDE - why? #1 - I've taken the time to learn it in and
out, and #2 - I never have to leave the keyboard.

Again, familiarity wins out.

> I think chosing your language should not be influenced by 
> irrational hatred
> for MS.

How does anything with perl have to do with/against MS? I'm confused.
Perl runs great on Win32.
 
> But I am wandering off, the question was: what to use for web 
> development?
> Java, C#, Perl, PHP all seem to do the trick.

I agree - all would be easier than plain C++.

Luke

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



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

2003-08-01 Thread Richard Heintze
Is this an appropriate place to post questions on
Win32::ODBC/MSAccess 2000/Perl 5.6 cgi/Apache HTTPD? 

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.

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

 Thanks,
 Siegfried

__
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: Have Module, Will Travel

2003-08-01 Thread Casey West
It was Friday, August 01, 2003 when Dan Muey took the soap box, saying:
: Howdy All,
: I need some input on how to do steps 2.5 and 3 below(or if I'm missing a step):
: 
: 1) - make module
: I have a Module I made that does what I want when I do.
:  use lib '/home/joe/mama';
:  use Module;
: 
: What I'd like to do is put it on CPAN.
: 
: 2) - make the file for it to put on cpan
: I've been looking at : 
: http://cpan.org/misc/cpan-faq.html#How_make_bundle
: To see how to make it ready for cpan 
: (any other resources, suggestions, etcc on this topic are welcome)
: 
: I think I have that down. 
: That basically makes the one file I upload to cpan right? (for each module and each 
version of a module)

Please read http://search.cpan.org/perldoc?ExtUtils::MakeMaker::Tutorial

: 2.5) My module uses a couple other modules so:
: 
:   How can I do step 2 so that, during the 
:   perl Makefile.PL,make, make install dance,
:   it will test to see if they're installed, 
:   if not try to install them and if they can't 
:   be installed tell them to 
:   install them first then stop installtion?

See the above instruction.

: 3) - put it on cpan for public use
: 
: I know I need to get an account and namespace approval and 
: upload it but I'm lost as to how to do that/finer points of it.
: I know the docs are there but I missed it on cpan. 

Also read this: http://cpan.org/misc/cpan-faq.html#How_contribute_modules

  Casey West

-- 
Shooting yourself in the foot with Clipper 
You grab a bullet, get ready to insert it in the gun so that you can
shoot yourself in the foot and discover that the gun that the bullets
fits has not yet been built, but should be arriving in the mail
_REAL_SOON_NOW_. 


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



Have Module, Will Travel

2003-08-01 Thread Dan Muey
Howdy All,
I need some input on how to do steps 2.5 and 3 below(or if I'm missing a step):

1) - make module
I have a Module I made that does what I want when I do.
 use lib '/home/joe/mama';
 use Module;

What I'd like to do is put it on CPAN.

2) - make the file for it to put on cpan
I've been looking at : 
http://cpan.org/misc/cpan-faq.html#How_make_bundle
To see how to make it ready for cpan 
(any other resources, suggestions, etcc on this topic are welcome)

I think I have that down. 
That basically makes the one file I upload to cpan right? (for each module and each 
version of a module)

2.5) My module uses a couple other modules so:

How can I do step 2 so that, during the 
perl Makefile.PL,make, make install dance,
it will test to see if they're installed, 
if not try to install them and if they can't 
be installed tell them to 
install them first then stop installtion?

3) - put it on cpan for public use

I know I need to get an account and namespace approval and 
upload it but I'm lost as to how to do that/finer points of it.
I know the docs are there but I missed it on cpan. 

Any pointers to documentation/experience on the best way to go from step 2 to being 
able to 
have people find it at search.cpan.org or the Author section, etc... Or install via 
CLI/CPAN 

TIA

Dan


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



Re: lynx, wget, etc and timeouts

2003-08-01 Thread Charles Logan
On Friday 01 August 2003 01:08, John W. Krahn wrote:

> You can use the LWP::UserAgent (or LWP::Simple which uses
> LWP::UserAgent) module which allows you to set a timeout value.
>
> perldoc LWP::UserAgent

Thank you John!  It's certainly nice to be able to ask the gurus!
That's exactly what the doctor ordered!  Works like a champ!

Charles


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



RE: Have Module, Will Travel

2003-08-01 Thread Dan Muey
> It was Friday, August 01, 2003 when Dan Muey took the soap 
> box, saying:
> : Howdy All,
> : I need some input on how to do steps 2.5 and 3 below(or if 
> I'm missing a step):
> : 
> : 1) - make module
> : I have a Module I made that does what I want when I do.
> :  use lib '/home/joe/mama';
> :  use Module;
> : 
> : What I'd like to do is put it on CPAN.
> : 
> : 2) - make the file for it to put on cpan
> : I've been looking at : 
> : http://cpan.org/misc/cpan-faq.html#How_make_bundle
> : To see how to make it ready for cpan 
> : (any other resources, suggestions, etcc on this topic are welcome)
> : 
> : I think I have that down. 
> : That basically makes the one file I upload to cpan right? 
> (for each module and each version of a module)
> 
> Please read 
> http://search.cpan.org/perldoc?> ExtUtils::MakeMaker::Tutorial
> 
> 
> : 2.5) My module uses a 
> couple other modules so:
> : 
> : How can I do step 2 so that, during the 
> : perl Makefile.PL,make, make install dance,
> : it will test to see if they're installed, 
> : if not try to install them and if they can't 
> : be installed tell them to 
> : install them first then stop installtion?
> 
> See the above instruction.
> 
> : 3) - put it on cpan for public use
> : 
> : I know I need to get an account and namespace approval and 
> : upload it but I'm lost as to how to do that/finer points of it.
> : I know the docs are there but I missed it on cpan. 
> 
> Also read this: 
> http://cpan.org/misc/cpan-> faq.html#How_contribute_modules
> 
>   
> Casey West
> 

Thanks Casey that's what I was looking for!

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



Module install

2003-08-01 Thread Dan Muey
Howdy all am I thinking of this corretcly:
According to:
http://search.cpan.org/author/JHI/perl-5.8.0/lib/ExtUtils/MakeMaker.pm#make_test


If I have a file called test.pl it will run that script as teste of the installation.

So if they do by hand:
 perl Makefile.PL # create make file
 make # use Makefile
 make test# runs test.pl
 make install # if I want to install

Now if they leave out make test then they are on their own.
But if I put this in test.pl and it fails then they'll 
see that it failed and know not to go further, right?:

test.pl :
 #!/usr/bin/perl -w 
 use strict;
 eval {
use CGI qw(:standard);
use DBI;
 }; 
 if($@) { print "Error: you are mjissing module you pansy!\n"; }
 else { print "Test Ok\n"; }

So if one of those modules are not installed make test will give them my erro message.

Is that correct?

Or is there a better way to insure any modules it uses are 
installed/try to install them if not/and fail if they can't be found or installed?
Either via the make dance or via CPAN ?

Documentation on this specific subject welcome also, I looked at what others pointed 
me tooo but it didn't address it specifically.

TIA

Dan



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



Re: Module install

2003-08-01 Thread Casey West
It was Friday, August 01, 2003 when Dan Muey took the soap box, saying:
: Howdy all am I thinking of this corretcly:
: According to:
: http://search.cpan.org/author/JHI/perl-5.8.0/lib/ExtUtils/MakeMaker.pm#make_test
: 
: 
: If I have a file called test.pl it will run that script as teste of the installation.
: 
: So if they do by hand:
:  perl Makefile.PL # create make file
:  make # use Makefile
:  make test# runs test.pl
:  make install # if I want to install
: 
: Now if they leave out make test then they are on their own.
: But if I put this in test.pl and it fails then they'll 
: see that it failed and know not to go further, right?:

Yes, but please read http://search.cpan.org/perldoc?Test::Tutorial


  Casey West

-- 
Shooting yourself in the foot with MasPar
You shoot all of your friends' feet simultaneously. 


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



Re: Quick DBI connection

2003-08-01 Thread Rob Dixon

Casey West wrote:
> It was Thursday, July 31, 2003 when Dan Muey took the soap box, saying:
> : If I do
> :
> : use DBI;
> : my $dbh = DBI->connect('DBI:mysql:localhost','user','pass');
> :
> : To connect to the mysql driver the package name is actually DBI::db not DBI.
> :
> : My question is: is it always going to be DBI::db regardless of the driver?
> : I need ot know for some stuff I'm making that uses the name space of $dbh object.
>
> Yep.
>
>   Casey West

Good answer Casey! But messing with a package's name space is not to be
recommended unless you absolutely /have/ to. Won't subclassing do what
you want Dan?

Cheers,

Rob



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



RE: Module install

2003-08-01 Thread Dan Muey
> It was Friday, August 01, 2003 when Dan Muey took the soap 
> box, saying:
> : Howdy all am I thinking of this corretcly:
> : According to:
> : 
> http://search.cpan.org/author/JHI/perl-5.8.0/lib/ExtUtils/Make
Maker.pm#make_test
: 
: 
: If I have a file called test.pl it will run that script as teste of the installation.
: 
: So if they do by hand:
:  perl Makefile.PL # create make file
:  make # use Makefile
:  make test# runs test.pl
:  make install # if I want to install
: 
: Now if they leave out make test then they are on their own.
: But if I put this in test.pl and it fails then they'll 
: see that it failed and know not to go further, right?:

Yes, but please read http://search.cpan.org/perldoc?Test::Tutorial

I sure will Casey, I figured that would work and I also figured their was a better way 
to do it.
Looks like I have plenty to read up on!

Thanks Casey!

Dan

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



RE: Quick DBI connection

2003-08-01 Thread Dan Muey
> > : To connect to the mysql driver the package name is 
> actually DBI::db not DBI.
> > :
> > : My question is: is it always going to be DBI::db 
> regardless of the driver?
> > : I need ot know for some stuff I'm making that uses the 
> name space of $dbh object.
> >
> > Yep.
> >
> >   Casey West
> 
> Good answer Casey! But messing with a package's name space is 
> not to be recommended unless you absolutely /have/ to. Won't 
> subclassing do what you want Dan?

I'm not sure...
What I'm trying to do is two phase:

1) make a function like so:
Test.pl
use DBI;

$dbh->myfunc(...);

 sub DBI::db::myfunc {
my $dbh = shift;
$dbh->do(...
 }

That works great.

2) Next I want to move sub DBI::db::myfunc {} from Test.pl into a module so I can do:

use DBI;
use MYSuperModule; # exporting DBI::db::myfunc {}

$dbh->myfunc(...);

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!

Thanks

Dan

> 
> Cheers,
> 
> Rob

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



Re: nested pattern match

2003-08-01 Thread Raghupathy
Rob and David,

  Thanks very much! That's exactly what I am looking
for and sorry for the misleading subject on the email.


Rob: Could you please explain why you need 2 questions
marks on line#7 instead of just one minimal quantifier
needed  (I hope I am using the right words this time
!!!).

Thanks,
Ramesh

1 while ( $code =~ m{
2\#(ifn?def) \s+ def \s* \n
3(.*?) \s+
4(?:
5\#else \s+ def \s* \n
6(.*?) \s+
7)??   
8\#endif \s+ def \s* \n
9  }isxg ) {

10  my ($def, $undef) = $1 eq 'ifdef' ? ($2, $3 
11  || '') : ($3 || '', $2);

12  printf "  Defined: %s\n", $def;
13  printf "Undefined: %s\n", $undef;
14  print "\n";
}




__
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: Quick DBI connection

2003-08-01 Thread Bob Showalter
Dan Muey wrote:
> > > > To connect to the mysql driver the package name is actually
> > > > DBI::db not DBI. 
> > > > 
> > > > My question is: is it always going to be DBI::db regardless of
> > > > the driver? I need ot know for some stuff I'm making that uses
> > > > the name space of $dbh object. 
> > > 
> > > Yep.
> > > 
> > >   Casey West
> > 
> > Good answer Casey! But messing with a package's name space is
> > not to be recommended unless you absolutely /have/ to. Won't
> > subclassing do what you want Dan?
> 
> I'm not sure...
> What I'm trying to do is two phase:
> 
> 1) make a function like so:
> Test.pl
>   use DBI;
> 
>   $dbh->myfunc(...);
> 
>  sub DBI::db::myfunc {
>   my $dbh = shift;
>   $dbh->do(...
>  }
> 
> That works great.
> 
> 2) Next I want to move sub DBI::db::myfunc {} from Test.pl into a
> module so I can do: 
> 
>   use DBI;
>   use MYSuperModule; # exporting DBI::db::myfunc {}
> 
>   $dbh->myfunc(...);
> 
> 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

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



RE: Quick DBI connection

2003-08-01 Thread Dan Muey
 
> Dan Muey wrote:
> > > > > To connect to the mysql driver the package name is actually 
> > > > > DBI::db not DBI.
> > > > > 
> > > > > My question is: is it always going to be DBI::db 
> regardless of 
> > > > > the driver? I need ot know for some stuff I'm making 
> that uses 
> > > > > the name space of $dbh object.
> > > > 
> > > > Yep.
> > > > 
> > > >   Casey West
> > > 
> > > Good answer Casey! But messing with a package's name 
> space is not to 
> > > be recommended unless you absolutely /have/ to. Won't 
> subclassing do 
> > > what you want Dan?
> > 
> > I'm not sure...
> > What I'm trying to do is two phase:
> > 
> > 1) make a function like so:
> > Test.pl
> > use DBI;
> > 
> > $dbh->myfunc(...);
> > 
> >  sub DBI::db::myfunc {
> > my $dbh = shift;
> > $dbh->do(...
> >  }
> > 
> > That works great.
> > 
> > 2) Next I want to move sub DBI::db::myfunc {} from Test.pl into a 
> > module so I can do:
> > 
> > use DBI;
> > use MYSuperModule; # exporting DBI::db::myfunc {}
> > 
> > $dbh->myfunc(...);
> > 
> > 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

Ah thanks Bob, 
I'll have to digest that sucker this weekend. Thanks

Dan

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



Re: nested pattern match

2003-08-01 Thread Rob Dixon

"Raghupathy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Rob and David,
>
>   Thanks very much! That's exactly what I am looking
> for and sorry for the misleading subject on the email.
>
>
> Rob: Could you please explain why you need 2 questions
> marks on line#7 instead of just one minimal quantifier
> needed  (I hope I am using the right words this time
> !!!).
>
> Thanks,
> Ramesh
>
> 1 while ( $code =~ m{
> 2\#(ifn?def) \s+ def \s* \n
> 3(.*?) \s+
> 4(?:
> 5\#else \s+ def \s* \n
> 6(.*?) \s+
> 7)??
> 8\#endif \s+ def \s* \n
> 9  }isxg ) {
>
> 10  my ($def, $undef) = $1 eq 'ifdef' ? ($2, $3
> 11  || '') : ($3 || '', $2);
>
> 12  printf "  Defined: %s\n", $def;
> 13  printf "Undefined: %s\n", $undef;
> 14  print "\n";
> }

Sure. The first question mark is a quantifier: the same as
{0,1}, meaning 'match one repetition if possible, otherwise
none'. The second is a non-greedy modifier, turning it into
'match no repetitions if possible, otherwise one'.

HTH,

Rob





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



Apache::Session::Mysql

2003-08-01 Thread mmbodji
This may not be the right place, but I would like to see a working example of 
Apache::Session::mysql (session id management). Does anyone has a concrete and 
complete example to share.

Thanks.

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



Re: Regex Help

2003-08-01 Thread ss004b3324
Hi,

I have a number of strings, in the following format:
A deep resonant "ooh-hu" with emphasis on the
first syllable.
from which I wish to extract the following part of the string using a regex:
ooh-hu
I have been trying to no avail - and would very much appreciate some help
with this problem.

TIA,

Shaun
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.505 / Virus Database: 302 - Release Date: 30/07/2003


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