Multiple Page Web-forms, without passing earlier pages values to the next one?

2004-08-04 Thread Sanjay Arora
I am using RH9, postgreSQL and perl5. Is it possible to get users to submit multiple 
page web-forms but not to pass values from one form to the next? I would like to store 
each page to the database server as it is submitted. Also, to build in the process to 
resume the web-form submission at a later time e.g say there are twent pages to submit 
and the user stops feeding the forms at the tenth form. I would like to email the user 
a reminder so he can log back in and start from the eleventh form. Can anyone tell me 
if this sort of thing is implemented anywhere, so I can study it. Or, can anyone 
provide me pointers on how to do it or links for the same? What modules would I 
require or what type of logic is generally required.

Any help will be greatly appreciated.

With best regards.
Sanjay.



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




Choosing only numbers from the output

2004-08-04 Thread sudhindra k s
  
Hi

I have an output which looks like this:

Tag   : Result
146603:
147020:  
147155: NONE 
147160:
147232:
147243:  
147254: none 
147318:
147341: NONE 
147430: N/A 
147708:
147710:  
147729:  
147768:  
147851:
147921:
147949:  
147981:  
147983:  
147991:
148007:  
148080:  
148105:
148200:
148312: 38160 
148329: 44139 
148444: NONE 
148514:  
148573:  
148697:
148759:  
148919:
148920:
148921:
148923:
148924:
148933:
148934:
148935:
148936:
148937:
148938:
148939:
148951:
148996:

Now i want to gather all the "Tags" for which the "Result" is a number (but shouldnt 
include the tag if the result is 0). The corresponding Result should go to another 
array. 

Considering the above example my array1 should contain 148312 and 148329 and array2 
should contain 38160 and 44139 

How do i do this?

Thanks in advance

Regards
Sudhindra















Re: Choosing only numbers from the output

2004-08-04 Thread Gunnar Hjalmarsson
Sudhindra K S wrote:
I have an output which looks like this:
Do you possibly mean input? ;-)
Tag   : Result
148200:
148312: 38160
148329: 44139
148444: NONE
148514:
148573: 
148697:

Now i want to gather all the "Tags" for which the "Result" is a
number (but shouldnt include the tag if the result is 0). The
corresponding Result should go to another array.
Considering the above example my array1 should contain 148312 and
148329 and array2 should contain 38160 and 44139
How do i do this?
while () {
my ($tag, $result) = split /[ :]+/;
if ($result =~ /^\d+$/ and $result > 0) {
...
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

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



Re: Choosing only numbers from the output

2004-08-04 Thread John W. Krahn
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
sudhindra k s wrote:
|
| Hi
Hello,
| I have an output which looks like this:
|
| Tag   : Result
| 146603:
| 147020:
| 147155: NONE
| 147160:
| 147232:
| 147243:
| 147254: none
| 147318:
| 147341: NONE
| 147430: N/A
| 147708:
| 147710: 
| 147729:
| 147768:
| 147851:
| 147921:
| 147949: 
| 147981:
| 147983:
| 147991:
| 148007: 
| 148080:
| 148105:
| 148200:
| 148312: 38160
| 148329: 44139
| 148444: NONE
| 148514:
| 148573: 
| 148697:
| 148759:
| 148919:
| 148920:
| 148921:
| 148923:
| 148924:
| 148933:
| 148934:
| 148935:
| 148936:
| 148937:
| 148938:
| 148939:
| 148951:
| 148996:
|
| Now i want to gather all the "Tags" for which the "Result" is a number (but shouldnt 
include the tag if the result is 0). The corresponding Result should go to another array.
|
| Considering the above example my array1 should contain 148312 and 148329 and array2 
should contain 38160 and 44139
|
| How do i do this?
I would use an array of arrays or an array of hashes instead of two
separate arrays.
my @tag_and_results;
while (  ) {
~next unless /^(\d+)\D+([1-9]\d*)/;
~push @tag_and_results, [ $1, $2 ];
~}

John
- --
use Perl;
program
fulfillment
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFBEMgW5dGfmBZ1ssARAmiKAJ43Qy6ysZoUR/GURjurXf4FMlVNCACfSn/J
VQZ4Wxrgr9T6J7zbLXJDOPM=
=C2SM
-END PGP SIGNATURE-
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Browsing a site and checking/posting webmail using perl...

2004-08-04 Thread Chris Devers
On Wed, 4 Aug 2004, Sanjay Arora wrote:
I am using RH9, postgreSQL and perl5. I would like to get my system to 
automatically visit a site, go to the login url, login, browse to the 
mail/messages link and get the messages one by one and save them in a 
postgreSQL database.
Okay. Do you have any code do do any of this?
If not, take a look at the CPAN modules DBI (you should already have 
this), DBD::Pg (the PostgreSQL database driver), and LWP (available most 
easily in cpan as Bundle::LWP). Also, WWW::Mechanize might be useful. 
For sending mail there's many options, but Mail::Simple might be easy.

Get these installed using the CPAN shell, then look over the docs & try 
some starter code. If you hit any stumbling blocks, let the list know.

I would like to do this with multiple sites. Is this possible with 
perl? What modules do I need? Are any readymade scripts that can be 
adapted to my needs available?
Yes this is all possible, and done regularly by many people. The catch 
is that everyone who does this has slightly different needs, so code for 
doing all of this may not be available in one place. So, like I say, 
look over the documentation for these modules and try some code to do 
aspects of your project, and then start plugging it all together.


--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Mr. Lucky'
 by Henry Mancini
 from 'The Best Of Mancini'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: Choosing only numbers from the output

2004-08-04 Thread Yacketta, Ronald
One way would be to split each line using : as the delimiter.. 

I am sure there are others, but I think split would be the easiest... IMHO



From: sudhindra k s
Sent: Wed 8/4/2004 5:48 AM
To: [EMAIL PROTECTED]
Subject: Choosing only numbers from the output


  
Hi

I have an output which looks like this:

Tag   : Result
146603:
147020:  
147155: NONE 
147160:
147232:
147243:  
147254: none 
147318:
147341: NONE 
147430: N/A 
147708:
147710:  
147729:  
147768:  
147851:
147921:
147949:  
147981:  
147983:  
147991:
148007:  
148080:  
148105:
148200:
148312: 38160 
148329: 44139 
148444: NONE 
148514:  
148573:  
148697:
148759:  
148919:
148920:
148921:
148923:
148924:
148933:
148934:
148935:
148936:
148937:
148938:
148939:
148951:
148996:

Now i want to gather all the "Tags" for which the "Result" is a number (but shouldnt 
include the tag if the result is 0). The corresponding Result should go to another 
array. 

Considering the above example my array1 should contain 148312 and 148329 and array2 
should contain 38160 and 44139 

How do i do this?

Thanks in advance

Regards
Sudhindra


Re: finding out what is uninitialized

2004-08-04 Thread Tim McGeary
Thank you, Charles.  I appreciate that!  Just by reading through your 
re-write, I'm learning a bunch more!

Tim
Tim McGeary
Senior Library Systems Specialist
Lehigh University
610-758-4998
[EMAIL PROTECTED]

Charles K. Clarkson wrote:
From: Tim McGeary  wrote:
: I don't get any errors either with the sample.pl and
: sample files.  So I wonder if the data is bad in the
: middle of the file.  I guess that has to be it since
: I get the errors with sample.pl and the full data file.
: 
: What is the best way to redirect that bad data to a
: different file or array?

The @fund_array array doesn't contain information
about the raw data used to create it. For that reason,
it would be difficult to report the raw data while
manipulating @fund_array without changing its structure.
Here's a rewrite of sample.pl. It does the same
thing you were doing without the arrays. It is not
exactly the same output. I left the trailing pipe off
the end of each record. It is uncommon for it to be
there.
You should be able to find the line number of
sample.txt from the uninitialized error you are
receiving. I unsuccessfully tried to reproduce your
error by corrupting the data myself. Let us know if
you find the error in your data.
HTH,
Charles K. Clarkson

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



E-mail Parsing

2004-08-04 Thread Marcos . Rebelo
I'm have a email in a text file. From this file I would like to get the
sender information, the attached files and the body of the e-mail.

Is there something simple to do this?

Marcos

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




Re: Choosing only numbers from the output

2004-08-04 Thread Zeus Odin
I think a hash is more apt for this problem, but changing to (an) array(s)
is not difficult at all.

The data as posted had white space trailing some of the digits after the
colons. I found this worked better for me. Your results may vary.
;-)

#!/usr/bin/perl
use warnings;
use strict;

my %tag;

while () {
  /^(\d+)\s*:\s*(\d+)/ or next;
  $tag { $1 } = $2 unless $2 =~ /^0+$/;
}
 while ( my($k, $v) = each %tag ) { print "$k ==> $v\n"; }

__DATA__
146603:
147020:
147155: NONE
.
.
.


"Gunnar Hjalmarsson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

>  while () {
>  my ($tag, $result) = split /[ :]+/;
>  if ($result =~ /^\d+$/ and $result > 0) {
>  ...



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




DBI Install

2004-08-04 Thread Witzke, Rob

I am trying to install DBI on a Sun Solaris box but am running into problems.

When I run the make program, I get the following message:
DEVELOP 59% perl Makefile.PL
*** Note:
The optional PlRPC-modules (RPC::PlServer etc) are not installed.
If you want to use the DBD::Proxy driver and DBI::ProxyServer
modules, then you'll need to install the RPC::PlServer, RPC::PlClient,
Storable and Net::Daemon modules. The CPAN Bundle::DBI may help you.
You can install them any time after installing the DBI.
You do *not* need these modules for typical DBI usage.

Optional modules are available from any CPAN mirror, in particular
http://search.cpan.org/
http://www.perl.com/CPAN/modules/by-module
http://www.perl.org/CPAN/modules/by-module
ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module

Creating extra DBI::PurePerl test: t/zz_01basics_pp.t 
Creating extra DBI::PurePerl test: t/zz_02dbidrv_pp.t 
Creating extra DBI::PurePerl test: t/zz_03handle_pp.t 
Creating extra DBI::PurePerl test: t/zz_04mods_pp.t 
Creating extra DBI::PurePerl test: t/zz_05thrclone_pp.t 
Creating extra DBI::PurePerl test: t/zz_06attrs_pp.t 
Creating extra DBI::PurePerl test: t/zz_07kids_pp.t 
Creating extra DBI::PurePerl test: t/zz_08keeperr_pp.t 
Creating extra DBI::PurePerl test: t/zz_09trace_pp.t 
Creating extra DBI::PurePerl test: t/zz_10examp_pp.t 
Creating extra DBI::PurePerl test: t/zz_15array_pp.t 
Creating extra DBI::PurePerl test: t/zz_20meta_pp.t 
Creating extra DBI::PurePerl test: t/zz_30subclass_pp.t 
Creating extra DBI::PurePerl test: t/zz_40profile_pp.t 
Creating extra DBI::PurePerl test: t/zz_41prof_dump_pp.t 
Creating extra DBI::PurePerl test: t/zz_42prof_data_pp.t 
Creating extra DBI::PurePerl test: t/zz_50dbm_pp.t 
Creating extra DBI::PurePerl test: t/zz_60preparse_pp.t 
Creating extra DBI::PurePerl test: t/zz_80proxy_pp.t 
Checking if your kit is complete...
Looks good

I see you're using perl 5.008 on sun4-solaris, okay.
Remember to actually *read* the README file!
Use  'make' to build the software (dmake or nmake on Windows).
Then 'make test' to execute self tests.
Then 'make install' to install the DBI and then delete this working
directory before unpacking and building any DBD::* drivers.

Writing Makefile for DBI

DEVELOP 61% make
cp Changes blib/lib/DBI/Changes.pm
cp dbivport.h blib/arch/auto/DBI/dbivport.h
cp dbd_xsh.h blib/arch/auto/DBI/dbd_xsh.h
cp lib/DBI/FAQ.pm blib/lib/DBI/FAQ.pm
cp Driver_xst.h blib/arch/auto/DBI/Driver_xst.h
cp lib/DBI/SQL/Nano.pm blib/lib/DBI/SQL/Nano.pm
cp lib/DBD/DBM.pm blib/lib/DBD/DBM.pm
cp DBI.pm blib/lib/DBI.pm
cp lib/DBD/Proxy.pm blib/lib/DBD/Proxy.pm
cp lib/DBI/Const/GetInfo/ANSI.pm blib/lib/DBI/Const/GetInfo/ANSI.pm
cp DBIXS.h blib/arch/auto/DBI/DBIXS.h
cp lib/DBI/Const/GetInfoReturn.pm blib/lib/DBI/Const/GetInfoReturn.pm
cp lib/DBD/Sponge.pm blib/lib/DBD/Sponge.pm
cp lib/DBI/Const/GetInfoType.pm blib/lib/DBI/Const/GetInfoType.pm
cp lib/DBI/DBD/Metadata.pm blib/lib/DBI/DBD/Metadata.pm
cp lib/DBI/W32ODBC.pm blib/lib/DBI/W32ODBC.pm
cp lib/Bundle/DBI.pm blib/lib/Bundle/DBI.pm
cp lib/DBI/Const/GetInfo/ODBC.pm blib/lib/DBI/Const/GetInfo/ODBC.pm
cp lib/DBI/ProfileDumper/Apache.pm blib/lib/DBI/ProfileDumper/Apache.pm
cp lib/DBI/Profile.pm blib/lib/DBI/Profile.pm
cp Driver.xst blib/arch/auto/DBI/Driver.xst
cp lib/DBD/File.pm blib/lib/DBD/File.pm
cp lib/DBI/ProfileDumper.pm blib/lib/DBI/ProfileDumper.pm
cp dbipport.h blib/arch/auto/DBI/dbipport.h
cp lib/DBD/NullP.pm blib/lib/DBD/NullP.pm
cp lib/DBI/DBD.pm blib/lib/DBI/DBD.pm
cp lib/DBI/ProxyServer.pm blib/lib/DBI/ProxyServer.pm
cp lib/Win32/DBIODBC.pm blib/lib/Win32/DBIODBC.pm
cp dbi_sql.h blib/arch/auto/DBI/dbi_sql.h
cp lib/DBD/ExampleP.pm blib/lib/DBD/ExampleP.pm
cp lib/DBI/PurePerl.pm blib/lib/DBI/PurePerl.pm
cp lib/DBI/ProfileData.pm blib/lib/DBI/ProfileData.pm
/s/sirsi/Unicorn/Bin/perl -p -e "s/~DRIVER~/Perl/g" blib/arch/auto/DBI/Driver.xst > 
Perl.xsi
/s/sirsi/Unicorn/Bin/perl /usr/local/sirsi/lib/perl5/5.8.0/ExtUtils/xsubpp  -typemap 
/usr/local/sirsi/lib/perl5/5.8.0/ExtUtils/typemap -typemap typemap  Perl.xs > Perl.xsc 
&& mv Perl.xsc Perl.c
/opt/SUNWspro/bin/cc -c   -I/usr/local/include -O   -DVERSION=\"1.42\" 
-DXS_VERSION=\"1.42\" -KPIC "-I/usr/local/sirsi/lib/perl5/5.8.0/sun4-solaris/CORE"  
-DDBI_NO_THREADS Perl.c
/bin/sh: /opt/SUNWspro/bin/cc: not found
make: *** [Perl.o] Error 1

The message said that I had perl version 5.008 installed but I actuall have the 
following:

DEVELOP 66% perl -v

This is perl, v5.8.0 built for sun4-solaris

Any help would be greatly appreciated.

Rob

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




Re: Browsing a site and checking/posting webmail using perl...

2004-08-04 Thread Sanjay Arora
Thanks for the tips, Chris. Ill start looking at the documentation of
the code you pointed.

On Wed, 2004-08-04 at 17:14, Chris Devers wrote:
> On Wed, 4 Aug 2004, Sanjay Arora wrote:
> 
> > I am using RH9, postgreSQL and perl5. I would like to get my system to 
> > automatically visit a site, go to the login url, login, browse to the 
> > mail/messages link and get the messages one by one and save them in a 
> > postgreSQL database.
> 
> Okay. Do you have any code do do any of this?
> 
> If not, take a look at the CPAN modules DBI (you should already have 
> this), DBD::Pg (the PostgreSQL database driver), and LWP (available most 
> easily in cpan as Bundle::LWP). Also, WWW::Mechanize might be useful. 
> For sending mail there's many options, but Mail::Simple might be easy.
> 
BTW, its not SMTP mail I want, its webmail of the particular web-sites.
If you have any seperate pointers for this, please let me know.

> Get these installed using the CPAN shell, then look over the docs & try 
> some starter code. If you hit any stumbling blocks, let the list know.
> 
> > I would like to do this with multiple sites. Is this possible with 
> > perl? What modules do I need? Are any readymade scripts that can be 
> > adapted to my needs available?
> 
> Yes this is all possible, and done regularly by many people. The catch 
> is that everyone who does this has slightly different needs, so code for 
> doing all of this may not be available in one place. So, like I say, 
> look over the documentation for these modules and try some code to do 
> aspects of your project, and then start plugging it all together.
> 
If you know of any pieces of code, you mentioned as being scattered on
the net, please let me know, if its not too much of any effort. You see
I am newbie at perl. In fact, I code with books open in front of me and
couple of helping web-site tutorials open on my screenreferring to
them every two minutes. Understanding how somebody has done something
for another website will go a long way for my coding effort. IAC, I am
talking before I have even startedguess its my nervousness as a
newbie speaking.

Ill start looking at the documentation you mentioned and revert to the
list, in case I have any problems.

Thanks again.

With best regards.
Sanjay.



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




Re: Browsing a site and checking/posting webmail using perl...

2004-08-04 Thread Chris Devers
Sanjay -- please direct all replies to the list, not me directly.
On Wed, 4 Aug 2004, Sanjay Arora wrote:
On Wed, 2004-08-04 at 17:14, Chris Devers wrote:
On Wed, 4 Aug 2004, Sanjay Arora wrote:

BTW, its not SMTP mail I want, its webmail of the particular 
web-sites. If you have any seperate pointers for this, please let me 
know.
Nothing comes to mind, sorry. If it's (say) hotmail or yahoo that you 
want, there may be code out there, but I don't know where. Also, 
anything that gets information this way is a "screen scraper", which is 
to say that the next time the webmail provider changes their interface, 
any software that tries to work with their site is probably going to 
break. If it's possible to get at the same mail some other way -- via 
POP or IMAP -- that's almost definitely going to be more reliable.

If you know of any pieces of code, you mentioned as being scattered on 
the net, please let me know, if its not too much of any effort.
Sorry, I don't have any at hand. Like I say, this sort of thing is done 
often, but everyone writing such a system has different requirements so 
the particulars become significant.

I suspect that you'll be much better off by breaking your project down 
into simpler components -- store & retrieve information from the 
database, get & post information to & from web sites, etc -- and then 
once you have these working, try to get them going in tandem.

This will, almost as a side effect, get you writing nice, reusable, 
modular, easy to maintain code.

Let the list know if you have more specific questions. :)

--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Timothy'
 by Henry Mancini
 from 'The Best Of Mancini'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: DBI Install

2004-08-04 Thread NYIMI Jose \(BMB\)


> -Original Message-
> From: Witzke, Rob [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 04, 2004 3:30 PM
> To: [EMAIL PROTECTED]
> Subject: DBI Install
> 
> ...
> /bin/sh: /opt/SUNWspro/bin/cc: not found
> make: *** [Perl.o] Error 1

Your compiler was not found ...

José.



 DISCLAIMER 

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

Thank you for your cooperation.

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


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




Re: DBI Install

2004-08-04 Thread Chris Devers
On Wed, 4 Aug 2004, Witzke, Rob wrote:
I am trying to install DBI on a Sun Solaris box but am running into 
problems.
Have you tried using the CPAN shell? If you have it available, it's 
*much* easier than the way you're trying it.

$ sudo perl -MCPAN -e shell
cpan shell -- CPAN exploration and modules installation (v1.76)
ReadLine support enabled
cpan> install DBI
And you're done.
Actually, that's a gentle lie -- if you haven't used the CPAN shell 
before, you'll be asked a series of configuration questions before you 
get to the 'cpan>' prompt, but most of them are straightforward and you 
can usually just accept the defaults.

Once you're done setting up the shell, you get the 'cpan>' prompt and 
from there it's one line to install any module: "install My::Module".

That said...
/opt/SUNWspro/bin/cc -c   -I/usr/local/include -O   -DVERSION=\"1.42\" -DXS_VERSION=\"1.42\" 
-KPIC "-I/usr/local/sirsi/lib/perl5/5.8.0/sun4-solaris/CORE"  -DDBI_NO_THREADS Perl.c
/bin/sh: /opt/SUNWspro/bin/cc: not found
make: *** [Perl.o] Error 1
...do you actually have a C compiler at /opt/SUNWspro/bin/cc ?
The message said that I had perl version 5.008 installed but I actuall 
have the following:

DEVELOP 66% perl -v
This is perl, v5.8.0 built for sun4-solaris
Perl 5.008 *is* 5.8.0.
The reasons for this are old & boring, but basically Perl 5 just kept 
having micro .00x releases for a few years before people got around to 
making the numbers more sensible by masking over a couple of the zeroes. 
Hence, 5.006x is 5.6.x, and 5.8.x is 5.008x. You're more likely to see 
the version represented as 5.x.y these days, but some things will still 
present it as 5.00xy like it used to be. Don't worry about it.


--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Moon River'
 by Henry Mancini
 from 'The Best Of Mancini'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: DBI Install

2004-08-04 Thread Witzke, Rob
Well, it seems that I don't have a c compiler loaded.  (I thought that I did)

Is is possible to get the DBI stuff pre-compiled?

Where can I get the CPAN shell?  I looked for it on the CPAN web site but I don't see 
it.
If I do find it, will it do any good without a C compiler?

Rob

-Original Message-
From: Chris Devers [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 04, 2004 9:53 AM
To: Witzke, Rob
Cc: [EMAIL PROTECTED]
Subject: Re: DBI Install


On Wed, 4 Aug 2004, Witzke, Rob wrote:

> I am trying to install DBI on a Sun Solaris box but am running into 
> problems.

Have you tried using the CPAN shell? If you have it available, it's 
*much* easier than the way you're trying it.

 $ sudo perl -MCPAN -e shell

 cpan shell -- CPAN exploration and modules installation (v1.76)
 ReadLine support enabled

 cpan> install DBI

And you're done.

Actually, that's a gentle lie -- if you haven't used the CPAN shell 
before, you'll be asked a series of configuration questions before you 
get to the 'cpan>' prompt, but most of them are straightforward and you 
can usually just accept the defaults.

Once you're done setting up the shell, you get the 'cpan>' prompt and 
from there it's one line to install any module: "install My::Module".

That said...

> /opt/SUNWspro/bin/cc -c   -I/usr/local/include -O   -DVERSION=\"1.42\" 
> -DXS_VERSION=\"1.42\" -KPIC "-I/usr/local/sirsi/lib/perl5/5.8.0/sun4-solaris/CORE"  
> -DDBI_NO_THREADS Perl.c
> /bin/sh: /opt/SUNWspro/bin/cc: not found
> make: *** [Perl.o] Error 1

...do you actually have a C compiler at /opt/SUNWspro/bin/cc ?

> The message said that I had perl version 5.008 installed but I actuall 
> have the following:
>
> DEVELOP 66% perl -v
>
> This is perl, v5.8.0 built for sun4-solaris

Perl 5.008 *is* 5.8.0.

The reasons for this are old & boring, but basically Perl 5 just kept 
having micro .00x releases for a few years before people got around to 
making the numbers more sensible by masking over a couple of the zeroes. 
Hence, 5.006x is 5.6.x, and 5.8.x is 5.008x. You're more likely to see 
the version represented as 5.x.y these days, but some things will still 
present it as 5.00xy like it used to be. Don't worry about it.



-- 
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/

np: 'Moon River'
  by Henry Mancini
  from 'The Best Of Mancini'

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




Re: E-mail Parsing

2004-08-04 Thread Wiggins d Anconia
> I'm have a email in a text file. From this file I would like to get the
> sender information, the attached files and the body of the e-mail.
> 
> Is there something simple to do this?
> 
> Marcos
> 

Check out the MIME::Parser or Mail::Box modules from CPAN. There are
others probably but these two I have used.

http://danconia.org

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




RE: DBI Install

2004-08-04 Thread Witzke, Rob
Chris,

Thank you very much for you help.

I ran your command $ perl -MDBI -e '1' and got no results so I guess that is a good 
thing.

I will be looking into getting a c compiler.  Any suggestions?

Rob

-Original Message-
From: Chris Devers [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 04, 2004 10:29 AM
To: Witzke, Rob
Cc: PerlBeginners (E-mail)
Subject: RE: DBI Install


On Wed, 4 Aug 2004, Witzke, Rob wrote:

> Well, it seems that I don't have a c compiler loaded.  (I thought that 
> I did)

That'll slow you down :-)

> Is is possible to get the DBI stuff pre-compiled?

Maybe, but DBI is often available with Perl itself. Have you verified 
that you don't already have it? What happens if you run this:

 $ perl -MDBI -e '1'
 $

You should get no output, no errors, if it's installed. If you don't 
have it, you should get something like this:

 $ perl -MFictionalModule -e '1'
 Can't locate FictionalModule.pm in @INC (@INC contains:
 /System/Library/Perl/5.8.1/darwin-thread-multi-2level
 /System/Library/Perl/5.8.1
 /Library/Perl/5.8.1/darwin-thread-multi-2level /Library/Perl/5.8.1
 /Library/Perl /Network/Library/Perl/5.8.1/darwin-thread-multi-2level
 /Network/Library/Perl/5.8.1 /Network/Library/Perl .).
 BEGIN failed--compilation aborted.
 $

The paths will be different, but the error will be similar.

> Where can I get the CPAN shell?  I looked for it on the CPAN web site 
> but I don't see it. If I do find it, will it do any good without a C 
> compiler?

Again, it's frequently available with recent versions of Perl -- you 
mentioned 5.8.0, which really ought to have it by default. Try this:

 $ perl -MCPAN -e '1'

If that gives no errors, you've got it -- run it by doing a

 $ perl -MCPAN -e 'shell'

As noted before, you have to set it up the first time, but after that it 
should Just Work.


Note though that a lot of CPAN modules depend on a C compiler, and using 
the CPAN shell doesn't get you around that requirement. The CPAN shell 
just automates the process of finding, downloading, building, testing, 
and installing modules, but if you're missing the system tools needed to 
do any of those steps -- such as a C compiler -- then CPAN can't help.


-- 
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/

np: 'Baby Elephant Walk'
  by Henry Mancini
  from 'The Best Of Mancini'

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




C Compiler

2004-08-04 Thread Witzke, Rob
Any recommendations on a c compiler to run on a Sun Sparc box?

Rob

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




Re: finding out what is uninitialized

2004-08-04 Thread Tim McGeary
A little merging of this new sample file and my whole file and it works 
like a charm!  Thank you all for teaching me some new tricks.  I'm 
happier with perl now.  :)  Special thanks to Charles.

Tim
Tim McGeary
Senior Library Systems Specialist
Lehigh University
610-758-4998
[EMAIL PROTECTED]

Charles K. Clarkson wrote:
From: Tim McGeary  wrote:
: I don't get any errors either with the sample.pl and
: sample files.  So I wonder if the data is bad in the
: middle of the file.  I guess that has to be it since
: I get the errors with sample.pl and the full data file.
: 
: What is the best way to redirect that bad data to a
: different file or array?

The @fund_array array doesn't contain information
about the raw data used to create it. For that reason,
it would be difficult to report the raw data while
manipulating @fund_array without changing its structure.
Here's a rewrite of sample.pl. It does the same
thing you were doing without the arrays. It is not
exactly the same output. I left the trailing pipe off
the end of each record. It is uncommon for it to be
there.
You should be able to find the line number of
sample.txt from the uninitialized error you are
receiving. I unsuccessfully tried to reproduce your
error by corrupting the data myself. Let us know if
you find the error in your data.
HTH,
Charles K. Clarkson

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



RE: DBI Install

2004-08-04 Thread Chris Devers
On Wed, 4 Aug 2004, Witzke, Rob wrote:
Well, it seems that I don't have a c compiler loaded.  (I thought that 
I did)
That'll slow you down :-)
Is is possible to get the DBI stuff pre-compiled?
Maybe, but DBI is often available with Perl itself. Have you verified 
that you don't already have it? What happens if you run this:

$ perl -MDBI -e '1'
$
You should get no output, no errors, if it's installed. If you don't 
have it, you should get something like this:

$ perl -MFictionalModule -e '1'
Can't locate FictionalModule.pm in @INC (@INC contains:
/System/Library/Perl/5.8.1/darwin-thread-multi-2level
/System/Library/Perl/5.8.1
/Library/Perl/5.8.1/darwin-thread-multi-2level /Library/Perl/5.8.1
/Library/Perl /Network/Library/Perl/5.8.1/darwin-thread-multi-2level
/Network/Library/Perl/5.8.1 /Network/Library/Perl .).
BEGIN failed--compilation aborted.
$
The paths will be different, but the error will be similar.
Where can I get the CPAN shell?  I looked for it on the CPAN web site 
but I don't see it. If I do find it, will it do any good without a C 
compiler?
Again, it's frequently available with recent versions of Perl -- you 
mentioned 5.8.0, which really ought to have it by default. Try this:

$ perl -MCPAN -e '1'
If that gives no errors, you've got it -- run it by doing a
$ perl -MCPAN -e 'shell'
As noted before, you have to set it up the first time, but after that it 
should Just Work.

Note though that a lot of CPAN modules depend on a C compiler, and using 
the CPAN shell doesn't get you around that requirement. The CPAN shell 
just automates the process of finding, downloading, building, testing, 
and installing modules, but if you're missing the system tools needed to 
do any of those steps -- such as a C compiler -- then CPAN can't help.

--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Baby Elephant Walk'
 by Henry Mancini
 from 'The Best Of Mancini'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: C Compiler

2004-08-04 Thread Wiggins d Anconia
> Any recommendations on a c compiler to run on a Sun Sparc box?
> 
> Rob
> 

This has what to do with Perl?

http://gcc.gnu.org/

http://danconia.org

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




RE: C Compiler

2004-08-04 Thread West, William M

>
>Any recommendations on a c compiler to run on a Sun Sparc box?
>
>Rob


this is bordering on off-topic, but since a compiler is useful
for certain Perl modules, 

 go get gcc

http://gcc.gnu.org/install/binaries.html


this is a page to get gcc when you can't compile it yourself.  now, i didn't
see sparc mentioned on the page- wasn't looking too terribly hard.


good luck 

:)


willy


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




RE: C Compiler

2004-08-04 Thread Bliss, Kevin
 gcc, it is available as a solaris package at sunfreeware.com

-Original Message-
From: Witzke, Rob [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 04, 2004 7:24 AM
To: PerlBeginners (E-mail)
Subject: C Compiler

Any recommendations on a c compiler to run on a Sun Sparc box?

Rob

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







--

This email is confidential and may be legally privileged.

It is intended solely for the addressee. Access to this email by anyone else, unless 
expressly approved by the sender or an authorized addressee, is unauthorized.

If you are not the intended recipient, any disclosure, copying, distribution or any 
action omitted or taken in reliance on it, is prohibited and may be unlawful. If you 
believe that you have received this email in error, please contact the sender, delete 
this e-mail and destroy all copies.

==


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




RE: C Compiler

2004-08-04 Thread NYIMI Jose \(BMB\)


> -Original Message-
> From: Witzke, Rob [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 04, 2004 4:24 PM
> To: PerlBeginners (E-mail)
> Subject: C Compiler
> 
> 
> Any recommendations on a c compiler to run on a Sun Sparc box?
> 
> Rob

Have a look to DBI FAQs
http://dev.isystek.com/dbi/fom-serve/cache/12.html
From
http://dbi.perl.org

HTH,

José.




 DISCLAIMER 

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

Thank you for your cooperation.

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


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




testing for end-of-file

2004-08-04 Thread james derry
hi, all,
the answer to my question in probably obvious to all but me, but i don't 
know how to test for end-of-file. basically, i want the conditional to 
test TRUE if $lineCounter eq $lineLength OR the end-of-file has been 
reached. i can't find how do this in my learning perl or the perl faqs 
i've looked through.

   if ($lineCounter == $lineLength || EOF){do something;}
thanks,
james
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: DBI Install

2004-08-04 Thread NYIMI Jose \(BMB\)
> -Original Message-
> From: Witzke, Rob [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 04, 2004 4:32 PM
> To: Chris Devers
> Cc: PerlBeginners (E-mail)
> Subject: RE: DBI Install
> 
> 
> Chris,
> 
> Thank you very much for you help.
> 
> I ran your command $ perl -MDBI -e '1' and got no results so 
> I guess that is a good thing.
> 
> I will be looking into getting a c compiler.  Any suggestions?

Have a look to DBI FAQs
http://dev.isystek.com/dbi/fom-serve/cache/12.html
From
http://dbi.perl.org

HTH,

José.


 DISCLAIMER 

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

Thank you for your cooperation.

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


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




RE: C Compiler

2004-08-04 Thread Witzke, Rob
It has a lot to do with perl if your modules can't install without it.

-Original Message-
From: Wiggins d Anconia [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 04, 2004 10:55 AM
To: Witzke, Rob; PerlBeginners (E-mail)
Subject: Re: C Compiler


> Any recommendations on a c compiler to run on a Sun Sparc box?
> 
> Rob
> 

This has what to do with Perl?

http://gcc.gnu.org/

http://danconia.org

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




Re: testing for end-of-file

2004-08-04 Thread James Edward Gray II
On Aug 4, 2004, at 9:57 AM, james derry wrote:
hi, all,
the answer to my question in probably obvious to all but me, but i 
don't know how to test for end-of-file. basically, i want the 
conditional to test TRUE if $lineCounter eq $lineLength OR the 
end-of-file has been reached. i can't find how do this in my learning 
perl or the perl faqs i've looked through.

   if ($lineCounter == $lineLength || EOF){do something;}
Perl has an eof() routine.  Just replace the EOF above with eof.
Are you sure you need this though?  Perl generally handles this kind of 
thing for us, with the proper setup:

while (my $line = ) {	# will be false when we've read all 
lines
	# work with each line in $line here...
}

Hope that helps.
James
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: finding Makefiles which containing a backslash continuation character where the next line is blank or whitespace

2004-08-04 Thread Ken Wolcott
John;

  Thank you very much for the help...works like a charm...now I'll try
to study it carefully to understand how to use this the next time I need
something like this...

Cool...

Ken Wolcott

On Tue, 2004-08-03 at 20:20, John W. Krahn wrote:
> Ken Wolcott wrote:
> > Hi;
> 
> Hello,
> 
> >   I need to find Makefiles that contain a backslash line continuation
> > character followed by a blank (or whitespace only) line.  I tried a
> > regular expression first but just couldn't get it right.  I then tried
> > comparing by a pair of strings, but that isn't right either.
> > 
> > [snip code]
> 
> This will do what you want:
> 
> #!/usr/bin/perl
> use strict;
> use diagnostics;
> 
> while ( <> ) {
>  my $line_num = $.;
>  if ( /\\\s*$/ ) {
>  my $line_before;
>  if ( ( $line_before = <> ) =~ /^\s*$/ ) {
>  print "$ARGV has a backslash continuation to a following blank line at 
> line $line_num\n";
>  }
>  else {
>  $_ = $line_before;
>  redo;
>  }
>  }
>  }
> 
> __END__
> 
> 
> 
> John
> -- 
> use Perl;
> program
> fulfillment


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




RE: DBI Install

2004-08-04 Thread Johnson, Shaunn
--howdy:

--wouldn't it be better if you went to http://www.sunfreeware.com
--and snagged a compiler (gcc works, i believe) - i'm sure you'll use it
--for other stuff in the future anyways ...

--*shrug*

--just my $0.02 cents ...

-X


-Original Message-
From: Witzke, Rob [mailto:[EMAIL PROTECTED]



Well, it seems that I don't have a c compiler loaded.  (I 
thought that I did)

Is is possible to get the DBI stuff pre-compiled?

Where can I get the CPAN shell?  I looked for it on the CPAN 
web site but I don't see it.
If I do find it, will it do any good without a C compiler?

[snip]


RE: DBI Install

2004-08-04 Thread Chris Devers
On Wed, 4 Aug 2004, Witzke, Rob wrote:
I ran your command $ perl -MDBI -e '1' and got no results so I guess 
that is a good thing.
Yeah, that means you already have DBI.
Now you just need DBD drivers for the database[s] you need.
I will be looking into getting a c compiler.  Any suggestions?
GCC is probably a good bet if Sun doesn't make one of their own 
available. As someone else noted, try 
for things like this.

--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Experiment In Terror'
 by Henry Mancini
 from 'The Best Of Mancini'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: DBI Install

2004-08-04 Thread Bob Showalter
Witzke, Rob wrote:
> Well, it seems that I don't have a c compiler loaded.  (I thought
> that I did) 

As others have pointed out, you need a C compiler to install some modules.

However, I'm pretty sure you can't just "grab gcc" and start installing DBI.
You need to build modules with the same compiler that Perl was built with.
If you don't have that compiler, best be would be to a) get gcc, b) rebuild
Perl itself with gcc, c) then build DBI and other modules.

I may be wrong about this, so somebody correct me if I am.

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




use vs. require in modules

2004-08-04 Thread Christopher J. Bottaro
i have 4 packages:

PackageA
use IO::File;
require My::Utils::Reader

PackageB
use IO::File;
use XML::Writer;

My::Utils::Reader
use My::Utils;

My::Utils
use Exporter;

in my perl program, i dynamically load PackageA and PackageB like this:

eval("require $package_name1");
eval("require $package_name2");

my question is why does PackageA have to "require My::Utils::Reader" instead
of "use My::Utils::Reader"?  PackageB dynamically loads fine and it "uses"
other packages.  in fact, every package i list here uses "use" instead of
require.  why is there an exception for PackageA and "require
My::Utils::Reader"?

thanks for the help.


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




RE: DBI Install

2004-08-04 Thread Witzke, Rob
Unfortunately, this does indeed seem to be the case and I can't rebuild perl without 
jeopardizing our primary system

Thanks for all of the suggestions,

Rob

-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 04, 2004 12:20 PM
To: Witzke, Rob; PerlBeginners (E-mail)
Subject: RE: DBI Install


Witzke, Rob wrote:
> Well, it seems that I don't have a c compiler loaded.  (I thought
> that I did) 

As others have pointed out, you need a C compiler to install some modules.

However, I'm pretty sure you can't just "grab gcc" and start installing DBI.
You need to build modules with the same compiler that Perl was built with.
If you don't have that compiler, best be would be to a) get gcc, b) rebuild
Perl itself with gcc, c) then build DBI and other modules.

I may be wrong about this, so somebody correct me if I am.

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




Re: use vs. require in modules

2004-08-04 Thread Randal L. Schwartz
> "Christopher" == Christopher J Bottaro <[EMAIL PROTECTED]> writes:

Christopher> My::Utils
Christopher> use Exporter;

Do you have "@ISA = Exporter" too?  Much easier to write this as

use base 'Exporter';

This might be why it needs to be require'd instead of use'd.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: E-mail Parsing

2004-08-04 Thread Brian Gerard
And the clouds parted, and Wiggins d Anconia said...
>
> > I'm have a email in a text file. From this file I would like to get the
> > sender information, the attached files and the body of the e-mail.
> > 
> > Is there something simple to do this?
> > 
> 
> Check out the MIME::Parser or Mail::Box modules from CPAN. There are
> others probably but these two I have used.
> 

I'll second the nomination for Mail::Box.  I'm using it to parse a
collection of emails for processing on the headers and body and it works
like a charm!

HTH-
Brian

  /~~\
 | Brian Gerard   Duct tape is like the Force. It has |
 | First initial + 'lists' a light side and a dark side and   |
 | at technobrat dot comit holds the universe together.   |
  \__/

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




RE: DBI Install

2004-08-04 Thread Witzke, Rob
That would be great.  Where can I find the instructions for that?

Rob

-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 04, 2004 2:49 PM
To: Witzke, Rob; PerlBeginners (E-mail)
Subject: RE: DBI Install


Witzke, Rob wrote:
> Unfortunately, this does indeed seem to be the case and I can't
> rebuild perl without jeopardizing our primary system 

You can build a second copy of Perl and point to that for your DBI scripts
by changing the shebang line...

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




Re: Choosing only numbers from the output

2004-08-04 Thread Gunnar Hjalmarsson
Zeus Odin wrote:
Gunnar Hjalmarsson wrote:
while () {
my ($tag, $result) = split /[ :]+/;
if ($result =~ /^\d+$/ and $result > 0) {
...
The data as posted had white space trailing some of the digits
after the colons.
Yes, but how would that matter? Please read the second sentence in 
"perldoc -f split".

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: DBI Install

2004-08-04 Thread Bob Showalter
Witzke, Rob wrote:
> Unfortunately, this does indeed seem to be the case and I can't
> rebuild perl without jeopardizing our primary system 

You can build a second copy of Perl and point to that for your DBI scripts
by changing the shebang line...

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




Re: use vs. require in modules

2004-08-04 Thread Christopher J. Bottaro
heh, that was it, thanks a bunch.

Randal L. Schwartz wrote:

>> "Christopher" == Christopher J Bottaro
>> <[EMAIL PROTECTED]> writes:
> 
> Christopher> My::Utils
> Christopher> use Exporter;
> 
> Do you have "@ISA = Exporter" too?  Much easier to write this as
> 
> use base 'Exporter';
> 
> This might be why it needs to be require'd instead of use'd.
> 



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




RE: DBI Install

2004-08-04 Thread Chris Devers
On Wed, 4 Aug 2004, Witzke, Rob wrote:
> Witzke, Rob wrote:
> > Unfortunately, this does indeed seem to be the case and I can't
> > rebuild perl without jeopardizing our primary system
>
> You can build a second copy of Perl and point to that for your DBI 
> scripts by changing the shebang line...

That would be great.  Where can I find the instructions for that?
With the instructions for installing Perl itself.
Just follow the regular intructions for building Perl on your platform. 
The only wrinkle to be aware of that might not be spelled out in the 
standard instructions is that you need to specify an alternate install 
directory, such as /usr/local or /opt.

If you already have a copy of Perl at /usr/bin/perl, then your installed 
version will wipe it out. This can be appealing at first, but if you do 
this then system scripts that depend on the vendor's Perl being a 
particular version in /usr/bin/perl may break, and if the vendor sends 
out a new version of Perl with some future update then your copy will 
break.

By putting your copy elsewhere, you avoid such complications.
The easiest way here is to specify "./configure --prefix=/usr/local" 
when setting up your copy, but read over the documentation that comes 
with your new version of Perl, and look over the options available from 
a "./configure --help" to see if there's anything else you want.

Beyond that, just follow the shipped directions and, as always, let the 
list know if you hit any complications.

--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Fallout!'
 by Henry Mancini
 from 'The Best Of Mancini'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE : E-mail Parsing

2004-08-04 Thread Jose Nyimi


> -Message d'origine-
> De : Brian Gerard [mailto:[EMAIL PROTECTED]
> Envoyé : mercredi 4 août 2004 19:40
> À : Perls of Wisdom
> Objet : Re: E-mail Parsing
> 
> And the clouds parted, and Wiggins d Anconia said...
> >
> > > I'm have a email in a text file. From this file I would like to
get
> the
> > > sender information, the attached files and the body of the e-mail.
> > >
> > > Is there something simple to do this?
> > >
> >
> > Check out the MIME::Parser or Mail::Box modules from CPAN. There are
> > others probably but these two I have used.
> >
> 
> I'll second the nomination for Mail::Box.  I'm using it to parse a
> collection of emails for processing on the headers and body and it
works
> like a charm!
> 

I'm using Mail::Box as well ...
It is great !

José.


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




question

2004-08-04 Thread DBSMITH
Is the last unless statement saying "break out of the loop only when @a is 
read completely through?
I also have a formatting question.  The output is printing a ' after a 
newline and I have played with the code by moving "print $tick in and 
outside the loop, but cannot get it to work.  Here is what I mean:

-w 'barcode=E01497 or barcode=E01496 or barcode=E01332 or 
barcode=E00405
'edm01:/usr/local/bin/perld>>

I would like to have the tick right after the last element E string

#!/usr/local/bin/perl -w
use strict;
open (FH,"/usr/local/bin/perld/derektapes") or die "cannot open FH: $! 
\n";
my $w_param="-w ";
my $tick="'";
my $b_param="barcode=";
my $or_string=" or ";
chomp ( my @a = );

#   $a[$i]=$_;
#   $i++;
#   print map {$_, "\n"} @a;

print $w_param,  $tick;
while (@a) { 
my @output = ();
for ( 1..4 ) {
push @output, $b_param . shift @a;
last unless @a;
}
print join ($or_string, @output),"\n";
}
print $tick;


thank you, 
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



Malloc problem Perl

2004-08-04 Thread Julianno Sambatti

Hi all, 

I have a perl code that reads a file into a list in an array of array. Then it 
rearranges each 
nested array in another format - 4 columns instead of 2 - by randomly picking an 
element 
of each array and reassembling another array. It's been working when the infile is 
small. 
However, when it is large the program crashes and spits the following message:

*** malloc: vm_allocate(size=262144) failed with 3
*** malloc[591]: error: Can't allocate region
Out of memory!


which is obviously related to memory allocation.

Can someone help me fixing this problem?

Thanks

Julianno Sambatti

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




Re: Re: Determining Odd and Even Numbers

2004-08-04 Thread Richard A. Evans
> The chosen examples struck me as funny.  Movie Quiz time (probably just
> for the americans):
>
> Ron: "Are you going to put in 220?"
> Jack: "Yeh, 220 or 221 whatever it takes..."

MR. MOM



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




Re: Get .exe or .zip file from the server via perl script

2004-08-04 Thread Nicolay A. Vasiliev
Hello, Gunnar!
Thanmk you and sorry for delay!
Gunnar Hjalmarsson wrote:
Nicolay A. Vasiliev wrote:
I don't know anything how to download the file via perl script.

This code, which I copied from a program of mine, may get you started:
open FILE, "< $dir/$file" or die "Can't open ... $!";
binmode FILE;
binmode STDOUT;
print "Content-Type: application/zip\n",
  "Content-Disposition: attachment; filename=$file\n",
  'Content-Length: ' . (stat "$dir/$file")[7] . "\n\n";
while () { print }
close FILE;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: E-mail Parsing

2004-08-04 Thread Thomas Bätzler
[EMAIL PROTECTED] <[EMAIL PROTECTED]> asked:
> I'm have a email in a text file. From this file I would like 
> to get the sender information, the attached files and the 
> body of the e-mail.
> 
> Is there something simple to do this?

Yeah. MIME::Parser from the MIME-tools distribution.

HTH,
Thomas


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




Re: Choosing only numbers from the output

2004-08-04 Thread Zeus Odin
You are correct. I did not properly look at the regex you passed to split.

"Gunnar Hjalmarsson" <[EMAIL PROTECTED]> wrote
> > The data as posted had white space trailing some of the digits
> > after the colons.
>
> Yes, but how would that matter? Please read the second sentence in
> "perldoc -f split".



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




Re: question

2004-08-04 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote:
Is the last unless statement saying "break out of the loop only
when @a is read completely through?
In effect: Yes.
I also have a formatting question.  The output is printing a '
after a newline
A wild guess would be that it's because the "'" is printed after the
printing of a "\n". ;-)  Have you tried:
print join ($or_string, @output), $tick, "\n";
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



using Class::Struct in a module

2004-08-04 Thread Christopher J. Bottaro
package My::Module;
use Class::Struct;

struct Blah => {
field1 => '$',
field2 => '$'
};

sub new {
# normal constructor
}

sub f   {
my $s = new Blah; # this calls new() defined above
$s->field1 = 1;
$s->field2 = 2;
return $s;
}

package main;

my $obj = new My::Module;
my $s = $obj->f();
print "$s->field1\n$s->field2\n";

-

ok, the problem is that in My::Module::f(), the statement my '$s = new Blah'
calls My::Module::new() instead of constructing a struct of type Blah.  how
can i get this code to perform the way i want?

thank you for the help.


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




Re: question

2004-08-04 Thread John W. Krahn
[EMAIL PROTECTED] wrote:
Subject: question
Please try to use a more descriptive subject line.  :-)

Is the last unless statement saying "break out of the loop only when @a is 
read completely through?
I also have a formatting question.  The output is printing a ' after a 
newline and I have played with the code by moving "print $tick in and 
outside the loop, but cannot get it to work.  Here is what I mean:

-w 'barcode=E01497 or barcode=E01496 or barcode=E01332 or 
barcode=E00405
'edm01:/usr/local/bin/perld>>

I would like to have the tick right after the last element E string
#!/usr/local/bin/perl -w
use strict;
open (FH,"/usr/local/bin/perld/derektapes") or die "cannot open FH: $! 
\n";
my $w_param="-w ";
my $tick="'";
my $b_param="barcode=";
my $or_string=" or ";
chomp ( my @a = );

#   $a[$i]=$_;
#   $i++;
#   print map {$_, "\n"} @a;
print $w_param,  $tick;
while (@a) { 
my @output = ();
for ( 1..4 ) {
push @output, $b_param . shift @a;
last unless @a;
}
print join ($or_string, @output),"\n";
}
print $tick;
You are printing $tick after the newline.  Try printing it before the newline.
 print join ($or_string, @output),"$tick\n";

John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Malloc problem Perl

2004-08-04 Thread Wiggins d'Anconia
Julianno Sambatti wrote:
Hi all, 

I have a perl code that reads a file into a list in an array of array. Then it rearranges each 
nested array in another format - 4 columns instead of 2 - by randomly picking an element 
of each array and reassembling another array. It's been working when the infile is small. 
However, when it is large the program crashes and spits the following message:

*** malloc: vm_allocate(size=262144) failed with 3
*** malloc[591]: error: Can't allocate region
Out of memory!
which is obviously related to memory allocation.
Can someone help me fixing this problem?
Thanks
Julianno Sambatti
Are you sure you haven't just hit the physical limit of memory on the 
machine?  Is this under win32?

How big is the file when it starts to exhibit this behavior, is your 
Perl configured with large file support? Are you processing the file 
line by line when possible as opposed to slurping it?

http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Sorting HTML tables

2004-08-04 Thread Perl
I wrote some code to identify and print HTML tables below:

use strict;

my @table;
my $logfile;
my $counter;
my $inc;
my @array;

die "You must enter an argument. \n" if $#ARGV <0;
$logfile = chomp ($ARGV);
foreach my $line(<>){

if ($line =~ /(TABLE)(.+)/) {
$inc++;

}

$table[$inc] .= $line; # append each line to the array element

$counter++;

}

# Print out each table to show that the script works.   

foreach my $lineno (0..$#table) {
print "TABLE: $lineno \n";
print $table[$lineno];
print "\n\n\n";
sleep 1;
}



The problem I am stuck with is that now I want to sort the tables based
on a Priority (which range from 1-3). There may be several tables with
the same priority numbers.   An example of a Priority 3 would be:


Priority

3

I need help in understanding the methodology in how to extract these 2
items and then sort the tables in Priority order (all the 1's, 2's and
3's). 

Thanks.

--Paul


Re: Choosing only numbers from the output

2004-08-04 Thread Christopher J. Bottaro
this is an interesting question in that its not about syntax or a specific
problem in perl.

here's the algorithm:

while there are lines to read from the input
read a line
split the line into two seperate strings around the colon
if both strings are numbers
append the first string into array1
append the second string into array2

that is "how you do this", or at least one way...=)

sudhindra k s wrote:

>  
> Hi
> 
> I have an output which looks like this:
> 
> Tag   : Result
> 146603:
> 147020:
> 147155: NONE
> 147160:
> 147232:
> 147243:
> 147254: none
> 147318:
> 147341: NONE
> 147430: N/A
> 147708:
> 147710: 
> 147729:
> 147768:
> 147851:
> 147921:
> 147949: 
> 147981:
> 147983:
> 147991:
> 148007: 
> 148080:
> 148105:
> 148200:
> 148312: 38160
> 148329: 44139
> 148444: NONE
> 148514:
> 148573: 
> 148697:
> 148759:
> 148919:
> 148920:
> 148921:
> 148923:
> 148924:
> 148933:
> 148934:
> 148935:
> 148936:
> 148937:
> 148938:
> 148939:
> 148951:
> 148996:
> 
> Now i want to gather all the "Tags" for which the "Result" is a number
> (but shouldnt include the tag if the result is 0). The corresponding
> Result should go to another array.
> 
> Considering the above example my array1 should contain 148312 and 148329
> and array2 should contain 38160 and 44139
> 
> How do i do this?
> 
> Thanks in advance
> 
> Regards
> Sudhindra



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




Re: Sorting HTML tables

2004-08-04 Thread Chris Devers
On Wed, 4 Aug 2004, Perl wrote:
I wrote some code to identify and print HTML tables below
Don't do that.
HTML is tremendously difficult to analyze properly with tools like 
regular expressions.

You're much, much better off using a proper parser library that can 
build up a tree model of the html that you can analyze as you like.

The standard libraries for this are probably HTML::Parser and 
HTML::Treebuilder. You may also like HTML::TableContentParser.

 
 


This may point you in a useful direction:
  use HTML::TableContentParser;
  $p  = HTML::TableContentParser->new();
  $html   = read_html_from_somewhere();
  $tables = $p->parse($html);
  for $t (@$tables) {
for $r (@{$t->{rows}}) {
  print "Row: ";
  for $c (@{$r->{cells}}) {
print "[$c->{data}] ";
  }
  print "\n";
}
  }
Something like this should work even for godawful ms-html :-)
The problem I am stuck with is that now I want to sort the tables 
based on a Priority (which range from 1-3). There may be several 
tables with the same priority numbers.  An example of a Priority 3 
would be:

# extraordinarily ugly html omitted
I need help in understanding the methodology in how to extract these 2 
items and then sort the tables in Priority order (all the 1's, 2's and 
3's).
It looks like HTML::TableContentParser makes sorting through the 
structure of the table pretty easy; HTML::Parser could go farther by 
reducing it down to just the printable text -- some combination of the 
two may be useful here.

Once you've stripped out all the junk (all the span tags, the paragraph 
tags, the "" type debris, etc), you just need to do convert 
the html structure into some kind of populated data structure.

You didn't give enough of the html to suggest what the rest of the table 
is structured like -- it was really just one big hairy table cell -- so 
it's hard to guess how the other pieces fit together.

Can you post a simpler example of what the table is built like, e.g.:
++---+---++
| priority 1 | field | another field | some more  |
++---+---++
| priority 3 | field | any data here | other things   |
++---+---++
| priority 2 | field | stuff stuff   | whatever   |
++---+---++
Or is it more complcated than that?

--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Lujon'
 by Henry Mancini
 from 'The Best Of Mancini'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE : DBI Install

2004-08-04 Thread Jose Nyimi


> -Message d'origine-
> De : Witzke, Rob [mailto:[EMAIL PROTECTED]
> Envoyé : mercredi 4 août 2004 19:36
> À : Bob Showalter; PerlBeginners (E-mail)
> Objet : RE: DBI Install
> 
> Unfortunately, this does indeed seem to be the case and I can't
rebuild
> perl without jeopardizing our primary system
> 

You could considere building your own perl and modules.
If for instance the primary perl of your system is /usr/bin/perl then
you could choose making an other one as /usr/local/bin/perl and force
your script using the later.

All of this assum that your are in alignment with your organization
policy.
Convincing sysadmin is not always possible :-)

José.



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




Number formatting

2004-08-04 Thread Colin . Johnstone
Hi all,

I am doing conversions from square metres to square feet for example.

I have a regex that removes any commas or spaces in a number.

I then do the conversion

return an integer

but then want to display the number with the commas or spaces put back in 
to make it easier to read.

What do you suggest?


my $units = iwpt_dcr_value('dcr.lettableArea.units');
my $area = iwpt_dcr_value('dcr.lettableArea.Area');
 
$modifiedArea =~ s/,\s//;
 
$squareMetres = ( $units eq 'square metres' ) ? $area : 
int $modifiedArea * 0.0929;
$squareFeet = ( $units eq 'square feet' )  ? $area 
: int $modifiedArea * 10.764;
 
$lettableArea = $squareMetres .qq[m2 or ] . 
$squareFeet . qq[f2 (approx)];
 
iwpt_output( $lettableArea );

Regards

Colin

Re: Number formatting

2004-08-04 Thread Chris Devers
On Thu, 5 Aug 2004 [EMAIL PROTECTED] wrote:
but then want to display the number with the commas or spaces put back 
in to make it easier to read.

What do you suggest?
Two minutes of Googling found dozens of suggestions.
This may be the best one:
  How can I output my numbers with commas added?
  This subroutine will add commas to your number:
  sub commify {
 local $_  = shift;
 1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
 return $_;
 }
  This regex from Benjamin Goldberg will add commas to numbers:
 s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g;
  It is easier to see with comments:
 s/(
 ^[-+]?# beginning of number.
 \d{1,3}?  # first digits before first comma
 (?=   # followed by, (but not included in the match) :
(?>(?:\d{3})+) # some positive multiple of three digits.
(?!\d) # an *exact* multiple, not x * 3 + 1 or whatever.
 )
|  # or:
 \G\d{3}   # after the last group, get three digits
 (?=\d)# but they have to have more digits after them.
 )/$1,/xg;

Google and PerlFaq are your friends.
--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
np: 'Mr. Lucky'
   by Henry Mancini
   from 'The Best Of Mancini'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Number formatting

2004-08-04 Thread Randy W. Sims
On 8/4/2004 10:02 PM, [EMAIL PROTECTED] wrote:
Hi all,
I am doing conversions from square metres to square feet for example.
I have a regex that removes any commas or spaces in a number.
I then do the conversion
return an integer
but then want to display the number with the commas or spaces put back in 
to make it easier to read.
Number::Format

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



RE: Help needed in extracting html over HTTTPS protocol.

2004-08-04 Thread Sanjay Arora
Anas

I have a similar requirement. Can you tell me which perl modules are you
using for connecting to http and getting html & which modules for
extracting info. I havent got to your stage, so I guess Ill keep an eye
on your thread ;-).

And Bob, thanks for the tip though its a bit advanced for me yet.

Best regards.
Sanjay.

On Wed, 2004-08-04 at 17:45, Bob Showalter wrote:
> Anas Perwez wrote:
> > Hi All,
> > My requirement is to extract html from any site ( HTTPS) and then
> > parse it for selective contents
> > 
> > I am able to connect to HTTP sites but when it comes to HTTPS , it is
> > throwing errors.
> 
> [ snip LWP code ]
> 
> Have you read http://search.cpan.org/src/GAAS/libwww-perl-5.800/README.SSL ?


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




floating point convertion

2004-08-04 Thread Mark Cohen

Hello ,

I have a transferred a file from an IBM mainframe to a windows platform that
I need to analyse. The file contains an 8 byte floating point hexadecimal
representaion 44FE8800.

This should be converted to the number 65160.

I created the following subroutine which works ok but it does alot
of work. Is there something more efficient ?

 # first byte (value-40) - get exponent base 16;
 # next 7 bytes (sum for each bit) - (1/2)** exponential for each bit
 # result = sum of all bits * (16 ** exponent)

sub floatmvs {
 my $mat=0;
 my $firstbyte = unpack "H2", $_[0];
 my $exp=$firstbyte-40;  # base 16
 my $bin=unpack('B*',substr($_[0],1,7));
   for ($start=0; $start <56; $start+=1) {
$bit=substr($bin,$start,1);
$bitpos=$start+1;
if ($bit == 1) {
$val=(1/2)**($bitpos);
$mat=$mat+$val;
}
   }
   my $num=$mat*(16**$exp);
   return $num;
}





Thanks Mark


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