[13351] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 761 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 10 17:07:28 1999

Date: Fri, 10 Sep 1999 14:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 10 Sep 1999     Volume: 9 Number: 761

Today's topics:
    Re: buying perl book (Help me) <makkulka@cisco.com>
        Could someone break this down for me? <pkester@mindspring.net>
        Effective Perl Programming (if that's OK with you Randa <cLive@direct2u.co.uk>
    Re: help with BNF <makkulka@cisco.com>
    Re: HELP!! Regular Expression GRU: Extract Text between <sariq@texas.net>
    Re: HELP!! Regular Expression GRU: Extract Text between <rootbeer@redcat.com>
        how to pass exit status on Windows NT <yuri@intertrust.com>
    Re: How to send control codes from Expect module <wpflum@my-deja.com>
    Re: HTML Parser 2.23 TokenParser without a file handle  (Bill Moseley)
    Re: HTML Parser 2.23 TokenParser without a file handle  <ef@kwinternet.com>
    Re: HTML Parser 2.23 TokenParser without a file handle  (Bill Moseley)
    Re: I want to exit my script without sending anything b <makkulka@cisco.com>
    Re: I want to exit my script without sending anything b <cLive@direct2u.co.uk>
    Re: Inserting environment variables at the command prom (Alan Curry)
    Re: mastering algorithms a munition? <spike_YYwhiteYY@YYdellYY.com>
    Re: perl mail filter? lvirden@cas.org
    Re: perl mail filter? <revjack@radix.net>
    Re: Premature end of script headers (Dan Wilga)
    Re: progressive display of CGI output <pmane@rational.com>
        Project: perl to ksh for sync logins <ultrak@my-deja.com>
    Re: Running perl script with cron <makkulka@cisco.com>
        Time out!!! was:Re: mastering algorithms a munition? <dturley@pobox.com>
    Re: using SSI command or howto merge many files in 1 ou <crispbcd@linux.zrz.tu-berlin.de>
    Re: what am doing wrong creating an html page using a t <pmane@rational.com>
    Re: WHAT IS THE BEST WAY (DebbieOney)
        Win32::MAPI problem - reading and sending shapirojNOSPAM@logica.com
    Re: Y2K bugs on the Internet (Chris Nandor)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Fri, 10 Sep 1999 11:35:46 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: buying perl book (Help me)
Message-Id: <37D94F81.473556C4@cisco.com>

[ sine2117@my-deja.com wrote:

> Hello, anyone have a good tip of a nice perl book. like perl cookbook or
> something ?

Effective Perl Programming: Writing Better Programs With Perl
                     by Joseph N. Hall
--



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

Date: Fri, 10 Sep 1999 13:13:21 -0700
From: "Paul Kester" <pkester@mindspring.net>
Subject: Could someone break this down for me?
Message-Id: <7rbolj$i02$1@nntp5.atl.mindspring.net>

I am trying to find out some information on what a specific section of code
means in a line..

The code I am inquiring about is two slashes "/\"  I have seen many
references to it, but not what exactally it does..

Here is an example of a line that has it in the coding:

($stocknum,$name,$price,$status) = split(/\|/,$i);

It is a line from a search cgi script..

Any info would be appreciated.

Thanks,
Paul K.







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

Date: Fri, 10 Sep 1999 12:35:39 -0700
From: cLive hoLLoway <cLive@direct2u.co.uk>
Subject: Effective Perl Programming (if that's OK with you Randal... :)
Message-Id: <37D95D8B.5E9BA5E1@direct2u.co.uk>

Effective Perl Programming by J Hall and Randal Schwartz

 ...we are not worthy, we are not worthy...

(just got it - hence the 'oh my god I gotta learn to declare vars'
post..)

arghhhhh, but then I *like* baby talk... <sob>

cLive ;-)

PS - my spell check suggests 'Sandal' for 'Randal'. Subliminal or what?

sine2117@my-deja.com wrote:
> 
> Hello, anyone have a good tip of a nice perl book. like perl cookbook or
> something ?



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

Date: Fri, 10 Sep 1999 11:40:41 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: help with BNF
Message-Id: <37D950A8.349D376A@cisco.com>

[ cornmuffin wrote:

> I'm not sure where to ask this question.

Try newsgroups like comp.compilers.*
--



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

Date: Fri, 10 Sep 1999 14:38:40 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: HELP!! Regular Expression GRU: Extract Text between two HTML Tags
Message-Id: <37D95E40.A4874DAC@texas.net>

[Moved the "answer" after the question, and snipped a ton of extraneous
crap.]

Daniel Ulrich wrote:
> <smansoor@my-deja.com> wrote in message news:7r9bio$4hd$1@nnrp1.deja.com...
> > I need some help writing a regular expression that can extract text
> > between two HTML tags. For example I need to extract <BODY><IMG SRC ....
> > (Some other HTML)...</BODY> the resulting text will be <IMG SRC ...
> > (Some other HTML)...
> 
> $_=$yourhtml
> /\<body\>([\n|\r|.]*)\<\/body\>/i;
> 
> The results will be found in the $1 variable. That should work if it doesn't
> try using the ( ) insted of the [ ].

That doesn't even come *close* to working.  

These is the type of nonsense that will drive the people we depend upon
for assistance fleeing from c.l.p.misc.

STOP IT!  NOW!!!

- Tom


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

Date: Fri, 10 Sep 1999 11:23:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: HELP!! Regular Expression GRU: Extract Text between two HTML Tags
Message-Id: <Pine.GSO.4.10.9909101100410.16999-100000@user2.teleport.com>

On Fri, 10 Sep 1999, someone mistakenly wrote:

> $_=$yourhtml
> /\<body\>([\n|\r|.]*)\<\/body\>/i;
> 
> The results will be found in the $1 variable. That should work if it
> doesn't try using the ( ) insted of the [ ].

Congratulations! This posting has been nominated as one of the most
misleading postings in c.l.p.misc this year! While we're waiting for the
judges to tally the error score, let's hear what our panel of experts has
to say about this entry.

Henrietta Raisinbottom: I was struck by the elegant use of regular
expressions _far_ too simple to be of use in parsing something so complex
as HTML. I'm still waiting to see how the talent competition stacks up,
but this one is a real competitor.

Mr. Roswell: Yes, this entry shows a keen grasp of misinformation. Did you
notice how the poster clearly implied that even he himself didn't know
whether the code would work, then gave a totally bogus method of fixing it
up? And I hardly can look at the second line of code without being filled
with a feeling of wishing I knew Python. The backslashes on the angle
brackets are a touch of genius.

Mark Dyson: I don't know. The use of the asterisk in the regular
expression might actually be correct. I'd consider this a real challenger
if the poster had thought to write {0-} instead. I'm sure the judges won't
let that slide without at least a tenth-point deduction.

Let's go back to the judges table now to see what.... what.... what's
that? Uhm, yes, okay. Ahem. Well, folks, this happens sometimes. The
perils of a live broadcast. Due to technical difficulties, the judges will
be re-calculating this score by hand. It seems that some kind of numeric
overflow has occurred. But while we're waiting, let's watch this video
entitled "A Salute to ADA!"

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 10 Sep 1999 11:37:05 -0700
From: Yuri Shtil <yuri@intertrust.com>
Subject: how to pass exit status on Windows NT
Message-Id: <37D94FD1.645D18FC@intertrust.com>

Hi, all

I have a perl script that calls an another perl script via a system
call:

$stat = system("SCript2");

I am trying to pass the status from script2. I tried exit with 0, 1, -1.
Somehow
the $stat in the caller script is always 0, and so is $? variable.

Any idea what gives ?

    Thank you.





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

Date: Fri, 10 Sep 1999 18:04:13 GMT
From: Bill <wpflum@my-deja.com>
Subject: Re: How to send control codes from Expect module
Message-Id: <7rbh6k$mvu$1@nnrp1.deja.com>

It's amazing what you can do if you beat your head against a wall long
enough. I'm now able to run a perl script that will telnet in to our
Accounting Box, look to see if the Message alert is present and
correctly log back out, I could just drop the telnet session because it
leaves open stuff in the accounting program.  Now that I've amazed
myself once today I figured I'd try to do it again by taking the next
step and trying to actually transfer the messages to a normal unix mail
system.  My biggest problem now is with the screen dump again.  I don't
think I'll need a term emulator just a way for me to redirect the
screen to a variable, this would be an 'Except' question since 'Except'
is the module interfacing with the telnet program.  What I'm looking
for is almost like a multiline match but instead of matching anything I
need to 'see' the text I'm matching against so I can copy it.
Anyone have any ideas...while I'm waiting its back to the wall and
the 'Expect' docs. ;)


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 10 Sep 1999 11:42:13 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: HTML Parser 2.23 TokenParser without a file handle or file name
Message-Id: <MPG.1242f0dc894b16ec989734@nntp1.ba.best.com>

Eric Frazier (ef@kwinternet.com) seems to say...
> my $par = HTML::TokeParser->new(<<HTML) or die "fuck $!";

This is a documentation problem.  You need to read it again and see what 
you can pass to new().

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Fri, 10 Sep 1999 19:55:31 GMT
From: Eric Frazier <ef@kwinternet.com>
Subject: Re: HTML Parser 2.23 TokenParser without a file handle or file name
Message-Id: <37D9611F.20EB4C37@kwinternet.com>

Hi,

In the TokenParser.pm it says 
"The HTML::TokeParser is an alternative interface to the HTML::Parser
class.
It basically turns the HTML::Parser inside out.  You associate a file
(or any IO::Handle object or ***string***) with the parser at
construction time and.."

Ok associate a string, HOW? 

I did this..

t/tokeparser........ok
All tests successful.
Files=9,  Tests=36,  2 secs ( 0.34 cusr  0.93 csys =  1.27 cpu)

ok so this code from tokenparser.t below works..
	$p = HTML::TokeParser->new(\<<HTML);
	<title>Title</title>
	<H1>
	Heading
	</h1>
	HTML

	print "not " unless $p->get_tag("h1") && $p->get_trimmed_text eq
"Heading";
	print "ok 5\n";
	undef($p);

I can also use 

use HTML::TokeParser;

$p = HTML::TokeParser->new(\<<HTML);
<html><head>
<title>Welcome to Stonehenge!</title>
</head> <body bgcolor=White text=Black>
<h1>Welcome to Stonehenge!</h1>
<table border=2 cellspacing=0 cellpadding=10>
<tr><td valign=top width="80">
<table bgcolor=#eeeeee border=2><tr><td>
<table cellspacing=0 cellpadding=2>
<tr><td><B>Stonehenge</B></td></tr>
HTML

with no error

but as soon as I try to do something with it. 

if ($p->get_tag("title")) {
      my $title = $p->get_trimmed_text;
      print "Title: $title\n";
  }

 I get 
Not a GLOB reference at /usr/lib/perl5/site_perl/HTML/TokeParser.pm line
43.



Thanks,

Eric 





Bill Moseley wrote:
> 
> Eric Frazier (ef@kwinternet.com) seems to say...
> > my $par = HTML::TokeParser->new(<<HTML) or die "fuck $!";
> 
> This is a documentation problem.  You need to read it again and see what
> you can pass to new().
> 
> --
> Bill Moseley mailto:moseley@best.com
> pls note the one line sig, not counting this one.


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

Date: Fri, 10 Sep 1999 13:15:55 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: HTML Parser 2.23 TokenParser without a file handle or file name
Message-Id: <MPG.124306d6923dc001989735@nntp1.ba.best.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

Eric Frazier (ef@kwinternet.com) seems to say...
> In the TokenParser.pm it says 
> "The HTML::TokeParser is an alternative interface to the HTML::Parser
> class.
> It basically turns the HTML::Parser inside out.  You associate a file
> (or any IO::Handle object or ***string***) with the parser at
> construction time and.."
> 
> Ok associate a string, HOW? 

What part of this didn't you understand?

    If the argument is a reference to a plain scalar, then this
    scalar is taken to be the document to parse.


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Fri, 10 Sep 1999 11:08:18 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: I want to exit my script without sending anything back to the users     browser
Message-Id: <37D94912.A3FA5CF0@cisco.com>

[ Taylor wrote:

> Is it possible to make my script send the email and die?  Does my script
> have to send a URL back to the users browser?  I just don't want the
> page to reload.

At a minimum you have to send HTTP status 204 to the browser.
--



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

Date: Fri, 10 Sep 1999 12:26:22 -0700
From: cLive hoLLoway <cLive@direct2u.co.uk>
Subject: Re: I want to exit my script without sending anything back to the users   browser
Message-Id: <37D95B5E.4F19DF0D@direct2u.co.uk>

Taylor

Where your script has a line something like:

print "Content-type: text/html\n\n";

or a call to a function that does this, eg

&PrintHeader; or print header();

This sends output to the browser. Quick hack is to place the following
just before it:

print "Status: 204 No Response\n\n";
exit(0);

I would also add an onSubmit javascript to your form so that the user
gets a pop-up alert() saying 'Thank you for submitting your form. This
page will remain. This is meant to happen!' or something like that...
Users expect a new page, so they'll keep clicking submit otherwise....

cLive ;-)

Taylor wrote:
> I have a script that emails form data to me.  I wrote it from a
> tutorial.  It sends the email fine but it insists upon sending a
> confirmation URL back to the users browser.  I do not want this because
> I am using Flash and my Flash file is nearly 300k which takes a long
> time to reload.  I tried deleting the part of my script that sends the
> confirmation URL but now I get an error message from the server saying
> the script failed to execute.  I know it's executing because I am
> receiving the email.
> 
> Is it possible to make my script send the email and die?  Does my script
> have to send a URL back to the users browser?  I just don't want the
> page to reload.
> 
> Any suggestions would be greatly appreciated.
> 
> Taylor
> sine_wave@earthlink.net



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

Date: Fri, 10 Sep 1999 18:17:29 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Inserting environment variables at the command prompt
Message-Id: <ZWbC3.2514$N77.149349@typ11.nn.bcandid.com>

In article <JmZB3.986$N77.54843@typ11.nn.bcandid.com>,
Kragen Sitaker <kragen@dnaco.net> wrote:
>
>Assuming you're exactly like me and use bash, you can say something like
>export QUERY_STRING='walnuts=bananas&tilapia=fish'
>./whatchamacallit.cgi

Here's a very old shell feature that not enough people use:

$ QUERY_STRING='walnuts=bananas&tilapia=fish' ./whatchamacallit.cgi

sets QUERY_STRING in the environment of whatchamacallit.cgi, but unlike your
export command, doesn't pollute the environment of the shell or any following
commands.

As always, *csh doesn't do it, so don't try.
-- 
Alan Curry    |Declaration of   | _../\. ./\.._     ____.    ____.
pacman@cqc.com|bigotries (should| [    | |    ]    /    _>  /    _>
--------------+save some time): |  \__/   \__/     \___:    \___:
 Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman


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

Date: Fri, 10 Sep 1999 13:26:02 -0500
From: "Spike White" <spike_YYwhiteYY@YYdellYY.com>
Subject: Re: mastering algorithms a munition?
Message-Id: <7rbi97$t8j$1@galaxy.us.dell.com>


David Turley wrote in message <7r8dln$cau$1@nnrp1.deja.com>...
>I've been pouring over "Mastering Algorithms in Perl" and see that this
>book will be one of those "I need a copy at work and at home" books,
>like the Cookbook.
>
>On page 549 the RSA algorithm in Perl is printed, along with a warning
>that t-shirts, etc with this printed on them are classed as munitions by
>the US. So, does this mean that this book is also a munition?


Clinton & Congress loosened up restrictions on exporting the DES
algorithm recently, probably the RSA algorithm also.

Spike




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

Date: 10 Sep 1999 18:51:07 GMT
From: lvirden@cas.org
Subject: Re: perl mail filter?
Message-Id: <7rbjur$7vh$1@srv38.cas.org>
Keywords: Hexapodia as the key insight


According to revjack  <revjack@radix.net>:
:Just curious, has anyone here ever written their own procmail-style 
:e-mail filter using perl? I keep getting these suicidal impulses to 

You mean like the mailagent program that's in CPAN?  I think there's
a second one there as well.
-- 
<URL: mailto:lvirden@cas.org> Quote: Save us from the snobs.
<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.


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

Date: 10 Sep 1999 19:09:01 GMT
From: revjack <revjack@radix.net>
Subject: Re: perl mail filter?
Message-Id: <7rbl0d$72g$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight

lvirden@cas.org explains it all:

:According to revjack  <revjack@radix.net>:
::Just curious, has anyone here ever written their own procmail-style 
::e-mail filter using perl? I keep getting these suicidal impulses to 

:You mean like the mailagent program that's in CPAN?

Something less complex than that. Just wondering if anyone had any 
experience-earned advice to share.

I've got a relatively straightforward script now that directs mail 
to either my default mailbox or a mailbox of my choosing, all with
proper flocking (at least, I think so). Now I'm wondering how to
forward mail sent to, say, revjack+camel@radix.net, to my friends
on the "camel" mailing list. Stuff like that.


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

Date: Fri, 10 Sep 1999 15:19:20 -0400
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: Re: Premature end of script headers
Message-Id: <dwilgaREMOVE-1009991519200001@wilga.mtholyoke.edu>

In article <37d80807.558916@news.skynet.be>, bart.lateur@skynet.be (Bart
Lateur) wrote:

> Jim wrote:
> 
> >Does anyone know what the error Premature end of script headers means?
> >
> >I moved a Perl cgi form script on to an Apache web server (1.3) running
> >on Linux (5.2) and when I press the submit button, this is the error I
> >get.
> >
> >I know the script works,
> 
> It usually means that the script doesn't run. At all. Check:
> 
>  * that you uploaded it as Ascii
>  * that you set file permissions correctly (chmod in FTP; R and X for
> "all" is necessary)
>  * that the path in the "#!" line is correct.
> 
>    HTH,
>    Bart.

It can also mean that you didn't include any HTTP response header info.
Most Unix Web servers will expect to at least see a minimal header at the
start of any output:

print "Content-type: text/html\n\n";

Dan Wilga          dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply  **


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

Date: Fri, 10 Sep 1999 14:45:27 -0400
From: Pravin Mane <pmane@rational.com>
Subject: Re: progressive display of CGI output
Message-Id: <37D951C7.610BDC92@rational.com>



krubba@my-deja.com wrote:

> Just wondering if anybody knows how to have a
> cgi script feed it's output to the browser one
> line at a time. I tried some buffer flushing
> techniques, with little success, i.e. setting
> STDOUT-autoflush(1) and calling flush() after
> each line, but obviously that didn't work.

you have to make your script into a "non-parsed-header" script.  What
this means is that your script is solely responsible for creating ALL
the http headers that the browser desires.  Usually, you only send a
"Content-type:" header, and go about your merrie way, and the web server
that passed the CGI request to your script begrudgingly fills in the
missing headers.  You now have to specifically send a couple more
headers than you're used to:

#set autoflush
$| = 1;

#build your content...
$myHtmlPageToSend = { ...whatever...}

#find out how long it is...
$pageLength = length($myHtmlPageToSend);

#output headers...
print  "$ENV{'SERVER_PROTOCOL'} 200 OK\n";
print  "Server: $ENV{'SERVER_SOFTWARE'}\n";
print  "Content-type: text/html\n";
print "Content-length: $pageLength\n";
print "\n";

#output your page...
print $myHtmlPageToSend;


next, if your script was called "myScript.pl",  change the name to
"nph-myScript.pl" and run it. The "nph-" part alerts all the players
that you're handling the headers, and the server "steps out of the way"
to let you do your thing.  The browser now receives data at YOUR pace,
instead of in a blob, the way the server sends it.

There are more content headers, such as dates and other things, but
these are the bare minimum. You can probably even get away without the
content-length one as well.  In fact you certainly can. You could output
your headers, then call a sub that builds a page, printing each line as
it comes up, and the web browser will display it as it is sent.


>
>
> I'm guessing it has more to do with how cgi
> passes its output to server which queues it up,
> then serves it to the browser. Is there any
> way to get around this? I noticed metacrawler
> feeds it 1 line at a time (www.metacrawler.com).

yes

>
>
> Any ideas?

yes

dwoz




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

Date: Fri, 10 Sep 1999 20:51:47 GMT
From: Kermit Lowry, III <ultrak@my-deja.com>
Subject: Project: perl to ksh for sync logins
Message-Id: <7rbr0u$ulp$1@nnrp1.deja.com>

 Perl to ksh conversion project.  Any takers?

I have the need to sync logins (suids) on 6 currently running sybase
servers (v11.03.3/AIX 4.3.2) and keep them synced whenever adding new
users.

Ed Barlow has a perl utility and algorithm documentation that will
accomplish this (I assume, I have not checked it because I can't run
perl).  This script is at
http://www.tiac.net/users/sqltech (great site) under sync logins. My
problem is that we do not run perl on our AIX boxes and have no real
expertise in perl.  So I am going to try to convert his algorithms to
ksh (our default shell).

I am looking for a few good persons, who might also be in my situation,
to assist me with this undertaking.  Please contact me by taking DELETE
out of the email below if you are interested.

I have emailed Ed to let him know of my intent.

-- Kermit Lowry, III


--
----------------
"Only you can prevent forest fires!" -Smoky
klowry@DELETEfhlbatl.com


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 10 Sep 1999 11:10:51 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Running perl script with cron
Message-Id: <37D949AB.778AB7B8@cisco.com>

[ "Saeed Moradi-Maram (SAMO)" wrote:

> - it takes the output lines mostly the print
>   statements and sends THEM to users!

This is what cron does. Anything that goes to STDOUT
is mailed to the user. A good idea is to write all o/p
from the program to a file.
--



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

Date: Fri, 10 Sep 1999 18:39:59 GMT
From: David Turley <dturley@pobox.com>
Subject: Time out!!! was:Re: mastering algorithms a munition?
Message-Id: <7rbj9s$omq$1@nnrp1.deja.com>

In article <MPG.12434af1d2825a93989cbf@news-server>,

Okay, I apologize! I asked the original question so I have the right to
end the thread I hope. My question was not meant to evoke a discussion
of the merits of US export law. My post was only vaguely on-topic, the
discusionof export laws is WAY OFF TOPIC!!!!!

--
David Turley
dturley@pobox.com
http://www.binary.net/dturley


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 10 Sep 1999 22:24:18 +0200
From: Christoph Bauer <crispbcd@linux.zrz.tu-berlin.de>
Subject: Re: using SSI command or howto merge many files in 1 output
Message-Id: <37D968F2.A9EC17A0@linux.zrz.tu-berlin.de>

Hi,

Pascal Deschenes schrieb:
> 
> Hi,
> I am trying to use SSI command within a perl script. But it looks like
> perl or the server can't handle the SSI prior to post it as the code
> works but does not output my SSI command stuff. My goal is to
> output html from many files. Say I have a header file, a core file and
> a footer file each contenaining html tags, I wanna merge the whole thing

Sigh...

since you're running a cgi the server doesn't bother with any ssi tags
in it. In fact he doesn't care with (well almost) anything you send
back.
You don't need them anyway.

> in one output. Any idea? Below is my test snippet:
> 
> #!/usr/bin/perl
> print "Content-type:text/html\n\n";
> print <<EndOfHTML;
> <html>
> <head>
> <title>Test Page</title>
> </head>
> <body>
> <h2>Hello, world!<BR>
EndOfHTML
my $age=stat($file)[#] #i dont know the right element.
print "Last modi.. $age </h2>\n";
#> Last modified: <!--#echo var="LAST_MODIFIED" -->
 
open (BANN,"<$full_path_2_banner") or print "$0:$!";
print...
#> <!--#include virtual="/logs/banner"-->
#> </body>
#> </html>

ciao
Christoph



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

Date: Fri, 10 Sep 1999 15:43:11 -0400
From: Pravin Mane <pmane@rational.com>
Subject: Re: what am doing wrong creating an html page using a template and  database?
Message-Id: <37D95F4F.DA08525@rational.com>

see my comments inside your script

dwoz

Jason wrote:

> Hello,
>
> I am writing a script where a person will have
> -a database of data
> -an html file that needs to be used as a template .... top and bottom parts
> not be repeated but the middle part that is going to contain the records
> should be generated ...  the script needs to take !0! and change it to
> field[0]     !1! to field[1] and son on ..
>
> Can some one please tell me what am I doing wrong?
>
> #!/usr/bin/perl
> use CGI qw(:standard);
>
> print "Content-type:text/html\n\n";
>

#you're using CGI, why roll your own headers?


>
> my $template = param("template");
> my $outputfile = param("outputfile");
> my $file = param("datafile");
> my $delimator = param("delimator");

#did you actually instantiate a CGI object somewhere,
#and forgot to type it in here?
#if not, you've got a show-stopper right off the bat.
# it should look like:

#$myCGI = new CGI::Response();
#my $template = $myCGI ->param("template");

> unless (open (TEMPL, $template))
>  {
>  print "Cannot open $template";
>  exit;
>  }
> undef ($/);
> $template=<TEMPL>;
> close TEMPL;
> ($top, $record, $bottom)=split(/<!--record-->/, $template);
>

#now you want to print $top before doing anything else...

>
> # matching
> $count=0;
> unless (open (FILE, $file))
>  {
>  print "Cannot open $file";
>  exit;
>  }
>
> @data=<FILE>;
> close FILE;
>

# OOPS!!! forgot to reset $/...that means that @data will have ONE entry in it.

#but looking below, seems you don't really want to use an array anyway? Make it
"$data." instead of "@data"

#you also need to define $start before your loop.  But why use a $start
variable? is it EVER
#going to be anything other than zero?

>
> LOOP: for ($a=$start; $a<@data; $a++)

# change this to:
LOOP: for ($a=0; $a < $#data; $a++)

>
>  {
>  $data[$a]=~s/$delimator//;

#hey, look ma! no delimitor (or del im A tor, whatever that is!) remove this
line.

>
>   {
>   @fields=split(/\$delimator/, $data[$a]);

# this line will never do anything useful because you already blew away all
your delimiters. (excuse me; separators.)

>   $line=$record;
>   $line=~s/!(\d+)!/$fields[$1]/g;
>   print $line;
>   }
>  }

There's lots more wrong, but that should get you started!!

hope this helped

dwoz



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

Date: 10 Sep 1999 19:10:20 GMT
From: debbieoney@aol.com (DebbieOney)
Subject: Re: WHAT IS THE BEST WAY
Message-Id: <19990910151020.17171.00006525@ng-fe1.aol.com>

onathan Stowe gellyfish@gellyfish.com 
Date: Thu, 09 September 1999 05:05 AM EDT wrote:

>>"Mr Creutzfeldt and Mr Jakob: No-one had ever heard of these two eminent
medical men until someone had the>>

What is the rest of this?
____
Deborah Oney
Absence of evidence is not evidence of absence.
Blood Recall/Withdrawal-Creutzfeldt Jakob Disease
http://members.aol.com/debbieoney/blood.htm
CJD Watch-the international CJD tracker
http://members.aol.com/stacy91434/watch/watch.htm


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

Date: Fri, 10 Sep 1999 16:43:44 -0400
From: shapirojNOSPAM@logica.com
Subject: Win32::MAPI problem - reading and sending
Message-Id: <MPG.12433788649b582a989685@news.logica.co.uk>


Well, I wanted to do some automated processing of the mail I receive at 
work, where everything is done via Microsoft Exchange/Outlook, so I was 
delighted to find Win32::MAPI. But it's acting a bit wacky. I don't know 
if it's the module, or imapi.dll, or my system's mapi dll.

What I want to do is examine all the mail in my in-box, and, if the 
subject line matches a pattern, send out an e-mail, (not necessarily to 
the same person), and then delete the original mail. What happens is a 
bit inconsistent, but generally I get too many people in my To: list. A 
boiled-down piece of code that exhibits the problem follows:

--------Start code
#!/perl/bin/perl.exe -w
use strict;
use Win32::MAPI ('Yes', 'No') ;

my($obj)=new Win32::MAPI(UseDefProfile=>Yes);

my $dest;
$dest = 'shapirojsXXX@XXXhotmail.com';

my $msgTxt = 'Hey, you can ignore this. It\'s a test';
my $subject = "Low level mailing test";
my %data;

if($obj->IsMAPI){print "MAPI okay...\n"}
else{die "\n MAPI is not available!\n"}

if($obj->Logon() ) { print "Logon okay...\n" }
else{ die "Can't logon!";}


my $i = 0; # don't process too many!
while( $obj->Next() and ++$i < 5) {

        %data=(LeaveUnread=>1, NoAttachments=>1, UnreadOnly=>0, 
HeaderOnly=>0);


        $obj->Read(\%data);

        print "\nFrom: " . $data{Originator} . " Subject: " . 
$data{Subject} . " ";
        print "Date: " . $data{DateRecvd} . "\n";
        next if $data{ Subject } !~ /sendtestmsg/;
        
        print "Found Subject line with 'sendtestmsg'\n";

        print "Processing active msg: From: " . $data{Originator}." 
Subject: ".$data{Subject}."\n";
        print "Date: " . $data{DateRecvd} . "\n";
        #print "Message: ".$data{Text}."\n";


        print "\nGoing to send message to $dest\n";

        # Send the mail
        %data = ();
        $data{Text} = $msgTxt;
    $data{Subject} = $subject;
    $data{To} = [ $dest ];
    $data{ShowDialog} = 0;
        
        if( not $obj->Send(\%data) ) {
                print "Couldn't send mail to ", $dest, "\n";
                print "Error: ", $obj->LastError; 
                next;
                }

        
#       $obj->Delete();
}

$obj->Logoff() ;
undef $obj;
---------- End Code

The problem varies depending on $dest. With my hotmail account, the To: 
list contains 2 addresses, one invalid
"'shapirojsXXX@XXXhotmail.com'" <shapirojsXXX@XXXhotmail.c>

the other valid

"'shapirojsXXX@XXXhotmail.com'" <shapirojsXXX@XXXhotmail.com>

(spam-proofing this message is getting to be a pain).

When I send it too my work address ( which is where the script runs), I 
get from 3 to 8 copies of my work address in the To: list. When I send it 
to a friend, I get a list of my work address and my friends address. 

I dug into MAPI.pm, and verified in Send()

--->    print "In MAPI.pm, rcpt is --$recipient--\n";

        my($Ret)=$SendMail->Call($data->{Text},$recipient,$CC,$Bcc,
        $data->{Subject}, $Attachment,$data->{ShowDialog},
        $data->{Acknowledge},$obj->{handle},$Ptr1);

that the $recipient list is correct. So as far as I can tell, either the 
SendMail function in imapi.dll is picking-up information left around from 
previous calls (maybe to ReadMail), or my installed MAPI is acting goofy. 
I'm having no problems using Microsoft Exchange to read/send my mail. 
Would it be possible to get the code for imapi.dll? That would probably 
help me pinpoint the problem.


And while I've got the attention of all the MAPI interested people, I've 
got a question about the general strategy. What I really want to do is

[following is psuedo-Perl, where $msg is some abstract object, not a 
Win32::MAPI blessed reference.]

foreach $msg ( mailbox ) {
    push @mymsgs, $msg->id if ($msg->subject has the right format);
}

foreach $msg->id ( @mymsgs) {
        Read( $msg );
        Create new e-mail;
        Send new e-mail;
        delete $msg;
}



I can't do this with Win32::MAPI, and I don't know if I can do it with 
MAPI at all. Reading the MAPI documents I got from the Microsoft web 
site, it looks like Send, Read, and Delete use a MessageID to specify the
message being processed. Would it be possible to add forms of 
Win32::MAPI->Read and Win32::MAPI->Delete that referred to a messageID. 
I'm guessing that Win32::MAPI is maintaining some sort of "Current 
MessageID" inside the dll, and so I can only operate on that message. As 
you can see in my script above, I've commented out the Delete. It was 
behaving even more strangely when that was in. I couldn't figure out what
was supposed to happen when I deleted the "current" message, and then did
Next(). 

Anyways, TIA for all the help, and thank you Amine for providing 
Win32::MAPI. 


Jonathan Shapiro
shapirojsXXX@XXXhotmail.com


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

Date: Fri, 10 Sep 1999 20:12:58 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Y2K bugs on the Internet
Message-Id: <pudge-1009991613050001@192.168.0.77>

In article <7r8t9v$5hk@junior.apk.net>, catfood@apk.net (Mark W. Schumann)
wrote:

# In article <pudge-0709991617590001@192.168.0.77>,
# Chris Nandor <pudge@pobox.com> wrote:
# >I defy you to show me one example of a good programmer making a Y2K error
# >in Perl.
# 
# While I agree with your point, this challenge verges on tautology.  If
# the programmer [consistently] makes a Y2K error, s/he's not a good
# programmer.
# 
# Followups trimmed ruthlessly.

That is the point.  She contested good programmers make these Y2K errors. 
Of course, they don't, because one who does is not.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

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


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