[18453] in Perl-Users-Digest
Perl-Users Digest, Issue: 621 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 3 21:05:50 2001
Date: Tue, 3 Apr 2001 18:05:16 -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: <986346316-v10-i621@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 3 Apr 2001 Volume: 10 Number: 621
Today's topics:
Re: "Breakthrough" Perl compiler? (Jeff Robertson)
Re: "Breakthrough" Perl compiler? <comdog@panix.com>
Re: All-time "answer golf" winner! (was Re: array contr <ebneter@ix.netcom.com>
Re: All-time "answer golf" winner! (was Re: array contr <uri@sysarch.com>
Re: array control issues <wayne.keenan@ntlworld.com>
basic question - java button <root@novastar.dtdns.net>
Re: basic question - java button <bcoon@sequenom.com>
Best way to save HTML form data to XML (Lucient Chan)
Re: Best way to save HTML form data to XML (Eric Bohlman)
Re: Deleting one line from a file <david_j_findlay@yahoo.com.au>
Re: Deleting one line from a file <juex@deja.com>
Re: Deleting one line from a file <mischief@velma.motion.net>
Re: Deleting one line from a file <uri@sysarch.com>
Re: Does localtime() handle daylight savings <root@novastar.dtdns.net>
Re: Does localtime() handle daylight savings <wayne.keenan@ntlworld.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Apr 2001 23:59:19 GMT
From: jeff_robertson@yahoo.com (Jeff Robertson)
Subject: Re: "Breakthrough" Perl compiler?
Message-Id: <slrn9ckour.a6e.jeff_robertson@localhost.localdomain>
On Thu, 18 May 2000 21:32:50 -0400, brian d foy <brian@smithrenaud.com> wrote:
>In article <8g1on0$2e3i$1@news4.isdnet.net>, "Charles Henry" <charles.henry@engineer2k.com> posted:
>
>> Great but you seem to forget the *ONE* interesting reason to compile Perl
>> script : one doesn't have to have Perl installed in order to run your
>> program!
>
>unless you're talking about perl compiling a script to machine code,
>you are still going to need an interpreter. and if you are, you then
>have to compile it for every different architecture.
Usually people who need (or want) to do this are only interested in
targetting Win32, so the portability problem is moot.
------------------------------
Date: Tue, 03 Apr 2001 19:01:29 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: "Breakthrough" Perl compiler?
Message-Id: <comdog-6EF463.19012903042001@news.panix.com>
In article <slrn9ckour.a6e.jeff_robertson@localhost.localdomain>,
jeff_robertson@yahoo.com (Jeff Robertson) wrote:
> On Thu, 18 May 2000 21:32:50 -0400, brian d foy <brian@smithrenaud.com> wrote:
> >In article <8g1on0$2e3i$1@news4.isdnet.net>, "Charles Henry" <charles.henry@engineer2k.com> posted:
> >> Great but you seem to forget the *ONE* interesting reason to compile Perl
> >> script : one doesn't have to have Perl installed in order to run your
> >> program!
> >unless you're talking about perl compiling a script to machine code,
> >you are still going to need an interpreter. and if you are, you then
> >have to compile it for every different architecture.
> Usually people who need (or want) to do this are only interested in
> targetting Win32, so the portability problem is moot.
are you sure its only Win32? what evidence do you have that supports
that?
--
brian d foy <comdog@panix.com>
------------------------------
Date: Tue, 03 Apr 2001 16:12:56 -0700
From: Kate Ebneter <ebneter@ix.netcom.com>
Subject: Re: All-time "answer golf" winner! (was Re: array control issues)
Message-Id: <3ACA58F8.1C7CAD50@ix.netcom.com>
Tad McClellan wrote:
>
> Top-posted because I don't want to obfuscate it.
>
> This has to be an all-time winner for providing a direct answer
> to the question asked in the least number of characters.
>
> Abigail's posts regularly earn smirks from me, but this one
> was an outright guffaw.
>
> ROTFL
>
> Abigail <abigail@foad.org> wrote:
> >danny webster (dsw@naughty.onetel.net.uk) wrote on MMDCCLXXII September
> >MCMXCIII in <URL:news:slrn9cjmr8.dfa.dsw@naughty.onetel.net.uk>:
> ><> Hi there.
> ><>
> ><> I posted yesterday, but I had no joy wqith the response.
> ><>
> ><> What im trying to do, is pull out or add a virtualhost to a file (httpd.conf)
> ><>
> ><> A vhost entry starts with <VirtualHost domain.com>
> ><> and ends with </VirtualHost>
> ><>
> ><> I need to read in the top line, then the config between, up to the
> ><> </VirtualHost> part.
> ><>
> ><> There may be hundreds of them, or just a few. Then I need to add each one to
> ><> a separate array, which I can thne manipulate etc.
> ><>
> ><> How can I go about this?
> >
> >
> >..
> >
At some risk to my ego, I'm going to delurk here and admit that I don't
understand this. But, being interested in all things perl-ish, I
would very much like to. So -- what's the deal here?
Kate Ebneter
Not yet another perl hacker...
------------------------------
Date: Wed, 04 Apr 2001 00:17:16 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: All-time "answer golf" winner! (was Re: array control issues)
Message-Id: <x7r8z9tt6b.fsf@home.sysarch.com>
>>>>> "KE" == Kate Ebneter <ebneter@ix.netcom.com> writes:
KE> Tad McClellan wrote:
>> Abigail <abigail@foad.org> wrote:
>> ><>
>> ><> A vhost entry starts with <VirtualHost domain.com>
>> ><> and ends with </VirtualHost>
>> ><>
>> ><> I need to read in the top line, then the config between, up to the
>> ><> </VirtualHost> part.
>> ><>
>> >..
KE> At some risk to my ego, I'm going to delurk here and admit that I don't
KE> understand this. But, being interested in all things perl-ish, I
KE> would very much like to. So -- what's the deal here?
look up the range operator in perlfunc. study it. you will then know.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Tue, 03 Apr 2001 23:16:23 +0100
From: "wayne.keenan" <wayne.keenan@ntlworld.com>
Subject: Re: array control issues
Message-Id: <3ACA4BB7.13E20457@ntlworld.com>
Abigail wrote:
> danny webster (dsw@naughty.onetel.net.uk) wrote on MMDCCLXXII September
> <> What im trying to do, is pull out or add a virtualhost to a file (httpd.conf)
> <>
> <> A vhost entry starts with <VirtualHost domain.com>
> <> and ends with </VirtualHost>
> <>
> <> How can I go about this?
>
> ..
>
> Abigail
no fair!
if ..
------------------------------
Date: Wed, 4 Apr 2001 01:41:59 +0300
From: "novastar" <root@novastar.dtdns.net>
Subject: basic question - java button
Message-Id: <9adjjj$61b$1@usenet.otenet.gr>
Well maybe it is very easy, but I do not know how to do it ( I tried what
the FAQ said with no success ). I want to include some java script code to a
perl cgi script. It is only for loading the previous page. Here is the java
code on a html format :
<script language="javascript">
function goBack()
{ window.history.go(-1); }
</script>
</head>
<body>
<input type=button onclick="goBack();" value="Previous Page">
</body>
Please help.
------------------------------
Date: Tue, 03 Apr 2001 16:17:58 -0700
From: Bryan Coon <bcoon@sequenom.com>
Subject: Re: basic question - java button
Message-Id: <3ACA5A26.FBE25747@sequenom.com>
novastar wrote:
> Well maybe it is very easy, but I do not know how to do it ( I tried what
> the FAQ said with no success ). I want to include some java script code to a
> perl cgi script. It is only for loading the previous page. Here is the java
> code on a html format :
>
> <script language="javascript">
> function goBack()
> { window.history.go(-1); }
> </script>
> </head>
> <body>
> <input type=button onclick="goBack();" value="Previous Page">
> </body>
>
> Please help.
You can find your solution in the CGI documentation.
Hint: Javascript Action Button
Good luck!
Bryan
------------------------------
Date: 3 Apr 2001 15:02:58 -0700
From: lucie@sinden.nccom.com (Lucient Chan)
Subject: Best way to save HTML form data to XML
Message-Id: <9adhai$r6f@sinden.nccom.com>
Hi,
I'm reading data from a HTML page which contains a form, and I'm trying
to write the user-entered data in the form to a XML file. Can anyone
tell me the best way to accomplish this?? Does any of the perl modules
such as XML::DOM provide an API to create a XML document??
Thanks.
------------------------------
Date: 3 Apr 2001 23:32:10 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Best way to save HTML form data to XML
Message-Id: <9admhq$m1n$1@bob.news.rcn.net>
In comp.text.xml Lucient Chan <lucie@sinden.nccom.com> wrote:
> I'm reading data from a HTML page which contains a form, and I'm trying
> to write the user-entered data in the form to a XML file. Can anyone
> tell me the best way to accomplish this?? Does any of the perl modules
> such as XML::DOM provide an API to create a XML document??
While you can indeed use XML::DOM, it's a bit heavyweight for this
purpose. I'd be more inclined to suggest XML::Writer, or XML::Generator
(especially if you're used to using the HTML-generating function in
CGI.pm, as it works similarly). XML::Simple, XML::XPath, XML::Twig,
XML::Handler::YAWriter, and others also have generation facilities, though
they might be overkill.
Finally, while *reading* XML without the help of a module is ill-advised,
*writing* it with print statements is possible, as long as you deal
escaping and character-encoding issues yourself.
------------------------------
Date: Wed, 4 Apr 2001 18:14:33 +1000
From: David Findlay <david_j_findlay@yahoo.com.au>
Subject: Re: Deleting one line from a file
Message-Id: <PIry6.8552$45.50407@newsfeeds.bigpond.com>
Abigail wrote:
> What do you expect should happen if you do:
>
> push @outtext, $_;
According to the example I got it from(see that URL) it should delete the
line from the file.
David
------------------------------
Date: Tue, 3 Apr 2001 15:40:25 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Deleting one line from a file
Message-Id: <3aca515b$1@news.microsoft.com>
"David Findlay" <david_j_findlay@yahoo.com.au> wrote in message
news:PIry6.8552$45.50407@newsfeeds.bigpond.com...
> Abigail wrote:
> > What do you expect should happen if you do:
> >
> > push @outtext, $_;
>
> According to the example I got it from(see that URL) it should delete the
> line from the file.
Ah, I see.
But according to the documentation:
push ARRAY,LIST
Treats ARRAY as a stack, and pushes the values of LIST onto the
end of ARRAY. [...]
So, push neither deletes anything nor does it deal with files.
What is wrong with the answer to 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?
jue
------------------------------
Date: Tue, 03 Apr 2001 23:58:17 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Deleting one line from a file
Message-Id: <tckospgh5tu522@corp.supernews.com>
David Findlay <david_j_findlay@yahoo.com.au> wrote:
> I am trying to delete one line from a text file using the second example on
> this page: http://www.perlmonks.org/index.pl?node_id=19436&lastnode_id=1839
> When I feed push(@outtext,$_); with the line of text I want removed,
> nothing happens. Seeing I have gone to all the trouble of being able to
> feed it this line, what do i do to get rid of the line, without totally
> rearranging my code. Thanks,
You have misunderstood the example at that URL. That example, in
fact, is stated on the same page to be incomplete. It shows you
how to start the program and tells you `Do what you want from here'.
Earlier in the same node, the poster gave a one-liner to do the
same sort of thing.
Here's a quickie for you, if you promise to read the FAQ:
while(<>) { print unless /what I don't want matched/ }
This example assumes STDIN for input and STDOUT for output,
but you can change that in any text editor.
Chris
--
Christopher E. Stith
Where there's a will, there's a lawyer.
------------------------------
Date: Wed, 04 Apr 2001 00:15:06 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Deleting one line from a file
Message-Id: <x7u245tt9x.fsf@home.sysarch.com>
>>>>> "DF" == David Findlay <david_j_findlay@yahoo.com.au> writes:
DF> Abigail wrote:
>> What do you expect should happen if you do:
>>
>> push @outtext, $_;
DF> According to the example I got it from(see that URL) it should
DF> delete the line from the file.
you have reading comprehension skill issues.
while(<FILEHANDLE>){
if ($_ ne 'b|b|b|b|b|b'){
push(@outtext,$_);
}
that is the code you are referring to. where did you get the idea that
the push line deletes a line? do you understand what is going on in that
code? if not, get a good beginning perl book and read it before you post
again. and don't go hanging around perlmonks stealing the wrong bits of
code.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Wed, 4 Apr 2001 01:21:17 +0300
From: "novastar" <root@novastar.dtdns.net>
Subject: Re: Does localtime() handle daylight savings
Message-Id: <9adicp$5bg$1@usenet.otenet.gr>
We have also trouble with tivoli on windows NT4. Here some perl code I wrote
to correct some things; I do not know if it helps on your problem byt may be
you could find it usefull . George
****************************************************************************
#
# Calculation of time difference between the local and remote host
# To find the correct time difference you must take about the daylight
setting
# and season for both machines; there 16 diferent cases !!!
#
#
****************************************************************************
# Daylight saving setting discovery
$local_daylight = hex (
$Registry->{"LMachine/SYSTEM/CurrentControlSet/Control/TimeZoneInformation/D
isableAutoDaylightTimeSet"} );
$remote_daylight = hex (
$Registry->{"//$host/LMachine/SYSTEM/CurrentControlSet/Control/TimeZoneInfor
mation/DisableAutoDaylightTimeSet"} );
$local_daylight ==1 ? ( $local_daylight ="off" ) : ( $local_daylight ="on" )
;
$remote_daylight==1 ? ( $remote_daylight="off" ) : ( $remote_daylight="on" )
;
# Find the remote day
my $remote_time=Win32::AdminMisc::GetTOD("\\\\$host");
if (! defined $remote_time)
{
print logfile "Failure : could not check the day at $host\n";
print logfile "\n","-" x71,"\n" ; close(logfile);
die "Failure : could not check the day at $host\n";
}
else
{
print logfile "Success : day is checked at $host\n";
print "Success : day is checked at $host\n";
}
my @time_array_remote = localtime($remote_time);
my $rday = scalar localtime($remote_time);
$rday =~s/(^\w+) .*/\1/;
$time_array_remote[4]+=1;
my ($month_remote,$day_remote)=($time_array_remote[4],$time_array_remote[3])
;
# season calculation at remote host
if (($month_remote>3) && ($month_remote<10)) {
$remote_season="summer" } # summer for sure
elsif (($month_remote==3) && ($day_remote<25)) {
$remote_season="winter" } # winter for sure
elsif (($month_remote==10) && ($day_remote<25)) {
$remote_season="summer" } # summer for sure
# check date at march
elsif (($month_remote==3) && ($day_remote=>25) && ($day_remote<=31))
{
&find_season($day_remote,"march","remote",$rday);
}
# check date at october
elsif (($month_remote==10) && ($day_remote=>25) && ($day_remote<=31))
{
&find_season($day_remote,"october","remote",$rday);
}
# winter for sure
else
{
$remote_season="winter" ;
}
# season calculation at local host
# check local time
my ($month,$day) =( $time_array[4],$time_array[3]) ;
if (($month>3) && ($month<10)) { $local_season="summer" } # summer for
sure
elsif (($month==3) && ($day<25)) { $local_season="winter" } # winter for
sure
elsif (($month==10) && ($day<25)) { $local_season="summer" } # summer for
sure
# check date at march
elsif (($month==3) && ($day=>25) && ($day<=31))
{
&find_season($day,"march","local",0);
}
# check date at october
elsif (($month==10) && ($day=>25) && ($day<=31))
{
&find_season($day,"october","local",0);
}
# winter for sure
else
{
$local_season="winter" ;
}
# calculation of the fix time quantity . Fix time is what we have to add
# at the remote time as we can see it with the command "net time \\host",
# in order the final value to be the true time
if (($local_daylight eq "on")&&($remote_daylight eq
"on")&&($local_season eq "summer")&&($remote_season eq "summer")) { $fixtime
= 0 }
elsif (($local_daylight eq "on")&&($remote_daylight eq
"on")&&($local_season eq "summer")&&($remote_season eq "winter")) { $fixtime
= -1 }
elsif (($local_daylight eq "on")&&($remote_daylight eq
"on")&&($local_season eq "winter")&&($remote_season eq "summer")) { $fixtime
= 1 }
elsif (($local_daylight eq "on")&&($remote_daylight eq
"on")&&($local_season eq "winter")&&($remote_season eq "winter")) { $fixtime
= 0 }
elsif (($local_daylight eq "on")&&($remote_daylight eq
"off")&&($local_season eq "summer")&&($remote_season eq "summer")) {
$fixtime = -1 }
elsif (($local_daylight eq "on")&&($remote_daylight eq
"off")&&($local_season eq "summer")&&($remote_season eq "winter")) {
$fixtime = -1 }
elsif (($local_daylight eq "on")&&($remote_daylight eq
"off")&&($local_season eq "winter")&&($remote_season eq "summer")) {
$fixtime = 0 }
elsif (($local_daylight eq "on")&&($remote_daylight eq
"off")&&($local_season eq "winter")&&($remote_season eq "winter")) {
$fixtime = 0 }
elsif (($local_daylight eq "off")&&($remote_daylight eq
"on")&&($local_season eq "summer")&&($remote_season eq "summer")) { $fixtime
= 1 }
elsif (($local_daylight eq "off")&&($remote_daylight eq
"on")&&($local_season eq "summer")&&($remote_season eq "winter")) { $fixtime
= 0 }
elsif (($local_daylight eq "off")&&($remote_daylight eq
"on")&&($local_season eq "winter")&&($remote_season eq "summer")) { $fixtime
= 1 }
elsif (($local_daylight eq "off")&&($remote_daylight eq
"on")&&($local_season eq "winter")&&($remote_season eq "winter")) { $fixtime
= 0 }
elsif (($local_daylight eq "off")&&($remote_daylight eq
"off")&&($local_season eq "summer")&&($remote_season eq "summer")) {
$fixtime = 0 }
elsif (($local_daylight eq "off")&&($remote_daylight eq
"off")&&($local_season eq "summer")&&($remote_season eq "winter")) {
$fixtime = 0 }
elsif (($local_daylight eq "off")&&($remote_daylight eq
"off")&&($local_season eq "winter")&&($remote_season eq "summer")) {
$fixtime = 0 }
elsif (($local_daylight eq "off")&&($remote_daylight eq
"off")&&($local_season eq "winter")&&($remote_season eq "winter")) {
$fixtime = 0 }
# Calculate the schedule time
if ( ($rtime) = `net time \\\\$host` =~ /^.* (\d+:\d+ \w*)/g )
{
print logfile "Success : found the time of $host\n";
print "Success : found the time of $host\n";
}
else
{
print logfile "Failure : could not check the time at $host\n";
print logfile "\n","-" x71,"\n" ; close(logfile);
die "Failure : could not check the time at $host\n";
}
($t1,$t2,$t3)=split(/[: ]/, $rtime);
# Increase the time two minutes plus
$t2+=2;
if ( $t2 >= 60 )
{
$t1+=1;
print $t1;
if ( $t1==12)
{
$t3=~tr/AP/PA/;
}
if ( $t1==13)
{
$t1=1;
}
$t2-=60;
}
# Correction of the remote hour due to fix time
$t1+=$fixtime;
$t1=1 if $t1==13;
if ($fixtime != 0)
{
if ( $t1==12)
{
$t3=~tr/AP/PA/;
}
}
$t2=sprintf "%.2d",$t2;
$new_rtime=$t1.":".$t2." ".$t3;
<jtaylo04@nospam.mail.orion.org> wrote in message
news:FDqy6.77$L53.365@news.more.net...
> Yes! We have NT 4.0 too and are also having problems with some commercial
> software that uses perl on a NT 4.0. If anyone has any answers, please
> email me at jstaylo@coxnet.org as I'm not a frequent reader of this NG.
>
> Jack
>
> Your_Name_Here <ramu_chidambaram@agilent.com> wrote:
> | Hi,
> | Does anyone know whether localtime functions handles the daylight
> | savings correctly on WINNT 4.0
> | If I run the below two lines, I still see the old timings. Rebooting my
> | machine has not helped.
>
> | ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
> | print "time $mday-$months[$mon]-$year.$hour:$min:$sec\n";
>
> | Thanks for the help,
> | chidam
>
> --
> During branding, cowboys have sore calves.
------------------------------
Date: Tue, 03 Apr 2001 23:25:49 +0100
From: "wayne.keenan" <wayne.keenan@ntlworld.com>
Subject: Re: Does localtime() handle daylight savings
Message-Id: <3ACA4DED.5A807F68@ntlworld.com>
> | If I run the below two lines, I still see the old timings. Rebooting my
> | machine has not helped.
>
> | ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
> | print "time $mday-$months[$mon]-$year.$hour:$min:$sec\n";
>
> | Thanks for the help,
> | chidam
>
what's the value of $isdst ?
------------------------------
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 V10 Issue 621
**************************************