Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Re: using HTML::Template effectively

Thread Tools

Re: using HTML::Template effectively

J. Gleixner
Posts: n/a
On 06/26/12 14:31, Cal Dershowitz wrote:
> I've been using perl scripts to mechanize oft-repeated tasks for my
> website. I tell my friend what I'm doing and he says, "oh you need
> HTML::Template."

Have your friend help you first and do we need to know what your friend

>What I hope to do with this thread is re-write it with
> modules, as well as providing a utility to make my choice of filenames
> less obvious, but still within the organizational scheme that will be
> this site.
> First, though, I want to go back just a bit and clear up my last few
> difficulties with what has gone before:

First though, this has nothing to do with the Subject!!!!!!!! Folks
who know a lot about HTML::Template just wasted their time reading
your post.

> Q1) I continue to have difficulties combining the syntax of lexical
> variables and RE's:
> my $word = "ceiling";
> my @matching = map /ceiling_(\d+)\.html/, @remote_files;
> my $html_file = "ceiling_$newnum1.html";
> How would I write those last 2 lines of code with $word instead of
> "ceiling?"

This is all you needed to post. Code showing the issue and
your question.

Use ${word} where you want it to occur, instead of $word.

my $html_file = "${word}_$newnum1.html";

Since you could have a variable $word_, you need to show
that you really only want it to use $word.

> Q2) There's a huge amount of reading out there on this topic, which I'm
> grateful for. Anyone have a link that they think is particularly
> effective at studying up on this?
> Q3) This one's a little out there. Right after the unlink statement up
> there, or better yet, just before the close statement, what would happen
> if you wrote:
> open( my $gh, '>', or die("Can't open for
> writing: $!");

No need for () there..
die "Can't open for writing: $!"

> where the name of the script itself is,and then attempted to
> write from $gh to $fh linewise? I know it's illegal in C, so I don't
> want to just try it and see what happens.

Bye bye

Think about it.....
What do you think '>' will do?
Why do you think you want do to that?
Actually, I'm not sure what you're asking.. How do you 'write from $gh
to $fh'?

You can answer this yourself. Be sure to have a copy of
first though.

> It's too much work cleaning up...

Do you think anyone will continue reading your post if put in
more garbage???..

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: using cpan effectively Rainer Weikusat Perl Misc 1 09-04-2012 02:36 PM
Re: using cpan effectively Mart van de Wege Perl Misc 6 08-26-2012 10:29 AM
Re: using HTML::Template effectively Rainer Weikusat Perl Misc 4 07-07-2012 04:56 AM
Re: using HTML::Template effectively Peter Makholm Perl Misc 0 06-27-2012 07:25 AM
Effectively using Magic and Range in Runescape virgolds_comrsgold Computer Support 0 06-11-2007 08:20 AM