[13976] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1386 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 15 18:14:05 1999

Date: Mon, 15 Nov 1999 15:10:28 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942707427-v9-i1386@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 15 Nov 1999     Volume: 9 Number: 1386

Today's topics:
        FastCGI (wasRe: localtime object y2k compliant?) (Kragen Sitaker)
    Re: FastCGI (wasRe: localtime object y2k compliant?) <uri@sysarch.com>
    Re: File read-write <lr@hpl.hp.com>
    Re: File read-write <krishnasanjay@hotmail.com>
    Re: File read-write (Martien Verbruggen)
    Re: Forms data <lr@hpl.hp.com>
    Re: help <gellyfish@gellyfish.com>
    Re: Help: Struggling with fork <gellyfish@gellyfish.com>
    Re: how to parse dir recursively for files? <gellyfish@gellyfish.com>
        how to step through list <kev@tnw.org>
    Re: I think my install is toast <gellyfish@gellyfish.com>
    Re: Is $$variable allowed like in PHP ? <gellyfish@gellyfish.com>
        Java faster than perl ?!?!? <RMalta@bigfoot.com>
    Re: Making a Perl/Tk standalone executable <cbrunet@locus.ca>
    Re: mSQL/Perl <lr@hpl.hp.com>
        Multiple scripts <anovikov@heron.itep.ru>
    Re: New Perl and CGI Resource site <gellyfish@gellyfish.com>
    Re: OO woes <uri@sysarch.com>
    Re: OO woes (Brett W. McCoy)
    Re: OO woes (Damian Conway)
        Open Source Bulletin Board malte_ubl@my-deja.com
    Re: Perl-CPAN CD-ROM? + Best Linux Distrib for Perl? <gellyfish@gellyfish.com>
        Perl/CGI programmer wanted <gip@frontier.net>
    Re: Please help me create a file with perl <christian@wix.dk>
    Re: Please help me create a file with perl <aviva.starkman@exchange.sp.trw.com>
    Re: Redirect to LOCAL file <gellyfish@gellyfish.com>
    Re: Removing all combinations of spaces/tabs at end of  <sariq@texas.net>
    Re: Removing all combinations of spaces/tabs at end of  (Craig Berry)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 15 Nov 1999 19:19:20 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: FastCGI (wasRe: localtime object y2k compliant?)
Message-Id: <Y0ZX3.13790$YI2.640682@typ11.nn.bcandid.com>

In article <80nf94$hpm@junior.apk.net>,
Mark W. Schumann <catfood@apk.net> wrote:
>In article <89oV3.54785$23.2047035@typ11.nn.bcandid.com>,
>Kragen Sitaker <kragen@dnaco.net> wrote:
>>I don't find CGI.pm particularly ugly, myself, but it is undeniably
>>big.
>
>Right, but then you have FastCGI.
>
>It's not an all-Perl solution, naturally, but it does the right thing
>and lets you use your Perl code efficiently with little pain.

Have you used FastCGI?  Does it live up to OpenMarket's performance
claims?  Is it easy to use from Perl?

-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: 15 Nov 1999 14:32:42 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: FastCGI (wasRe: localtime object y2k compliant?)
Message-Id: <x7903zwnxh.fsf@home.sysarch.com>

>>>>> "KS" == Kragen Sitaker <kragen@dnaco.net> writes:

  KS> Have you used FastCGI?  Does it live up to OpenMarket's performance
  KS> claims?  Is it easy to use from Perl?

openmarket doesn't own it anymore. the protocol is public now. there are
several servers which offer it (free and commercial) with commercial
plugins to netscrape and redmondware from fast engines and an apache
module.

it does work well and fast and many large sites use it. it is easy to
use in general and in many case requires very little work to change a
regular perl cgi program to a fast cgi one. writing a fast cgi script
from scratch is usually better as you can then handle memory leak issues
directly. most converted programs are written so badly (they assume
exiting after the cgi script is done) they have to exit after N loops
under fast cgi to clean up.

much more on www.fastcgi.com.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: Mon, 15 Nov 1999 11:57:17 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: File read-write
Message-Id: <MPG.129a057684dd3bf998a20d@nntp.hpl.hp.com>

In article <80pj7m$djv$1@nnrp1.deja.com> on Mon, 15 Nov 1999 18:26:06 
GMT, krishnasanjay@my-deja.com <krishnasanjay@my-deja.com> says...
> I have the following text file :
> ----------------
> This is a test
> ..
> ..
> pattern delete this
> and also this.
> -----------------
> Now I want to delete everything in the file after
> the pattern is encountered. I know for sure that
> the pattern occurs only once in the entire file.
> In the example shown above, I want to delete
> "delete this" and "and also this". I do not want
> to open another file and copy all the contents
> over until I reach the pattern. Any help is
> greatly appreciated.

perlfaq5: "How do I change one line in a file/delete a line in a 
file/insert a line in the middle of a file/append to the beginning of a 
file?"

Note particularly the next-to-last paragraph, which begins: "In the 
unique case of deleting lines at the end of a file, ..."

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Mon, 15 Nov 1999 22:14:57 GMT
From: Sanjay Krishna <krishnasanjay@hotmail.com>
Subject: Re: File read-write
Message-Id: <80q0ku$o4s$1@nnrp1.deja.com>

This section of the code that the faq talks about only deletes the last
line. What do I do  if for ex. the pattern that I am looking for appears
in the last line ? In that case I do not want to delete the last line
but I only want to delete the characters in the last line which appear
after the pattern.

Thanks
Sanjay
In article <MPG.129a057684dd3bf998a20d@nntp.hpl.hp.com>,
  Larry Rosler <lr@hpl.hp.com> wrote:
> In article <80pj7m$djv$1@nnrp1.deja.com> on Mon, 15 Nov 1999 18:26:06
> GMT, krishnasanjay@my-deja.com <krishnasanjay@my-deja.com> says...
> > I have the following text file :
> > ----------------
> > This is a test
> > ..
> > ..
> > pattern delete this
> > and also this.
> > -----------------
> > Now I want to delete everything in the file after
> > the pattern is encountered. I know for sure that
> > the pattern occurs only once in the entire file.
> > In the example shown above, I want to delete
> > "delete this" and "and also this". I do not want
> > to open another file and copy all the contents
> > over until I reach the pattern. Any help is
> > greatly appreciated.
>
> perlfaq5: "How do I change one line in a file/delete a line in a
> file/insert a line in the middle of a file/append to the beginning of
a
> file?"
>
> Note particularly the next-to-last paragraph, which begins: "In the
> unique case of deleting lines at the end of a file, ..."
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
>


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Mon, 15 Nov 1999 22:27:45 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: File read-write
Message-Id: <BN%X3.33$Va.2088@nsw.nnrp.telstra.net>

On Mon, 15 Nov 1999 18:26:06 GMT,
	krishnasanjay@my-deja.com <krishnasanjay@my-deja.com> wrote:
> I have the following text file :
> ----------------
> This is a test
> ..
> ..
> pattern delete this
> and also this.
> -----------------
> Now I want to delete everything in the file after
> the pattern is encountered.

# perl -ni -e 'print unless /pattern/ .. 0' files

>                             I know for sure that
> the pattern occurs only once in the entire file.
> In the example shown above, I want to delete
> "delete this" and "and also this". I do not want
> to open another file and copy all the contents
> over until I reach the pattern.

Why not? Well, if you insist.

#!/usr/bin/perl -w
use strict;
use Fcntl;

my $oldpos = 0;

sysopen(FILE, 'fooobaaa', O_RDWR) || die $!;
while (<FILE>)
{
	last if /DELETE/;
	$oldpos = tell(FILE);
}
truncate(FILE, $oldpos);
close(FILE);

Replace 'DELETE' with your pattern. Replace fooobaaa with your file
name. Replace the die message with something more informative.

Note that the above has not extensively been tested. I haven't even
spent a lot of time thinking about possible caveats. It's up to you to
read the relevant manual pages to find out if there are any. 

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Think of the average person. Half of
Commercial Dynamics Pty. Ltd.   | the people out there are dumber.
NSW, Australia                  | 


------------------------------

Date: Mon, 15 Nov 1999 11:43:09 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Forms data
Message-Id: <MPG.129a022a68d02fee98a20b@nntp.hpl.hp.com>

In article <80pfla$eo6$1@news.inet.tele.dk> on Mon, 15 Nov 1999 18:27:21 
+0100, Pavel Kunc <kupa@cmail.cz> says...
> i need some help with forms. I need to get $sql in the form "author LIKE
> shakespeare AND author LIKE goethe", but script down prints only "author
> LIKE shakespeare".
> 
> Why?
> 
> 
> use CGI;
> $query = new CGI;
> %Pary;
> for (@names) {$Pary{$_} = $query->param($_);}
> 
> $sql = join ' AND ', map{$_.' LIKE '.$Pary{$_};} sort keys %Pary;
> 
> print "Content-type: text/html", "\n\n";
> print "$sql", "<br>", "\n";
> exit (0);

Apparently, your query includes two parameters named 'author':  
'author=goethe&author=shakespeare'.  But your hash %Pary can have only 
one value for the key 'author', which is the last value assigned.

I suggest another reading of the CGI.pm documentation, to see how to 
deal with multiple parameters with the same name.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 15 Nov 1999 18:20:10 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: help
Message-Id: <80pisq$21p$1@gellyfish.btinternet.com>

On Mon, 15 Nov 1999 11:59:35 +0000 Tim Mann wrote:
> Hi Folks,
>  Can anyone show me how to get form input from a web page to a file on a
> unix system.

If you are using the module CGI.pm and have read the documentation and you 
have read the pelfunc manpage about 'open' and 'print' then this should
be a 'no brainer' - you might also want to read the CGI FAQ at:

   <http://www.webthing.com/tutorials/cgifaq.html>


/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 15 Nov 1999 21:02:49 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help: Struggling with fork
Message-Id: <80psdp$24e$1@gellyfish.btinternet.com>

On Mon, 15 Nov 1999 00:09:17 +0000 Ryan T. Rhea wrote:
> 

Others have addressed your forking problem but:

> open(SHELLS,"/etc/shells") || die "\nbad computer: something is very
> wrong!\n";  #get list of shells
> $number = 0;
> while (<SHELLS>) {
>     chop;

You might consider using chomp here instead.

>     ($bs,$bs,$shellname) = split(/\//);      #just take the shell name,
> drop /bin/
>     $shells[$number]=$shellname;

You might consider doing 'push @shells, $shellname' and lose the indexing
altogether ...

>     write;                                                    #write to
> table...
>     $number++;
> }
> 

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 15 Nov 1999 19:58:20 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to parse dir recursively for files?
Message-Id: <80poks$237$1@gellyfish.btinternet.com>

On Fri, 12 Nov 1999 21:42:57 GMT Kazz Asher wrote:
>>This is bad advice.
> 
> Kragen, perhaps you should take your medication. 90% of your posts are
> merely to be an asshole. Refrain - is your keyword of the day.
> 

And 100% of your posts that I have read are pointless ill-informed and
juvenile but hey you got a special line of your own in my killfile so
things arent so bad ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Mon, 15 Nov 1999 14:46:59 -0600
From: "Kevin J. Davis" <kev@tnw.org>
Subject: how to step through list
Message-Id: <B455CD63.3F2%kev@tnw.org>

Hello,

I have used the readdir() operator to suck some filenames into a list. The
files are all plain text but then I am using another simple routine to
generate header and footer HTML so that the pages can be viewed on a web
browser. (This is cryptic but necessary under the circumstance.)

I have stripped the "." and ".." files using grep and have populated the
list as I expect. What I would like to do is be able to use form elements
(back, forward) to step through the list. As of now I am generating a large
linked list and must go back and forth between a file displayed and the
whole list.

Here is some sample code in hopes that helps someone understand my quandry
better :-)

To populate list @processingorders:

    opendir (PROCESSING, "$orders_processing_path") || &CGIDie("Unable to
open $orders_processing_path: $!");
    @processingorders = grep(/\.order/,readdir(PROCESSING));
    
    $number_in_process = @processingorders;
    
    print qq!
    The following orders are now marked "in process":\n
    <BR><BR>
    <FONT SIZE="-1">
    <OL>\n!;
        
    foreach $processingorder (@processingorders)
        {
        print qq!<LI> <A HREF="$temp_link?view_order=$processingorder"> Web
Order \#$processingorder</A>\n!;
        }
    
    closedir (PROCESSING);

So you see all I can do is show them in an HTML bulleted list. I would like
to take list (219812.order,238935.order,9035709.order...) and view one, hit
"next" button and automatically run the "view_order" routine on the next in
the list. It would be nice if I go then move back and forth.

If someone has pointers or some example code it would be appreciated. Let me
know if more info is needed.

--

Kev



------------------------------

Date: 15 Nov 1999 20:49:39 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: I think my install is toast
Message-Id: <80prl3$23i$1@gellyfish.btinternet.com>

On Mon, 15 Nov 1999 03:12:23 GMT webqueen, queen of the web wrote:
>  I installed RH6.1 and have been running it OK for like 2 weeks, but the
> system locked up twice on my last week and each time it told me to run
> fsck on the filesystem. It found a mess of errors and (corrected?) them.
> 

I'd install C/PM

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 15 Nov 1999 19:19:45 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is $$variable allowed like in PHP ?
Message-Id: <80pmch$22n$1@gellyfish.btinternet.com>

On 15 Nov 1999 16:41:31 +0000 (GMT) Ben Evans wrote:
> 
> So for quick and dirty scripts of up to a few hundred lines
> where I pretty much know exactly what I want to be doing,
> and I'm not depending on user input in any but the most
> restricted way, there's no real problem[1] with soft references?
> 

Well they are ugly, they usually indicate you havent spent sufficient
time thinking about how data is to be handled in your program - you are
altering the namespace of your program for your convenience at run time
rather than thinking about the structure of the data before you even set
your fingers to the keyboard.  I wouldnt use symrefs in a program of
ten lines let alone 'a few hundred lines'  as there is absolutely no need
for it.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Mon, 15 Nov 1999 23:10:18 +0100
From: Ricardo Malta <RMalta@bigfoot.com>
Subject: Java faster than perl ?!?!?
Message-Id: <383084CA.B1431034@bigfoot.com>

This is a multi-part message in MIME format.
--------------85FADBF923CBC74837458630
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

can some one tell me why this java script is so much faster than the
perl one ??

Could it come from the variable type ?? In java you difine it as integer
and under perl it can be an integer, float, string, etc... ??

--
Work  : Ricardo.Malta@partner.bmw.de
Home  : RMalta@bigfoot.com
---------------------------------------------------------
Real programmers don't comment their code.
It was hard to write, it should be hard to understand.
--------------85FADBF923CBC74837458630
Content-Type: application/x-perl;
 name="challange.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="challange.pl"

#!/usr/local/bin/perl
$i=0;
$j=0;
while ($i<100000)
   {
   $j=0;
   while ($j<100)
      {
      $j++;
      }
   $i++;
   }
print $j;

--------------85FADBF923CBC74837458630--



------------------------------

Date: Mon, 15 Nov 1999 14:51:11 -0500
From: "Christian Brunet" <cbrunet@locus.ca>
Subject: Re: Making a Perl/Tk standalone executable
Message-Id: <%tZX3.175$li5.7753@wagner.videotron.net>

Hi,

The way I know is to use perl2exe

www.perl2exe.com

Christian Brunet
cbrunet@locus.ca

Nigel W <nigel_williams@my-deja.com> wrote in message
news:80pc2q$7ii$1@nnrp1.deja.com...
> Does anyone know if it's possible to make a wrapper for a Perl/Tk
> script so that it can run on a system which doesn't have Perl/Tk
> installed.
>
> The reason for this is to generate software/Oracle DB installation
> scripts with a nice GUI which I can use on any Solaris box without
> having to install Perl/Tk.
>
> Any help appreciated,
>
> Thanks
>
> Nigel
>
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




------------------------------

Date: Mon, 15 Nov 1999 11:17:40 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: mSQL/Perl
Message-Id: <MPG.1299fc2ca4ca51c198a209@nntp.hpl.hp.com>

In article <80p90l$o3b$1@mail.pl.unisys.com> on Mon, 15 Nov 1999 
10:31:30 -0500, Erick Jensen <erick.jensen@unisys.com> says...
> I am writing a Perl program that inserts data into a mSQL database.  The
> first field in the table I am inserting into is an ID field (just a integer
> I use as a primary key) which gets incremented with each new record.  When I
> insert a new record into the table I want to get the highest ID and add 1 to
> that to make it the ID of the new record.  Is there any easy way to do this?

Yes.  The SQL dialect used by mSQL includes a statement:

    CREATE SEQUENCE ON table [STEP value] [VALUE value]

'MySQL and mSQL', O'Reilly (Pub.), p. 269.  [I won't name the authors 
here, for a reason that cognoscenti of this newsgroup will appreciate.]  
I have found this book to be a convenient desktop reference for these 
two dialects of SQL, though the Perl content leaves much to be desired.

> Also if two users are using the program and performing the same operation
> simultaneously, will there be a conflict (since the ID must be unique)?
> Most SQL databases support transactions which will take care of this.

There would be if you did the incrementing yourself.  But the methods 
provided by the various databases are supposed to deal with this issue 
correctly.
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Sun, 14 Nov 1999 18:49:24 +0300
From: Alexei Novikov <anovikov@heron.itep.ru>
Subject: Multiple scripts
Message-Id: <382EDA04.75BC0318@heron.itep.ru>

Dear All,
I have a multiple perl scripts within my program. All of them share some
information, like the path to the files to process, passwords to access
db, etc. I was wondering if there is a tool that will be able to read
this information from one file and then write it to all script files ? I
think that MakeMaker can do this but I have no clue how. Any
suggestions, pointers ?
	Chao,
		Alexei.


------------------------------

Date: 15 Nov 1999 19:45:59 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: New Perl and CGI Resource site
Message-Id: <80pntn$231$1@gellyfish.btinternet.com>

On 15 Nov 1999 14:06:42 GMT info@perlscan.com wrote:
> 
> Just trying to get a new CGI Search Engine filled up.
> Please post any scripts you have written to CGIScan at
> http://cgiscan.com
> 

You posted this a week ago - and it appears that no-one was particularly
interested then - but if you want us to pass judgement again so be it.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 15 Nov 1999 14:08:16 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: OO woes
Message-Id: <x7d7tbwp27.fsf@home.sysarch.com>

>>>>> "DC" == David Cantrell <NukeEmUp@ThePentagon.com> writes:

  DC> Imagine you have two classes, classA and classB.  If objectA (an
  DC> instance of classA) calls classB->new() to instantiate objectB, is
  DC> there any way that objectB can get a reference to objectA without me
  DC> having to pass objectA to classB->new()?

how could you get anything in new() without passing it explicitly or
implicitly? data always has to be passed somehow. as you noted caller
will tell you much about the call stack but not about any objects.

  DC> I'd rather not have to pass the reference to objectA into
  classB-> new() as that will break my nice clean interface by
  DC> introducing a special case for a few classes.

other than making classA inherit from classB via @ISA and calling new
with $objectA->new() not much can be done. even then, if classA has a
new, you have to invoke classB's new inside it with SUPER::.

also what would objectB do with objectA? if it mungs the guts of ObjectA
you are breaking encapsulation unless they are classes related by
inheritance. think about how you really want the 2 classes to
interact. passing an object to another is perfectly valid and is
something a project i am working on will do.

uri


-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: Mon, 15 Nov 1999 19:12:56 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: OO woes
Message-Id: <slrn830mtp.3ft.bmccoy@moebius.foiservices.com>

Also Sprach Uri Guttman <uri@sysarch.com>:

>  DC> I'd rather not have to pass the reference to objectA into
>  classB-> new() as that will break my nice clean interface by
>  DC> introducing a special case for a few classes.
>
>other than making classA inherit from classB via @ISA and calling new
>with $objectA->new() not much can be done. even then, if classA has a
>new, you have to invoke classB's new inside it with SUPER::.
>
>also what would objectB do with objectA? if it mungs the guts of ObjectA
>you are breaking encapsulation unless they are classes related by
>inheritance. think about how you really want the 2 classes to
>interact. passing an object to another is perfectly valid and is
>something a project i am working on will do.

Another option is to create an in-between object to pass messages back and
forth between the two objects, kind of as a poor man's request broker.
Just as with Perl, in OOP, there's always more than one way to do it --
with both Perl and OOP, this increases geometrically. :-)

-- 
Brett W. McCoy                             bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek)   http://www.foiservices.com
FOI Services, Inc./DIOGENES                301-975-0110
---------------------------------------------------------------------------


------------------------------

Date: 15 Nov 1999 19:28:10 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: OO woes
Message-Id: <80pmsa$kd6$1@towncrier.cc.monash.edu.au>

NukeEmUp@ThePentagon.com (David Cantrell) writes:

   > Imagine you have two classes, classA and classB.  If objectA (an
   > instance of classA) calls classB->new() to instantiate objectB, is
   > there any way that objectB can get a reference to objectA without me
   > having to pass objectA to classB->new()?


	use Devel::DumpStack qw(caller2);

	sub classB::new
	{
		my $objectA = (caller2(1))[0]->[0];
	}


Alternatively, you could pass the extra argument via the symbol table:

	sub classA::someMethod
	{
		local $classB::objectA = $objectA;
		my $objectB = classB->new();
	}

	sub classB::new
	{
		my ($class,@args) = @_;
		bless {
			creator => $objectA,
			# etc.
		      }, $class;
	}

But don't do that.


   > I'd rather not have to pass the reference to objectA into
   > classB->new() as that will break my nice clean interface by
   > introducing a special case for a few classes.

In my view, circumventing the constructor argument list is the more
serious violation of interface. Whatever a class's &new needs to create
an object ought to be passed to it explicitly, via its argument list.
Implicit argument-passing mechanisms (such as the two shown above)
introduce subtlety, which is the natural enemy of maintainability.


   > I can't look in Damian Conway's excellent OO-perl book ATM cos it's
   > about 200 miles away :-(

Fortunately, the man himself is only 10000 miles away :-)

Damian


------------------------------

Date: Mon, 15 Nov 1999 18:55:24 GMT
From: malte_ubl@my-deja.com
Subject: Open Source Bulletin Board
Message-Id: <80pkuh$epk$1@nnrp1.deja.com>

Hi,

we at Webmaster-Forums.com are working on an Open
Source Bulletin Board called Boardzilla. If you
worked with UltimateBB or BigTalker before you
probably know what a pain in the *** that is.
Well, we want to improve that situation, and
create our own Bulletin Board using the advantages
of Open Source. We still need support on the
programming. The project will be most likely done
in Perl in combination with either a flat file
database or SQL. mod_perl is an option, too.
Especially, if you have experience, in Open Source
we would more than appreciate you help, but
everyone else with experience in Programming can
help, too.

Our site is currently using the BigTalker Bulletin
Board which brings another interesting point to
this project because BigTalker's creator already
tried to hack our forums, so we would have
to continue to use his software (Of course, we
dont know exactly who it was. Its just a guess).
So, if you have experience in security issues, we
could use your help, too :-)

This is not supposed to sound like we dont have
anything in our hands but the idea.
Webmaster-Forums has a pool of talent with over
1300 members, but we still appreciate all support
we can get.

You can check out discussions about this topic @
http://www.webmaster-forums.com/cgi-bin/bigtalker/
forum.cgi?forum=18
There you will find some more information and you
can post it if you would like to contribute to
this project.

I hope I'll se ya guys around,

Malte

(You can contact me on ICQ: 17132076)


I will append the original post which initiated
this project:
Hi,

recently, there has been a big controversy about
the creator (or copier) of the software
which runs these forums - BigTalker. When you look
for alternative forum software, you
might find some pretty good ones; some of them
might be faster than this board,
especially those which use SQL, but there nothing
really cool out there that could make
all of us say: "Wow, we need that board ". It
seems like development has come to a
halt since UBB reinvented the web based bulletin
board.

Thus, I think, we, as a community, should make our
own board fitting all of our needs. I
know that this is easier said than done, but on
the other hand I know, that the people
who are around in the Webmaster-Forums have the
skills to do it. We have forums that
cover a wide, almost complete, range of subjects
and technologies which you need to do
such a project. Further, in all of those forums
you have regulars, not only the
moderators, who are experts in their fields, going
from server side aspects, over the
client side, all the way to marketing and hosting
of websites.

What I imagine is that we create a new forum that
is solely concerned with the
development of the bulletin board. First we need
to develop and road map for the
development, and then "walk" it step by step. The
first step may be to just have all
members post their wishes and needs, new ideas,
and improvements to existing forum
software. As a next step a smaller group
consisting of experts would start the
programming. Every day they would post their
process in the appropriate forum.
Everytime they encounter a problem, they would
post the source code, and everybody
could propose ways to make the code work. The same
process could be used to get rid
of bottlenecks and bugs. The testing would be
public, too. I am sure Chad would host the
software for free, so everybody could try it out.
Another advantage of this
development-process would be that separate tasks,
like for example a tool which
converts existing databases from other boards to
our format, could be posted on TWF
and distributed to people who are willing to
donate some time. And I'm sure there are
these people, because that's what these forums are
all about.

Well, this was just an idea. I'd like to hear your
opinions about this matter. If you think it
can be done, or it's totally impossible, post it
here. Maybe some people have first
suggestions of what should be improved, or others
might even already say that they
would like to be a part of the project.

Welcome to BoardZilla - The Open Source Bulletin
Board!

Later,

Malte


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: 15 Nov 1999 18:54:52 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl-CPAN CD-ROM? + Best Linux Distrib for Perl?
Message-Id: <80pkts$228$1@gellyfish.btinternet.com>

On Mon, 15 Nov 1999 15:22:16 GMT Mark Summerfield wrote:
> Does anyone know if CPAN is available on CD-ROM? And if so from where?
> 

No.  In the sense that CPAN is constantly  updated and dynamic this is
impossible.

> Are there any prepared 'bundles' of perl modules that don't come with
> the standard distribution, e.g. a 'CGI' bundle, a 'DBI' bundle and so on
> each of which has all the CPAN modules in its category, ideally in .rpm
> and .deb formats for easy installation? (Would probably need two sets at
> the moment one for 5.004 and one for 5.005 since they aren't binary
> compatible.)
> 

Why do you want install modules from platform dependent packages when you
it is not exactly difficult to do :

perl Makefile.PL
make
make test
make install

?


> Which Linux distribution is the best for Perl work -- I'm defining
> 'best' as being the one with the most Perl modules in addition to the
> standard ones, and best environment for Perl coding. At present I use
> Debian 2.1 which I find excellent in these regards except for the fact
> that it uses 5.004 and there are some features of 5.005, e.g. qr//, that
> I'd really like to use.
> 

This is a question for a Linux newsgroup.
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Mon, 15 Nov 1999 14:15:04 -0700
From: Greg Phillips <gip@frontier.net>
Subject: Perl/CGI programmer wanted
Message-Id: <383077CC.1602EB6@frontier.net>

We're developing a web-based distance learning application and are
looking for a Perl CGI programmer
to assist our development team on a sub-contract basis (offsite).  If
you are interested, please contact me at your convenience.

Greg Phillips
SOF, Inc.
Durango, CO
gip@frontier.net
970-247-3610





------------------------------

Date: Mon, 15 Nov 1999 20:25:46 +0100
From: Christian Wix <christian@wix.dk>
Subject: Re: Please help me create a file with perl
Message-Id: <38305E39.DADB6628@wix.dk>

I know this will work:

#!/usr/bin/perl -w

open (FILE,">>Jonas") or die "can't append to filename: $!";
print FILE "Test \n";
close (FILE);
chmod(0666, "Jonas");

// Chris, Denmark

Jonas Nilsson wrote:

> Hello.
> I don't know so much perl. I think a script that create a file should
> look something like this, but I get a Internal Server Error all the
> time. Does anyone know what's wrong please tell me. Thanks.
>
> My script:
>
> #!/usr/bin/perl
> open(FILE,">>jonas") \n";
> print FILE"Test\n";
> close(FILE);
> `chmod 666 jonas`;
>
> Thanks
> Jonas

--
Christian Wix
Bergsøekollegiet 23,st - 2309
Søllerød
2850 Nærum
Denmark
Phone: +45 45505171-(tone)-2309 / +45 26258162
Email & www: mailto:christian@wix.dk - http://www.wix.dk
ICQ #21322285




------------------------------

Date: Mon, 15 Nov 1999 14:30:06 -0800
From: avivA Starkman <aviva.starkman@exchange.sp.trw.com>
Subject: Re: Please help me create a file with perl
Message-Id: <3830896E.EA4BD62C@exchange.sp.trw.com>

> My script:
> 
> #!/usr/bin/perl
> open(FILE,">>jonas") \n";
> print FILE"Test\n";
> close(FILE);
> `chmod 666 jonas`;
 
The second line should read:
	open(FILE,">>jonas");

-- 
 __  __   _ __   \ |     Aviva Starkman (or spelled backwards, avivA)
   |   |  |   |  |\|     Georgia Tech, B. CmpE '96!
 | | __|_   __|_ | \     avivas@emu.sp.trw.com.NOSPAM


------------------------------

Date: 15 Nov 1999 19:03:47 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Redirect to LOCAL file
Message-Id: <80plej$22h$1@gellyfish.btinternet.com>

On Mon, 15 Nov 1999 10:32:13 -0500 Crawfishy wrote:
> I normally use the LOCATION header in my cgi's to redirect the browser to a
> new page but as I understand it, you must use a full URL for location to
> work. Is there a way to use a relative address to redirect. The reason for
> this is that if I put full urls and then move the pages/scripts to another
> server, I will have to redo all the urls.
> So there must be a way to make it more portable... right?

Who knows ?  You might get an answer if you ask in a newsgroup that is
concerned with such matters - comp.infosystems.www.authoring.cgi - that
is if it is not answered in the CGI FAQ at : 

<http://www.webthing.com/tutorials/cgifaq.html>

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Mon, 15 Nov 1999 12:48:13 -0600
From: Tom Briles <sariq@texas.net>
Subject: Re: Removing all combinations of spaces/tabs at end of string
Message-Id: <3830556D.E6C6D0D4@texas.net>

GlenHovde wrote:
> 
> >Simple.
> >
> >$MyString =~ s/\s*$//;
> >
> 
> strips everything from the first space char to end of line (forgot the ^)

What are you talking about?

No, the above regex isn't perfect, since the '*' should be a '+'.

But it certainly doesn't do what *you* said it does.  You might consider
testing things before posting willy-nilly.

I can't figure out why people feel they have to post code, when there's
a perfectly good answer in the FAQ.

- Tom


------------------------------

Date: Mon, 15 Nov 1999 22:42:36 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Removing all combinations of spaces/tabs at end of string
Message-Id: <s3132skhsq92@corp.supernews.com>

name2@my-deja.com wrote:
: $MyString =~ s/\s*$//;

That does some useless work if there are no spaces at the end.  Change the
* to + to fix this.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 1386
**************************************


home help back first fref pref prev next nref lref last post