[32325] in Perl-Users-Digest
Perl-Users Digest, Issue: 3592 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 18 14:09:24 2012
Date: Wed, 18 Jan 2012 11:09:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 18 Jan 2012 Volume: 11 Number: 3592
Today's topics:
Re: How to remove STDIN in perl CGI <justin.1201@purestblue.com>
Re: Searching Complex Array Values <jimsgibson@gmail.com>
Re: Searching Complex Array Values <tzz@lifelogs.com>
Single-File Inheritance <jimsgibson@gmail.com>
Re: Single-File Inheritance xhoster@gmail.com
Re: Single-File Inheritance (Seymour J.)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 18 Jan 2012 09:07:16 +0000
From: Justin C <justin.1201@purestblue.com>
Subject: Re: How to remove STDIN in perl CGI
Message-Id: <4neiu8-2ks.ln1@zem.masonsmusic.co.uk>
On 2012-01-17, James <hslee911@yahoo.com> wrote:
> How to remove STDIN string in perl CGI (post method) once it is
> processed? Is it possible?
> The goal is, if the browser is refreshed, the STDIN string no longer
> affects the outcome.
I'm not certain what it is you mean, but it sounds like one of these may
be the answer.
use CGI qw/:standard -nosticky/;
(fields don't remember their previous value)
$query->delete('foo','bar','baz');
clears the named parameters.
'perldoc CGI' will help with both of these.
If I'm wrong, please try to explain better what you mean, or, as Ben has
said, provide an example.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Tue, 17 Jan 2012 16:56:05 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: Searching Complex Array Values
Message-Id: <170120121656059824%jimsgibson@gmail.com>
In article <170120121100027068%jimsgibson@gmail.com>, Jim Gibson
<jimsgibson@gmail.com> wrote:
> my $b = $a->{inst}-=>[0]->{'A-data'};
Sorry for the typo. That should be:
my $b = $a->{inst}->[0]->{'A-data'};
--
Jim Gibson
------------------------------
Date: Wed, 18 Jan 2012 08:23:34 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Searching Complex Array Values
Message-Id: <8762g9uotl.fsf@lifelogs.com>
On Sat, 14 Jan 2012 22:31:38 -0800 (PST) Pradeep Patra <smilesonisamal@gmail.com> wrote:
PP> I have a complex array reference. I want to search the
PP> 'name'="v1" and if it matches then search for "ctrs" and then 'C-data'
PP> get the value of "success"?
...
PP> Is there a efficient way of searching this kind then it will be
PP> useful?
You may like the CPAN Data::Match module. It's built for this kind of
searching.
Ted
------------------------------
Date: Tue, 17 Jan 2012 17:08:50 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Single-File Inheritance
Message-Id: <170120121708505710%jimsgibson@gmail.com>
I am trying to do the Right Thing and write a data-processing program
using lofty Object-Oriented principles, instead of my usual lazy
procedural ways, but I am having trouble with putting multiple class
packages into one file. I started out using just one file for
convenience while I develop a framework, and then was planning on
splitting the file into separate modules once I got the basics working.
I am trying to read some data files that have the same format in the
first 6 lines, then have different data records in subsequent lines. I
thought I would write a parent class that reads the header lines, then
child classes to read and parse subsequent lines.
Here is the result:
% cat single.pl
#!/usr/local/bin/perl
use strict;
use warnings;
my $file = ConfigFile->new(); # line 5
package DataFile;
sub new
{
my($class) = shift;
my $self = {};
bless $self, $class;
return $self;
}
package ConfigFile;
our @ISA = qw( DataFile );
% perl single.pl
Can't locate object method "new" via package "ConfigFile" at single.pl
line 5.
% perl -v
This is perl, v5.10.1 (*) built for darwin-2level
If I put the packages in separate files, it works (compiles and runs).
I am almost sure that I have done this type of thing before, and I
can't find any documentation that says I can't.
Should I be able to put multiple packages in a single file and use
inheritance for two of those packages?
Thanks.
--
Jim Gibson
------------------------------
Date: 18 Jan 2012 01:31:46 GMT
From: xhoster@gmail.com
Subject: Re: Single-File Inheritance
Message-Id: <20120117203145.805$rp@newsreader.com>
Jim Gibson <jimsgibson@gmail.com> wrote:
>
> % cat single.pl
> #!/usr/local/bin/perl
> use strict;
> use warnings;
>
> my $file = ConfigFile->new(); # line 5
>
....
>
> package ConfigFile;
> our @ISA = qw( DataFile );
> % perl single.pl
> Can't locate object method "new" via package "ConfigFile" at single.pl
> line 5.
The creation of the @ISA alias occurs at compile time (I think), but the
assignment to @ISA happens only at run time when that line is encountered.
At the time line 5 is executed, the ISA assignment line has not yet
be run in the runtime, so has not yet taken place and @ISA is empty.
You can wrap the @ISA assignment in a BEGIN block to force it to happen at
compile time, or you can move your main code to be below the package code.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Wed, 18 Jan 2012 09:10:03 -0500
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: Single-File Inheritance
Message-Id: <4f16d2bb$5$fuzhry+tra$mr2ice@news.patriot.net>
In <170120121708505710%jimsgibson@gmail.com>, on 01/17/2012
at 05:08 PM, Jim Gibson <jimsgibson@gmail.com> said:
>I am trying to do the Right Thing and write a data-processing program
>using lofty Object-Oriented principles, instead of my usual lazy
>procedural ways,
You have to carve the bird at the joints.
>I am trying to read some data files that have the same format in the
>first 6 lines, then have different data records in subsequent lines.
>I thought I would write a parent class that reads the header lines,
>then child classes to read and parse subsequent lines.
Why? Why not a generic parent class and child classes for header lines
and for each category inferred from the header?
>my $file = ConfigFile->new(); # line 5
Shouldn't that be
my $file = DataFile->new(); # line 5
>If I put the packages in separate files, it works (compiles and
>runs).
Could yuou show skeletal versions of the individual files?
--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>
Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to spamtrap@library.lspace.org
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 V11 Issue 3592
***************************************