[18087] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 247 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 8 18:06:07 2001

Date: Thu, 8 Feb 2001 15:05:22 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981673521-v10-i247@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 8 Feb 2001     Volume: 10 Number: 247

Today's topics:
    Re: (OFF TOPIC) Re: This is driving me nuts and I need  <godzilla@stomp.stomp.tokyo>
    Re: alt.perl and correctness (was Re: hex to binary con (Peter J. Acklam)
    Re: alt.perl and correctness (was Re: hex to binary con (Peter J. Acklam)
        Builing INSERT-statement from hash <tore@extend.no>
    Re: Builing INSERT-statement from hash blah@blah.blah.invalid
    Re: Builing INSERT-statement from hash (Damian James)
    Re: Builing INSERT-statement from hash <tore@extend.no>
        Check for Data Input on Serial Port? dave_farrance@my-deja.com
    Re: Check for Data Input on Serial Port? <aqumsieh@hyperchip.com>
        dbm hashes : Operation not permitted <m_ario@my-deja.com>
        dialog with spawned process? big_amko@my-deja.com
    Re: Editing a file if line doesn't exist already <godzilla@stomp.stomp.tokyo>
    Re: getting date from Week number <kstep@pepsdesign.com>
        Graph-ReadWrite 1.00 <neilb@cre.canon.co.uk>
    Re: Help! Good Perl Training class recomendation in Sil <terrence.brannon@oracle.com>
        How many times per day do you say Perl is so fuckin' ba <terrence.brannon@oracle.com>
    Re: How to get data from HTML to PERL? <steve@peachy.com>
    Re: how to prevent Browser from loading a page from cac <kstep@pepsdesign.com>
    Re: how to prevent Browser from loading a page from cac <hou2@hotmail.com>
    Re: how to prevent Browser from loading a page from cac egwong@netcom.com
    Re: how to prevent Browser from loading a page from cac <tore@extend.no>
    Re: HTML formatted messages <steve@peachy.com>
    Re: Is scalar a float, int or string? <thoren@southern-division.com>
    Re: LWP::Simple issue? <godzilla@stomp.stomp.tokyo>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 08 Feb 2001 14:45:19 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: (OFF TOPIC) Re: This is driving me nuts and I need a guru
Message-Id: <3A83217F.4D012577@stomp.stomp.tokyo>

Chris Fedde wrote:
 
> Godzilla! wrote:
> > Randal L. Schwartz wrote:

> >There are those leaning towards technological methods of
> >absolute identity of people using our internet, a driver's
> >license, fingerprints, so to speak. I am one of those people.
> >My hopes are, in time, technology will provide a method of
> >'stamping' each computer with an identity which will protect
> >our right to privacy yet provide a quick and certain method
> >to identify those perpetrating abuse upon others.

> Why stop there.  Why not simply require all citizens to get
> an inductive ID microchip implanted at birth.

I have a hunch, neither a microchip implant nor a serial
number tattooed on a forearm, would help to locate an
originating computer via our internet. However, this
notion might help to initiate serious civil unrest
with my being one of the first to lock and load.

Not long back, I read a proposal to stamp computer
bios guts with a serial number, which many have already.
Mine does although it is disabled. A serial number would
be transmitted with all net transactions. This seems a 
logical solution, if serial number listings are maintained
much like firearm registration; semi-confidential. This
would at least give law enforcement a lead on where to look,
or a beginning point. Better law enforcement than me. There
are many using our internet whose fingers I would break
without hesitation.

Godzilla!


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

Date: 08 Feb 2001 21:50:50 +0100
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: alt.perl and correctness (was Re: hex to binary conversion ? Please help)
Message-Id: <wk7l30c3l4.fsf@math.uio.no>

merlyn@stonehenge.com (Randal L. Schwartz) writes:

> >>>>> "Peter" == Peter J Acklam <jacklam@math.uio.no> writes:
> 
> Peter> True, and that is a problem.  On the other hand, alt.perl
> Peter> doesn't have the endless insults and horassments that you
> Peter> find here.
> 
> I wonder how come people keep saying this.
>
> In CLPM, I see a *ton* of good questions and answers go by.  And
> at that volume, there also happen to be quite a few *bad*
> questions that show up, and then the ensuing "RTFM" or "that's
> offtopic" posts that rightfully follow.

I was not referring to "bad questions", "RTFM" and "that's
offtopic" posts.  Such posts are legitimate.  Add the appropriate
amount of sarcasm and they can even be quite amusing.

I was referring to posts where one poster is doing nothing but
attacking another.  I get tired of reading about certain posters'
personal problems with other posters here.  Sure, some people
can't behave and deserve an appropriate answer, but two wrongs
doesn't make a right.  And some people can't take a hint, but
going on forever is often fruitless, and someone has got to be
the first to shut up.

Peter

-- 
sub int2roman{@x=split//,sprintf'%04d',shift;@r=('','I','V','X','L','C','D'
,'M');@p=([],[1],[1,1],[1,1,1],[1,2],[2],[2,1],[2,1,1],[2,1,1,1],[1,3],[3])
;join'',@r[map($_+6,@{$p[$x[0]]}),map($_+4,@{$p[$x[1]]}),map($_+2,@{$p[$x[2
]]}),map($_+0,@{$p[$x[3]]})];}print "@{[map{int2roman($_)}@ARGV]}\n";#JAPH!


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

Date: 08 Feb 2001 21:50:55 +0100
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: alt.perl and correctness (was Re: hex to binary conversion ? Please help)
Message-Id: <wkzofwaojr.fsf@math.uio.no>

abigail@foad.org (Abigail) writes:

> My contribution of getting rid of alt.perl is not subscribing to
> it, and to killfile anything crossposted to it. (But that might
> for some people be just the reason to post in alt.perl...)

When the subject has been brought up in alt.perl -- why people
post there, that is -- the general opinion seems to be that they
just can't stand the heat of c.l.p.misc.  They have been burnt by
flames in c.l.p.misc too many times and moved to alt.perl.

Obviously, if they have been flamed here, their Perl skills are
probably not high enough to give good answers in alt.perl.  I
think that might explain some of the "blind leading the blind"-
syndrome of alt.perl.

Peter

-- 
sub int2roman{@x=split//,sprintf'%04d',shift;@r=('','I','V','X','L','C','D'
,'M');@p=([],[1],[1,1],[1,1,1],[1,2],[2],[2,1],[2,1,1],[2,1,1,1],[1,3],[3])
;join'',@r[map($_+6,@{$p[$x[0]]}),map($_+4,@{$p[$x[1]]}),map($_+2,@{$p[$x[2
]]}),map($_+0,@{$p[$x[3]]})];}print "@{[map{int2roman($_)}@ARGV]}\n";#JAPH!


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

Date: Thu, 8 Feb 2001 22:46:20 +0100
From: Tore Aursand <tore@extend.no>
Subject: Builing INSERT-statement from hash
Message-Id: <MPG.14ed320ffb1acbd698989b@news.online.no>

Hi!

I have a hash populated with data.  I want to build an SQL insert 
statement based on this data;

  my $hash_ref = $Object->{'_properties'};

'$hash_ref' is now something like;

  'firstname' => 'John',
  'lastname' => 'Doe'

How do I convert this data the smoothest (...) way to fit into my 
insert statement?  I would like to do something like this;

  my $sth = $dbh->prepare(qq|INSERT INTO tbl
                             ($fields) VALUES ($values)|);

Thanks for any replies!


-- 
Tore Aursand - tore@extend.no - http://www.extend.no/~tore/


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

Date: Thu, 08 Feb 2001 22:07:58 GMT
From: blah@blah.blah.invalid
Subject: Re: Builing INSERT-statement from hash
Message-Id: <2NEg6.1199$y03.124606@news.flash.net>

Tore Aursand <tore@extend.no> wrote:
> I have a hash populated with data.  I want to build an SQL insert 
> statement based on this data;
>   my $hash_ref = $Object->{'_properties'};
>
> '$hash_ref' is now something like;
>
>   'firstname' => 'John',
>   'lastname' => 'Doe'
>
> How do I convert this data the smoothest (...) way to fit into my 
> insert statement?  I would like to do something like this;
>
>   my $sth = $dbh->prepare(qq|INSERT INTO tbl
>                              ($fields) VALUES ($values)|);

$fields = join(",", keys %$hashref);
$values = join(",", values %$hashref);

This works because keys and values will return data in the same order
(see "keys" and "values" in perlfunc.)

Depending on the type of values you're setting, you might need to properly
quote the data in your join.


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

Date: 8 Feb 2001 22:09:31 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Builing INSERT-statement from hash
Message-Id: <slrn98668n.ecd.damian@puma.qimr.edu.au>

Thus spake Tore Aursand on Thu, 8 Feb 2001 22:46:20 +0100:
>Hi!
>

Well, g'day!

>I have a hash populated with data.  I want to build an SQL insert 
>statement based on this data;
>
>  my $hash_ref = $Object->{'_properties'};
>
>'$hash_ref' is now something like;
>
>  'firstname' => 'John',
>  'lastname' => 'Doe'
>
>How do I convert this data the smoothest (...) way to fit into my 
>insert statement?  I would like to do something like this;
>
>  my $sth = $dbh->prepare(qq|INSERT INTO tbl
>                             ($fields) VALUES ($values)|);
>

Assuming that the keys in your hashref have the same names as the fields in
your db table, you could just do something like:

my $fields = join ",", keys %{$hash_ref};
my $values = join ",", map {$dbh->quote($_)} values %{$hash_ref};

You might also want to consider using placeholders instead -- check the
DBI docs. Also, there's no error checking in the above code -- the real
code DOES check for failure, doesn't it? :-)

>Thanks for any replies!
>

You're very welcome.

Cheers,
Damian
-- 
$;=ord$%,$:=$;-ord q,.,,$_=q 13346:3366:3276:3326:3386:546:566:966:3396:3376:1.
q 73386:546:;96:3326:3336:3386:3266:3236:3366:546::26:3236:3366:32:6:546:32667.
q,:;96:;;6:3296:3236:3366:326:56,,s,.,;ord($&)-$:-$;;;;;,eg,s,$;,;chr$&-$:;,eg,
eval eval;               #requires 5.6.0 ## my first attempt at one of these...


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

Date: Thu, 8 Feb 2001 23:34:39 +0100
From: Tore Aursand <tore@extend.no>
Subject: Re: Builing INSERT-statement from hash
Message-Id: <MPG.14ed3d6adf66285698989e@news.online.no>

In article <2NEg6.1199$y03.124606@news.flash.net>, 
blah@blah.blah.invalid says...
>> How do I convert this data the smoothest (...) way to fit into my 
>> insert statement?  I would like to do something like this;
>> [...]

> $fields = join(",", keys %$hashref);
> $values = join(",", values %$hashref);
> 
> This works because keys and values will return data in the same order
> (see "keys" and "values" in perlfunc.)

Really?  *shame on me*  I was really sure that this didn't work, so I 
didn't even bother try it. :-/  Sorry - my fault!

> Depending on the type of values you're setting, you might need to
> properly quote the data in your join.

Yeah.  That's another problem.  I guess I can't quote the whole string, 
as there will be numbers in it.  Hmm.

Ok - thanks a lot!


-- 
Tore Aursand - tore@extend.no - http://www.extend.no/~tore/


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

Date: Thu, 08 Feb 2001 19:19:00 GMT
From: dave_farrance@my-deja.com
Subject: Check for Data Input on Serial Port?
Message-Id: <95ureo$83i$1@nnrp1.deja.com>

Newbie alert!

How do I determine if data is present in the serial port input buffer?

Or alternatively, how do I stop "getc" waiting forever if I read a
serial port that has no data?

Regards - Dave Farrance


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 08 Feb 2001 19:37:44 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Check for Data Input on Serial Port?
Message-Id: <7almrhx8xh.fsf@merlin.hyperchip.com>


dave_farrance@my-deja.com writes:

> How do I determine if data is present in the serial port input buffer?
> 
> Or alternatively, how do I stop "getc" waiting forever if I read a
> serial port that has no data?

I can suggest two options:

1) Look into the select() function.
2) Look into the IO::Select module.

The IO::Select module comes standard with every Perl distribution, and
is an OO wrapper around the select() system call. It's the preferred
way, IMHO.

--Ala


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

Date: Thu, 08 Feb 2001 21:01:05 GMT
From: Mario <m_ario@my-deja.com>
Subject: dbm hashes : Operation not permitted
Message-Id: <95v1ec$det$1@nnrp1.deja.com>

I get a 'Operation not permitted' error while trying to modify a key in
a dbm hash.

The script runs on a brand new NT server (possible config error?).
All files are set with 777 permission (dbm too),I am wondering if this
can be a problem.

I also get an 'File not Found' while trying to create a dbm file.I
tested it by uploading 2 pre-made .dir and .pag files.

I tested the scripts on 2 other machines,they work fine.

If anyone knows of a possible cause,please let me know.
--
Mario
diab.litoATusa.net


Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 08 Feb 2001 21:33:20 GMT
From: big_amko@my-deja.com
Subject: dialog with spawned process?
Message-Id: <95v3b0$f69$1@nnrp1.deja.com>

What would be the easiest way to "establish an automated dialog" with
some process/program from within calling perl script. By "dialog" I
mean not only to be able to capture stdout/stderr of the spawned
process/program but also to pass input to that process/program. For
instance I want to automate this situation:
I have one "black-box" program that after being called from perl using
for instance "system" command:

 ...
system("my_black_box.exe");
 ....

we get on the stdout something like:

>"Are you happy? [Y/N]"

from the "black box".

How I can pass my input (i.e. "Y") from within calling perl script in
order to succesfuly exit from the "black box"?
By being "black box" I can't do that by passing it as an argument, but
rather the "black box" is listening for the stdin for either "Y" or "N".

I see that module Expect.pm could help me with this issue but the
problem is that in that case solution is not PORTABLE anymore (i.e.
Expect.pm doesn't seem to be portable on Windows platform)!!

Any suggestion/example how to do that using perl is welcome? I have
heard that Expect/Tcl can be good for this?

Thanx



Sent via Deja.com
http://www.deja.com/


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

Date: Thu, 08 Feb 2001 12:04:26 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Editing a file if line doesn't exist already
Message-Id: <3A82FBCA.C4290D40@stomp.stomp.tokyo>

jstanley wrote:

(some snippage)
 
> I am having trouble thinking of a way to edit a 
> file only if a particular line doesn't exist.

> Unfortunately the way I am doing it now, the WHILE
> statement checks each line in the file and adds test
> to the bottom of the file for everytime it doesn't
> find a match.  


> open (LAST, ...

> while (defined <LAST>) 
>  {
>   if (/text to match/i) 
>    { print "Match exists\n"; }
>   else
>    { Add line to file Code.......


Your code is doing exactly what it should. In 
Plain English, you are saying,

 "If a match is not found, append to my file."

So, for every line which does not match, your
apppend routine runs. I am somewhat confused
how you are doing an append write with your
file only opened for a read.

Remove your append routine from your while loop
and add a control to initiate an append.

$control = "false";

while (<FILE>)...

if match found...

$control = "true"

last; (exit your while loop)


For your append routine outside of
your while loop,

if ($control eq "false")

append file ...


Godzilla!


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

Date: Thu, 8 Feb 2001 14:10:58 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: getting date from Week number
Message-Id: <95uqul$2c2$1@slb7.atl.mindspring.net>

<mike_solomon@lineone.net> wrote in message
news:95uki5$1ap$1@nnrp1.deja.com...
> Using Date::Calc I can get a Week number by providing a date
>
> ($week,$year) = Week_of_Year($year,$month,$day);
>
> I want to provide the Week number and the Year and get the Week
> Commencing date
>
> So if I provide week 3 year 2001 I want to get back 15/01/2001

Date::Calc provides all the tools you need to do this.  You just need to
figure out how....

1) Find the day of week for January 1st of the given year.

2) Calculate the number of days until the first monday of the year.

3) Add 7 days for each week starting from week 1.

4) Return the date this many days after January 1st.

<< BEGIN CODE >>

use strict;
use warnings;

use Date::Calc qw(Day_of_Week Week_of_Year Add_Delta_Days);

# perlstyle?  use Date::Calc::Style ;-)

sub Date_from_Week_of_Year {
    my ($year, $week) = @_;
    my $dd = (8 - Day_of_Week($year,1,1)) % 7;
    $dd += 7 * ($week - 1);
    return Add_Delta_Days($year,1,1,$dd);
}

my $week = 3;
my $year = 2001;

my ($y1, $m1, $d1) = Date_from_Week_of_Year($year, $week);
print "Week $week of $year starts on $y1-$m1-$d1\n";

($week,$year) = Week_of_Year($y1,$m1,$d1);
print "$y1-$m1-$d1 is week $week of $year\n";

<< END CODE >>

HTH,

Kurt Stephens





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

Date: Thu, 8 Feb 2001 19:08:43 GMT
From: Neil Bowers <neilb@cre.canon.co.uk>
Subject: Graph-ReadWrite 1.00
Message-Id: <t85s3aka2oqt26@corp.supernews.com>

Graph-ReadWrite 1.00 is currently making its way round CPAN:

	  file: $CPAN/authors/id/N/NE/NEILB/Graph-ReadWrite-1.00.tar.gz
	  size: 7027 bytes
	   md5: d7883fd4e9f396decd777949e21bac2b

This is a collection of perl classes for reading and writing
directed graphs in a variety of file formats. The graphs have
to be represented using Jarkko's Graph classes.

The bundle currently includes:

	Graph::Reader, Graph::Writer	base classes
	Graph::{Reader,Writer}::XML	a simple XML format for graphs
	Graph::Writer::Dot		format used by dot [1]
	Graph::Writer::VCG		format used by VCG [2]

[1] dot is a tool for batch layout of graphs, part of the
    graphviz toolkit from AT&T Research (http://www.graphviz.org/)
    I used it to generate postscript and GIF renderings.

[2] VCG is an interactive tool originally for Visualising Compiler Graphs.
    http://www.cs.uni-sb.de/RW/users/sander/html/gsvcg1.html
    Can also generate hardcopy, but I find it most useful for
    interactive visualisation.

Neil




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

Date: Thu, 08 Feb 2001 14:30:41 -0800
From: Terrence Monroe Brannon <terrence.brannon@oracle.com>
Subject: Re: Help! Good Perl Training class recomendation in Silicon Valley  needed!
Message-Id: <3A831E11.8513C24D@oracle.com>

Maybe you should consult the Silicon Valley Perl mongers. I'm sure they
would know of some good resources.

gfichten@telocity.com wrote:

> I hope that I can find my answer here:
> I am looking for a good Perl training class for
> the beginner in the workshop format (not over
> WEB) in Silicon Valley.
>
> There are many companies that offer to take
> classes over the WEB,  however I am strong
> believer in formal education in the classroom.
>
> I would like to find 2-5 days professional course
> that will offer hands-on training in specially
> built classrooms.
>
> Can you recommend any company that offers that?
>
> Thank you very much!
>
> Gene
>
> Sent via Deja.com
> http://www.deja.com/



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

Date: Thu, 08 Feb 2001 14:45:01 -0800
From: Terrence Monroe Brannon <terrence.brannon@oracle.com>
Subject: How many times per day do you say Perl is so fuckin' bad
Message-Id: <3A83216D.B9698FE@oracle.com>

I mean, I'm ripping. I'm raging. popping. splicing. concatenating,
objectifying. Able to solve large problems in a single bound. It's a
language, it's a plan. It's Perl again!!!

"perl is so fuckin' bad" x ($times/$day) ;




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

Date: Thu, 8 Feb 2001 21:54:02 -0000
From: "Steve Kay" <steve@peachy.com>
Subject: Re: How to get data from HTML to PERL?
Message-Id: <95v4do$jlr$1@neptunium.btinternet.com>

I wonder if the HTML::Parser module might help here?

http://search.cpan.org/doc/GAAS/HTML-Parser-3.15/Parser.pm

DESCRIPTION
Objects of the HTML::Parser class will recognize markup and separate it from
plain text (alias data content) in HTML documents. As different kinds of
markup and text are recognized, the corresponding event handlers are
invoked.

HTML::Parser in not a generic SGML parser. We have tried to make it able to
deal with the HTML that is actually "out there", and it normally parses as
closely as possible to the way the popular web browsers do it instead of
strictly following one of the many HTML specifications from W3C. Where there
is disagreement there is often an option that you can enable to get the
official behaviour.

The document to be parsed may be supplied in arbitrary chunks. This makes
on-the-fly parsing as documents are received from the network possible.

If event driven parsing does not feel right for your application, you might
want to use HTML::TokeParser. It is a HTML::Parser subclass that allows a
more conventional program structure.


<jedialf@my-deja.com> wrote in message news:95tmjk$7t6$1@nnrp1.deja.com...
> Normally, perl program will have HTML codes embedded.
>
> BUT I do not want to have HTML codes in PERL program...which means the
> PERL program has to read data from HTML file.
>
> Example in PERL file:
> .....#codes are embedded here
>
> open(UPDATE,"<../perl.htm");
>   while(my $line = <UPDATE>){
> $line=~ s/t_value/$tableid/;
> $line=~ s/u_value/$::input{'u'}/;
> $line=~ s/g_value/$::input{'g'}/;
> print "$line\n";
>
>  }
>
> ..... #codes are embedded here
>
> This allows PERL file to read HTML file and replaces the value with $
> values for processing. This would read the file, line by line.
>
> Reason for this: It would allow me to amend HTML files easily without
> meddling PERL codes.
>
> I am not sure how to get a desired section from HTML file for
> processing, especially a form handling. (Using data from SQL database).
>
> Sample of HTML codes.
>
>
> <html>
> <head>
> <meta http-equiv="Content-Language" content="en-us">
> <meta http-equiv="Content-Type" content="text/html; charset=windows-
> 1252" Pragma:no-cache>
> <title>description</title>
> </head>
> <SCRIPT SRC="dbadmin.js" LANGUAGE="JavaScript">
> </script>
>
> <UPDATETABLE>
> <form method="POST" action="plmgss_dbadmin.x">
> <input type="hidden" name="f" value="f_value">
> <input type="hidden" name="t" value="t_value">
> <input type="hidden" name="u" value="u_value">
> <input type="hidden" name="g" value="g_value">
> <table border="0" width="100%" cellspacing="0" cellpadding="0">
> <tr>
> <td width="29%" colspan="2"><i><font color="#800000" face="Impact"
> size="6" >description</font></i></td>
> </tr>
> <tr>
> <td width="2%">&nbsp;</td>
> </tr>
> </table>
> </UPDATETABLE>
>
> <PERLBODY>
> <table border="1" cellspacing="0" cellpadding="0">
> <td width='10%'><p align='center'><font color='#800000' face='Arial'
> size='2'>INDEX</font></p></td>
> <td>
> <input type="text" name="countname" value="field" size=60 style="font-
> family: Arial; color: #800000 font-weight: bold">
> </td>
> </table>
> <input type=hidden name=spanid value=Rowcount>
> <input type=hidden name=colcount value=Colcount>
> <span id=SpanID>
> </span>
> <table>
> <tr><td></td></tr>
> </table>
> <input type="Submit" name="Submit" value="Save"><input type="button"
> name="NewRow" value="New Entry" onclick="anotherrow()"><input
> type="button" name="Back" value="Back" onclick="javascript:history.back
> ()">  </form>
>
> </form>
> </PERLBODY>
> </body>
>
> I have incorporate <UPDATETABLE> and <PERLBODY> to indicate different
> section.
>
> I would appreciate to have a simple source code similiar to this. Thank
> you.
>
>
> Sent via Deja.com
> http://www.deja.com/




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

Date: Thu, 8 Feb 2001 14:32:35 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: how to prevent Browser from loading a page from cache?
Message-Id: <95us45$540$1@slb6.atl.mindspring.net>

"Pidge66" <hou2@hotmail.com> wrote in message
news:3a82e97b$0$15967@wodc7nh6.news.uu.net...
> My perl script updates a HTML document.  How can I make the browser load
the
> new document instead of from its cache?  I have a interim page which
> indicates that changes have been made and to click OK to go to the new
page.
>

Considering that this is a Perl newsgroup, I would first rephrase the
question as "How do I set the Expire field in an HTTP header using Perl?"

#/usr/bin/perl -wT
use strict;
use CGI;

my $query = new CGI;
print $query->header(-expires => '+0s');

HTH,

Kurt Stephens





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

Date: Thu, 8 Feb 2001 15:49:58 -0500
From: "Pidge66" <hou2@hotmail.com>
Subject: Re: how to prevent Browser from loading a page from cache?
Message-Id: <3a83058e$0$2432@wodc7nh6.news.uu.net>

Thanks. But my problem is a bit different. If I may entertain anyone, my
scenario is as follows:

I have a few static HTML pages in the home page directory. There is a link
to my PERL script, in the cgi-bin directory, which updates one of the HTML
pages. The script then output a confirmation page and a OK link which points
to the URL of the newly modified HTML page.  The problem is that the browser
always loads the old page when I click on the OK link.

I have tried a few things:

1) include a JavaScript which tries to make the browser reload() every time.
This works when I tested on a Personal Web Server but for some reason
doesn't work on my ISP.

2) point the OK link to a perl script which reads the new document and
output to the browser. The problem is that all of the URL on the document
becomes invalid because the current directory is now the cgi-bin directory.
Would it be a bad practice to lump the script and the static files in the
same directory??

A small problem but quite annoying.  Any help would be great!

"Kurt Stephens" <kstep@pepsdesign.com> wrote in message
news:95us45$540$1@slb6.atl.mindspring.net...
> "Pidge66" <hou2@hotmail.com> wrote in message
> news:3a82e97b$0$15967@wodc7nh6.news.uu.net...
> > My perl script updates a HTML document.  How can I make the browser load
> the
> > new document instead of from its cache?  I have a interim page which
> > indicates that changes have been made and to click OK to go to the new
> page.
> >
>
> Considering that this is a Perl newsgroup, I would first rephrase the
> question as "How do I set the Expire field in an HTTP header using Perl?"
>
> #/usr/bin/perl -wT
> use strict;
> use CGI;
>
> my $query = new CGI;
> print $query->header(-expires => '+0s');
>
> HTH,
>
> Kurt Stephens
>
>
>




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

Date: Thu, 08 Feb 2001 21:38:16 GMT
From: egwong@netcom.com
Subject: Re: how to prevent Browser from loading a page from cache?
Message-Id: <clEg6.1190$y03.124606@news.flash.net>

Pidge66 <hou2@hotmail.com> wrote:
> I have a few static HTML pages in the home page directory. There is a link
> to my PERL script, in the cgi-bin directory, which updates one of the HTML
> pages. The script then output a confirmation page and a OK link which points
> to the URL of the newly modified HTML page.  The problem is that the browser
> always loads the old page when I click on the OK link.

This still isn't a perl problem.  I suggest you look at one of the
comp.infosystems groups (perhaps comp.infosystems.www.authoring.cgi or
comp.infosystems.www.misc).

The basic rule of thumb is this: you can't force a browser to do anything
it doesn't want to do.

That said, why not just rename the new html page?  Incrementing the
filename (from foo001.html to foo002.html etc) ought to do the trick.
Either that or just skip the "confirmation page" completely and have
your script return the modified html.

[follows set to ciw.misc]


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

Date: Thu, 8 Feb 2001 22:51:11 +0100
From: Tore Aursand <tore@extend.no>
Subject: Re: how to prevent Browser from loading a page from cache?
Message-Id: <MPG.14ed333e9c59c81c98989d@news.online.no>

In article <3a82e97b$0$15967@wodc7nh6.news.uu.net>, hou2@hotmail.com 
says...
> How can I make the browser load the new document instead of from
> its cache?

This is a Perl newsgroup, but your question isn't related to Perl at 
all.

The answer can be found in the comp.infosystems.www.authoring.html FAQ;
http://www.htmlhelp.com/faq/html/publish.html#no-cache


-- 
Tore Aursand - tore@extend.no - http://www.extend.no/~tore/


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

Date: Thu, 8 Feb 2001 21:56:15 -0000
From: "Steve Kay" <steve@peachy.com>
Subject: Re: HTML formatted messages
Message-Id: <95v4hr$jtj$1@neptunium.btinternet.com>

How about http://search.cpan.org/doc/ALIAN/MIME-Lite-HTML-0.9/HTML.pm

DESCRIPTION
This module provide routine to transform a HTML page in MIME::Lite mail. The
job done is:

Get the file (LWP) if needed

Parse page to find include images

Attach them to mail with adequat cid

Include external CSS,Javascript file

Replace relative url with absolute one

It can be used by example in a HTML newsletter. You make a classic HTML
page, and give just url to MIME::Lite::HTML

"ntbrute" <ntbrute.nospam@email.com> wrote in message
news:aYjg6.8968$iM6.1112324@newsread1.prod.itd.earthlink.net...
> Heiya,
>
> I'm trying to send HTML-formatted messages using Net::SMTP or any other
> module.  Does anyone have any pointers or examples?
>
>
> TIA !!
>
>
>
>




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

Date: Thu, 8 Feb 2001 20:46:04 +0100
From: Thoren Johne <thoren@southern-division.com>
Subject: Re: Is scalar a float, int or string?
Message-Id: <MPG.14ed15afd8afebf2989865@news.btx.dtag.de>

In article <m3zofxoxjz.fsf@mumonkan.sunstarsys.com>, Joe Schaefer aka 
joe+usenet@sunstarsys.com says...
> Thoren Johne <thoren@southern-division.com> writes:
> 
> > i still have no idea why it terminates, and why '=' is not the last 
> > printed character. some 'mystical' POD related i guess.
> > 
> > is it explained somewhere?
> 
> How about a hint:
>    stick a "print $@" statement in there somewhere.

ouuhh - i missed the order of evaluation - chop comes after the failed 
eval (blushing)

> Here's my first crack at writing one of these little puzzles.
> No hints for the one below, but you probably need to close stderr :)
> As always, comments are welcome.

personally i prefer those japh's that run with strict and -w ;)

why don't you just add some parens there (^) to get rid of that
    'Warning: Use of "pop" without parens is ambiguous at...'?

sub{$].=(pop).(--$#%2?q: ::qq::)};
        ^   ^

-- 
# Thoren Johne - 8#X - thoren@southern-division.com
# Southern Division Classic Bikes - www.southern-division.com
END{*5=sub{(print'J')+goto&{$=+=2}},$==3,*7=sub{(print'A')-goto&{$=+=4}},
*11=sub{(print'PH 8#X')*goto&{$=+=2}}=>$==42=>*13=sub{42}=>goto&{$=-=37}}


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

Date: Thu, 08 Feb 2001 11:39:18 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: LWP::Simple issue?
Message-Id: <3A82F5E6.749E488C@stomp.stomp.tokyo>

"Peter L. Berghold" wrote:
 
>  Godzilla! wrote:

> >> foreach my $site(@sitelist){
> >>         printf "Gloming site: %s ... ";
> >>         my $content = get($site);
> >>         carp 'Nothing retrieved from ' . $site . "\n" unless $content;
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>            What's this?


I read no evidence you tested your Carp syntax
to discover if it is actually working. Blind
Faith in technology is illogical.

 
> >How do you know nothing is being returned? There
> >is no print command nor any apparent device to
 
> When the program runs
> A) the carp message comes out and 
> B) the rest of the processing of the content gets skipped.

No, based on your code posted, no further processing
takes place. There is nothing to skip. In your original
article you made no mention of an error message return.
Your use of next appears to be redunant in your loop.
However, you snipped pertinent subsequent code.

(snipped)
 
> Bottom line is this: $content is blank when get($site)
> returns and I'm trying to figure out why. If I do a 
> lwp -source on the site I get the RSS file that I was
> after. In fact, for now that is how I'm getting
> the RSS files until I can figure out why LWP Simple
> get isn't working.

If you ran my test code precisely as shown and no
content is returned, your problem is not with LWP.
Could be your site addresses are FUBAR, could be
there is a problem linking to LWP and other modules
via your script. This is verified by you via your
command line access to LWP and successful return.
Why are you questioning LWP after verifying it
does work? Seems you are barking up the wrong tree.


Godzilla!


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

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 247
**************************************


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