[12116] in Perl-Users-Digest
Perl-Users Digest, Issue: 5716 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 18 18:07:20 1999
Date: Tue, 18 May 99 15:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 18 May 1999 Volume: 8 Number: 5716
Today's topics:
_Please_ improve localtime! <occitan@esperanto.org>
Re: Accents Sensitivity <baliga@synopsys.com>
Re: Creating FIle with a predeterminated Size <gellyfish@gellyfish.com>
Re: DBI not thread safe. Another way? zenin@bawdycaste.org
Re: error passing a CGI object to a function in a pm. <bwlang@genome.wi.mit.edu>
Re: error passing a CGI object to a function in a pm. <bwlang@genome.wi.mit.edu>
Re: Help w/ /tr func <baliga@synopsys.com>
Re: Help! cgi and system() failure <baliga@synopsys.com>
Re: Help! cgi and system() failure <madigan@rohan.sdsu.edu>
Re: How to get the infomation of a variable if it is sc (Tad McClellan)
Re: How to get the infomation of a variable if it is sc <cassell@mail.cor.epa.gov>
Re: How to override HTTP_USER_AGENT when using libwww-p <gellyfish@gellyfish.com>
Is there a wait()? <airman@inreach.com>
Re: Is there a wait()? (Alastair)
Re: Newbie: HTTP_HOST / Redirect? <gellyfish@gellyfish.com>
Object Help <bwaite@uswest.com>
Re: Object Help <baliga@synopsys.com>
Re: object oriented perl-good reference? <baliga@synopsys.com>
Re: Perl "constructors" armchair@my-dejanews.com
Re: Perl "constructors" armchair@my-dejanews.com
Re: Problem With Scope (Tad McClellan)
Re: Q: System Call <baliga@synopsys.com>
QUESTION: does Perl lack immediate binding within an ar <brannon@quake.usc.edu>
Re: QUESTION: does Perl lack immediate binding within a (Ilya Zakharevich)
regenerating perl.exp <sjr3a@etext.lib.Virginia.EDU>
Removing a directory with contents <gdnova@enteract.com>
Saving/Reading Hashes <jalil@corp.home.net>
Re: Saving/Reading Hashes <baliga@synopsys.com>
Re: Saving/Reading Hashes <dgris@moiraine.dimensional.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 18 May 1999 21:41:05 GMT
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: _Please_ improve localtime!
Message-Id: <7hsmpi$r6q$1@nnrp1.deja.com>
Going from 2 to 3 digits in the year returned by localtime is hardly a
feature, though it should mostly avert the Y2k headaches. This likely
means touching a lot of proggies before year's end.
The other hassle is the absurd month number (time and again I have
fallen into the trap). It prevents me from writing something neat like
join '.', (localtime)[5,4,3]. Instead I have to assign to variables and
increment the month. The only advantage of this weird numbering is
indexing a month-name-array, but then I need a scalar anyways, so it
doesn't hurt to subtract one.
So, hey, give us poor programmers a break. Introduce a $^something
option to give localtime more useful semantics. And announce that it
will be the default in 5.007. Or a more kludgy variant, that will
however never break existing programmes: Add two elements to the
returned list, with alternative proper values.
--
Perl |berallhin:
Perl everywhere: http://beam.to/iPerl/
Perl ^cien:
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Tue, 18 May 1999 14:51:16 -0700
From: Yogish Baliga <baliga@synopsys.com>
To: amenrique@my-dejanews.com
Subject: Re: Accents Sensitivity
Message-Id: <3741E0D3.70E54AFD@synopsys.com>
You can use Phoenetic searching using the soundex function.
-- Baliga
amenrique@my-dejanews.com wrote:
> I have developed a search engine in Spanish. It works fine. The problem
> is that users are trying to find words without writing the accents used
> in spanish, i.e. they search for Maria with no results, as the right
> spelling is Marma (with an accent on the i)
>
> Is there an easy way the make the search "not sensitive" to the
> accents, so a search for Maria would return all findings with Marma?
>
> Sorry if the answer is obvious, but I have tried to find a solution at
> the Perl Man and the FAQs on www.perl.com without success.
>
> Antonio
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
------------------------------
Date: 18 May 1999 21:01:39 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Creating FIle with a predeterminated Size
Message-Id: <7hskfj$5p9$1@gellyfish.btinternet.com>
On 18 May 1999 19:04:52 GMT John Stanley wrote:
> In article <3741ACF4.ADBE04C5@hp.com>, Pep Mico <"Pep Mico"@hp.com> wrote:
>>How can I create a file with a predeterminated file? or for example, how
>>Can I create a file with a size of 10Mbytes?
>
> mkfile 10m
>
Sounds great. Unfortunately I dont appear to have this on my system.
It puts me in mind of the wonderful create_file from ICL VME ,
unfortunately there isnt a port of Perl there ;-{
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 18 May 1999 21:13:23 GMT
From: zenin@bawdycaste.org
Subject: Re: DBI not thread safe. Another way?
Message-Id: <927062145.313416@localhost>
Darrel Davis <darreld@his.com> wrote:
: Excellent. After looking through the Perl Cookbook I was going to use a
: separate process and communicate via pipes. I know how to create the DBI
: thread but how would I communicate with the BDI thread from the other
: threads? via a global hash?
Yes, that's one way. Make sure you get all the locking working
though. You can also use pipes between threads, or shared memory,
or...
I haven't used Perl threads for database servers as yet, choosing
instead to use a multiple process server design since I can safely
do anything in the children without affecting the others. Threads
and the issues that travel with them can be a nightmare to keep
sane. It doesn't help at all that the Perl thread API is in flux,
perl isn't thread safe, many perl libraries aren't thread safe, and
very little that claims to be thread safe has really been tested
extensively...
I wouldn't use threads in production code yet. They also aren't
needed except possibly in some designs under Win32 (that lacks
fork() and tons of other functionality.
--
-Zenin (zenin@archive.rhps.org) Caffeine...for the mind.
Pizza......for the body.
Sushi......for the soul.
-- User Friendly
------------------------------
Date: Tue, 18 May 1999 16:22:44 -0400
From: "Bradley W. Langhorst" <bwlang@genome.wi.mit.edu>
Subject: Re: error passing a CGI object to a function in a pm.
Message-Id: <3741CC14.53A1992C@genome.wi.mit.edu>
Ronald J Kimball wrote:
> I think you got no meaningful response for other reasons. In
> particular:
>
> 1. Too much code: we generally prefer to debug _short_ code samples.
> 190 lines takes too much time to go through.
>
I first asked the question with reformatted pseudocode so it would be easy
to read but somebody
started telling me about a semicolon missing...
John Porter said
> Did you actually cut-and-paste this from your
> actual code?
>
so i did cut and paste it.
There must be some happy medium. I'm trying to find it.
>
> 2. Wrapped lines: code with wrapped lines is extremely difficult to
> debug. Just running it requires manual unwrapping. When you
> post code, make sure each line is less than 80 characters long.
okay - i will try to be sure that i do this in the future.
>
> Anyway, I would suggest printing out the value of $q before the line
> where the error occurs. It should look something like this:
>
> CGI=HASH(0x102c5128)
>
That is a valuable suggestion - and I did try that.
Before the call to the perlmod function
and inside the perlmod function the value of $q looks exactly the same
Thanks for taking time to look at this problem - I've really been sweating
it for a while now.
brad
------------------------------
Date: Tue, 18 May 1999 16:23:16 -0400
From: "Bradley W. Langhorst" <bwlang@genome.wi.mit.edu>
Subject: Re: error passing a CGI object to a function in a pm.
Message-Id: <3741CC34.A3BBC2D8@genome.wi.mit.edu>
Ronald J Kimball wrote:
> I think you got no meaningful response for other reasons. In
> particular:
>
> 1. Too much code: we generally prefer to debug _short_ code samples.
> 190 lines takes too much time to go through.
>
I first asked the question with reformatted pseudocode so it would be easy
to read but somebody
started telling me about a semicolon missing...
John Porter said
> Did you actually cut-and-paste this from your
> actual code?
>
so i did cut and paste it.
There must be some happy medium. I'm trying to find it.
>
> 2. Wrapped lines: code with wrapped lines is extremely difficult to
> debug. Just running it requires manual unwrapping. When you
> post code, make sure each line is less than 80 characters long.
okay - i will try to be sure that i do this in the future.
>
> Anyway, I would suggest printing out the value of $q before the line
> where the error occurs. It should look something like this:
>
> CGI=HASH(0x102c5128)
>
That is a valuable suggestion - and I did try that.
Before the call to the perlmod function
and inside the perlmod function the value of $q looks exactly the same
Thanks for taking time to look at this problem - I've really been sweating
it for a while now.
brad
------------------------------
Date: Tue, 18 May 1999 14:30:20 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: Help w/ /tr func
Message-Id: <3741DBEC.C990DE47@synopsys.com>
try using
s/\n//g;
-- Baliga
Steve Short wrote:
> I would like to use either the tr/ or s/ function to remove all
> occurances of carriage returns from a text variable. What searchtext
> character should I try??
>
> I tried \n & \r but neither worked. Sometimes people will add these CR's
>
> to the forms, and I'm writing a tab delimeted file with these forms, so
> the extra CR's are being intepreted as record delimeters in my
> database.... Help!!
------------------------------
Date: Tue, 18 May 1999 14:09:59 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: Help! cgi and system() failure
Message-Id: <3741D727.E81853F5@synopsys.com>
The directory having "runscript" is not in the path environment variable
when the
CGI script run. If the CGI script you are giving on the browser and the
runscript are
in the same directory, use system( "./runscript" ) instead of system(
"runscript" );
-- Baliga
Michael Madigan wrote:
> If anyone has seen something similar to this please help me out.
>
> I am trying to make a call from a perl cgi script:
> system("runscript");
> to run a perl script on my server. It runs fine from the command line
> but not when invoked through a browser. I have tried different quotes,
> back quotes, exec(). All the permissions are 0777 for "runscript". The
> directory permissions are 0711 and the cgi permissions are 0755, these
> are the system defaults. My only guess is the browser is not allowed to
> execute a script on the server through a system() call.
>
> If anyone has any insight, it would be greatly appreciated.
> Mike Madigan
> madigan@rohan.sdsu.edu
------------------------------
Date: Tue, 18 May 1999 14:26:53 -0700
From: Michael Madigan <madigan@rohan.sdsu.edu>
To: baliga@synopsys.com
Subject: Re: Help! cgi and system() failure
Message-Id: <3741DB1D.1B85@rohan.sdsu.edu>
Thanks. Actually I tried that, I even gave it the absolute path:
"/home/httpd/cgi-bin/runscript" both with no success.
I even tried setting the path in my .cshrc to look in this directory.
My new theory is that the sh shell does not have the ability to execute
scripts when called from a browser. Anyone heard of this happening?
MM
Yogish Baliga wrote:
>
> The directory having "runscript" is not in the path environment variable
> when the
> CGI script run. If the CGI script you are giving on the browser and the
> runscript are
> in the same directory, use system( "./runscript" ) instead of system(
> "runscript" );
>
> -- Baliga
>
> Michael Madigan wrote:
>
> > If anyone has seen something similar to this please help me out.
> >
> > I am trying to make a call from a perl cgi script:
> > system("runscript");
> > to run a perl script on my server. It runs fine from the command line
> > but not when invoked through a browser. I have tried different quotes,
> > back quotes, exec(). All the permissions are 0777 for "runscript". The
> > directory permissions are 0711 and the cgi permissions are 0755, these
> > are the system defaults. My only guess is the browser is not allowed to
> > execute a script on the server through a system() call.
> >
> > If anyone has any insight, it would be greatly appreciated.
> > Mike Madigan
> > madigan@rohan.sdsu.edu
------------------------------
Date: Tue, 18 May 1999 10:51:39 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to get the infomation of a variable if it is scalar or integer?
Message-Id: <rpurh7.pga.ln@magna.metronet.com>
Ryan Ngi (ryanngi@hotmail.com) wrote:
: How to get the infomation of a variable if it is scalar or integer?
An integer _is_ a scalar.
So I dunno what question you meant to ask. I'll guess though.
Perl FAQ, part 4:
"How do I determine whether a scalar is a number/whole/integer/float?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 18 May 1999 13:07:17 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How to get the infomation of a variable if it is scalar or integer?
Message-Id: <3741C875.33D8C683@mail.cor.epa.gov>
Ryan Ngi wrote:
>
> How to get the infomation of a variable if it is scalar or integer?
Whoa. You seem to have some confusion here.. or else you have
given me a case of it. :-)
An integer is one kind of scalar. There is not an exclusive
'or' in your question. What are you trying to do? One of these:
Check whether you have a string or number?
Check whether you have a scalar or list context?
Perhaps if you show us some code and tell us why you need
this, we'll be able to tell what the problem is.
You might also want to read the perldata manpage: go to
a command prompt and type
perldoc perldata
{or just read the HTML version; or run 'man'; or read the POD}.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 18 May 1999 19:53:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to override HTTP_USER_AGENT when using libwww-perl?
Message-Id: <7hsggh$5jf$1@gellyfish.btinternet.com>
On Tue, 18 May 1999 12:04:07 -0700 Mark Ginsburg wrote:
>
> Hi,
>
> how do I override the HTTP_USER_AGENT = AgentName/0.1
> libwww-perl/5.33<BR>
> entry when I use the libwww-perl package?
>
This is the example from the lwpcook manpage:
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("$0/0.1 " . $ua->agent);
# $ua->agent("Mozilla/8.0") # pretend we are very capable browser
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 18 May 1999 14:23:33 -0700
From: LEB <airman@inreach.com>
Subject: Is there a wait()?
Message-Id: <3741DA55.40E53AAC@inreach.com>
I am pretty new to perl. I am putting together a script that needs to do
the following:
- write a file
- wait 10 seconds
- write another file
I've got the file writing down ok, but can't seem to figure out the wait
part.
I looked up sleep() and tried that but it bombed. Returned a could not
compile error??
I really appreciate any help.
------------------------------
Date: Tue, 18 May 1999 21:43:17 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Is there a wait()?
Message-Id: <slrn7k3rai.5o.alastair@calliope.demon.co.uk>
LEB <airman@inreach.com> wrote:
>I've got the file writing down ok, but can't seem to figure out the wait
>part.
>I looked up sleep() and tried that but it bombed. Returned a could not
>compile error??
The 'sleep' function is standard i.e.
sleep 10;
will sleep for 10 secs. What code and what error?
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: 18 May 1999 21:26:11 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Newbie: HTTP_HOST / Redirect?
Message-Id: <7hsltj$5pm$1@gellyfish.btinternet.com>
On Sun, 16 May 1999 10:45:38 -0800 Joe wrote:
> Hello,
>
> I'm trying to create a simple script to check the HTTP_HOST and load the
> appropriate web page. (I have several different domains pointing to the
> same server.) The following script should work according to my minimal
> understanding of Perl, but regardless of what HTTP_HOST equals, it always
> loads http://aksell.com. Can anyone tell me what I'm doing wrong?
>
> ################## Redirect.cgi Begin ####################
> #!/usr/bin/perl
>
> $domain=$ENV{'HTTP_HOST'};
>
> print "Content-type: text/html\n\n";
> print "<HTML><HEAD><TITLE>..</TITLE>";
>
> if (($domain=="aksell.com") || ($domain=="www.aksell.com")) { print "<META
> HTTP-EQUIV=\"refresh\"
> CONTENT=\"0;url=http://www.aksell.com/index.html\">"; }
>
> elsif (($domain=="alaskanweb.net") || ($domain=="www.alaskanweb.net")) {
> print "<META HTTP-EQUIV=\"refresh\"
> CONTENT=\"0;url=http://www.alaskanweb.net/index.html\">"; }
>
> #else DEFAULT
>
> print "</HEAD>";
> print "<BODY></BODY></HTML>";
> ################## Redirect.cgi End ######################
>
>
It is probably not working because you are checking strings with a numeric
test operator - you should read the perlop manpage to understand the
difference between '==' and 'eq'.
Of course you could always do something like :
$_ = $ENV{'HTTP_HOST'};
if (/askell.com$/ )
{
# whatever
}
elsif(/alaskanweb.net$/ )
{
# whatever
}
Of course I could also take issue with your use of the "<META .." thing
as opposed to the more widely supported "Location:" header but this isnt
the place to get into that.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 18 May 1999 14:38:28 -0600
From: Brad Waite <bwaite@uswest.com>
Subject: Object Help
Message-Id: <3741CFC4.FAF1DFD7@uswest.com>
Hi guys,
I'm not very good with OO stuff, so I'm hoping to get a few pointers (pun
intended).
Here's what I'm trying to do: I've got one program, mapVis, that reads a .gif
image via L. Stein's GD.pm, and draws on it according to the coordinates passed
to it. Program two, readVis, is supposed to take the object and magnify a
section and write it to a file. I'm trying to use ShareLite.pm to store the
objects in shared memory space, but it doesn't seem to work right.
Here's basic code.
mapVis:
$share = new IPC::ShareLite( -key=>'Joe', -create=>1 , -destroy=>0) || die;
open(GIF, "/tmp/pic.gif");
$gif = newFromGif GD::Image("GIF");
close(GIF);
$share->store($gif);
readVis:
$share = new IPC::ShareLite( -key=>'Joe', -create=>0, -destroy=>0) || die;
$newgif = share->fetch;
print "$newgif";
Output of readVis:
GD::Image=SCALAR(0xce23c)
How do I dereference(?) $newgif in readVis? Or can't I? Help. Please.
-Brad
------------------------------
Date: Tue, 18 May 1999 14:12:49 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: Object Help
Message-Id: <3741D7D1.A0354F00@synopsys.com>
By the output it seems like, $newgif is a reference to a scalar. So try to use $$newgif
-- Baliga
Brad Waite wrote:
> Hi guys,
>
> I'm not very good with OO stuff, so I'm hoping to get a few pointers (pun
> intended).
>
> Here's what I'm trying to do: I've got one program, mapVis, that reads a .gif
> image via L. Stein's GD.pm, and draws on it according to the coordinates passed
> to it. Program two, readVis, is supposed to take the object and magnify a
> section and write it to a file. I'm trying to use ShareLite.pm to store the
> objects in shared memory space, but it doesn't seem to work right.
>
> Here's basic code.
>
> mapVis:
>
> $share = new IPC::ShareLite( -key=>'Joe', -create=>1 , -destroy=>0) || die;
>
> open(GIF, "/tmp/pic.gif");
> $gif = newFromGif GD::Image("GIF");
> close(GIF);
>
> $share->store($gif);
>
> readVis:
>
> $share = new IPC::ShareLite( -key=>'Joe', -create=>0, -destroy=>0) || die;
> $newgif = share->fetch;
> print "$newgif";
>
> Output of readVis:
>
> GD::Image=SCALAR(0xce23c)
>
> How do I dereference(?) $newgif in readVis? Or can't I? Help. Please.
>
> -Brad
------------------------------
Date: Tue, 18 May 1999 14:44:11 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: object oriented perl-good reference?
Message-Id: <3741DF2B.8032245F@synopsys.com>
Go to the following site
http://www.perl.com/CPAN-local/doc/manual/html/pod/
Here you will get a link to the Object Oriented Programming link.
-- Baliga
"%GIVEN NAME% o'regan" wrote:
> I am learning PERL and have a project coming up to design web forms for
> on-line
> submission of information. I was thinking I could use Object-Oriented
> principles to design
> the basic form class and grow from there. (I have done some very basic
> OOAD and some
> very basic JAVA so I already have a good understanding of the basics of
> OO) I have tried
> creating objects in PERL, but still struggling with the 500 error.
>
> Would any be able recommend a good book that addresses OO in Perl
> comprehensively?
>
> Has anyone ever approached this type of project in this way?
>
> any help appreciated.
>
> David O'Regan
------------------------------
Date: Tue, 18 May 1999 21:23:27 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hsloe$qd1$1@nnrp1.deja.com>
In article <7hrkov$4ah$1@nnrp1.deja.com>,
John Porter <jdporter@min.net> wrote:
> In article <7hqp4j$ibh$1@nnrp1.deja.com>,
> armchair@my-dejanews.com wrote:
> > In article <7hpar3$hdh$1@nnrp1.deja.com>,
> > John Porter <jdporter@min.net> wrote:
> > > In article <7hjioj$rks$1@nnrp1.deja.com>,
> > > armchair@my-dejanews.com wrote:
> > > > ... records are fixed in the number and type (but not
> > > > possible in Perl) of fields they hold, whereas a hash or array
can
> > > hold
> > > > 0 to n fields and has to be checked if the code is going to be
> > > "robust"
> > > > and handle invalid passed parameters gracefully.
> > >
> > > You know, an analogous situation exists in C++ (and in OO langs
> > > in general, including Perl).
> > >
> > > class A;
> > >
> > > class B : A {
> > > public:
> > > int foo();
> > > };
> > >
> > > class C : A {
> > > public:
> > > int bar();
> > > };
> > >
> > > int f( A& a ) {
> > > a.foo(); // can I call this?
> > > a.bar(); // or this? and how do I know?
> > > };
> >
> > This code is not valid, at least not in C++, as it won't compile:
> >
> > ERROR: A has no member foo
> > ERROR: A has no member bar
>
> You seem to have missed my point.
> Since it's possible that the A passed in is actually B or C, in
> which case I would like to call foo or bar, respectively, some
> kind of "type testing" must be done, so that I only call foo or
> bar in the legal cases (i.e. where a is a B or a C, respectively).
> So you can't really escape "type testing" even in C++.
> And it's rather more work than the simple 'exists' in Perl.
>
This situation does not arise in C++. If A is actually referring to a B
or C, you can only call member functions in B or C that also exist in A
as virtual member functions. You could never call foo or bar, regardless
of any "type testing" in this example. So you need to add a virtual foo
and a virtual bar to A. But then there is still no problem. If you have
a B and call bar() you get A's bar(), not a runtime error.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Tue, 18 May 1999 21:29:24 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hsm3i$qnh$1@nnrp1.deja.com>
In article <7hrkgb$413$1@nnrp1.deja.com>,
John Porter <jdporter@min.net> wrote:
> In article <7hqo8k$hte$1@nnrp1.deja.com>,
> armchair@my-dejanews.com wrote:
> > I think I am catching on. It is okay to criticize a programmer's
> style,
> > but not Perl's style.
>
> That must be qualified: it's ok for those who know what they're
> talking about to criticize Perl.
The only people that can "criticize" Catholocism are the Pope, bishops,
priests, and nuns.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Tue, 18 May 1999 10:56:06 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Problem With Scope
Message-Id: <62vrh7.pga.ln@magna.metronet.com>
Ryan Ngi (ryanngi@hotmail.com) wrote:
: $x = 5
You are missing the statement terminator there.
: sub{
You are missing the subroutine name there.
: my($x)=3;
: $y= ..... # how to assign y to the global $x, not the my($x)
: }
Your words to not match your code fragment.
$main::x = $y; # assign y to the global $x
$y = $main::x; # assign global $x to $y
You should spend a little more time on framing a coherent question
before posting it.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 18 May 1999 14:24:07 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: Q: System Call
Message-Id: <3741DA77.9CC28AE8@synopsys.com>
I think it should have been \$$PND_COUNTER and \$$DEVICE_COUNTER.
Otherwise perl is going to pass the command
nawk '{print $$PND_COUNTER $$DEVICE_COUNTER}' <filename>
to the undelying OS.
-- Baliga
bdwheele@indiana.edu wrote:
> In article <Pine.SOL.3.96.990518112620.22134A-100000@ux12.cso.uiuc.edu>,
> Bryan Camp <b-camp@students.uiuc.edu> writes:
>
> $'s in " quoted strings are treated as perl variables. To get a real
> $ in a string, use \$.
>
> so...
>
> >
> > system("nawk '{print $$PND_COUNTER, $$DEVICE_COUNTER }' $File_Names[$c]");
> >
>
> would become:
>
> system("nawk '{print \$\$PND_COUNTER, \$\$DEVICE_COUNTER}' $File_Names[$c]");
>
> Brian Wheeler
> bdwheele@Indiana.edu
------------------------------
Date: 18 May 1999 13:02:42 -0700
From: tbrannon <brannon@quake.usc.edu>
Subject: QUESTION: does Perl lack immediate binding within an array
Message-Id: <ysiz4slajgdd.fsf@nunki.usc.edu>
It would be nice if the latter elements of the list assignment could
use the values bound in former elements:
sub x_power_scores {
($subthresh,$superthresh,$power,$WSBN,$WSPN,$WSBD,$WSPD)=@_;
$weight{$subthresh}{numerator}=$WSBN;
$weight{$subthresh}{denominator}=$WSBD;
$weight{$superthresh}{numerator}=$WSPN;
$weight{$superthresh}{denominator}=$WSPD;
could be written as
($subthresh,$superthresh,$power, $weight{$subthresh}{numerator},$WSPN,$WSBD,$WSPD)=@_;
--
Terrence Brannon * brannon@lnc.usc.edu * http://lnc.usc.edu/~brannon
(213) 740-3397 [office] (323) 294-3028 [home]
------------------------------
Date: 18 May 1999 20:18:58 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: QUESTION: does Perl lack immediate binding within an array
Message-Id: <7hshvi$fvi$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to tbrannon
<brannon@quake.usc.edu>],
who wrote in article <ysiz4slajgdd.fsf@nunki.usc.edu>:
>
> It would be nice if the latter elements of the list assignment could
> use the values bound in former elements:
>
> sub x_power_scores {
>
> ($subthresh,$superthresh,$power,$WSBN,$WSPN,$WSBD,$WSPD)=@_;
>
> $weight{$subthresh}{numerator}=$WSBN;
> $weight{$subthresh}{denominator}=$WSBD;
> $weight{$superthresh}{numerator}=$WSPN;
> $weight{$superthresh}{denominator}=$WSPD;
>
>
> could be written as
> ($subthresh,$superthresh,$power,
> $weight{$subthresh}{numerator},$WSPN,$WSBD,$WSPD)=@_;
See
($a, $b) = ($b, $a);
and other similar constructs which would break.
Ilya
------------------------------
Date: Tue, 18 May 1999 16:30:44 -0400
From: Stephen Ramsay <sjr3a@etext.lib.Virginia.EDU>
Subject: regenerating perl.exp
Message-Id: <Pine.A41.4.10.9905181629090.38978-100000@etext.lib.Virginia.EDU>
Mongers,
I accidentally erased the perl.exp file from my CORE directory (it's a
long story). Is there any way I can regenerate this file without
rebuilding the distribution?
Thanks,
Steve
Stephen Ramsay
Assistant Director
Electronic Text Center email: sjr3a@virginia.edu
------------------------------
Date: Tue, 18 May 1999 16:08:50 -0500
From: "Jeff Foege" <gdnova@enteract.com>
Subject: Removing a directory with contents
Message-Id: <7hskul$4jm$1@eve.enteract.com>
First let me start off by saying I am new to Perl, as I'm sure you know by
the subject line. I'm having problems with the routine out of the cookbook
for removing a directory and anything below it.
I was looking at Example 9.3 rmtree1 I could type the example but I figured
I wouldn't waste anyones bandwidth plus I'm sure a lot of people might have
the cookbook already.
I trying to delete a folder : e:\aveenon\base\bldback
That folder contains another folder \disk1 which may contain some files. I
want Perl to delete the whole bldback folder and anything below it. I guess
I just wasn't using the example correctly. If someone could point me the
right direction or maybe explain that example a little more would help a
great deal.
Thanks, Jeff
If you could also send your response to jeff_foege@nmss.com
------------------------------
Date: Tue, 18 May 1999 20:33:10 GMT
From: "Jalil Feghhi" <jalil@corp.home.net>
Subject: Saving/Reading Hashes
Message-Id: <927059590.242360@zeppelin.svr.home.net>
I have a complex hash table that I need to save to disk when my progrm stops
and read it at the startup.
I don't want to iterate through the whole thing and save/read all elements.
Is there another way to do this? Anyway to use printf for example to write
the whole thing to a file and then read everything back with one simple read
operation?
Thanks,
-Jalil
------------------------------
Date: Tue, 18 May 1999 14:03:45 -0700
From: Yogish Baliga <baliga@synopsys.com>
Subject: Re: Saving/Reading Hashes
Message-Id: <3741D5B1.34342CFA@synopsys.com>
If it is a simple Hash with just scalar key and scalar value, you can use Unix
DBM file
to store it. But if the Hash is complex, where key or value is a reference to
Hash or Array,
then you need to device your own way of storing it.
-- Baliga
Jalil Feghhi wrote:
> I have a complex hash table that I need to save to disk when my progrm stops
> and read it at the startup.
> I don't want to iterate through the whole thing and save/read all elements.
> Is there another way to do this? Anyway to use printf for example to write
> the whole thing to a file and then read everything back with one simple read
> operation?
>
> Thanks,
>
> -Jalil
------------------------------
Date: 18 May 1999 15:24:20 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Saving/Reading Hashes
Message-Id: <m3r9oehy0r.fsf@moiraine.dimensional.com>
Yogish Baliga <baliga@synopsys.com> (who doesn't understand how
to quote text, so I've rearranged things) writes:
> Jalil Feghhi wrote:
> > I have a complex hash table that I need to save to disk when
> > my progrm stops and read it at the startup.
> > I don't want to iterate through the whole thing and save/read
> > all elements. Is there another way to do this? Anyway to use
> > printf for example to write the whole thing to a file and then
> > read everything back with one simple read operation?
> If it is a simple Hash with just scalar key and scalar value, you
> can use Unix DBM file to store it. But if the Hash is complex, where
> key or value is a reference to Hash or Array, then you need to
> device your own way of storing it.
Nonsense, there is no need to devise a new way of doing this.
Perfectly good methods exist already.
For single dimensional data structures use Data::Dumper (standard
with 5.005+, from CPAN for obsolete perls). For multi-dimensional
structures use MLDBM (from CPAN for all versions of perl).
Both provide reasonably good persistence mechanisms.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5716
**************************************