Re: Module and file naming conventions

2005-04-01 Thread Chris Devers
On Fri, 1 Apr 2005 [EMAIL PROTECTED] wrote: > Assuming you have a base class called Money and a subclass called Coin > (where the Coin package declares @ISA = qw (Money)), what is the > appropriate naming convention? > > Classes - Money and Money::Coin > Files - Money.pm and Money/Coin.pm > > or

First time parsing XML

2005-04-01 Thread Johnstone, Colin
Gidday All, I would like to use xml Parser to parse this chunk of xml (below) and return the business unit name and id attributes for each of the elements where division id = '221' I have tried #!/web/Interwoven/TeamSite/iw-perl/bin/iwperl use XML::XPath; use XML::XPath::XMLParser; my $xpath;

First time Parsing XML

2005-04-01 Thread Johnstone, Colin
Gidday All, I would like to use xml Parser to parse this chunk of xml (below) and return the business unit name and id attributes for each of the elements where division id = '221' I have tried #!/web/Interwoven/TeamSite/iw-perl/bin/iwperl use XML::XPath; use XML::XPath::XMLParser; my $xpath;

Re: Frustration - split not working as expected

2005-04-01 Thread Brett Williams
Thanks very much to all for the help, i was close to tearing my hair out there :) In particular for the explanations of the code, very very helpful for a newbie like me. I now understand where i was going wrong. Brettaw -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

Module and file naming conventions

2005-04-01 Thread Brad.Carlson
Assuming you have a base class called Money and a subclass called Coin (where the Coin package declares @ISA = qw (Money)), what is the appropriate naming convention? Classes - Money and Money::Coin Files - Money.pm and Money/Coin.pm or Classes - Money and Coin Files - Money.pm and Coin.pm

RE: Attempting OO with Perl - New() method in subclass not working

2005-04-01 Thread Brad.Carlson
Okay, why is the subclass's new() not required? Is it because the DBLogon's additional field (DBNAME) is added via the _init() method? So you end up with something like this: # Base class Logon new() sub new { my $that = shift; my $class = ref($that) || $that; my $self = {}; bles

Re: import() functions from another module

2005-04-01 Thread JupiterHost.Net
[snip] Digest::MD5, and tomorrow, I decide that the function isn't going to be called 'md5_base64' anymore, because I got sick of typing it. From now on it's going to be 'md5_64'. You now have to go through and fix your module to make it export the new function name. That is exactly the point o

Re: import() functions from another module

2005-04-01 Thread Jay Savage
On Apr 1, 2005 4:04 PM, JupiterHost.Net <[EMAIL PROTECTED]> wrote: > > Are you even serious? I sent the exact code that reproduced the problem. > You said you didn't have time to run it which is fine, > but it was there :) > The code you sent 1) was oversimplified and 2) presented you as creati

Re: Frustration - split not working as expected

2005-04-01 Thread BJ
I think if you want to be lazy you can set the env variable $,="\n"; Also, wont this create an array of 3 items? Perhaps you want to throw in a print "$pricelist[1] \n" instead of print @pricelist. (dont do both though) Brett Williams wrote: Hi :) Ive been working all afternoon trying to get wha

Re: import() functions from another module

2005-04-01 Thread JupiterHost.Net
Thanks for your input, I beleive I may have not been clear aboutthe goal and apologize if it confused you. Lee, It's generally best to provide as real-world an example as possible when asking for help on this list. Code doesn't confuse things--or people--around here. We all look at the code you s

Re: import() functions from another module

2005-04-01 Thread Jay Savage
On Apr 1, 2005 12:03 AM, JupiterHost.Net <[EMAIL PROTECTED]> wrote: > > Assuming that your import() does what you think it does--and I don't > > have time to test it, but as long as you're USEing it anyway, why not > > just write a wrapper instead of the pass-the-import nonsense--you > > Because t

Re: .pm and .pl files.

2005-04-01 Thread Jay Savage
On 30 Mar 2005 07:07:56 -0800, Randal L. Schwartz wrote: > > "Chris" == Chris Devers <[EMAIL PROTECTED]> writes: > > Chris> By convention, the .pm extension denotes Perl modules -- libraries used > Chris> by other scripts but not run directly -- and .pl denotes Perl scripts > -- > Chris> pro

RE: Attempting OO with Perl - New() method in subclass not workin g

2005-04-01 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > I am trying to build an inheritable object, and I am using examples > from the Perl Cookbook, 2nd edition, mostly Recipe 13.1, using the > new and _init methods. Your subclass does not need (and should not have) a new() method; it can use the one from the base class. As

RE: Attempting OO with Perl - New() method in subclass not working

2005-04-01 Thread Brad.Carlson
Thank you! I tried the SUPER->_init() and that took care of it. However, I donn't want to force an inherited class to have to know how the parent's new() works, so I tried this as well (and it worked) - I have the new() call it's own _init explicitly: # the new() from Logon.pm sub new {

Re: Frustration - split not working as expected

2005-04-01 Thread Offer Kaye
On Apr 1, 2005 6:39 PM, Charles K. Clarkson wrote: > > Using a "\n" after the $! variable suppresses information about > the error. Correction - the "\n" doesn't suppress the information because it comes after the "$!" variable - it has nothing to do with it. This behaviour is due to "die".

RE: .pm and .pl files.

2005-04-01 Thread Charles K. Clarkson
Mike Lesser wrote: : Is the library file thing passe? I was going to put some stuff in a : library, but I get the impression that I should jump right to a pm. : As a newbie this is a little daunting. I use .pl for scripts and .pm for modules. Modules can be daunting

Re: Attempting OO with Perl - New() method in subclass not working

2005-04-01 Thread Randal L. Schwartz
> "Jeff" == Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> writes: Jeff> Oh, right. April Fool? ;) Perhaps that's half right. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Com

Re: Attempting OO with Perl - New() method in subclass not working

2005-04-01 Thread Jeff 'japhy' Pinyan
On Apr 1, Randal L. Schwartz said: "Jeff" == Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> writes: Jeff>sub new { Jeff> my $that = shift; Jeff> my $class = ref($that) || $that; Jeff> my $self = $class->SUPER::new(); Jeff> $self->SUPER::_init(); There's a rule of thumb from smallta

Re: Attempting OO with Perl - New() method in subclass not working

2005-04-01 Thread Randal L. Schwartz
> "Jeff" == Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> writes: Jeff>sub new { Jeff> my $that = shift; Jeff> my $class = ref($that) || $that; Jeff> my $self = $class->SUPER::new(); Jeff> $self->SUPER::_init(); There's a rule of thumb from smalltalk that if you're using a "

Re: import() functions from another module

2005-04-01 Thread JupiterHost.Net
Joshua Colson wrote: On Thu, 2005-03-31 at 12:41 -0600, JupiterHost.Net wrote: Hello, I am working on a module that needs to import a function from Digest::MD5. The reasoning on this is that its a subclass so it'd be handy to be able to use() it and export functions from the parent module witho

Re: import() functions from another module

2005-04-01 Thread JupiterHost.Net
Any ideas would be most appreciated! I think all you need to do is export the md5_base64 sub from FooTest That and add Diget::MD5 to @ISA :) Now it works great! Thanks to all who helped with this! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Frustration - split not working as expected

2005-04-01 Thread Charles K. Clarkson
Offer Kaye wrote: : my $infile = "file.txt"; : open (INPUT, $infile) or die "$0 error, can't open $infile for reading: $!\n"; : The "open" line is essentially the same as yours, I simply beefed-up : the error message (read "perldoc perlvar" for more info about $0 and :

Re: .pm and .pl files.

2005-04-01 Thread Mike Lesser
So if we don't want to be like dweebs, it's no extension for scripts, pl for libraries? What's weird is that many of the O'Reily books I have use the pl... so I blame them. Is the library file thing passe? I was going to put some stuff in a library, but I get the impression that I should jump

Re: Frustration - split not working as expected

2005-04-01 Thread Offer Kaye
On Apr 1, 2005 12:45 PM, Brett Williams wrote: > Im aware of regular > expressions now, but find them too confusing at this stage (im an > extreme newbie to any programming). Read "perldoc perlrequick" (type that into your terminal), that will get you up to speed quickly regarding regular expressi

Re: Frustration - split not working as expected

2005-04-01 Thread Mr M senthil kumar
Hi, On Fri, 1 Apr 2005, Brett Williams wrote: > The text file reads, > > :Weekly expenses...: > :1002.00: > :125.00: > :61864.35: > :890876.99: > :9.99: > > I want to print to screen all text between ":" on a new line. I > thought this would be easy :) > The final code i came up with is, > > op

Re: Database -> Excel

2005-04-01 Thread Robert
"Lawrence Statton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> I see a whole passle of Excel modules on CPAN. I am querying an Oracle >> database and I want to save that query into an Excel file. What module >> would you suggest that I use? >> >> Robert >> > > It is like three m

Keeping format when printing

2005-04-01 Thread Brian Volk
Hi All, When sending a document to the printer in perl, is it possible to keep the formatting? When I send an .html doc to the printer, it prints out the HTML tags like so... begin - First Aid Procedures: Eyes: Hold eye open and rinse slowly and gentl

Re: modules - lost again

2005-04-01 Thread Peter Scott
On Fri, 01 Apr 2005 07:29:17 -0500, Peter Rabbitson wrote: > [...] I decided to create a central Configuration.pm > which will hold different hashes with "configuration sections" e.g.: > > package Configuration; > > %Configuration::auth = ( >[...]... > > You get the idea. Now I am able to ac

modules - lost again

2005-04-01 Thread Peter Rabbitson
This is to extend my question earlier about modules. Most of the OOP concepts are very nicely explained in perlboot kindly pointed out by Japhy (thank you!), however I stumbled against a problem. I don't know if I am not looking at it correctly, or the idea I want to implement is entirely ill.

Re: Frustration - split not working as expected

2005-04-01 Thread John W. Krahn
Brett Williams wrote: Hi :) Ive been working all afternoon trying to get what seems like a fairly simple outcome with split, but depite trying again & again i can't get things going. I would very much appreciate any help/insight offered. What im trying to do is read from a text file and use split t

Re: Program error

2005-04-01 Thread Felix Geerinckx
On 01/04/2005, GR Kumaran wrote: > #!c:/sieperl/perl/5.8.0/bin/MSWin32-x86-perlio/perl > > use CGI; > use warnings; > use strict; > > my $page = new CGI; > > if (DEBUG) { > open(DEBUGFILE, ">>debug.txt") || die; > $page->save(DEBUGFILE); > close(DEBUGFILE); > } > =

Frustration - split not working as expected

2005-04-01 Thread Brett Williams
Hi :) Ive been working all afternoon trying to get what seems like a fairly simple outcome with split, but depite trying again & again i can't get things going. I would very much appreciate any help/insight offered. What im trying to do is read from a text file and use split then print to display

Program error

2005-04-01 Thread GR Kumaran
Hello, What is error in this program? === #!c:/sieperl/perl/5.8.0/bin/MSWin32-x86-perlio/perl use CGI; use warnings; use strict; my $page = new CGI; if (DEBUG) { open(DEBUGFILE, ">>debug.txt") || die; $page->save(DEBUGFILE); close(DEBUGFILE); }