[15845] in Perl-Users-Digest
Perl-Users Digest, Issue: 3257 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 5 18:25:56 2000
Date: Mon, 5 Jun 2000 15:05:22 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <960242722-v9-i3257@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 5 Jun 2000 Volume: 9 Number: 3257
Today's topics:
Re: Call file.htm and pass it a parameter?? <steve@gte.net>
Re: Call file.htm and pass it a parameter?? <npecca@yahoo.com>
Convert reference to array into an array of references twolfmaier@acm.org
Re: Convert reference to array into an array of referen (Abigail)
Re: Convert reference to array into an array of referen twolfmaier@acm.org
Re: Convert reference to array into an array of referen (Abigail)
Re: Daylight savings time? <flavell@mail.cern.ch>
Re: Daylight savings time? <juex@deja.com>
Re: Daylight savings time? <red_orc@my-deja.com>
Re: Daylight savings time? <red_orc@my-deja.com>
Re: Daylight savings time? <red_orc@my-deja.com>
Re: DBM or flat file? juump@my-deja.com
easy reference question <nlymbo@mindspring.com>
Re: easy reference question (Bart Lateur)
Re: easy reference question (Neil Kandalgaonkar)
Re: easy reference question <gnari@simnet.is>
Extracting an area from web page <erick@teal.net>
Re: Extracting an area from web page <memmett@fraser.sfu.ca>
Re: Extracting an area from web page (Eric Bohlman)
Re: Extracting an area from web page <erick@teal.net>
Re: Extracting an area from web page <gnari@simnet.is>
Re: Ftp using Net::FTP or LWP::Simple <flavell@mail.cern.ch>
getpwent with duplicate UIDs (Sweth Chandramouli)
Re: global chown ?? <jim@no.spam.ta>
Gtk/Glade usage <atrus@atrustrivalie.eu.org>
Re: Help: OOPS Inheritance... (Bart Lateur)
hidden field problem and multi-page CGI.pm script <prlawrence@lehigh.edu>
Re: hidden field problem and multi-page CGI.pm script (David Efflandt)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 05 Jun 2000 19:25:13 GMT
From: "SteveSingletary" <steve@gte.net>
Subject: Re: Call file.htm and pass it a parameter??
Message-Id: <s8T_4.947$Hs5.124059@dfiatx1-snr1.gtei.net>
Thank you all. I was hoping for a miracle command so that I could read in
the passed parameters and issue a command like http://page2.htm +values (?).
However, you'll let me know the command didn't exist! I did get it working
by doing the ole print <<eof; ...... eof.
Thanks again - this newsgroup is a real life saver for us newbies!!!
--
Steve
SteveSingletary <steve@gte.net> wrote in message
news:gOQ_4.304$Hs5.80101@dfiatx1-snr1.gtei.net...
> I'm trying to pass a parameter from one page.htm to another page.htm. I
was
> told I need to run a perl script (I'm on unix) in order to pass the
> parameter. Does anybody have the correct syntax for this??
> Thanks ...
>
> --
>
> Steve
>
>
------------------------------
Date: Mon, 5 Jun 2000 23:37:41 +0400
From: "HB" <npecca@yahoo.com>
Subject: Re: Call file.htm and pass it a parameter??
Message-Id: <393c0404@news.telekom.ru>
Tina Mueller wrote...
>how can you pass parameters to HTML-pages?
<FORM action="qux.html?quux=quuux&quuuux=quuuuux" .....
and qux.html contains SSI directives checking the parameters. No Perl.
No CGI.
------------------------------
Date: Mon, 05 Jun 2000 19:06:06 GMT
From: twolfmaier@acm.org
Subject: Convert reference to array into an array of references
Message-Id: <8hgtmg$fji$1@nnrp1.deja.com>
I would like to convert a reference to an array into an array of
references to arrays with one elements of the original array each.
arrayref -> ('abc', 'def', 'ghi', ...)
should become:
array_arrayref = (arrayref -> ('abc'), arrayref -> ('def'), ...)
I found a way to do this:
#!perl -w
use strict;
my $arrayref = ['abc', 'def', 'ghi'];
my @array_arrayref;
foreach (@$arrayref) {
push(@array_arrayref, [$_]);
}
# Depending on context, the variable $separated could be true or false
my $separated = 1;
foreach ($separated ? @array_arrayref : $arrayref) {
print("@$_\n");
}
That seems to work. However, I am looking for a more elegant version
that creates the array of references in the foreach list:
foreach ($separated ? <magic here> : $arrayref) {
print("@$_\n");
}
I believe I know Perl enough to know that it can be done. I just don't
know it enough to know how it could be done.
Thanks for your help,
Thomas
-----------------------------------------------------
Thomas Wolfmaier
Human-Computer Interaction Resource Network (HCIRN)
25 Bucks Green Road, Thornhill, ON, Canada, L3T 4G1
Tel: +1-905-881-7095
Email: twolfmaier@acm.org
Web: www.hcirn.com
-----------------------------------------------------
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 5 Jun 2000 19:53:14 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Convert reference to array into an array of references
Message-Id: <8hh0f9$6ko$1@news.panix.com>
On Mon, 05 Jun 2000 19:06:06 GMT, twolfmaier@acm.org <twolfmaier@acm.org> wrote:
++ I would like to convert a reference to an array into an array of
++ references to arrays with one elements of the original array each.
++
++ arrayref -> ('abc', 'def', 'ghi', ...)
++
++ should become:
++
++ array_arrayref = (arrayref -> ('abc'), arrayref -> ('def'), ...)
++
++
++ I found a way to do this:
++
++
++ #!perl -w
++ use strict;
++
++ my $arrayref = ['abc', 'def', 'ghi'];
++ my @array_arrayref;
++ foreach (@$arrayref) {
++ push(@array_arrayref, [$_]);
++ }
Why not just:
my @array_arrayref = map {[$_]} @$arrayref;
++
++ # Depending on context, the variable $separated could be true or false
++ my $separated = 1;
++ foreach ($separated ? @array_arrayref : $arrayref) {
++ print("@$_\n");
++ }
++
++
++ That seems to work. However, I am looking for a more elegant version
++ that creates the array of references in the foreach list:
++
++
++ foreach ($separated ? <magic here> : $arrayref) {
++ print("@$_\n");
++ }
I'm not sure what you want. What do you want to do in "<magic here>"?
Something that makes the array of arrayrefs from $arrayref? But that
would be silly, so I think you want something else. I just don't know
what.
Abigail
------------------------------
Date: Mon, 05 Jun 2000 21:02:41 GMT
From: twolfmaier@acm.org
Subject: Re: Convert reference to array into an array of references
Message-Id: <8hh4h4$l64$1@nnrp1.deja.com>
Hi Abigail,
Thanks for your response.
In article <8hh0f9$6ko$1@news.panix.com>,
abigail@arena-i.com wrote:
> On Mon, 05 Jun 2000 19:06:06 GMT, twolfmaier@acm.org
<twolfmaier@acm.org> wrote:
> ++ I would like to convert a reference to an array into an array of
> ++ references to arrays with one elements of the original array each.
>
> Why not just:
> my @array_arrayref = map {[$_]} @$arrayref;
Thanks, that's exactly what I was looking for.
> ++ foreach ($separated ? <magic here> : $arrayref) {
> ++ print("@$_\n");
> ++ }
>
> I'm not sure what you want. What do you want to do in "<magic here>"?
> Something that makes the array of arrayrefs from $arrayref? But that
> would be silly...
Why would that be silly. That's exactly what I had in mind. My program
now reads:
#!perl -w
use strict;
my $arrayref = ['abc', 'def', 'ghi'];
my $separated = 1;
foreach ($separated ? map {[$_]} @$arrayref : $arrayref) {
print("@$_\n");
}
Thanks again,
Thomas
-----------------------------------------------------
Thomas Wolfmaier
Human-Computer Interaction Resource Network (HCIRN)
25 Bucks Green Road, Thornhill, ON, Canada, L3T 4G1
Tel: +1-905-881-7095
Email: twolfmaier@acm.org
Web: www.hcirn.com
-----------------------------------------------------
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 5 Jun 2000 21:33:44 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Convert reference to array into an array of references
Message-Id: <8hh6bo$86q$1@news.panix.com>
On Mon, 05 Jun 2000 21:02:41 GMT, twolfmaier@acm.org <twolfmaier@acm.org> wrote:
++
++ Why would that be silly. That's exactly what I had in mind. My program
++ now reads:
++
++
++ #!perl -w
++ use strict;
++
++ my $arrayref = ['abc', 'def', 'ghi'];
++
++ my $separated = 1;
++ foreach ($separated ? map {[$_]} @$arrayref : $arrayref) {
++ print("@$_\n");
++ }
But, what's the point? It's an obscure, inefficient way to print with
newlines or spaces between the elements.
{local $" = $separated ? "\n" : " "; print "@$arrayref\n";}
Abigail
------------------------------
Date: Mon, 5 Jun 2000 21:06:38 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Daylight savings time?
Message-Id: <Pine.GHP.4.21.0006052105260.2487-100000@hpplus01.cern.ch>
On Mon, 5 Jun 2000, Rodney Engdahl wrote:
> you could check for first sunday in april and last sunday in october,
Has the World suddenly agreed on changeover dates while I wasn't
looking?
------------------------------
Date: Mon, 5 Jun 2000 13:12:34 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Daylight savings time?
Message-Id: <393c09b2$1@news.microsoft.com>
"Rodney Engdahl" <red_orc@my-deja.com> wrote in message
news:8hgp7b$bna$1@nnrp1.deja.com...
> In article <393BDCD6.CF2DEE01@coaps.fsu.edu>,
> Stacey Campbell <campbell@coaps.fsu.edu> wrote:
> > Hi,
> > I have a perl program that retrieves files from an FTP server by the
> > hour. The files are names by the hour, so I get files according to
> what
> > time it is now. The bi-annual time change is a problem, though.
> > Instead of changing my program twice a year, can anyone give me a
> > routine that will tell if it is EDT or EST?
>
> you could check for first sunday in april and last sunday in october,
> when the changes happen, unless your code runs where DST does not.
>
> Daylight Saving Time, for the U.S. and its territories, is NOT observed
> in Hawaii, American Samoa, Guam, Puerto Rico, the Virgin Islands, the
> Eastern Time Zone portion of the State of Indiana, and the state of
> Arizona (not the Navajo Indian Reservation, which DOES observe). Navajo
> Nation participates in the Daylight Saving Time policy, due to its large
> size and location in three states.)
Bad, bad, bad idea.
- you don't want to recode your program whenever one of those confusing
rules you listed above changes (unless you are interested in job security)
- Assuming that the question about EDT versus EST was just an example for a
more general problem your solution doesn't take into account any non-US
changes, e.g. summer time in Europe. You really, really don't want to
hand-code them.
The correct solution is surprisingly simple: write globalized code!
In this particular case create the file names based on UTC which does not
have summer time in the first place.
If you want to use local time for e.g. customers, then it's trivial to
convert UTC to local time just for display (there are numerous programs out
there to do that).
jue
------------------------------
Date: Mon, 05 Jun 2000 20:54:23 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Daylight savings time?
Message-Id: <8hh41m$ktu$1@nnrp1.deja.com>
In article <Pine.GHP.4.21.0006052105260.2487-100000@hpplus01.cern.ch>,
"Alan J. Flavell" <flavell@mail.cern.ch> wrote:
> On Mon, 5 Jun 2000, Rodney Engdahl wrote:
>
> > you could check for first sunday in april and last sunday in
october,
>
> Has the World suddenly agreed on changeover dates while I wasn't
> looking?
>
>
intended context was US.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 05 Jun 2000 20:59:52 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Daylight savings time?
Message-Id: <8hh4bs$l2o$1@nnrp1.deja.com>
In article <393c09b2$1@news.microsoft.com>,
"Jürgen Exner" <juex@deja.com> wrote:
> "Rodney Engdahl" <red_orc@my-deja.com> wrote in message
> news:8hgp7b$bna$1@nnrp1.deja.com...
> > In article <393BDCD6.CF2DEE01@coaps.fsu.edu>,
> > Stacey Campbell <campbell@coaps.fsu.edu> wrote:
> > > Hi,
> > > I have a perl program that retrieves files from an FTP server by
the
> > > hour. The files are names by the hour, so I get files according
to
> > what
> > > time it is now. The bi-annual time change is a problem, though.
> > > Instead of changing my program twice a year, can anyone give me a
> > > routine that will tell if it is EDT or EST?
> >
> > you could check for first sunday in april and last sunday in
october,
> > when the changes happen, unless your code runs where DST does not.
> >
> > Daylight Saving Time, for the U.S. and its territories, is NOT
observed
> > in Hawaii, American Samoa, Guam, Puerto Rico, the Virgin Islands,
the
> > Eastern Time Zone portion of the State of Indiana, and the state of
> > Arizona (not the Navajo Indian Reservation, which DOES observe).
Navajo
> > Nation participates in the Daylight Saving Time policy, due to its
large
> > size and location in three states.)
>
> Bad, bad, bad idea.
> - you don't want to recode your program whenever one of those
confusing
> rules you listed above changes (unless you are interested in job
security)
Actually, since the context of the OP was an EDT/EST context, most of
those rules (everything but the start and stop dates) go away. Still,
it is better to use UTC and be done with the issue . . .
> - Assuming that the question about EDT versus EST was just an example
for a
> more general problem your solution doesn't take into account any
non-US
> changes, e.g. summer time in Europe. You really, really don't want to
> hand-code them.
>
> The correct solution is surprisingly simple: write globalized code!
> In this particular case create the file names based on UTC which does
not
> have summer time in the first place.
> If you want to use local time for e.g. customers, then it's trivial to
> convert UTC to local time just for display (there are numerous
programs out
> there to do that).
absolutely!
>
> jue
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 05 Jun 2000 20:56:50 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Daylight savings time?
Message-Id: <8hh468$l10$1@nnrp1.deja.com>
In article <Pine.GHP.4.21.0006052105260.2487-100000@hpplus01.cern.ch>,
"Alan J. Flavell" <flavell@mail.cern.ch> wrote:
> On Mon, 5 Jun 2000, Rodney Engdahl wrote:
>
> > you could check for first sunday in april and last sunday in
october,
>
> Has the World suddenly agreed on changeover dates while I wasn't
> looking?
>
>
also, the OP context was EDT/EST.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 05 Jun 2000 21:46:00 GMT
From: juump@my-deja.com
Subject: Re: DBM or flat file?
Message-Id: <8hh72i$nap$1@nnrp1.deja.com>
In article <393b37ff.1810955@news.rmi.net>,
posting.account@lynxview.com (William Herrera) wrote:
> On Mon, 05 Jun 2000 03:59:55 GMT, juump@my-deja.com wrote:
> >Is there a speed advantage to using a database instead of a flat
> >file for this particular kind of search?
>
> No, because with a random substring I doubt that indexing is of any
> value. If both the data and the substrings are somehow predictable,
> so the index key to the DBM might really mean something, things might
> be different.
> ...use a flat file and a fast hard disk with good buffers.
As I suspected. Thanks very much for your advice!
Steve
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 05 Jun 2000 15:04:18 -0700
From: steveFarris <nlymbo@mindspring.com>
Subject: easy reference question
Message-Id: <393C23E2.1A34CF83@mindspring.com>
Hi all,
Is there anyway to shorten the following to one line:
use CGI;
@x = param('xArray');
$xref = \@x;
something like:
$xref = \(param('xArray')); # doesn't work
--
steve farris
nylon fusion guitar site at http://www.mindspring.com/~nlymbo
------------------------------
Date: Mon, 05 Jun 2000 19:40:01 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: easy reference question
Message-Id: <394001a3.961736@news.skynet.be>
steveFarris wrote:
>Is there anyway to shorten the following to one line:
>
>use CGI;
>
>@x = param('xArray');
>$xref = \@x;
>
>something like:
>
>$xref = \(param('xArray')); # doesn't work
It doesn't work because it returns a list of references to each item
individually. What you want is probably "[ ... ]":
$xref = [ param('xArray') ];
--
Bart.
------------------------------
Date: 5 Jun 2000 19:47:03 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: easy reference question
Message-Id: <8hh03n$os$1@newsflash.concordia.ca>
In article <393C23E2.1A34CF83@mindspring.com>,
steveFarris <nlymbo@mindspring.com> wrote:
>Hi all,
>
>Is there anyway to shorten the following to one line:
>
>use CGI;
>
>@x = param('xArray');
>$xref = \@x;
>
>something like:
>
>$xref = \(param('xArray')); # doesn't work
This doesn't work because you can't get a reference to a list of
values:
\($foo, $bar, $baz) becomes (\$foo, \$bar, \$baz) ... see man perlref,
perlreftut, etc.
However, you can get the reference of an array, or an anonymous array:
$xref = [ param('xArray') ];
this just makes $xref a reference to an new anonymous array, composed
of values returned from param('xArray'). It won't be a magical alias for
param('xArray') should those values ever change.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: Mon, 5 Jun 2000 21:05:29 -0000
From: "Ragnar Hafstað" <gnari@simnet.is>
Subject: Re: easy reference question
Message-Id: <393c7988.0@news.isholf.is>
"steveFarris" <nlymbo@mindspring.com> wrote in message
news:393C23E2.1A34CF83@mindspring.com...
> Hi all,
>
> Is there anyway to shorten the following to one line:
>
> use CGI;
>
> @x = param('xArray');
> $xref = \@x;
>
sure:
@x = param('xArray');$xref = \@x; # :-)
seriously, you are probably thinking of:
$xref=[param('xArray')];
this should work, but note that param() has the wonderful ability
of returning either a scalar or a list depending on context, and the
line above happens to put it in a scalar context, fortunately.
so where you are not sure about context, or you want to make
the code clear, it is perfectly ok to use your 2 lines, specially as
the array is likely to be small. You could add a my to the first one.
you might want to look at
perldoc -q array
perldoc perlref
gnari
> something like:
>
> $xref = \(param('xArray')); # doesn't work
>
> --
> steve farris
> nylon fusion guitar site at http://www.mindspring.com/~nlymbo
>
>
------------------------------
Date: Mon, 5 Jun 2000 11:19:14 -0700
From: "Erick" <erick@teal.net>
Subject: Extracting an area from web page
Message-Id: <8hgqmh$sj1$1@news.chatlink.com>
I'm sure this is a pretty simple task, but I'm new to perl and not quite
sure how to go about it... if anyone could help I would really appreciate
it.
Basically I need to grab a web page from an outside source and have my perl
script analyze the page and grab a section and display it. The page that is
to be retrieved has specific markers at the beginning and end of the region
to be extracted.
I'm pretty sure I would need to start by putting getting the page and
putting it into a variable:
use LWP::Simple;
$page=get("http://www.site.com/blah.htm");
Then I think I would need split up the lines and put them into an array:
@abc=split(/\n/,$lines);
After that, I'm at a loss. I don't know how to tell it to start at a given
point, like <!-- START HERE --> and grab from there to the end point, $$
It doesn't seem like it would too difficult, and I'm hoping someone with a
little more experience with perl could make a recomedation as to how I
should go about this.
Thanks,
Erick
------------------------------
Date: 05 Jun 2000 12:03:52 -0700
From: Matthew Wilson Emmett <memmett@fraser.sfu.ca>
Subject: Re: Extracting an area from web page
Message-Id: <yvw93dms7xwn.fsf@fraser.sfu.ca>
Erick,
I would try,
"Erick" <erick@teal.net> writes:
> use LWP::Simple;
> $page=get("http://www.site.com/blah.htm");
$page =~ /\<!-- START HERE --\>.*?\<!-- END HERE --\>/;
$region_of_interest = $1;
Then you could split the region_of_interest etc etc...
Matt
------------------------------
Date: 5 Jun 2000 19:34:52 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Extracting an area from web page
Message-Id: <8hgvcs$lm2$5@slb1.atl.mindspring.net>
Matthew Wilson Emmett (memmett@fraser.sfu.ca) wrote:
: I would try,
:
: "Erick" <erick@teal.net> writes:
:
: > use LWP::Simple;
: > $page=get("http://www.site.com/blah.htm");
:
: $page =~ /\<!-- START HERE --\>.*?\<!-- END HERE --\>/;
:
: $region_of_interest = $1;
Not without capturing parens in the regex it won't.
------------------------------
Date: Mon, 5 Jun 2000 13:25:47 -0700
From: "Erick" <erick@teal.net>
Subject: Re: Extracting an area from web page
Message-Id: <8hh240$15o$1@news.chatlink.com>
Please forgive me, as I said, I'm pretty new to this. What are you
suggesting i do to make this suggestion work. Because if I execute the
script as is, it does not capture the region specified, I get the whole page
returned. Any help is much appreciated!
Erick
"Eric Bohlman" <ebohlman@netcom.com> wrote in message
news:8hgvcs$lm2$5@slb1.atl.mindspring.net...
> Matthew Wilson Emmett (memmett@fraser.sfu.ca) wrote:
> : I would try,
> :
> : "Erick" <erick@teal.net> writes:
> :
> : > use LWP::Simple;
> : > $page=get("http://www.site.com/blah.htm");
> :
> : $page =~ /\<!-- START HERE --\>.*?\<!-- END HERE --\>/;
> :
> : $region_of_interest = $1;
>
> Not without capturing parens in the regex it won't.
------------------------------
Date: Mon, 5 Jun 2000 21:38:47 -0000
From: "Gnari" <gnari@simnet.is>
Subject: Re: Extracting an area from web page
Message-Id: <393c8155.0@news.isholf.is>
"Erick" <erick@teal.net> wrote in message
news:8hh240$15o$1@news.chatlink.com...
> Please forgive me, as I said, I'm pretty new to this. What are you
> suggesting i do to make this suggestion work. Because if I execute the
> script as is, it does not capture the region specified, I get the whole
page
> returned. Any help is much appreciated!
>
> Erick
>
>
> "Eric Bohlman" <ebohlman@netcom.com> wrote in message
> news:8hgvcs$lm2$5@slb1.atl.mindspring.net...
> > Matthew Wilson Emmett (memmett@fraser.sfu.ca) wrote:
> > : I would try,
> > :
> > : "Erick" <erick@teal.net> writes:
> > :
> > : > use LWP::Simple;
> > : > $page=get("http://www.site.com/blah.htm");
> > :
> > : $page =~ /\<!-- START HERE --\>.*?\<!-- END HERE --\>/;
> > :
> > : $region_of_interest = $1;
> >
> > Not without capturing parens in the regex it won't.
what he means is that is cruel to post wrong code in reply to a question
as yours.
the capturing parens are used to specify what parts of the match are to
be returned or put into $1, $2 ...
in the example above they should surround the '.*?', giving us:
$page =~ /\<!-- START HERE --\>(.*?)\<!-- END HERE --\>/;
$region_of_interest = $1;
or, if you prefer:
($region_of_interest )=
$page =~ /<!-- START HERE -->(.*?)<!-- END HERE -->/;
you REALLY should read the docs. you can start with:
perldoc perlre
gnari
------------------------------
Date: Mon, 5 Jun 2000 21:09:45 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Ftp using Net::FTP or LWP::Simple
Message-Id: <Pine.GHP.4.21.0006052107500.2487-100000@hpplus01.cern.ch>
On Mon, 5 Jun 2000, Stacey Campbell wrote:
> Here is an example of code I use. I didn't write it all, though.
Hmmm
> #!/usr/local/bin/perl
no -w, no "use strict;"
> open(LOG,">> $log");
No check for errors
[..and so on..]
Lucky for you if it works.
--
"Some popular newsreaders, such as Outlook Express, automatically put the
cursor above the quoted material; you can take advantage of this by
scrolling down through the prior posting, deleting anything superfluous,
until you reach the point where you want to start your reply." -a.u.e FAQ
------------------------------
Date: Mon, 05 Jun 2000 20:53:14 GMT
From: sweth+perl@gwu.edu (Sweth Chandramouli)
Subject: getpwent with duplicate UIDs
Message-Id: <_qU_4.112035$E85.2208521@news1.rdc1.md.home.com>
It appears that getpwent slurps in passwd info
from the appropriate source and stores it in a hash keyed on UID; as a
result, duplicate UIDs (such as a second UID 0 account for admin use)
don't appear in an enumeration. Is this a) a bug, and b) avoidable without
doing kludgy things like parsing nsswitch and then enumerating the relevant
data source manually?
TIA,
Sweth.
--
Sweth Chandramouli ; <sweth@sweth.net>
<a href="http://www.sweth.net/legal/disc.html">*</a>
------------------------------
Date: Mon, 5 Jun 2000 21:04:13 +0100
From: "Jim Tench" <jim@no.spam.ta>
Subject: Re: global chown ??
Message-Id: <8hh135$n4n$1@uranium.btinternet.com>
Correct, I missed the "from user to user" bit in the original post. It
would work, but would just chown everything else as well ;-)
Elaine Ashton <elaine@chaos.wustl.edu> wrote in message
news:B5601CF5.5625%elaine@chaos.wustl.edu...
> in article 8he6vs$7e0$1@uranium.btinternet.com, Jim Tench at
jim@no.spam.ta
> quoth:
>
> > chown comes with a built in -R flag for just this purpose...
>
> No, the "R" is for recursive from the base dir and he wanted to find
> everything owned by a particular user and chown them system-wide.
>
> e.
>
------------------------------
Date: Mon, 05 Jun 2000 14:51:28 -0700
From: Yann Ramin <atrus@atrustrivalie.eu.org>
Subject: Gtk/Glade usage
Message-Id: <393C20E0.C3DAF98@atrustrivalie.eu.org>
Hi,
I've been dwelving into using GTK+ and Glade (as an interface builder).
I have glade2perl working, and everything is peachy, until I write my
own signal handlers. My question is:
How do I access another widget/form from my package? I can't figure
out how to do it :)
I.e., I have a text entry called name and an entry called passwd. When
name changes (I have the signal handler in place), I want to put that
text into passwd (its only an example). I've figured out I need to use
get_text and set_text, but how would I go about doing this?
Yann
--
--------------------------------------------------------------------
Yann Ramin atrus@atrustrivalie.eu.org
Atrus Trivalie Productions www.atrustrivalie.eu.org
irm.it.montereyhigh.com
Monterey High IT www.montereyhigh.com
ICQ 46805627
AIM oddatrus
Marina, CA
"All cats die. Socrates is dead. Therefore Socrates is a cat."
- The Logician
# fortune
"To be responsive at this time, though I will simply say, and therefore
this is a repeat of what I said previously, that which I am unable to
offer in response is based on information available to make no such
statement."
--------------------------------------------------------------------
------------------------------
Date: Mon, 05 Jun 2000 19:31:07 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Help: OOPS Inheritance...
Message-Id: <393bff80.414628@news.skynet.be>
Ala Qumsieh wrote:
>> $p = new HTMLStrip;
> ^^^
>This calls the method new() in the HTMLStrip module. Looking at the
>module above, you don't have a method called 'new'. Unlike C++, the
>word 'new' is not special with Perl.
No, but looking at the @ISA thing, he expected the call to be
transferred to the HTML::Parser module. Which is not an unreasonable
thing to expect. But hey, I never use Perl's OO stuff, so I don't know
why it doesn't work.
--
Bart.
------------------------------
Date: Mon, 5 Jun 2000 15:54:20 -0400
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: hidden field problem and multi-page CGI.pm script
Message-Id: <8hh0h4$bb0@fidoii.CC.Lehigh.EDU>
Hola,
I have succesfuly made a script that has a logon screen, and then uses the
user and password params to set up and display the second screen. I can't
go on to the third screen, though, because the user and pass aren't being
passed in again. So, I thought I'd use
$query->save(\*FILE)
and
$query = CGI->new(\*FILE)
to help me keep hold of the username and pass. No luck so far... Here's
the relevant portion of the script with the error inserted as a comment
where it occurs:
#!/usr/local/bin/perl -w
use diagnostics;
use strict;
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
$| = 1;
my $dsn = "instance.world";
my $bgcolor = "tan";
my $textcolor = "black";
# maps pages to functions
my %States = (
'Login' => \&login,
'SSRMenu' => \&ssr_menu,
'SSRAdd' => \&ssr_add,
'SSRMaint' => \&ssr_maint,
'SSRView' => \&ssr_view,
);
# Generate the current page
my $query = CGI->new;
my $Current_Screen = $query->param('.State') || 'Login';
die "No screen for $Current_Screen" unless $States{$Current_Screen};
if ($query->param('.file')) {
open FILE, '<' . $query->param('.file') or die "Couldn't open " .
$query->param('.file');
$query = CGI->new(\*FILE);
close FILE or die "Couldn't close " . $query->param('.file');
} else {
my $dir = '/u/www/temp_files/';
my $file = 1;
until (! -e ($dir . $file)) { $file++ }
print $query->hidden(-name => '.file', -value => "$dir$file");
}
standard_header();
open FILE, '>' . $query->param('.file') or die "Couldn't open " .
$query->param('.file');
## SCRIPT DIES RIGHT HERE, SAYING:
## Couldn't open at /home/prl2/public/www-data/cgi-bin//prl2_ssr.pl line 54.
## Obviously, the problem is that either the filename and path isn't being
## stored in the .file param, or I'm not gettin it out correctly. Any
ideas?
my ($dbh,$user,$dept,$right);
if ($Current_Screen ne 'Login') {
$dbh = DBI->connect('dbi:Oracle:' .
$dsn,$query->param('user'),$query->param('pass'),{RaiseError => 1})
or die $DBI::errstr;
$user = uc $query->param('user');
($dept,$right) = $dbh->selectrow_array(<<"");
SELECT deptid, rightid
FROM ssr.ssruser
WHERE userid = '$user'
unless ($dept and $right) {
print $query->hr,
$query->p( "User: $user has no department or rights data in
table ssruser! Ask the SSR Admin to check ",
"the status of user $user if you think user $user
should be able to use the SSR system."),
$query->hr;
standard_footer();
exit;
}
}
$query->save(\*FILE);
$States{$Current_Screen}->();
standard_footer();
exit;
# referenced modules actually follow here...
------------------------------
Date: 5 Jun 2000 21:42:06 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: hidden field problem and multi-page CGI.pm script
Message-Id: <slrn8jo7lb.8g9.efflandt@efflandt.xnet.com>
On Mon, 5 Jun 2000, Phil R Lawrence <prlawrence@lehigh.edu> wrote:
>
>I have succesfuly made a script that has a logon screen, and then uses the
>user and password params to set up and display the second screen. I can't
>go on to the third screen, though, because the user and pass aren't being
>passed in again. So, I thought I'd use
> $query->save(\*FILE)
>and
> $query = CGI->new(\*FILE)
>
>to help me keep hold of the username and pass. No luck so far... Here's
>the relevant portion of the script with the error inserted as a comment
>where it occurs:
And how to you get rid of all those old files?
(snip)
>} else {
> my $dir = '/u/www/temp_files/';
> my $file = 1;
> until (! -e ($dir . $file)) { $file++ }
> print $query->hidden(-name => '.file', -value => "$dir$file");
>}
>
>standard_header();
>open FILE, '>' . $query->param('.file') or die "Couldn't open " .
>$query->param('.file');
>
>## SCRIPT DIES RIGHT HERE, SAYING:
>## Couldn't open at /home/prl2/public/www-data/cgi-bin//prl2_ssr.pl line 54.
>## Obviously, the problem is that either the filename and path isn't being
>## stored in the .file param, or I'm not gettin it out correctly. Any
>ideas?
param('.file') is not only a hidden variable, but the dot prefix hides it
from CGI.pm (like a hidden Unix filename) as well. Try giving it a name
without a dot prefix. Not sure if this is in the docs, by I did notice if
I use undef for a field name (like a submit button) it ends up with a
generic name with a dot in front of it, but does not show up in params.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
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 3257
**************************************