[26202] in Perl-Users-Digest
Perl-Users Digest, Issue: 8389 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 5 06:05:22 2005
Date: Mon, 5 Sep 2005 03:05:05 -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, 5 Sep 2005 Volume: 10 Number: 8389
Today's topics:
Hacking a script (makemenu.pl) <Raffles01@kconline.com>
Re: Hacking a script (makemenu.pl) <pseudo@codernet.net>
Re: Hacking a script (makemenu.pl) <jkeen_via_google@yahoo.com>
Re: Hacking a script (makemenu.pl) <Raffles01@kconline.com>
Re: Hacking a script (makemenu.pl) <someone@example.com>
Is use vars and our the same ? <ngoc@yahoo.com>
Re: Is use vars and our the same ? (Anno Siegel)
Re: Looking for Equation Solver xhoster@gmail.com
maintainable code? <ngoc@yahoo.com>
Re: maintainable code? <john@castleamber.com>
Re: Padding Problem UPDATE (Still broken) (sgillett)
Tracking Dependencies <hal@thresholddigital.com>
Re: Tracking Dependencies <john@castleamber.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 4 Sep 2005 19:53:07 -0500
From: "Frank Louden" <Raffles01@kconline.com>
Subject: Hacking a script (makemenu.pl)
Message-Id: <JsednZ2dnZ2u7UbznZ2dnfAJht6dnZ2dRVn-0J2dnZ0@kconline.com>
Hi. Infrequent hacker here.
(Originally posted to alt.comp.lang.perl. Not much happening over there!)
(OK, then to comp.lang.perl where a kind soul redirected me.)
I've spent the last two days trying to hack H. Churchyard's makemenu.pl so
it will work on my WinME PC. I've got lots of hair but I won't have for
long.
If there is anyone out there that knows this script, I think I might learn
quite a bit by hacking my way thru this one but I could sure use some help.
I'm not looking for a working script or someone to do it for me. I'd just
like to understand what's going on here and why I am having such a tough
time getting very far with this. I'm using Activestate's perl, v5.8.6 built
for MSWin32-x86-multi-thread.
There are two "eval" lines here...
eval "exec /usr/local/bin/perl -S $0 $*" if $running_under_some_shell;
and...
eval '$'.$1.'$2;' while $ARGV[0] =~ /^(title=|toc=|dirprefix=)(.*)/ &&
shift;
The first is unnecessary (I think) and the second is extracting info from
the command line.
I don't know how advanced this script might be but it seems to be using
lot's of tricks that aren't taught in "Learning Perl on Win32 Systems". ;^)
Anyway, if there is someone that can spare the time to share some of their
knowledge with me, I'd be grateful.
I would attempt to contact the author of this script if I knew how. I've
used it "as is" on Linux and it works quite well for what I am wanting to
do.
Here's the error I get...
F:\Programming\Perl\HTML Menu Project>perl -d test2.pl title="My Menu" toc=1
*.htm > My_Menu.htm
Win32::OLE operating in debugging mode: _Unique => 1
Can't open *.htm: No such file or directory at test2.pl line 12.
And I have several small HTML files with the ".htm" extension in this
directory.
I've stripped this script down to what I think is the barest essentials for
testing. I don't expect this fragment to do anything I'm just trying to get
over a hump. I hit the "while (<>)" line and I get nothing. Here's what I
have at this time...
$title = ''; $toc = 0; $dirprefix = '';
eval '$'.$1.'$2;' while $ARGV[0] =~ /^(title=|toc=|dirprefix=)(.*)/ &&
shift;
$[ = 1; # set array base to 1
$\ = "\n"; # set output record separator
foreach $X (@ARGV) {
if ($X =~ /^[^=]+=/) {
print STDERR "Apparent misspelled or badly-placed command-line
option $\
&";
print STDERR "Attempting to continue anyway...";}}
$accum = ''; $haccum = '';
$xRS = $/;
#
while (<>) {
if ($_ =~ /$xRS$/o) {chop;} # strip record separator
if (($.-$FNRbase) == 1) {
if ($. == 1) {
if (!$title) {
$title = 'Menu for HTML files';}
print "<html><head><title>$title</title></head>";
print "<body><h1>$title</h1><hr><ul>";}
else {
if ($toc) {
&liout();}}
$hlevel = 0;}
};
Thanks in advance.
Raffles
------------------------------
Date: Sun, 04 Sep 2005 20:17:33 -0500
From: Willie Wilson <pseudo@codernet.net>
Subject: Re: Hacking a script (makemenu.pl)
Message-Id: <1125883205_1327@spool6-east.superfeed.net>
Frank Louden wrote:
> ...
> F:\Programming\Perl\HTML Menu Project>perl -d test2.pl title="My Menu" toc=1
> *.htm > My_Menu.htm
> Win32::OLE operating in debugging mode: _Unique => 1
> Can't open *.htm: No such file or directory at test2.pl line 12.
> ...
Maybe someone will correct me if I am wrong, but it appears that the DOS
prompt does not suppliment the asterisks for you like UNIX shells do; if
you 'echo *', you will just see '*', not all the files in the directory
like you would on a UNIX shell. You'll have to do the supplimentation
manually, perhaps by using glob().
Again, I could be wrong, but this seems to be the case here.
-Willie
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
------------------------------
Date: Mon, 05 Sep 2005 01:22:07 GMT
From: James E Keenan <jkeen_via_google@yahoo.com>
Subject: Re: Hacking a script (makemenu.pl)
Message-Id: <35NSe.7569$aG.1028@trndny01>
Frank Louden wrote:
> Hi. Infrequent hacker here.
>
> (Originally posted to alt.comp.lang.perl. Not much happening over there!)
> (OK, then to comp.lang.perl where a kind soul redirected me.)
>
> I've spent the last two days trying to hack H. Churchyard's makemenu.pl so
> it will work on my WinME PC. I've got lots of hair but I won't have for
> long.
You didn't provide a link so I had to google. When I did so, the pages
I came up with were discussing "htmlchek version 4.0, January 17 1995".
And this was documentation -- not the code itself.
While I suspect there are probably readers of this list who are familiar
with this script, I frankly suspect that better tools have been
developed in the last ten-and-a-half years. What task are you trying to
accomplish?
Jim Keenan
------------------------------
Date: Sun, 4 Sep 2005 22:04:03 -0500
From: "Frank Louden" <Raffles01@kconline.com>
Subject: Re: Hacking a script (makemenu.pl)
Message-Id: <WfednRBPtci8LobeRVn-iQ@kconline.com>
Thanks Willie and Jim. This version of perl allows globbing so I expected it
to work just fine with the <> operator. But, there are so many differences
between MSWindoze and Unix/Linux systems I thought the developers of this
distribution of perl would accomodate Win32's crippled OS.
"James E Keenan" <jkeen_via_google@yahoo.com> wrote in message
news:35NSe.7569$aG.1028@trndny01...
> Frank Louden wrote:
>
> > Hi. Infrequent hacker here.
> >
> > (Originally posted to alt.comp.lang.perl. Not much happening over
there!)
> > (OK, then to comp.lang.perl where a kind soul redirected me.)
> >
> > I've spent the last two days trying to hack H. Churchyard's makemenu.pl
so
> > it will work on my WinME PC. I've got lots of hair but I won't have for
> > long.
>
> You didn't provide a link so I had to google. When I did so, the pages
> I came up with were discussing "htmlchek version 4.0, January 17 1995".
> And this was documentation -- not the code itself.
>
> While I suspect there are probably readers of this list who are familiar
> with this script, I frankly suspect that better tools have been
> developed in the last ten-and-a-half years. What task are you trying to
> accomplish?
>
> Jim Keenan
>
>
------------------------------
Date: Mon, 05 Sep 2005 04:29:46 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Hacking a script (makemenu.pl)
Message-Id: <_QPSe.216630$9A2.71758@edtnps89>
Frank Louden wrote:
> Hi. Infrequent hacker here.
>
> (Originally posted to alt.comp.lang.perl. Not much happening over there!)
> (OK, then to comp.lang.perl where a kind soul redirected me.)
>
> I've spent the last two days trying to hack H. Churchyard's makemenu.pl so
> it will work on my WinME PC. I've got lots of hair but I won't have for
> long.
>
> If there is anyone out there that knows this script, I think I might learn
> quite a bit by hacking my way thru this one but I could sure use some help.
>
> I'm not looking for a working script or someone to do it for me. I'd just
> like to understand what's going on here and why I am having such a tough
> time getting very far with this. I'm using Activestate's perl, v5.8.6 built
> for MSWin32-x86-multi-thread.
It looks like makemenu.pl was created using the a2p program (Awk to Perl
translator) on makemenu.awk.
perldoc a2p
If you have a more recent version of a2p it should produce a more up-to-date
perl program.
> There are two "eval" lines here...
>
> eval "exec /usr/local/bin/perl -S $0 $*" if $running_under_some_shell;
This is superfluous in a perl program if the first line
(#!/usr/local/bin/perl) is the correct location of perl.
> and...
>
> eval '$'.$1.'$2;' while $ARGV[0] =~ /^(title=|toc=|dirprefix=)(.*)/ &&
> shift;
It appears that this is just sort-of imitating the perl '-s' command line switch.
> The first is unnecessary (I think) and the second is extracting info from
> the command line.
>
> I don't know how advanced this script might be but it seems to be using
> lot's of tricks that aren't taught in "Learning Perl on Win32 Systems". ;^)
>
> Anyway, if there is someone that can spare the time to share some of their
> knowledge with me, I'd be grateful.
>
> I would attempt to contact the author of this script if I knew how. I've
> used it "as is" on Linux and it works quite well for what I am wanting to
> do.
>
> Here's the error I get...
>
> F:\Programming\Perl\HTML Menu Project>perl -d test2.pl title="My Menu" toc=1
> *.htm > My_Menu.htm
> Win32::OLE operating in debugging mode: _Unique => 1
> Can't open *.htm: No such file or directory at test2.pl line 12.
DOS/Windows command processor (command.com/cmd.exe) does not expand wildcard
characters (like * or ?) so your perl program is trying to process the literal
file name '*.htm'.
perldoc -f glob
perldoc File::Glob
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 05 Sep 2005 08:37:21 +0200
From: ngoc <ngoc@yahoo.com>
Subject: Is use vars and our the same ?
Message-Id: <431bf4a0$1@news.broadpark.no>
Is "use vars qw()" and "our" the same scope, but differ in syntax only?
------------------------------
Date: 5 Sep 2005 07:39:42 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Is use vars and our the same ?
Message-Id: <dfgsnu$n5a$1@mamenchi.zrz.TU-Berlin.DE>
ngoc <ngoc@yahoo.com> wrote in comp.lang.perl.misc:
> Is "use vars qw()" and "our" the same scope, but differ in syntax only?
This is explained in the corresponding docs. Read "perldoc vars" and
"perldoc -f our".
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
Date: 05 Sep 2005 01:16:34 GMT
From: xhoster@gmail.com
Subject: Re: Looking for Equation Solver
Message-Id: <20050904211634.239$7v@newsreader.com>
Ignoramus14363 <ignoramus14363@NOSPAM.14363.invalid> wrote:
> On 03 Sep 2005 22:51:13 GMT, xhoster@gmail.com <xhoster@gmail.com> wrote:
> > Ignoramus14363 <ignoramus14363@NOSPAM.14363.invalid> wrote:
> >> I wrote one
> >>
> >> http://www.algebra.com/services/rendering/simplifier.mpl
> >>
> >> Besides simplifying, it shows work and plots math formulas. It is not
> >> available publicly though.
> >
> > Also, it doesn't give the right answer.
> >
> > "Text form: ((x^2-6x+9)/(x^2-3x-10))/((x^2-5x+6)/(x^2-8x+15))
> > simplifies to (x-3)/(x+2)"
> >
> > No, it doesn't.
>
> I will appreciate corrections and suggestions. What's the right answer
> there?
I didn't solve it fully; I just set x to zero which was enough to show the
simplification was wrong.
It appears that the correct answer is (x-3)^2/(x-2)/(x+2). It seem like
your program realizes that (x-3) is a common factor in two of the quadratic
groups, but then "cancels out" both of those groups in their entirety,
rather than just the factor of x-3.
Xho
>
> i
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Mon, 05 Sep 2005 09:57:28 +0200
From: ngoc <ngoc@yahoo.com>
Subject: maintainable code?
Message-Id: <431c0768@news.broadpark.no>
Hi
Now I have a perl program with 5000 lines of code in a file. I want to
divide it to many files, so that it is easy to maintain. But I face a
lot of trouble with many subroutines using class variables. I do not
want to use our. I remember 'NOT SURE' that two programs running with
two our variables with same name, it modifies each other values.
Is a 5000 lines of code in one file perl program normal in perl's world?
Or I have to change it as soon as possible if I do not want my current
and future colleagues will complain me as unexperience?
------------------------------
Date: 5 Sep 2005 10:00:26 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: maintainable code?
Message-Id: <Xns96C832EF6547Ccastleamber@130.133.1.4>
ngoc <ngoc@yahoo.com> wrote:
> Hi
> Now I have a perl program with 5000 lines of code in a file. I want to
> divide it to many files, so that it is easy to maintain.
Can you come up with a better design?
> But I face a
> lot of trouble with many subroutines using class variables.
Ouch (I guess you mean global variables).
> Is a 5000 lines of code in one file perl program normal in perl's world?
CGI.pm is 7500+ :-D. (But almost halve of it is documentation).
5000 lines of actual code is quite a lot to have in one program, or at
least, I can't find a script (so far) I have written that comes close to
it.
> Or I have to change it as soon as possible if I do not want my current
> and future colleagues will complain me as unexperience?
I think that depends much more on your coding style.
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Mon, 05 Sep 2005 07:16:06 GMT
From: steven_p_gillett_at_yahoo_dot_co_dot_uk@foo.com (sgillett)
Subject: Re: Padding Problem UPDATE (Still broken)
Message-Id: <WgSSe.184284$WN5.147373@fe02.news.easynews.com>
Hi Hal,
Thanks for your suggestion, I am now using
padding => 'standard'
but still get the following error from the java side:
javax.crypto.BadPaddingException: Given final block not properly padded
I have taken a look back at this thread as you suggested, and noticed that
in your earlier posts you had the same problem, and in your post on 23rd
August you were able to get it working with several tweaks.
Can you remember what changes you needed to make?
Thanks,
Steve.
--
##-----------------------------------------------##
Article posted with Web Developer's USENET Archive
http://www.1-script.com/forums
no-spam read and post WWW interface to your favorite newsgroup -
comp.lang.perl.misc - 36738 messages and counting!
##-----------------------------------------------##
------------------------------
Date: Mon, 05 Sep 2005 01:31:05 -0400
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Tracking Dependencies
Message-Id: <7vydnTWqsYmHRYbeRVn-gg@comcast.com>
I have some modules that started small (don't they all??), and has my
project has grown, have gotten large enough that I could split them in 2 or
more smaller logical blocks, creating 2,3 or 4 modules instead of 1. While
doing I've been doing this, I also have programs that have been revised
that they may no longer need all the modules I currently have them using.
I know when I run a Perl script and it calls a non-existing routine, I'll
get an error message, but it's not always possible to quickly or easily
make sure every possible path of program flow is checked to be sure of
this.
I was thinking of writing a script that would go through each program or
module I have, collect the names of all routines called and compare them
against Perl's own functions and all the functions defined in my modules,
but I figure there's already a way to do that either built into Perl, or on
CPAN (which seems to be down at the moment -- or at least I can't reach it
from here). The only keyword I can think of to describe what I'm trying to
do is dependency, and I'm not finding much useful using that.
So is there a way to track the functions called in a program or module and
get a listing of whether those functions are built-ins, defined in the
program, or what module each function is defined in?
Thanks for any help on this!
Hal
------------------------------
Date: 5 Sep 2005 06:29:17 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Tracking Dependencies
Message-Id: <Xns96C8F1D34205castleamber@130.133.1.4>
Hal Vaughan <hal@thresholddigital.com> wrote:
> least I can't reach it from here). The only keyword I can think of to
> describe what I'm trying to do is dependency, and I'm not finding much
> useful using that.
another keyword: refactoring (Not sure if that's going to help, though).
I would probably make a list of function names in the old module(s), and
just grep (in a smart way) over the old projects. Or maybe even make a
wrapper module which rerouts old calls to new modules.
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
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 8389
***************************************