[13678] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1088 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 15 18:05:58 1999

Date: Fri, 15 Oct 1999 15:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940025115-v9-i1088@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 15 Oct 1999     Volume: 9 Number: 1088

Today's topics:
    Re: "Protecting" Perl source code mattandap1@my-deja.com
    Re: "Protecting" Perl source code <marcel.grunauer@lovely.net>
    Re: "Protecting" Perl source code <rootbeer@redcat.com>
        200+ messages a day and still repetitive? <nolenj@worldnet.att.net>
    Re: @ARGV ---- Arrrrgggghhhh! :-) (Tad McClellan)
    Re: CLUELESS =( (Craig Berry)
    Re: CLUELESS =( <marcel.grunauer@lovely.net>
        cpan not working <msql2@yahoo.com>
        CSS / NETSCAPE -> Through PERL <ps1715@earthlink.net>
    Re: DBD DELETE statement jhagerty@my-deja.com
        encryption <mike@dice.net>
    Re: getting variables embeded in string to be evaluated <makkulka@cisco.com>
    Re: getting variables embeded in string to be evaluated <marcel.grunauer@lovely.net>
    Re: getting variables embeded in string to be evaluated (Larry Rosler)
    Re: good salt for crypt() ? <rootbeer@redcat.com>
    Re: Grabbing image size? (Michael Budash)
    Re: Grabbing image size? (Larry Rosler)
    Re: Ha ha! <aqumsieh@matrox.com>
    Re: Help weird html with CGI.pm and Ispell.pm (Clinton Pierce)
    Re: How to inquire, position and click the mouse in PER <rootbeer@redcat.com>
    Re: How to resize a web browser <jeff@vpservices.com>
    Re: Need help getting data into arrays <aqumsieh@matrox.com>
        Newbie Question <martin@mert.globalnet.co.uk>
    Re: Opinions? Efficiency & Drain of Pack/UnPack <rootbeer@redcat.com>
    Re: Opinions? Efficiency & Drain of Pack/UnPack (Larry Rosler)
        Perl Programmer Wanted <webmaster@aisinternet.hypermart.net>
        pod2html: simple how-to question <jhg@acm.org>
        pod2html: simple how-to question <jhg@acm.org>
    Re: Random string (Larry Rosler)
        Redirecting STDERR in Win32 PerlScript. epan@my-deja.com
    Re: Substituting Only Within Matched Substring <rootbeer@redcat.com>
        test2 <jhg@acm.org>
    Re: tr// question <aqumsieh@matrox.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 15 Oct 1999 20:56:15 GMT
From: mattandap1@my-deja.com
Subject: Re: "Protecting" Perl source code
Message-Id: <7u84d9$5fv$1@nnrp1.deja.com>

- DejaNews looks like this message was
cross-posted; I've taken out all the Posts
but comp.lang.perl.misc ...



> Do you have any ideas or suggestions for
> protection features I could put into place
> to help minimize the damage done by people
> pirating my scripts?
>

Just a few thoughts for you -

1) How did you get perl?
2) Did you pay for it?
3) Did you pay for the source?  Does anyone?

So, if Larry Wall gives away his code, is
it right to take advantage of that and
start talking about "Intellectual Property Rights" on perl source?

Of course, it is legal for you to do this -
but that doesn't mean that the Open Souce
folks have to help you hide your code.  I
HIGHLY suggest you look up this very
question in the perl FAQ.

But, let's say you are bound and determined
to have intellectual property rights for
your code, and forget the entire open source
movement, which created your interpreter.
What to do?

My honest recommendation is to give up on
"hiding" the source code by compiling it.
Instead, when you begin your contract work,
write up a very clear contract that specifically
limits the use and distribution of your script.
Then, stick appropriate statements and warnings
in the comments of the code.  I am not a lawyer
and not qualified to make law advice, but it
might be useful to look up the "Standard of
Reason" in a law book, and go with that.

If your contract and code is sufficiently
intimidating, you shouldn't have to worry
about theft of your code.

<Sarcasm>
Finally, when you have a finished product,
make a copy for yourself.  Take the original
and knock out all the useful comments, change
the names of the variables to things like
$stuff, $phooey, $nohelpforu, etc.  Change
the subroutines to this_is_copyrighted, etc.
</Sarcasm>

--- Of course, I haven't met many people
who've tried my final strategy and got
away with it.  I did embed the entire
transcript of the Vader/Skywalker duel in
"The Empire Strikes back" into a C Routine
once, but that's another story ...

just my $0.02 - and cheap $0.02, at that,


Matt Heusser,
http://grand-rapids.pm.org

Matt and ap at Allegan . network





Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 15 Oct 1999 21:19:31 GMT
From: Marcel Grunauer <marcel.grunauer@lovely.net>
Subject: Re: "Protecting" Perl source code
Message-Id: <EqgHOO4RYlpBYnLkQBq2Mkkigxcb@4ax.com>

On Fri, 15 Oct 1999 18:43:17 GMT, "Craig Vincent"
<webmaster@webdream.com> wrote:

> I'm looking at distributing various commercial perl scripts I've developed.
> Obviously once I start distributing it more than likely it will be passed
> around in the underworld webmaster market (assuming people like what I've
> done :D).

This has been discussed many times. Use deja.com to find the relevant
discussions.


-- 
Marcel, Perl Padawan
sub AUTOLOAD{$_=$AUTOLOAD;s;.*::;;;y;_; ;;print}&Just_Another_Perl_Hacker;


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

Date: Fri, 15 Oct 1999 14:42:56 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: "Protecting" Perl source code
Message-Id: <Pine.GSO.4.10.9910151433020.25558-100000@user2.teleport.com>

On Fri, 15 Oct 1999, Craig Vincent wrote:

> Newsgroups: comp.lang.perl, comp.lang.perl.misc, perl.misc, perl.moderated

If your news administrator still carries comp.lang.perl, please let him
or her know that that newsgroup has not existed since 1995. If you
have such an outdated newsgroup listing, you are probably missing out
on many other valid newsgroups as well. You'll be doing yourself and
many others a favor to use only comp.lang.perl.misc (and other valid
Perl newsgroups) instead.

I've changed the list of newsgroups to what (I think) you wanted, and set
follow-ups. (But I suspect that the follow-ups won't be Perl-specific, so
the moderators may refuse them.)

> Do you have any ideas or suggestions for protection features I could
> put into place to help minimize the damage done by people pirating my
> scripts?

Apply the proper number of lawyers. In general, once you let Wally use
your program, even if it's compiled, encoded, and obfuscated, there's no
way of preventing him from passing it on to Alice. But the copyright laws
(and, in rare cases, patent laws) provide a way for you to do something
about it when and if that happens, even if you give out the source.

Your local library probably has a good book on how to copyright your
software. Then you should need to pay for lawyers only if you feel that
your rights are being infringed.

Cheers!

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


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

Date: Fri, 15 Oct 1999 16:57:31 -0500
From: "Nolen Johnson" <nolenj@worldnet.att.net>
Subject: 200+ messages a day and still repetitive?
Message-Id: <7u86ts$oa7$1@bgtnsc03.worldnet.att.net>

Hi group:

This is not a perl question or  answer and  in reality nothing to do with
the perl language.
This has to do with this newsgroup in general and the same questions asked
over and over again.
Do people not
  1. read anymore?
  2.have any pride that makes them want to accomplish a task on their own?
  3.have a real desire to become a proficient programmer instead of a
newsgroup junkie?

By no means am I a proficient programmer in perl or any other language I
program in, but
I do try to learn the basics on my own by reading, trial and error, or just
common sense.
Some of the questions that are asked in this newsgroup makes you wonder if
the person(s) asking
them ever intend to use any  source other than this newsgroup to develop
even the most basic skills
in programming.

I would be ashamed of myself if asked a question about a programming
language that was possibly
explained in the first 10 pages of a beginner's guide for dummys on that
language.
I do not think I have to tell you, but those kind of questions are asked,
not only in here, but in practically
every newsgroup dealing with the education of a particular subject.

It is such a terrible waste to use a newsgroup such as this for a community
chat room instead of what it was
(IMO) intended for(real programming problems that have been challenged and
the results are incorrect)
IMO, I don't believe some of the people that ask questions have ever lifted
a finger to open a book,
read a FAQ, or just researched  in general the problem they are faced with.

I am not an A....HOLE , I'm just realistic and enjoy coming to a place where
I can get the information
I need without virtually ever asking a question.
I just read the responses to other peoples questions that may pertain to an
area of perl(in this case)
that I need educated on.

With all that said...feel free to give me a tongue-lashing for speaking
out-of-turn.

A closing note:
  Don't be afraid of crashing your computer a few times...In today's
technology most operating
systems wil probably recover.
  It is so cool when you finally figure something out on your own...if you
ever experience the
thrill, I guarantee you will think you are king of the world.





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

Date: Fri, 15 Oct 1999 12:13:05 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: @ARGV ---- Arrrrgggghhhh! :-)
Message-Id: <hqj7u7.626.ln@magna.metronet.com>

Tom Turton (tturton@ntx.waymark.net) wrote:

: I "want" to feed wildcard character filenames in via @ARGV, but it is
: seeking out matches and passing matched filenames in @ARGV.

[snip]

: Thanks (and feel free to flame if I've completely overlooked something
: which is intuitively obvious to the most semi-casual observer ;-)


   You have overlooked something.

   The passing of arguments to programs depend on the shell/command
   interpreter/or whatever.

   You have not told us what platform you are using.

   On Unix, the shell expands the wildcards _before_ perl is
   ever invoked.

   So it is a shell question, not a Perl question.

   You need to protect your args from being expanded by the shell
   (using quoting or backslashing) before it passes them on to perl.


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


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

Date: Fri, 15 Oct 1999 21:08:31 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: CLUELESS =(
Message-Id: <s0f5uf27r0158@corp.supernews.com>

Max (nihilist@kenobiz.com) wrote:
: ok, heres my problem.......http://www.kenobiz.com/problem.txt
: i have NO clue what is wrong, i ran my perl syntax checker on it but
: it comes up with nothing =(

No -w, no strict, no CGI.pm, no description of what specific problem
you're having -- are you a masochist or something? :)

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: Fri, 15 Oct 1999 21:09:58 GMT
From: Marcel Grunauer <marcel.grunauer@lovely.net>
Subject: Re: CLUELESS =(
Message-Id: <+qMHOAaP2sLmi+C7XcJdmFz6zr+z@4ax.com>

On Fri, 15 Oct 1999 20:46:14 GMT, nihilist@kenobiz.com (Max) wrote:

> ok, heres my problem.......http://www.kenobiz.com/problem.txt
> i have NO clue what is wrong, i ran my perl syntax checker on it but
> it comes up with nothing =(

Since I'm obviously bored and instilled with this perverse urge to see
the "code" that's behind such a wonderful message, I took a look at
that URL... the horror! the horror!

It looks like the remains of some voting script that died long ago. No
"-w", no "use strict", no "use CGI". Form parsing of the worst sort.
No indentation whatsoever. Uninitialised variables with confusing
names. Gratuitous use of backslashes in strings. String comparisons
with "==" instead of "eq". Gratuitous use of quote operators (print
"$tott").

From that, the subject and loving detail of the problem description, I
think the conclusion is fairly obvious. Script kiddie. No clue. No
logic. No manuals. No hope.

I'm still shaking. Project SOAP (nee CRAP), anyone? Please?


-- 
Marcel, Perl Padawan
sub AUTOLOAD{$_=$AUTOLOAD;s;.*::;;;y;_; ;;print}&Just_Another_Perl_Hacker;


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

Date: Fri, 15 Oct 1999 14:34:34 -0700
From: weimin li <msql2@yahoo.com>
Subject: cpan not working
Message-Id: <38079DEA.E9194E06@yahoo.com>

Hi All,
        I used to  recompile Apache/mod_perl at CPAN prompt and am
trying to do
it again now. However, after I ran
        $>perl -MCPAN -e shell
        cpan>recompile Apache
        I always got the following error message:
Fetching with LWP:
  ftp://ftp.cs.colorado.edu/pub/perl/CPAN/authors/01mailrc.txt.gz
Can't call method "mirror" on an undefined value at
/home/ucmbordb/perl/lib/5.00
502/CPAN.pm line 1804, <FIN> chunk 1.

        My guess is that something related to ftp is not working, but I
had no
clue on how to correct the problem. Could somebody lend me a hand?
Thanks a lot.
WL


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

Date: Fri, 15 Oct 1999 17:12:53 -0500
From: "RLD" <ps1715@earthlink.net>
Subject: CSS / NETSCAPE -> Through PERL
Message-Id: <7u86mv$313$1@fir.prod.itd.earthlink.net>

Ran across a strange problem that maybe someone can give me some direction
with...

Created a template file that uses CSS and JavaScript.  The layers are tables
that are displayed depending on what button is clicked.  The template works
fine when loaded in both Netscape and IE.  However... when I run my Perl
script which opens the template and then displays it... only IE displays it
correctly with full functionality.  Netscape on the other hand just sits
there, the calls to the JavaScript ing... seems to produce no output... it
is not hiding the tables and making visible the one chosen.

Is there something in the headers possibly that is not going over well with
Netscape?  I've used JavaScript in this manner before, but never with CSS
 ... could there be a problem with styles not loading correctly when the
output comes through a Perl script?  I'm stumped.

Please help,
Randall





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

Date: Fri, 15 Oct 1999 21:30:57 GMT
From: jhagerty@my-deja.com
Subject: Re: DBD DELETE statement
Message-Id: <7u86ei$6sv$1@nnrp1.deja.com>

Relevant information:
  delete command worked in Access
  Didn't in Perl at a command line
  Duplicated the commands in perl as close to Access as possible.

Full error message:
DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver]
Too few parameters. Expected 1. (SQL-07001)(DBD: st_execute/SQLExecute
err=-1) at C:\Perl\timetest.pl line 93, <IN> chunk 1006.
Database handle destroyed without explicit disconnect, <IN> chunk 1006.


The fix turned out to be that i needed quotes around my variable for
Access to interpet correctly.


Thanks for the help.!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 15 Oct 1999 21:43:43 GMT
From: Mike Heller <mike@dice.net>
Subject: encryption
Message-Id: <38079FC3.1EE67811@dice.net>

I'm writing an application that stores users in a database.  I have a
table that stores the user passwords.  Right now, I'm using the crypt()
function to encrypt the passwords before I store them.  I would like to
add the option to mail the user his or her password, but the crypt()
function is only one way.  Does anyone know of any good encryption
routines for perl (or possibly where I can find one)?

Thanks,
Mike



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

Date: Fri, 15 Oct 1999 14:04:16 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: getting variables embeded in string to be evaluated
Message-Id: <380796D0.80A4C50E@cisco.com>

{
Bill wrote:

> # want to store an array of strings with embedded variables, in
> particular
> # hash values which are not know at the time the string is stored
> # later after hash has been populated, want to print the strings
> # can't get embdded vars to be evaluated
> # note: array and hash may be very large with many subs per string

This is Item 58: Use @{[…]} or a tied hash to evaluate expressions inside
strings.
IN the book "effective perl programming" -  Hall & Schwartz.
--



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

Date: Fri, 15 Oct 1999 21:15:59 GMT
From: Marcel Grunauer <marcel.grunauer@lovely.net>
Subject: Re: getting variables embeded in string to be evaluated
Message-Id: <7aYHOPlh2c=cw23EZNfpErFObNaK@4ax.com>

On Fri, 15 Oct 1999 20:12:07 GMT, wlanahan@att.com (Bill) wrote:

> # want to store an array of strings with embedded variables, in
> particular
> # hash values which are not know at the time the string is stored
> # later after hash has been populated, want to print the strings
> 
> # can't get embdded vars to be evaluated
> # note: array and hash may be very large with many subs per string

> %ref = ();
> @arr = ();

No need to initialise variables with empty values. But you should "use
strict" and turn on warnings.

> 
[snip]

> print $arr[0];
> print "$arr[0]";

Gratuitous use of quote operator.

I'm not sure, but do you mean something like that:

#!/usr/bin/perl -w

use strict;

my $s = 'Hello %%cc%% world';
my %value;
$value{'cc'} = 'there';
$s =~ s/%%(.*?)%%/$value{$1}/e;
print $s;


Of course, you still have to check whether the variable name you find
($1 in the regex) is defined in the hash of values, but that's left as
an exercise to the reader.


-- 
Marcel, Perl Padawan
sub AUTOLOAD{$_=$AUTOLOAD;s;.*::;;;y;_; ;;print}&Just_Another_Perl_Hacker;


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

Date: Fri, 15 Oct 1999 14:45:03 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: getting variables embeded in string to be evaluated
Message-Id: <MPG.12714038640fb74798a09c@nntp.hpl.hp.com>

In article <7aYHOPlh2c=cw23EZNfpErFObNaK@4ax.com> on Fri, 15 Oct 1999 
21:15:59 GMT, Marcel Grunauer <marcel.grunauer@lovely.net> says...

 ...

> > print $arr[0];
> > print "$arr[0]";
> 
> Gratuitous use of quote operator.

 ...

> $s =~ s/%%(.*?)%%/$value{$1}/e;

Gratuitous use of /e modifier.  :-)

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


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

Date: Fri, 15 Oct 1999 14:59:58 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: good salt for crypt() ?
Message-Id: <Pine.GSO.4.10.9910151443300.25558-100000@user2.teleport.com>

On Fri, 15 Oct 1999, Dan Baker wrote:

> I am writing a little utility to create a password file for uploading
> and using in a simple .htaccess security scheme. I poked around for
> ways to generate the encrypted passwords and it looks like the perl
> crypt() function returns an encrypted string that can be used for this
> purpose...
> 
> true so far?

Yes, but see the modules on CPAN to keep from reinventing the wheel. 

> After reading crypt() docs and poking some more, I found some
> references indicating that some values for $salt would be better than
> others. Can someone please explain why?

Not Perl-specific, but I'll tell you anyway. There are 4096 different
possible salt values. One way for a cracker to try to find the passwords
(given the crypted values) is to crypt every word in a dictionary with a
given salt and see whether anything matches. If you use the same salt
value repeatedly, that makes the cracker's job easier.

So, first, don't let anyone get the password file. Be sure it's not
somewhere in the document tree or otherwise readable. 

Second, choose a salt that is as unlikely as possible. Generally, one
chosen at random should be fine.

    sub random_salt () {
	my @saltset = (0..9, 'A'..'Z', 'a'..'z', '.', '/');
	join '', @saltset[rand 64, rand 64];
    }

> I'm wondering just how carried away to get with this.... 

Well, once you know that the passwords are sent _unencrypted_ over the
net, you'll know that even this much is overkill. :-)

Cheers!

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



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

Date: Fri, 15 Oct 1999 14:29:26 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Grabbing image size?
Message-Id: <mbudash-1510991429260001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>

In article <38079276.22353035@news.xmission.com>, fharris@xmission.com wrote:

>I'm interested in being able to grab the image dimensions from a .GIF
>or .JPG picture using Perl.  Anyone know how to do this?
>
>Thanks,
>Frank

check out the Image::Size module.

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Fri, 15 Oct 1999 14:46:44 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Grabbing image size?
Message-Id: <MPG.127140a395e9f8f98a09d@nntp.hpl.hp.com>

In article <38079276.22353035@news.xmission.com> on Fri, 15 Oct 1999 
20:47:47 GMT, fharris@xmission.com <fharris@xmission.com> says...
> I'm interested in being able to grab the image dimensions from a .GIF
> or .JPG picture using Perl.  Anyone know how to do this?

Get the Image::Size module from CPAN.

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


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

Date: Fri, 15 Oct 1999 15:38:24 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Ha ha!
Message-Id: <x3y3dvc76tr.fsf@tigre.matrox.com>


emlyn_a@my-deja.com writes:

> Ha ha! Thanks, Uri. Actually, I'm a guy like the rest of you (I know, I
> know, the name is odd).

YES! I knew Abigail was a guy all along!

:-)

--Ala



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

Date: Fri, 15 Oct 1999 20:59:53 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Help weird html with CGI.pm and Ispell.pm
Message-Id: <3808957e.879365891@news.ford.com>

On Fri, 15 Oct 1999 17:43:53 GMT, Scott Beck <scott_beck@my-deja.com>
wrote:
>When I looked at it again today I realized my mistake after having some
>sleep. ahh sleep what a great thing.
>Thanks for your answer though.

Yes, it does wonders, doesn't it?  :)

>Do you happen to know of a more portable way to spell check?
>I know Ispell is not install on every computer.

PPT might have a spell or ispell port done by now, check with them at
http://language.perl.com/ppt.  It still requires a word list to be toted
around, though.  Any solution would.

-- 
Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
http://www.geeksalad.org


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

Date: Fri, 15 Oct 1999 14:05:49 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to inquire, position and click the mouse in PERL?
Message-Id: <Pine.GSO.4.10.9910151405330.25558-100000@user2.teleport.com>

On Fri, 15 Oct 1999, Nim Chu wrote:

> I am using Windows 98. I think there may exists a PERL module to
> inquire the current position of the mouse (which can be anywhere on
> the screen), set it to a new position, and right click the mouse, all
> under PERL script control. Can anyone give me some directions where to
> look. Thanks.

See the FAQ, section 8. Cheers!

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



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

Date: 15 Oct 1999 19:59:30 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How to resize a web browser
Message-Id: <38078758.29FFCC4B@vpservices.com>

Aaron Propst wrote:
> 
> we're not going in depth on how to do it in javascript.... we're only
> pointing Mu Shan in the right direction... perl is the wrong language to go
> trying to resize a browser.. javascript is the right one.  that's all there
> is to it.  I think i do know a bit about javascript.. and i've created some
> rather powerful apps by combining languages.

Ok, cool, I have no problem with someone saying "xyz is better done in
javascript and here's how you might do it; check in a javascript
newsgroup for more details or questions", I also have no problem with
"xyz can be accomplished with a combination of javascript and perl and
here's how to do it;, check in a javascript newsgroup if you have
questions about the javascript part or back here if you have questions
about the perl part".  

For sure it is easy to get confused about what language or protocol is
involved in doing a task or solving an error, I have done it many
times.  But helping the person differentiate where the solution resides
is part of the learning process.  It is no favor to a newbie to
encourage them to think that Perl and Javascript are interchangeable and
that it is arbitrary which one is used to solve a particular problem. 
Nor is it a favor to a newbie to encourage them to think they can get
their javascript problems solved in clpm.

-- 
Jeff


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

Date: Fri, 15 Oct 1999 15:36:00 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Need help getting data into arrays
Message-Id: <x3y4sfs76xr.fsf@tigre.matrox.com>


"Craig Vincent" <webmaster@webdream.com> writes:

> @foo = split(/|/, <STDIN>);
> 
> Theoretically that should break up each part and place it in a
> separate cell each in the list.

Theoretically? Why didn't you try it.
You suffer from the leaning tooth syndrome my friend. To fix you up:

	@foo = split /\|/, <STDIN>;

This would read only one line from STDIN though.

> I never tried doing a split directly with <STDIN>, if it doesn't work
> perhaps first declare
> a variable with <STDIN> as the value and then split that into a list.

Why didn't you try before posting?

> Sincerely,
> 
> Craig Vincent

	[Let's ignore your jeopardy-style post here]

What does your reply have to do with the original question, which you
quote below without any attributes?


> >
> > @data=<STDIN>
> >
> > Then loop through and assign each acceptable line to a new variable,
> > then split each variable into a scalar array, and then convert each
> > scalar array into a hash. My first problem can in trying to assign each
> > line to a new variable so I would end up with:
> >
> > $submission_1 = ('Date submitted:Tue Oct 12 15:18:53 EDT 1999',
> > 'pec29_Qty:123', 'ae_hrid:1234598')
> >
> > $submission_2 = ('Date submitted:Tue Oct 12 15:18:53 EDT 1999',
> > 'pec29_Qty:123', 'ae_hrid:1234598')

You don't have a line in each variable. You have a list. When you
assign a list to a variable, the variable gets the value of the last
element. You need to assign a reference to the list in your
variable. Read perllol and perldsc for info on how to do that.

> > etc...
> >
> > I tried this:
> >
> > $i=0;
> > foreach $item (@data){
> >      if ((substr $item, 0, 15) eq "Date submitted:"){
> >         $submission_$i=split (/|/, $item);

That will not do what you want. Why are you trying to split on a '|'
when you want to split on colons?

Besides, | is a special character in regexps. You should backwack it
to get its literal meaning:

	split /\|/, $string;

> >         $i++
> > }
> >
> > That was actually my last problem because, as you probably guessed, the
> > $submission$i didn't work and I couldn't figure out how to get assign a
> > new, sequential name to each item.

You don't really want to do that. You should use an array instead. I
would call the array @submission. And then, instead of assigning to a
variable $submission_1, you assign to an array element:

	$submission[1] = [split /:/, $item, 2];

It's cleaner, and easier to manage. You can add/remove variables as
you want very easily like that.

> > After that's worked out, I need to know if there is a way to turn a list
> > like this:
> >
> > $submission_1 = ('Date submitted:Tue Oct 12 15:18:53 EDT 1999',
> > 'pec29_Qty:123', 'ae_hrid:1234598')
> >
> > into a hash:
> >
> > %submission_1=("Date submitted"=>"Tue Oct 12 15:18:53 EDT 1999",
> >
> > "pec29_Qty"=>"123",
> >
> > "ae_hrid"=>"1234598")
> >
> > (I realize that I have to do something with the "Data Submitted" field
> > because of the colons in the date format.)

Use split() with the third argument == 2. This will split on the first
colon only, which seems to be what you need.

For more info:
	perldoc -f split

HTH,
--Ala



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

Date: Fri, 15 Oct 1999 22:13:06 +0100
From: "Martin Elliott" <martin@mert.globalnet.co.uk>
Subject: Newbie Question
Message-Id: <7u85va$3he$1@gxsn.com>

I am trying to incorporate Perl into a website. All I want to do is use it
to read input from a .txt file, and display it, and also to write to another
 .txt file regularly.

I have never used Perl before, so does anyone have any good URLs for
tutorials/FAQ or know any good books etc.

Also, how can you test Perl scripts without uploading the files?

Thanks for your time,

Martin




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

Date: Fri, 15 Oct 1999 14:07:38 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Opinions? Efficiency & Drain of Pack/UnPack
Message-Id: <Pine.GSO.4.10.9910151407080.25558-100000@user2.teleport.com>

On Fri, 15 Oct 1999, Paul D wrote:

>  Is the use of Pack and Unpack a significant strain on a system? 

My opinion: No.

> Does it make a script particularly slower and in need of more system
> resources/memory to do these two functions?

Have you seen the Benchmark module? Cheers!

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



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

Date: Fri, 15 Oct 1999 14:25:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Opinions? Efficiency & Drain of Pack/UnPack
Message-Id: <MPG.12713ba35688339c98a09b@nntp.hpl.hp.com>

In article <38072071.979AF582@home.com> on Fri, 15 Oct 1999 12:34:19 
GMT, Paul D <pdobbs@home.com> says...
>  I've been working on a couple of nifty scripts here, and think I may
> be drawing on the use of Pack and Unpack alot, so I just want to ask;
> 
>  Is the use of Pack and Unpack a significant strain on a system? IE:
> Does it make a script particularly slower and in need of more system
> resources/memory to do these two functions?

perldoc Benchmark

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


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

Date: Fri, 15 Oct 1999 21:52:35 GMT
From: AIS <webmaster@aisinternet.hypermart.net>
Subject: Perl Programmer Wanted
Message-Id: <7u87mt$7va$1@nnrp1.deja.com>

Perl Programmer Wanted

A.I.S. Web Development and Internet Solution is looking for a qualified
Perl and PHP programmer to work on a contract base with our clients and
with our company.

You must be willing to:

1)	Provide work directly to clients.
2)	Communicate efficiently.
3)	Finish projects on time and work under deadlines.
4)	Have access to the Internet and a phone line.

You will work at an hourly rate, or by the project and be paid directly
by A.I.S. or our client. The hourly rate is flexible. You will need the
following skills:

1)	Profound knowledge of Perl and PHP.
2)	Database Integration (SQL and text-based mainly).
3)	E-Commerce Integration.
4)	UNIX and Sun servers.
5)	Basic HTML and page layout.

A.I.S. is a start-up Internet Design Company, all members will be
expected to work hard and put free time into the exposure and promotion
of the company. You’ll also be expected to do some free programming for
the company web site.

If you are interested in such a position please email
jobs@aisinternet.hypermart.net with some URL’s and a summery of your
work, a resume, and a fee per hour.

Thank you.


--
Webmaster
A.I.S. Web Development & Internet Solutions
webmaster@aisinternet.hypermart.net
http://aisinternet.hypermart.net


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 15 Oct 1999 21:08:49 GMT
From: Jim Garrison <jhg@acm.org>
Subject: pod2html: simple how-to question
Message-Id: <380797E3.E3BCBB46@acm.org>

Repost: Apologies in advance if this is a duplicate.  My ISP
is having trouble configuring nntp correctly.
====================

Very simply:

I have a Perl installation with a bunch of stuff added
from CPAN (using the CPAN module), and I would like to 
(re-)generate a complete set of HTML documentation.

Can someone please post the command sequence one would
issue, from which directory, to accomplish this.  The 
usage instructions that come with pod2html are insufficient
for this task. (Perl installed in /usr/lib/perl5)

Pretty please can someone help?

TIA

Jim Garrison
jhg@acm.org


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

Date: Fri, 15 Oct 1999 15:36:08 -0500
From: Jim Garrison <jhg@acm.org>
Subject: pod2html: simple how-to question
Message-Id: <38079038.94DDE522@acm.org>

Repost: Apologies in advance if this is a duplicate.  My ISP
is having trouble configuring nntp correctly.
====================

Very simply:

I have a Perl installation with a bunch of stuff added
from CPAN (using the CPAN module), and I would like to 
(re-)generate a complete set of HTML documentation.

Can someone please post the command sequence one would
issue, from which directory, to accomplish this.  The 
usage instructions that come with pod2html are insufficient
for this task. (Perl installed in /usr/lib/perl5)

Pretty please can someone help?

TIA

Jim Garrison
jhg@acm.org


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

Date: Fri, 15 Oct 1999 14:51:14 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Random string
Message-Id: <MPG.127141ad5dcd8e0a98a09e@nntp.hpl.hp.com>

In article <3807985C.EABD81D7@dice.net> on Fri, 15 Oct 1999 21:12:08 
GMT, Mike Heller <mike@dice.net> says...
> Can anyone tell me how to generate a two character string from the set
> [./0-9A-Za-z].  I'm trying to encrypt passwords using the crypt()
> function.  I can generate a random two digit integer, but how do I
> generate a string?


#!/usr/local/bin/perl -w
use strict;

my @chars = ('.', '/', 'A' .. 'Z', 'a' .. 'z');

my $string = $chars[rand @chars] . $chars[rand @chars];

print "$string\n";
__END__

If you don't like to write long expressions twice,

my $string = join "", map $chars[rand @chars], 1, 2;

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


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

Date: Fri, 15 Oct 1999 21:38:05 GMT
From: epan@my-deja.com
Subject: Redirecting STDERR in Win32 PerlScript.
Message-Id: <7u86rr$77t$1@nnrp1.deja.com>

Is there a log/text file that save output to STDOUT and STDERR?

For example,

<%
print STDOUT "Outputing to STDOUT.\n";
print STDERR "Outputing to STDERR.\n";
%>

Is there a log file somewhere in IIS that keep the info? If not, how do
you redirect the output to a file. I tried the following but failed:

<%
use Win32::ASP;
open( SAVEERR, ">&STDERR" );
open( STDERR, ">C:/InetPub/scripts/error.log" ) || die "Cannot
Redirect.\n";
print STDERR "Testing 1 2 3.\n";
%>

It only created the file but it's empty.

Any help is much appreciated. Thanks.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 15 Oct 1999 14:29:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Substituting Only Within Matched Substring
Message-Id: <Pine.GSO.4.10.9910151416440.25558-100000@user2.teleport.com>

On 15 Oct 1999, Jim Monty wrote:

> There's gotta be a better way to do this:
> 
>     if (/^(\S+\s+)(\S.*  .*)/s) {
>         ($label, $value) = ($1, $2);
>         $value =~ s/  +/ /g;
>         $_ = $label . $value;
>     }
> 
> What is it?
> 
> (I want to get rid of the use of variables.)

Maybe you want this?

    s{^(\S+\s+)(\S.*  .*)}{
	my $value = $2;
	$value =~ s/  +/ /g;
	"$1$value";
    }es;

You may be able to do better if you know more about your data. For
example, if you know that you'll have only one run of multiple spaces in
the input. And the internal s/// may be better as tr/ //s, but only
Benchmark knows for sure (since that also may depend upon your data).

But don't stay awake for many nights trying to (over-)optimize this. It's
probably already as fast as it needs to be, for any practical purpose.

Cheers!

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



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

Date: Fri, 15 Oct 1999 21:05:26 GMT
From: Jim Garrison <jhg@acm.org>
Subject: test2
Message-Id: <38079718.8D273C2C@acm.org>

jhg@acm.org


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

Date: Fri, 15 Oct 1999 15:51:48 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: tr// question
Message-Id: <x3y1zaw767f.fsf@tigre.matrox.com>


Brandon <pooka@cygnus.ucdavis.edu> writes:

> Abigail wrote:
> > 
> > Brandon (pooka@cygnus.ucdavis.edu) wrote on MMCCXXXVI September MCMXCIII
> > in <URL:news:38064EA9.9A4F75E3@cygnus.ucdavis.edu>:
> > ``
> > `` Abigail was blatantly deriding the original poster. The original poster
> > `` was asking for a solution, not the source of his/her problem. Simply
> > `` implying that you didn't understand the man page is _not_ any sort of
> > `` useful solution to the problem. So I think my sarcasm was well founded.
> > 
> > You can't fix problems if you don't know the source of them.
> > 
> > Abigail
> 
> Interesting how almost _every_ other post in this thread mentions
> something useful: that he should use the substitution operator instead
> of translation... It's a good thing you're not a teacher. "Teacher, I
> can't get my chemisty experiment to work properly." "Go read the
> textbook again. I'm too busy coming up with clever signature lines."

But teachers teach you *HOW* to solve your problems. They don't merely
give solutions. Abigail was being a good teacher there, IMHO.

If that's your logic, then I can see you getting a calculator to add 1
and 1.

--Ala



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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 1088
**************************************


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