[24385] in Perl-Users-Digest
Perl-Users Digest, Issue: 6573 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 17 06:05:47 2004
Date: Mon, 17 May 2004 03:05:07 -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 Mon, 17 May 2004 Volume: 10 Number: 6573
Today's topics:
Re: Datetime overflow with DBI ODBC setting 19th centur <irhm@clara.net>
Installing modules on shared server <wunkalunka@elvis.com>
Re: Installing modules on shared server <spamtrap@dot-app.org>
Re: Installing modules on shared server <wunkalunka@elvis.com>
Re: Operator precedence <net.weathersongATnemo>
Re: Passing params from cli/sh (Malcolm Dew-Jones)
Re: Passing params from cli/sh <usenet@morrow.me.uk>
Re: Passing params from cli/sh <takesmore--nospam--thanthat@hotmale.com>
Re: Passing params from cli/sh <takesmore--nospam--thanthat@hotmale.com>
Re: Passing params from cli/sh <Joe.Smith@inwap.com>
Re: perl 5.8.3 problem <bik.mido@tiscalinet.it>
PERL calculator <gp@nospm.hr>
Re: PERL calculator <matthew.garrish@sympatico.ca>
Re: PERL calculator <jds@nospantrumpetweb.co.uk>
Re: PERL calculator (Anno Siegel)
Re: Perldoc versus Man <mgjv@tradingpost.com.au>
Re: print all combinations (Chris Charley)
Re: print all combinations <nakroshis@NOICKYSPAMsmart.net>
Re: simple problem w/ opening files <werbs@cox.net>
Re: simple problem w/ opening files <uri@stemsystems.com>
Re: simple problem w/ opening files <werbs@cox.net>
Re: simple problem w/ opening files <uri@stemsystems.com>
Re: simple problem w/ opening files <schaumfestiger@gmx.de>
Re: Sort an array + more <tadmc@augustmail.com>
Re: Stopping code execution in RE's <mb@uq.net.au.invalid>
Using Perl in Windows / Dreamweaver (gomerpyl3)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 17 May 2004 09:29:17 +0100
From: "iain" <irhm@clara.net>
Subject: Re: Datetime overflow with DBI ODBC setting 19th century dates with placeholders
Message-Id: <40a877c0$0$22317$4c56ba96@master.news.zetnet.net>
"James Willmore" <jwillmore@remove.adelphia.net> wrote in message
news:pan.2004.05.14.15.18.23.72592@remove.adelphia.net...
> On Fri, 14 May 2004 08:29:41 +0100, iain wrote:
>
> >
> > "James Willmore" <jwillmore@remove.adelphia.net> wrote in message
> > news:pan.2004.05.14.04.44.19.763862@remove.adelphia.net...
> >> > $sth->execute('1900-01-01'); # works OK
> >> > $sth->execute('1799-12-31'); # gives error
> >>
> >> First ... try to insert the date using the command line utility for the
> >> RDBMS. If it works, then it *should* work in the script. If it
doesn't,
> >> then the issue lies with the RDBMS.
> >>
> >> Next, you could use the 'debug' function in the DBI module to see what
the
> >> "conversation" is between the script and the database. That will shed
> >> some light on why it's not working as expected.
> >>
> >> There are more ideas, but give these a try first :-)
>
> >
> > Thanks for the suggestion, but I've tried both those - $dbh->trace(5)
shows
> > the date is passed to SQL Server ODBC driver in the same way for both
1901
> > and 1799.
> > BTW - I meant to show 1899 not 1799 in my original post - neither work
> > anyway.
> > The command line utility (SQL Query) only allows you to use complete SQL
DML
> > statements, not placeholders with parameters (as far as I know). And
the
> > former works fine for 1899 with perl DBI anyway.
> >
> > It seems to be something to do with ODBC not binding the date parameter
> > correctly when it would be held as a negative number on the database.
> >
> > I've also tried the SQL Server profiler on the server side, but haven't
got
> > it to show sufficient detail for
> > this kind of update.
>
> One more thing to try - you could tell the server what kind of data you're
> using. After reading Brian's post and the issue he had, it occured to me
> that you could try using the 'bind_param' function to set the type of data
> being used. Not quite as easy as the sample you posted, but may fix the
> issue.
>
> For example (untested and off top of head):
>
> use DBI qw(:sql_types);
>
> $sth = $dbh->prepare(<<SQL);
> insert into table (date, ...) values(?, ...)
> SQL
>
> $sth->bind_param(1, $date, SQL_DATE);
> ...
>
> $sth->execute();
>
> In this way, you're defining what the data type is for the database, not
> letting it try and figure it out for itself (which may be what it's trying
> to do).
>
> Again, just something to try and may not work.
>
> HTH
>
> --
> Jim
>
> Copyright notice: all code written by the author in this post is
> released under the GPL. http://www.gnu.org/licenses/gpl.txt
> for more information.
>
> a fortune quote ...
> The 80's -- when you can't tell hairstyles from chemotherapy.
>
>
Yes, I'd tried that as well!
Having scoured the DBI and DBD/ODBC docs, I am fairly convinced that the
odbc driver queries the server for the data type of the columns being
updated.
My best guess is that some of the code which deals with the parameters to
pre-prepared statements is treating the date as an unsigned integer, whereas
it needs to be signed (negative) for dates before 1900. If I had time I'd
re-code in VB, and then complain to either Microsoft or DBD::ODBC author.
But a more practical approach is to do a workaround which checks for old
dates (there are a small proportion) and uses a single unprepared execute.
Iain
------------------------------
Date: Mon, 17 May 2004 03:39:14 GMT
From: Derf <wunkalunka@elvis.com>
Subject: Installing modules on shared server
Message-Id: <Xns94EBE7CBBD085wunkalunkaelviscom@24.93.43.121>
I need to install two modules (LWP and Mime::Lite) in my area on a shared
server where I do not have root access. The instructions in the CPAN FAQ
say:
"You will have to add ~/myperl/man to the MANPATH environment variable"
How do I add something to the MANPATH environment variable (remembering I
am not root)?
Thanks for any help.
Derf
The full text of CPAN FAQ item I am quoting is:
Q: I am not root, how can I install a module in a personal directory?
You will most probably like something like this:
o conf makepl_arg "LIB=~/myperl/lib \
INSTALLMAN1DIR=~/myperl/man/man1 \
INSTALLMAN3DIR=~/myperl/man/man3"
install Sybase::Sybperl
You can make this setting permanent like all o conf settings with o conf
commit.
You will have to add ~/myperl/man to the MANPATH environment variable and
also tell your perl programs to look into ~/myperl/lib, e.g. by including
use lib "$ENV{HOME}/myperl/lib";
or setting the PERL5LIB environment variable.
Another thing you should bear in mind is that the UNINST parameter should
never be set if you are not root.
------------------------------
Date: Mon, 17 May 2004 00:12:00 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Installing modules on shared server
Message-Id: <KaidnULTV8gMpjXdRVn-tA@adelphia.com>
Derf wrote:
> How do I add something to the MANPATH environment variable (remembering I
> am not root)?
Well, to begin with, MANPATH specifies where 'man' will look for man pages,
so it really only needs to be added if you intend to use 'man' to read the
docs for the module you install.
How to add it depends on the shell you're using. Many Linux systems default
to bash - for that, you'd edit (or create) ~/.profile, and add the
following line:
MANPATH=$MANPATH:~/myperl/man
export MANPATH
See the man page for your shell if you're using a different one. If you're
not certain what one you're using, use 'echo $SHELL' to find out.
> use lib "$ENV{HOME}/myperl/lib";
Finally, keep in mind that, if you're writing a CGI script, it won't have
the same HOME directory as you do when you're logged in. So, you'll need to
spell out the full path here, instead of relying on $ENV{HOME}.
> or setting the PERL5LIB environment variable.
Same thing applies here - setting this variable in your login environment
won't effect CGI scripts. In addition, if you set it in ~/.profile (or the
equivalent for your shell), it won't effect scripts scheduled with cron.
So for anything other than scripts you intend to log in and run manually,
it's best to use 'use lib'.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Mon, 17 May 2004 06:13:07 GMT
From: Derf <wunkalunka@elvis.com>
Subject: Re: Installing modules on shared server
Message-Id: <Xns94ECDBFCA729wunkalunkaelviscom@24.93.43.119>
Thanks so much!
------------------------------
Date: Mon, 17 May 2004 01:08:23 GMT
From: David Frauzel <net.weathersongATnemo>
Subject: Re: Operator precedence
Message-Id: <49976ce299d0a3413c0bcbaaa6c5f54c@news.teranews.com>
yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote in
news:40a52e4a@news.victoria.tc.ca:
> When perl _uses_ the parse tree then the things at the bottom of the
> parse tree typically need to be calculated before it can calculate
> things higher up. By a happy accident, that often means that things
> attached to higher precedence operators have to be calculated first,
> but that's all it really is - a happy accident, and in fact if you
> have more than one branch of the tree then you still have to ask which
> side of the tree is to be calcuated first, and precedence has nothing
> to do with that.
Thank you, that helps clarify. "happy accident" describes it perfectly, in
that context. I do remember encountering similar topics described in what
few manuals I've been able to discover on building a parser; unfortunately
said manuals are usually just a bit too terse for me to squeeze much out
of.
I need to look more closely at the process of converting a meta-language
into a tree (after the lexer serializes text into the meta-language, I
mean). I had already played around with a similar notion, but it had
problems because I was using precedence incorrectly to build the tree.
I appreciate the other posts, too, but I'm not really interested in why
Perl does what it does, only how. Why my own parser decides to use whatever
precedence and associativity it does (which may not agree with Perl's
notions at all) is irrelevant. ;}
------------------------------
Date: 16 May 2004 16:42:31 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Passing params from cli/sh
Message-Id: <40a7fc67@news.victoria.tc.ca>
idis (takesmore--nospam--thanthat@hotmale.com) wrote:
: Greetings,
: This is literally my first day with perl. So i hope
: that you can bear with yet another fng. If this is not quite
: presented in the most efficient or coherent manner. It will
: improve.
: The object is to pass data/parameters to this scriptlet
: from within a bash/sh/*sh script or from the cli. It is basically
: an attempt for a generic and somewhat simple sed util.
you want the @ARGV array.
E.g.
use strict;
my ($vfindstr,$vreplacestr,$vfilestr) = @ARGV;
perldoc perlvar # tells you about variables like @ARGV
perldoc perlfunc # tells you about many useful functions.
perldoc perldoc # tells you about the available documents
--
(Paying) telecommute programming projects wanted. Simply reply to this.
------------------------------
Date: Sun, 16 May 2004 23:57:18 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Passing params from cli/sh
Message-Id: <c88v4u$lp6$1@wisteria.csv.warwick.ac.uk>
Quoth idis <takesmore--nospam--thanthat@hotmale.com>:
> -i.old -p -e "s/\ $vfindstr/\ $vreplacestr/g" $vfilestr
hmmm... this appeare to be a command line, not a script. I think you've
got the wrong end of some stick, somewhere.
You need to read an introduction to perl. perldoc perl (or man perl)
will list all the documentation which comes with perl, some of which is
introductory-level; if you've never done any proper programming before
(shell doesn't really count) (and maybe even if you have) then what you
really need is a book. 'Learning Perl' (O'Reilly) is the usual
recommendation for beginners; 'Programming Perl' (also O'Reilly) is the
canonical reference book (make sure you have the 3rd edition).
> It appears as though parameters are stored in @_
Subroutine parameters come in in @_, yes. Program parameters come in in
@ARGV instead.
> that will allow something such as
> local($vfindstr,$vreplacestr,$vfilestr) = @_;
If your book is still telling you to use local instead of my then drop
it quick and get a newer one. You will learn a lot of bad perl4-ish
habits if you're not careful.
> I assumed that it would be implemented such as
>
> perl psed.pl "vfindstr","vreplacestr","vfilestr"
Once you understand Perl, you will be able to write it to be called any
way you like.
> Any help would be appreciated. If this is the
> millionth time this question was posed. My apologies.
It isn't, but a small hint in case the next one is: you might want to
take a look at perldoc perlfaq :).
Ben
--
Heracles: Vulture! Here's a titbit for you / A few dried molecules of the gall
From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
(Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
/Alcestis/) [ flame, and falls out of sight. ] ben@morrow.me.uk
------------------------------
Date: Mon, 17 May 2004 01:43:42 GMT
From: idis <takesmore--nospam--thanthat@hotmale.com>
Subject: Re: Passing params from cli/sh
Message-Id: <Xns94EBDD222441Cx@65.24.7.50>
Ben Morrow <usenet@morrow.me.uk> wrote in news:c88v4u$lp6$1
@wisteria.csv.warwick.ac.uk:
>
> Quoth idis <takesmore--nospam--thanthat@hotmale.com>:
>> -i.old -p -e "s/\ $vfindstr/\ $vreplacestr/g" $vfilestr
>
> hmmm... this appeare to be a command line, not a script. I think
you've
> got the wrong end of some stick, somewhere.
>
> You need to read an introduction to perl. perldoc perl (or man perl)
> will list all the documentation which comes with perl, some of which
is
> introductory-level; if you've never done any proper programming
before
> (shell doesn't really count) (and maybe even if you have) then what
you
> really need is a book. 'Learning Perl' (O'Reilly) is the usual
> recommendation for beginners; 'Programming Perl' (also O'Reilly) is
the
> canonical reference book (make sure you have the 3rd edition).
>
>> It appears as though parameters are stored in @_
>
> Subroutine parameters come in in @_, yes. Program parameters come in
in
> @ARGV instead.
>
>> that will allow something such as
>> local($vfindstr,$vreplacestr,$vfilestr) = @_;
>
> If your book is still telling you to use local instead of my then
drop
> it quick and get a newer one. You will learn a lot of bad perl4-ish
> habits if you're not careful.
>
>> I assumed that it would be implemented such as
>>
>> perl psed.pl "vfindstr","vreplacestr","vfilestr"
>
> Once you understand Perl, you will be able to write it to be called
any
> way you like.
>
>> Any help would be appreciated. If this is the
>> millionth time this question was posed. My apologies.
>
> It isn't, but a small hint in case the next one is: you might want to
> take a look at perldoc perlfaq :).
I appreciate your response and you were dead on with your statement
about perl4. While is says 4-5 it must have been a transition in that
only a few pages were dedicated to 5 and all examples were 4. I did
look at the man pages and the conflicting examples from book to pc only
served to make things worse.. The book is history.. It is many times
more difficult to overcome only win exposure , VB and VBS ect in regard
to perl than it was for borne and even the transition to nix.
-regards
Idis
------------------------------
Date: Mon, 17 May 2004 01:50:12 GMT
From: idis <takesmore--nospam--thanthat@hotmale.com>
Subject: Re: Passing params from cli/sh
Message-Id: <Xns94EBDE3C4852Cx@65.24.7.50>
yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote in news:40a7fc67
@news.victoria.tc.ca:
> idis (takesmore--nospam--thanthat@hotmale.com) wrote:
>: Greetings,
>
>: This is literally my first day with perl. So i hope
>: that you can bear with yet another fng. If this is not quite
>: presented in the most efficient or coherent manner. It will
>: improve.
>
>: The object is to pass data/parameters to this scriptlet
>: from within a bash/sh/*sh script or from the cli. It is basically
>: an attempt for a generic and somewhat simple sed util.
>
> you want the @ARGV array.
>
> E.g.
>
> use strict;
> my ($vfindstr,$vreplacestr,$vfilestr) = @ARGV;
>
>
> perldoc perlvar # tells you about variables like @ARGV
> perldoc perlfunc # tells you about many useful functions.
>
> perldoc perldoc # tells you about the available documents
>
>
I do appreciate the nudge in the right direction.. This
is looking increasingly like a reasonable structure when i
disgard the outdated reference material.
trust the *man*.. indeed
regards
-idis
------------------------------
Date: Mon, 17 May 2004 09:36:42 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Passing params from cli/sh
Message-Id: <KI%pc.22909$6f5.2312726@attbi_s54>
idis wrote:
> looked at the man pages and the conflicting examples from book to pc only
> served to make things worse.. The book is history..
Do you have the most recent version of perl installed on the PC?
http://www.perl.org/ says the latest source version is 5.8.4 and
http://www.perl.org/get.html mentions 5.8.3 binaries (Win32 & Linux & more).
-Joe
------------------------------
Date: Mon, 17 May 2004 09:21:46 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: perl 5.8.3 problem
Message-Id: <0flfa05gohmu6iqgflfve6i63bvlqo7183@4ax.com>
On 16 May 2004 08:28:06 -0700, GlgAs@Netscape.net (laszlo) wrote:
>In the comp.lang.perl.Tk list somone complained similar problem in
>Linux.
>
>I suppose something is wrong with the rounding process used by the Tk
>module.
<OT>
Since you seem to know about clptk, I wonder why you posted this
*only* to clpmisc, whereas this is a question that could have been
either asked there or crossposted to both groups...
</OT>
Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
------------------------------
Date: Mon, 17 May 2004 01:43:14 +0200
From: "PHP2" <gp@nospm.hr>
Subject: PERL calculator
Message-Id: <c88u7m$hmq$1@ls219.htnet.hr>
I wish create perl calculator for 2 sets of prices.. 1st set has 10 fixed
prices and 2nd 5 prices.. how call prices and connect these prices with
quntity what user alone add and calculate total amount..
sure user can use only 1 detail from any of 2 prices sets or he can use all
or part of prices..
how resolve it simplest..
------------------------------
Date: Sun, 16 May 2004 21:29:52 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: PERL calculator
Message-Id: <eAUpc.2080$qJ5.169845@news20.bellglobal.com>
"PHP2" <gp@nospm.hr> wrote in message news:c88u7m$hmq$1@ls219.htnet.hr...
> I wish create perl calculator for 2 sets of prices.. 1st set has 10 fixed
> prices and 2nd 5 prices.. how call prices and connect these prices with
> quntity what user alone add and calculate total amount..
>
> sure user can use only 1 detail from any of 2 prices sets or he can use
all
> or part of prices..
>
> how resolve it simplest..
>
Please rephrase your question. The above makes no sense whatsoever.
Matt
------------------------------
Date: Mon, 17 May 2004 09:05:16 +0100
From: "Julia deSilva" <jds@nospantrumpetweb.co.uk>
Subject: Re: PERL calculator
Message-Id: <lm_pc.36331$VA4.32697@pathologist.blueyonder.net>
> Please rephrase your question. The above makes no sense whatsoever.
>
> Matt
>
So... you no speekada plane Englis den ?
------------------------------
Date: 17 May 2004 08:48:46 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: PERL calculator
Message-Id: <c89u9e$bmb$1@mamenchi.zrz.TU-Berlin.DE>
Julia deSilva <jds@nospantrumpetweb.co.uk> wrote in comp.lang.perl.misc:
> > Please rephrase your question. The above makes no sense whatsoever.
> >
> > Matt
> >
>
> So... you no speekada plane Englis den ?
Jokes about non-native speakers' English are not called for.
Anno
------------------------------
Date: 17 May 2004 00:59:41 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Perldoc versus Man
Message-Id: <slrncag3js.mhn.mgjv@verbruggen.comdyn.com.au>
On Fri, 14 May 2004 11:53:35 -0400,
Sherif Zaroubi <blah@blah.com> wrote:
> On Fri, 14 May 2004 11:40:26 -0400, James Willmore
><jwillmore@remove.adelphia.net> wrote:
[discussion about perldoc being part of standard system package on
Suse, Redhat, Mandrake]
>> What surprise? I execute the following and get ....
>>
>> jim@maxine:~> rpm -q -l perl-5.8.1-81 | grep perldoc
>> /usr/bin/perldoc
>> /usr/lib/perl5/5.8.1/pod/perldoc.pod
>> /usr/share/man/man1/perldoc.1.gz
>> jim@maxine:~>
>>
>> and there it is ... /usr/bin/perldoc :-) This is SuSE, version 9. And,
>> if I still had 8.1 available, or 8.0 or 7.1 or 6.4, I bet I'd get the
>> same
> Ok .. Maybe suse should not have been in my list. But For Mandrake:
Redhat also should not have been in your list, because perldoc is part
of the standard perl rpm there as well, and has been as long as I
remember (I checked 5.0, 8 and 9).
That leaves:
> [szaroubi@backup music]$ cat /proc/version
> Linux version 2.4.21-0.13mdk (flepied@bi.mandrakesoft.com) (gcc version
> 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)) #1 Fri Mar 14 15:08:06 EST 2003
> [szaroubi@backup music]$ rpm -q -l perl-5.8.0-19mdk | grep perldoc
> [szaroubi@backup music]$ rpm -q -l perl-doc-5.8.0-19mdk | grep perldoc
> /usr/bin/perldoc
> /usr/share/man/man1/perldoc.1.bz2
> [szaroubi@backup music]$
One out of three originally claimed.
Martien
--
|
Martien Verbruggen | Begin at the beginning and go on till you
Trading Post Australia | come to the end; then stop.
|
------------------------------
Date: 16 May 2004 18:48:00 -0700
From: charley@pulsenet.com (Chris Charley)
Subject: Re: print all combinations
Message-Id: <4f7ed6d.0405161748.31dc7732@posting.google.com>
Dan Jacobson <jidanni@jidanni.org> wrote in message news:<871xlmxwmd.fsf@jidanni.org>...
> Let's say our country's radio callsigns look like the output of
> for $a('B'){for $b(qw{V X}){for $c(1..8){for $d('A'..'Z'){print "$a$b$c$d\n"}}}}
> It bothers me that even though I can describe those callsigns
> with regexp /B[VX][1-8][A-Z]/, in printing them out one needs to write
> for loops for each element. Isn't there some
> sub combinations(){print all the combinations of all the elements of
> the array (not permutations)} that I can write?
You can use this feature of glob(), (or <>).
for(<{B}{V,X}{1,2,3,4,5,6,7,8}{A,B,C,D,E,F,G}>) {
print "$_\n";
}
Note that I don't have the full alphabet and only A to G for demo
purposes.
Thats because the full alphabet wouldn't fit on one line here in
Google. But if you supply the full alphabet, it will print all 416
combinations
(1 * 2 * 8 * 26).
HTH
Chris
------------------------------
Date: Mon, 17 May 2004 03:52:15 -0000
From: Rick Nakroshis <nakroshis@NOICKYSPAMsmart.net>
Subject: Re: print all combinations
Message-Id: <Xns94EBF2D0C2B6Fricknak@216.168.3.44>
[posted and mailed]
charley@pulsenet.com (Chris Charley) wrote in
news:4f7ed6d.0405161748.31dc7732@posting.google.com:
> You can use this feature of glob(), (or <>).
>
> for(<{B}{V,X}{1,2,3,4,5,6,7,8}{A,B,C,D,E,F,G}>) {
> print "$_\n";
> }
>
> Note that I don't have the full alphabet and only A to G for demo
> purposes.
> Thats because the full alphabet wouldn't fit on one line here in
> Google. But if you supply the full alphabet, it will print all 416
> combinations
> (1 * 2 * 8 * 26).
Now *that* is an elegant solution. How did you come up with that? Is it
buried in the Perl documentation, somewhere?
Rick
------------------------------
Date: Sun, 16 May 2004 19:05:27 -0700
From: "Mat W" <werbs@cox.net>
Subject: Re: simple problem w/ opening files
Message-Id: <I5Vpc.164828$f_5.7754@lakeread01>
I didn't get the bad info from a source. It was just an assumption. It's
been over a year since I programmed in perl and I'm pretty young. Forgive my
ignorance.
"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x78yfs2g7p.fsf@mail.sysarch.com...
> >>>>> "MW" == Mat W <werbs@cox.net> writes:
>
> MW> Now, in the script there are times when i need to print this
> MW> file. What i want to do is first set the variables, then open the
> MW> file and print the html contents.
>
> this is not a problem with opening files, it is a problem with variable
> interpolation and template expansion.
>
> please choose better subject on your future posts. knowing how to
> describe a problem is half the solution.
>
> BTW, where did you ever get the idea that variables in text read from a
> file would get interpolated? i am curious as if it is a source for your
> perl knowledge, it should be marked as very wrong.
>
> uri
>
> --
> Uri Guttman ------ uri@stemsystems.com --------
http://www.stemsystems.com
> --Perl Consulting, Stem Development, Systems Architecture, Design and
Coding-
> Search or Offer Perl Jobs ----------------------------
http://jobs.perl.org
------------------------------
Date: Mon, 17 May 2004 04:19:40 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: simple problem w/ opening files
Message-Id: <x7d653y9b8.fsf@mail.sysarch.com>
>>>>> "MW" == Mat W <werbs@cox.net> writes:
MW> I didn't get the bad info from a source. It was just an
MW> assumption. It's been over a year since I programmed in perl and
MW> I'm pretty young. Forgive my ignorance.
i appreciate your honesty. now please read the group guidelines and
learn about the evils of top posting.
and with perl (as with all computer things) never assume. the docs are
there for a purpose.
and the concept of a file being automatically interpolated when it is
read is scarier than all the redmond autoexecute every virus sent by
email stuff. what looks like a convenience to you (and every prisoner of
bill) is really a a major problem waiting to happen. too bad the evil
empire won't ever admit that. convenience is not always convenient in
the longer run. i wonder if how many of those who thought that auto
execution of attachments was a cool thing would like to turn back the
clock and not want nor use such a useless (how lazy do you HAVE to BE to
want to skip a click?) feature in exchange for a dramatic reduction in
virus (and the spam many of them generate now).
<snip of full quote>
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Sun, 16 May 2004 21:50:15 -0700
From: "Mat W" <werbs@cox.net>
Subject: Re: simple problem w/ opening files
Message-Id: <cwXpc.53091$Z%5.3644@okepread01>
I have a question. You said that "the concept of a file being automatically
interpolated" is pretty bad. I understand that if the content of the files
was allowed to be made by just anyone, then there is the potential for
disaster. But if the files are only made by me and others that I KNOW do not
intend any harm, is there still any danger? All I plan on containing in
these files is variables. I don't know if this is a bad question or not,
becuase I have not yet looked at templating for perl (but I plan on doing it
later tonight). Perhaps templating will solve my problem without there being
any risk that you reffered to earlier.
"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x7d653y9b8.fsf@mail.sysarch.com...
> >>>>> "MW" == Mat W <werbs@cox.net> writes:
>
> MW> I didn't get the bad info from a source. It was just an
> MW> assumption. It's been over a year since I programmed in perl and
> MW> I'm pretty young. Forgive my ignorance.
>
> i appreciate your honesty. now please read the group guidelines and
> learn about the evils of top posting.
>
> and with perl (as with all computer things) never assume. the docs are
> there for a purpose.
>
> and the concept of a file being automatically interpolated when it is
> read is scarier than all the redmond autoexecute every virus sent by
> email stuff. what looks like a convenience to you (and every prisoner of
> bill) is really a a major problem waiting to happen. too bad the evil
> empire won't ever admit that. convenience is not always convenient in
> the longer run. i wonder if how many of those who thought that auto
> execution of attachments was a cool thing would like to turn back the
> clock and not want nor use such a useless (how lazy do you HAVE to BE to
> want to skip a click?) feature in exchange for a dramatic reduction in
> virus (and the spam many of them generate now).
>
> <snip of full quote>
>
> uri
>
> --
> Uri Guttman ------ uri@stemsystems.com --------
http://www.stemsystems.com
> --Perl Consulting, Stem Development, Systems Architecture, Design and
Coding-
> Search or Offer Perl Jobs ----------------------------
http://jobs.perl.org
------------------------------
Date: Mon, 17 May 2004 05:14:42 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: simple problem w/ opening files
Message-Id: <x7y8nrws71.fsf@mail.sysarch.com>
>>>>> "MW" == Mat W <werbs@cox.net> writes:
>> i appreciate your honesty. now please read the group guidelines and
>> learn about the evils of top posting.
did you read that. please do. now. google for it. it is annoying to have
to edit your posts and delete the stuff i sent out. I KNOW WHAT I
SENT. i can find it on the server. YOU DON'T NEED TO KEEP IT.
MW> I have a question. You said that "the concept of a filex being
MW> automatically interpolated" is pretty bad. I understand that if
MW> the content of the files was allowed to be made by just anyone,
MW> then there is the potential for disaster. But if the files are
MW> only made by me and others that I KNOW do not intend any harm, is
MW> there still any danger? All I plan on containing in these files is
MW> variables. I don't know if this is a bad question or not, becuase
MW> I have not yet looked at templating for perl (but I plan on doing
MW> it later tonight). Perhaps templating will solve my problem
MW> without there being any risk that you reffered to earlier.
even if it could be done with little effort that is whole
point. something that potentially dangerous should take a little
work. as for you knowing your files are safe, that doesn't mean the guy
over there does. the workaround (which isn't a problem at all) is
templating so you can control what gets put where. ceding control to the
system and not caring is how evil is spread.
now stop top posting. no more help from me until you learn that one at
least.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Mon, 17 May 2004 10:16:23 +0200
From: Herr Hardy <schaumfestiger@gmx.de>
Subject: Re: simple problem w/ opening files
Message-Id: <qgsga01rbt4oqneblgvpdkfp6n9qqg1n1c@4ax.com>
On Sun, 16 May 2004 12:27:37 -0700, "Mat W" <werbs@cox.net> wrote:
><head><title>$mytitle</title></head>
>
>Now, in the script there are times when i need to print this file. What i
>want to do is first set the variables, then open the file and print the html
>contents.
You could try something like this:
Make your Html-Template to be some Perl-Code
test.html:
# START_FILE
print << "EOF_TEMPLATE";
<head><title>$mytitle</title></head>
EOF_TEMPLATE
1;
#EOF
>For example:
>$mytitle = "TEST";
>open (FILEIN, "./pages/test.html");
>@contents = <FILEIN>;
>close (FILEIN);
>print @contents.
Include this with Perl's 'require' to be executed, not just read
$mytitle = "TEST";
require "/path/to/templates/test.html";
There are some things to be carefully observed (e.g. masking:
email\@mydomain.com instead of email@mydomain.com) and maybe/ surely
some others... but to me it seems like a simple and fast way to solve
a little problem.
Ciao Hardy
------------------------------
Date: Sun, 16 May 2004 20:03:13 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Sort an array + more
Message-Id: <slrncag3qh.1t9.tadmc@magna.augustmail.com>
krzys-iek <krzys-iek@-----wp.pl> wrote:
> (perldoc is OK but its interface is not, perldoc.com is
> better).
And using your favorite editor on the raw *.pod files is better yet!
vi perlop.pod +/^=.*Quote
takes you right to the Quote and Quote-like Operators section
(I don't know how "the other" religion does it...).
:-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 17 May 2004 09:44:24 +1000
From: Matthew Braid <mb@uq.net.au.invalid>
Subject: Re: Stopping code execution in RE's
Message-Id: <c88uco$949$1@bunyip.cc.uq.edu.au>
Brian McCauley wrote:
> Matthew Braid <mb@uq.net.au.invalid> writes:
>
>
>>I'm writing a formatter package that basically has a little language
>>of its own to allow joombie users format their own stuff without
>>bothering me....
>>
>>One of the formatter 'tags' allows the use of a regular expression (in
>>a slightly stunted fashion), however I want to ensure no code
>>execution is performed.
>
>
> Then do _not_ put...
>
> use re 'eval';
>
> ...in your programs.
>
> If you are really paranoid put...
>
> no re 'eval';
>
> ...just before you compile the regex (either explicitly with qr// or
> implicitly by using a variable containing something other than a
> compiled regex in a regex context).
>
> But like I said, no eval is the default anyhow.
>
>
Good idea. I'm pretty sure a user couldn't trick my prog into using re 'eval',
but its better to be safe than sorry. no re 'eval' it is :)
MB
------------------------------
Date: 17 May 2004 01:35:43 -0700
From: gomerpyl3@aol.com (gomerpyl3)
Subject: Using Perl in Windows / Dreamweaver
Message-Id: <f545cf53.0405170035.7c95f67c@posting.google.com>
Hello,
I am unsure how I would go about including perl / cgi scripts in
dreamweaver - can anyone shed any light on this?
In particular, I would be looking to make my own input forms & maybe a
basic bulletin board.
Thanks
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6573
***************************************