[11691] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5291 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 3 13:05:20 1999

Date: Sat, 3 Apr 99 10:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 3 Apr 1999     Volume: 8 Number: 5291

Today's topics:
    Re: Apache::Registry <gellyfish@gellyfish.com>
    Re: Checking for a hung url <gellyfish@gellyfish.com>
    Re: Copy from Perl? <gellyfish@gellyfish.com>
    Re: determining the browser? <gellyfish@gellyfish.com>
        general module question <stevenhenderson@prodigy.net>
    Re: Help-Perl Usergroups (Randal L. Schwartz)
    Re: Help-Perl Usergroups (Tad McClellan)
        Help:  Perl not expanding wildcards from commandline. (rogDH)
    Re: here docs vs qq quote operator. Just personal prefe <dan_boo@bellsouth.net>
    Re: here docs vs qq quote operator. Just personal prefe <gellyfish@gellyfish.com>
    Re: How to include a module? (Peter L. Berghold)
    Re: How to include a module? <zenin@bawdycaste.org>
    Re: I need help on cgi communication with layers. <tazmen@primary.net>
    Re: I need help <gellyfish@gellyfish.com>
    Re: I need help <gellyfish@gellyfish.com>
        I'm stuck.. <debot@xs4all.nl>
    Re: I'm stuck.. <rra@stanford.edu>
    Re: I'm stuck.. <gellyfish@gellyfish.com>
        Is this patternmatching or what? <nca@tek.edu.jonkoping.se>
        parsing problem... <flanker@sonnet.ru>
    Re: Perl Question for generating HTML (Tad McClellan)
    Re: Pls help... regex to recognise a phone number. (Larry Rosler)
    Re: Program to format Perl code (syntax indents)????? <gellyfish@gellyfish.com>
        Reading Graphics <Thomas@aps.de>
    Re: ReadParse library - Output not in same sequence as  <gellyfish@gellyfish.com>
    Re: Sending a email using PERL <gellyfish@gellyfish.com>
    Re: Silicon Valley Perl Mongers? (Randal L. Schwartz)
        using perl CGI to automatically post data to an HTML fo (Rob Sweet)
    Re: using perl CGI to automatically post data to an HTM (Bob Trieger)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 3 Apr 1999 16:07:20 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Apache::Registry
Message-Id: <7e5ebo$8g$1@gellyfish.btinternet.com>

On Fri, 02 Apr 1999 22:09:48 GMT hojo wrote:
> A few questions regarding Registry.  I have been running all scripts.  But,
> when I finally put an index.html file, it tries to read it as a script.  Is
> there a setting for Registry that will enable it to read .html files as html
> files?
> 

I think that this is a server configuration issue rather than a Perl one
I am assuming that you have configured a directory to have any files
therein handled by mod_perl right ? 

I'd ask in comp.infosystems.www.servers.unix

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 3 Apr 1999 16:09:03 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Checking for a hung url
Message-Id: <7e5eev$8j$1@gellyfish.btinternet.com>

On Fri, 02 Apr 1999 13:42:32 -0800 Tory Johnson wrote:
> How can I check to see if a URL is hung or not.  What I want to do is
> have a cron job go out and check the Web Server to see if there are any
> URL's that are being hung and if so go and restart the server.
> 

Use the module LWP::UserAgent and the HEAD method.  There are good examples
in lwpcook document which comes with the module.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 3 Apr 1999 15:57:29 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Copy from Perl?
Message-Id: <7e5dp9$7c$1@gellyfish.btinternet.com>

On Sat, 3 Apr 1999 09:49:41 -0500 Computer Guru Consulting wrote:
> 
> Hello
> I have a simple(?) question...
> I am trying to copy the contenys of test.txt to test.dat...
> In unix I simply do this
> cp test.txt test.dat
> How do I do this in Perl? Thanks

What ways have you tried ?

File::Copy is a widely touted solution (it comes with Perl) although
there is no harm in doing:

system('cp','text.txt','text.dat');

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 3 Apr 1999 16:03:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: determining the browser?
Message-Id: <7e5e4j$8d$1@gellyfish.btinternet.com>

On Fri, 02 Apr 1999 20:41:34 -0500 George wrote:
> I would really appreciate it if someone could tell me how to determine
> which browser the user is .. using?  Just a generic IE or Navigator sort
> would be great.. I just hope I don't have to use JavaScript to do it,
> because that would be ickie.
> 

So you dont want me to visit your site ? :

GET / HTTP/1.0
Host: localhost:8080
Accept: text/html, text/plain, audio/x-pn-realaudio, image/*, image/jpeg, text/
sgml, video/mpeg, image/jpeg, image/tiff, image/x-rgb, image/png, image/x-xbitm
ap, image/x-xbm, image/gif, application/postscript, */*;q=0.01
Accept-Encoding: gzip, compress
Accept-Language: en
Negotiate: trans
User-Agent: Lynx/2.7.2 libwww-FM/2.14

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 3 Apr 1999 08:15:52 -0600
From: "Steven T. Henderson" <stevenhenderson@prodigy.net>
Subject: general module question
Message-Id: <ZarN2.19975$oa3.187636@news.san.rr.com>

currently, when my perl program is executed, i am passed a series of values
that correspond to form fields in an *existing* HTML file. i parse in this
file, substitute the passed values for any defaults and display the form.
this 'dynamic defaulting' allows me to edit existing records in a form-entry
database. additionaly, by using an existing HTML file (my form), i can let
my designer dink with colors, graphics, etc. w/o affecting me.

my question is: is there an existing PM or library that does all this work
for me? what is the standard way of performing this action? i know this is
done elsewhere, but cannot find it any faq's or posts.




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

Date: 03 Apr 1999 09:05:49 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Help-Perl Usergroups
Message-Id: <m1soaheis2.fsf@halfdome.holdit.com>

>>>>> "Tony" == Tony  <tonyd@aracnet.net> writes:

Tony> Can someone direct me to a group where I can post some of my job
Tony> openings for Perl Web Masters.

Perl jobs go on the Perl Jobs board sponsored by The Perl Journal --
see www.tpj.com for a location.

Tony>  The openings I have currently are
Tony> in Toronto Canada. I have heard that there is a Usergroup called
Tony> Perl Mongerers (not sure of the spelling) Help in these two
Tony> areas would really be appreciated.

The Perl Mongers website at www.pm.org should be able to direct you
to a PM group in your area.

Tony> Thank You!

Thank you for being interested in using existing resources!

print "Just another Perl hacker,"
-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Sat, 3 Apr 1999 06:14:10 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help-Perl Usergroups
Message-Id: <26t4e7.61h.ln@magna.metronet.com>

Tony (tonyd@aracnet.net) wrote:
: Can someone direct me to a group where I can post some of my job openings for 
: Perl Web Masters. 


   Any newsgroup with '.jobs' in its name.


: The openings I have currently are in Toronto Canada. I have 
: heard that there is a Usergroup called Perl Mongerers 


   http://www.pm.org/


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sat, 03 Apr 1999 16:37:30 GMT
From: rogdh@iname.com (rogDH)
Subject: Help:  Perl not expanding wildcards from commandline.
Message-Id: <3706438d.50524700@news.earthlink.net>

I just installed ActivePerl about a week ago.
I've written some scripts that work, so it seem that the install went
correctly.

However, it appartnetly does not expand wildcards from my commandline.

If I enter each arguments individually, the script processes the
files.
If I use a wild-card, the @ARGV contains what was entered on the
commandline... including the wildcard.

I'm running NT 4.0 sp4.   Did I have to do anything special for
wildcards to work.

thanks
roger



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

Date: Sat, 03 Apr 1999 16:06:54 GMT
From: Dan Boorstein <dan_boo@bellsouth.net>
Subject: Re: here docs vs qq quote operator. Just personal preference?
Message-Id: <3704EB1F.C98B0F70@bellsouth.net>


Bob Trieger wrote:
> 
[SNIP]
> 
> With here docs there is always the chance of the extraneous space at the end
> making your script fail. The more here docs in the script, the higher your
> risk of failure and if you use the same delimiting sequence the much bigger
> headache finding this error.

in general i have no use for trailing white-space in my code. for this
reason i have my text editor set to strip trailing white-space each time
a file is saved. in the 3 years that i've had it this way, i've never
needed to switch back, and have never had the problem of trailing space
after a here doc closure.

> Using here docs is suggested a lot more than simple quote operators and I was 
> wondering if there is an advantage or just out of habit?

if i don't mind the leading newline that i get from

print qq{
Must be near the top
middle
end
};

i'll use it (e.g., between lines of HTML tags). but if i need my text to
be well formatted, with newlines only where i really want them, i'll use
a here doc:

print <<EOF;
Must be at very top
middle
end
EOF

cheers,

dan boorstein


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

Date: 3 Apr 1999 16:32:05 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: here docs vs qq quote operator. Just personal preference?
Message-Id: <7e5fq5$94$1@gellyfish.btinternet.com>

On Sat, 03 Apr 1999 03:20:39 GMT Bob Trieger wrote:
> 
> Using here docs is suggested a lot more than simple quote operators and I was 
> wondering if there is an advantage or just out of habit?
> 

I tend to suffer from 'code blindness' rather than fat fingers and thus
it is easier for me to discern some dictinctive terminator in a bunch of
code than some single character.  Also the problem the problem of extraneous
white space is lessened by the use of an editor that allows you to easily
delete the remainder of a line from the cursor.

There is also a subtle difference inasmuch as the <<EOBLAH can be thought
of as standing for the entire quoted string in places where it would be
clumsy to use a multiline qq{string} such as the arguments to some 
function.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 03 Apr 1999 16:56:57 GMT
From: Peter@Berghold.Net (Peter L. Berghold)
Subject: Re: How to include a module?
Message-Id: <tLrN2.1649$qy5.1215@news.rdc1.nj.home.com>

In article <3703AF3F.64BFB81F@jpmorgan.com>, singh_mandeep@jpmorgan.com says...
>
>require "../perl_lib/CGI_Lite.pm";
>push (@INC, "/tmp/perl_lib");  #where CGI_Lite.pm resides
>push (@INC, ".");
>use CGI_Lite;
>

You were on the right track. Try this:

BEGIN { 
     push(@INC,"/tmp/perl_lib");
     push(@INC,".");  # I believe this is redundant...
}
use CGI_Lite;


Even better would be to install CGI_Lite where it belongs....


-- 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Peter L. Berghold                        Peter@Berghold.Net
"Linux renders ships                     http://www.berghold.net
 NT renders ships useless...."           ICQ# 11455958



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

Date: 03 Apr 1999 17:12:09 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: How to include a module?
Message-Id: <923159593.794964@thrush.omix.com>

[posted & mailed]

In comp.lang.perl.modules Mandeep Singh <singh_mandeep@jpmorgan.com> wrote:
: I want to include a module (CGI_Lite.pm) in my script. The problem is I
: don't want it to be installed i.e with Perl. I have the module in my local
: directory. How would I include it in my script?

	use lib '/tmp/perl_lib';
	use CGI_Lite;

-- 
-Zenin (zenin@archive.rhps.org)

        Yah, Emacs is a good OS, but I prefer FreeBSD.


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

Date: Sat, 03 Apr 1999 11:32:56 -0600
From: William Tammen <tazmen@primary.net>
Subject: Re: I need help on cgi communication with layers.
Message-Id: <370650C8.8A8D4A2D@primary.net>

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>

<center><b><font size=+3>Attention</font></b></center>
I do not want free programming, I would love to hear from anyone who gets
this working and would like to at least steer me on the correct path to
solving the problem.&nbsp; I do believe getting a good reliable way of
communicating with cgi programs in a dynamic html environment is very important
in achieving powerful dynamic sites and therefore makes this a worth while
endeavor.
<br>If you can get this to work and do not wish to share free of charge
then by all means email me with details on selling me the code.&nbsp; I
would be interested in paying for the code if that is what it takes.
<p>William Tammen wrote:
<blockquote TYPE=CITE>I need a way to design a link that will query say
like
<br>.../cgi-bin/forum/forum.pl?preview and post the form at the same time.&nbsp;
I
<br>know all about links only being able to use get method and I know about
<br>sending values with a query but that just does not cut it with text
<br>areas in the form do to the get methods length limits.&nbsp; Now the
normal
<br>post method of a form submit will do the action of
<br>.../cgi-bin/forum/forum.pl?preview and then submit to that url the
form
<br>data directly to stdin of the cgi.&nbsp; I also know of the javascript
function of
<br>submit but that is just a remote control feature, the forms action
would
<br>still have control and would replace my site page with the cgi response
<br>so that will not work. Now there has to be a way of doing
<br>this using javascript or java to mimic this exact process via a true
<br>link so that I can use the link as a perameter in a javascript function
<br>which will load the resulting page sent back by the cgi into a div
tag
<br>layer on my site.&nbsp; This function buffers the page then transfers
it to
<br>said div layer to perform cross browser.&nbsp; The function buffers
using
<br>iframe for IE and a layer in Netscape.&nbsp; This works fine on any
queried
<br>responses from the cgi.&nbsp; I just can't sent text area data in a
standard
<br>query value link. This problem must be solved since dhtml can not be
<br>integrated with cgi due to the natural static nature of cgi responses
<br>wiping out the page they where called from.&nbsp; Now Dan Stienman
has began
<br>attempts at working out this problem but he has only implemented a
cgi
<br>communication example which handles a radio button form.&nbsp; The
ultimate
<br>goal is to do this with all form values especially text fields and
text
<br>areas and combinations of them all in the form.&nbsp;&nbsp; If anyone
is
<br>interested Dan is the true dhtml guru of the net, perhaps the best
kept
<br>secret of the net, but is to busy with IE5 compatibility, his tutorial
on dhtml is second to none.
<p>The url to his main page is
<br><a href="http://www.dansteinman.com/dynduo/">http://www.dansteinman.com/dynduo/</a>
<p>and the url to the cgi communication&nbsp; is
<br><a href="http://www.dansteinman.com/dynduo/cgicomm/cgicomm.html">http://www.dansteinman.com/dynduo/cgicomm/cgicomm.html</a>
<p>&nbsp;Thanks in advance&nbsp; Bill
<br>&nbsp;
<br>&nbsp;</blockquote>
</html>



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

Date: 3 Apr 1999 15:46:24 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: I need help
Message-Id: <7e5d4g$6o$1@gellyfish.btinternet.com>

On Fri, 02 Apr 1999 22:17:06 -0600 William Tammen wrote:
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> I need a way to design a link that will query say like
> <br>.../cgi-bin/forum/forum.pl?preview and post the form at the same time.&nbsp;

Please do not post in HTML - at best it is annoying and at worst it will
cause your post to be ignored by the people who are most likely to answer
your question correctly.

Please use a descriptive subject line - some people will skip posts that
are similar to yours.  Some newsreaders will thread the post with other
posts with the same Subject line - this again will cause your post to
be ignored.

However in this case neither of these things really matter as your post
is off-topic for this newsgroup.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 3 Apr 1999 15:49:09 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: I need help
Message-Id: <7e5d9l$6r$1@gellyfish.btinternet.com>

On Fri, 2 Apr 1999 15:33:32 +0100 Ken wrote:
> Hi all.
> 
> I have a few scripts running together which create a basic web site. All
> seems to work fine with my versions of IE(4.72) and Netscape Navigator 4.04
> and Communicator 4.04 but i have been told that they don't work in IE 4.71.
> Bit of an odd problem......

Then its nothing to do with Perl is it ?

I really dont think it was necessary for you to make four posts about this
either.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 03 Apr 1999 18:06:57 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: I'm stuck..
Message-Id: <37063CA0.66E09501@xs4all.nl>

What must I do when I get this message: HTML::HeadParser=HASH(0X655848)


--
My Email  : debot@xs4all.nl
Homepages : - http://www.debot.nl/ppi/
            - http://www.searchy.net/




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

Date: 03 Apr 1999 08:14:30 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: I'm stuck..
Message-Id: <yliubdn0k9.fsf@windlord.stanford.edu>

Frank de Bot <debot@xs4all.nl> writes:

> What must I do when I get this message: HTML::HeadParser=HASH(0X655848)

Figure out why you're stringifying a reference to HTML::HeadParser when
that's clearly not what you wanted to do.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 3 Apr 1999 18:01:59 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: I'm stuck..
Message-Id: <7e5l2n$fe$1@gellyfish.btinternet.com>

On Sat, 03 Apr 1999 18:06:57 +0200 Frank de Bot wrote:
> What must I do when I get this message: HTML::HeadParser=HASH(0X655848)

When you print the return value of:

   HTML::HeadParser->new();

?

Thats because that value is only of any use if you want to access the
methods and properties of the HTML::HeadParser object.

Read the documentation for the module a bit more carefully in this case.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sat, 3 Apr 1999 19:14:36 +0200
From: "Annica Johansson" <nca@tek.edu.jonkoping.se>
Subject: Is this patternmatching or what?
Message-Id: <37064df7@news2.mixcom.com>

I'm trying to figure out how to get the script to search for a word given to
the script by the keyboard... Not only do I want the script to search for
that particular word, but I also want it to only search the first word on
every line.
Could anyone help me and tell me were I went wrong?


Thank you in advance!

Annica Johansson
(Perl newbie)

The code:

$file = '<C:\perl\mitt\test2.txt';
open(INFO, $file);
@lines = <INFO>;

print "Enter a word to search for:";
$a = <STDIN>;

while (<@lines>)  {
        @lines = $f;
        if ($f =~ /$a/) {
               print "$'";
                }
          }








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

Date: Sat, 3 Apr 1999 21:27:46 +0400
From: "Michael Yevdokimov" <flanker@sonnet.ru>
Subject: parsing problem...
Message-Id: <7e5j5u$o4j$1@bison.rosnet.ru>

Hello

I have a problem with parsing data... :((

$C_L=$ENV{'CONTENT_LENGTH'};
read(STDIN, $buffer, $C_L);
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)

  ($name, $value) = split(/=/, $pair);
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $value =~ s/%(..)/pack("c", hex($1))/ge; #
  $value =~ s/<!--(.|\n)*-->//g;
  $value =~ tr/+/ /; #change pluses onto spaces
  $H{$name} = $value;
  if ($value eq "") {
    # Save to array the names of null parameters
    push(@absent,$name);
  }
}

For example, form has POST method and one of the fields named as
'realname'..

I try to extract data from hash into $User varable:

$User=$H{'realname'};

Let <input type="text" name="realname" value="Michael Yevdokimov">

It's strange but when I try to show data from $User, I get only
"Michael", i.e. without my surname.. What's happened? What's wrong?

Thanks for help.

--
Best wishes,

Michael Yevdokimov

Email: flanker@sonnet.ru
ICQ: 30874618
-------------------------------------------------
>> Developers Support Site <<
Web: http://developer.tsx.org
http://www.basicnet.sonnet.ru
-------------------------------------------------





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

Date: Sat, 3 Apr 1999 06:08:17 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl Question for generating HTML
Message-Id: <1rs4e7.61h.ln@magna.metronet.com>

cjsub@hotmail.com wrote:
: I have been using perl for a few years to manipulate text files.
: Now i want to start formatting my output into HTML docs.
: Is the best way to do this using the Format Statement to create the misc
: stuff at the top of my html doc ??

   No.

: and then use the Format again for the body

   No.

: and then use format a third time for my closing <\> tags ??

   No.

: Any help or faq's will be greatly appreciated


   Perl's 'format' is handy for producing columnated reports,
   though I have never needed it in several years of Perl
   programming (I get what I need with (s)printf).

   Whitespace is "folded" in the presentation of HTML (it is
   ignored by the browser), so getting things lined up in
   pretty columns is unneeded work, since the browser will
   undo the work anyway.


   print() with a here-doc is handy for outputting a block
   of text, such as the head/tail of the HTML output:


print <<'ENDHTML';
Content-Type: text/html

<html>
<head>
   <title>My Web Page</title>
</head>
<body>
ENDHTML


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sat, 3 Apr 1999 08:23:32 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Pls help... regex to recognise a phone number.
Message-Id: <MPG.116fe05895e3d8ab989827@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <37062c8c.40064100@news.apex.net.au> on Sat, 03 Apr 1999 
14:58:26 GMT, Kim Saunders <kims@tip.net.au >says... 
> Me again, same plea for regex help. Can someone please help with with
> a regex (and associated code) that will analyse a string, and every
> time a phone number is in it, match, and print it?

I'll sketch some regexes.  Surely you can write the associated code 
yourself.

> Now, the bit that gets me is that this must recognise a number written
> by a human. And humans write numbers in silly ways... I am trying to
> get american numbers, which are in the format:
> 
> ((+)1) (123) 456 7890
> 
> Of courses, the problems are that the numbers can be in varing
> formats, with different puctuation, spaces in different places,
> brackets, hyphens, pluses (for international number). Basically, I
> thing if I can get something that will recognise a block of 7-16 or so
> characters, with nothing but digits, spaces, hyphens, brackets, and
> pluses, and at least 7 of them actual digits, I will be doing well. No
> matter what I do, it won't be foolproof, but just a few simple ones
> would be great to get me started.

7-16 or so characters, with nothing but digits, spaces, hyphens, 
brackets, and pluses

    /^[\d \-()+]{7,}$/

at least 7 of them actual digits

    /(\d.*){7}/

combining them into one mess

    /^[ ()+-]*(\d[ ()+-]*){7,}[ ()+-]*$/

> Ideally, something that would need say at least two sets of pure
> digits of length three or more would be great.

    /^[\d ()+-]*\d{3,}[ ()+-]+\d{3,}[\d ()+-]*$/
                                 ^
                               maybe 4?

One could argue with this requirement.  Then at some point one might 
consider stripping out all the non-digits:

   tr/0-9//cd

That -- and re-reading perlre as many times as necessary -- should get 
you started, at least.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 3 Apr 1999 16:13:21 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Program to format Perl code (syntax indents)?????
Message-Id: <7e5en1$8r$1@gellyfish.btinternet.com>

On Fri, 02 Apr 1999 16:58:42 -0500 PropART wrote:
> I just happened to read this about 15 min. ago...
> 
> http://language.perl.com/newdocs/pod/perlfaq3.html#Is_there_a_pretty_printer_forma
> 

Although generally it is better to encourage people to look for answer on
their own system:

   gellyfish@gellyfish:/home/gellyfish > perldoc -q pretty
   =head1 Found in /usr/lib/perl5/5.00502/pod/perlfaq3.pod

   =head2 Is there a pretty-printer (formatter) for Perl?

perldoc -q has its critics but it is quite handy nonetheless.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 3 Apr 1999 17:35:00 GMT
From: "Thomas Schwanhduser" <Thomas@aps.de>
Subject: Reading Graphics
Message-Id: <7e5jg4$otb$1@goof.de.uu.net>

Hi,

I want to check if several servers are online. To do this I want to run a
Perl-Script who should load http://www.domain1.com/images/picture.gif,
http://www.domain2.com/images/picture.gif .... and so on

If the program can load the picture it should display Server is OK. If not,
"Server is not online".

How I can display the results is no problem, but how can I load a GIF- oder
JPG-File??


Thanks for helping.


- Thomas




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

Date: 3 Apr 1999 15:38:29 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: ReadParse library - Output not in same sequence as input
Message-Id: <7e5cll$6l$1@gellyfish.btinternet.com>

On Sat, 03 Apr 1999 13:11:32 GMT rajesh_bhave@my-dejanews.com wrote:
> Hello
> 
> I am using ReadParse library provided by Perl to get all the input
> passed to the CGI script and display it on the HTML page. Since this
> library uses associative array, so I am unable to get the output in the
> same sequence in which input has to be given. Ofcourse, the (key, value)
> pairs displayed are OK, but the order is random. Can somebody help me
> out in this. I want the output in HTML to be displayed in same order as
> the input.

I dont know how one would go about it using cgi-lib.pl but CGI.pm
would enable you to do:

use CGI qw(:standard);

print header,start_html;

foreach (param())
{
  print $_," = ",param($_),"<BR>\n";
}

print end_html;

This behaviour is documented in the CGI.pm manpage:

       NOTE: As of version 1.5, the array of parameter names
       returned will be in the same order as they were submitted
       by the browser.  Usually this order is the same as the
       order in which the parameters are defined in the form

Of course this may or not be the order which the field appear on the
HTML page - that is entirely down to the browser and as such there is
nothing that can be done about it.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 3 Apr 1999 16:19:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Sending a email using PERL
Message-Id: <7e5f2j$90$1@gellyfish.btinternet.com>

On Fri, 2 Apr 1999 18:04:50 +0100 Sandwell wrote:
> I am writing a script which requires sending a email to the web master.  I
> have tried the following script, without much luck.  I have pasted the FULL
> script, if you could be give me an ideas??
> 
<snip>

> open(MAIL, "|/usr/sbin/sendmail") || die
> "Content-type: text/text\n\nCan't open /usr/lib/sendmail!";

As well as the more general problems that Larry has pointed out I think
that you will find that you need to specify the '-t' flag for sendmail
in order for it to find recipients in the input text.  Of course this
is not a Perl specific thing.  I would read the manpage for sendmail on
your system.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 03 Apr 1999 09:03:14 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Silicon Valley Perl Mongers?
Message-Id: <m1wvzteiwd.fsf@halfdome.holdit.com>

>>>>> "hwy280" == hwy280  <hwy280@yahoo.com> writes:

hwy280> Please correct if I'm wrong. But I find it really strange that there
hwy280> is NO Perl user group in Silicon Valley, where the use of Perl is
hwy280> everywhere and created such enormous wealth, and where I believe
hwy280> LW lives. Why is that? :-)

I've wondered that myself.  I visit SillyValley frequently, and hang
out with some cool Perl hackers there.  Maybe you should start a
group.

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Sat, 03 Apr 1999 11:14:06 GMT
From: sweet@enterpriseusa.com (Rob Sweet)
Subject: using perl CGI to automatically post data to an HTML form
Message-Id: <3705f69f.4861893@news.msen.com>

I need to have a Perl CGI script "automatically" fill out an HTML form
and "click" submit.  It seems like this shouldn't be that hard, but
I've looked through CGI.pm and libnet.pm and haven't come up with
anything.

Oh, one more thing... There are specific reasons why I can't simply
bypass the form and call the CGI that it calls, I've already examined
that route.

Thanks for any help.
Rob Sweet
sweet@enterpriseusa.com



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

Date: Sat, 03 Apr 1999 16:55:37 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: using perl CGI to automatically post data to an HTML form
Message-Id: <7e5h36$ego$1@birch.prod.itd.earthlink.net>

sweet@enterpriseusa.com (Rob Sweet) wrote:
o>I need to have a Perl CGI script "automatically" fill out an HTML form
o>and "click" submit.  It seems like this shouldn't be that hard, but
o>I've looked through CGI.pm and libnet.pm and haven't come up with
o>anything.
o>
o>Oh, one more thing... There are specific reasons why I can't simply
o>bypass the form and call the CGI that it calls, I've already examined
o>that route.

perldoc lwp

You also may want to check dejanews because this question has already been 
asked and answered twice this week on c.l.p.m

Good luck,

Bob Trieger
sowmaster@juicepigs.com       



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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". 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". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5291
**************************************

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