[8044] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1669 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 19 01:18:47 1998

Date: Sun, 18 Jan 98 22:00:25 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 18 Jan 1998     Volume: 8 Number: 1669

Today's topics:
        Array Troubles <toddm@rahul.net>
    Re: Book review wanted <camerond@mail.uca.edu>
    Re: can anybody help me please? <cxwu@email.msn.com>
    Re: Create file <rhodri@wildebst.demon.co.uk>
    Re: Create file <rjk@coos.dartmouth.edu>
    Re: Determining file type (Martien Verbruggen)
    Re: Download Usenet group (Martien Verbruggen)
    Re: FrontPage 98 <scwebREMOVE@scwebdesigns.com>
    Re: Hello... I need HELP!!! (brian d foy)
        MacPerl carriage returns <aaron@soltec.net>
    Re: Perl Library (Martien Verbruggen)
        PL/SQL in Oraperl <wtang@cs.ualberta.ca>
    Re: Puzzling behavior of c.l.p.* readers <ebohlman@netcom.com>
    Re: Puzzling behavior of c.l.p.* readers (Martien Verbruggen)
        Question about outputting HTML w/ images <sellis@vt.edu>
    Re: Question about outputting HTML w/ images (Abigail)
        Random Access File Methods? <dgoyette@NoMoreSPAMpcisys.net>
    Re: Random Access File Methods? (Martien Verbruggen)
    Re: Random Access File Methods? <doug@tc.net>
        Reading a .dat filefor a password <e.phillips@mindspring.com>
    Re: returning values out of a recursed sub <rhodri@wildebst.demon.co.uk>
    Re: source into binary code (Abigail)
    Re: source into binary code <rjk@coos.dartmouth.edu>
    Re: Why does'nt this sub work (Martien Verbruggen)
    Re: Why does'nt this sub work <rhodri@wildebst.demon.co.uk>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 19 Jan 1998 05:48:40 GMT
From: Todd McLaughlin <toddm@rahul.net>
Subject: Array Troubles
Message-Id: <69upfo$o92$1@samba.rahul.net>

I have an array question.  Here's the bit of code:

for($i = 0; $person[$i][0] <> ""; $i++)
{
        @person[$i]=split(/ /,<datafile>);
}

I'm trying to read lines (~50) in from a data file, separate the fields
(3), and dump it into an 2D array.  Can you explain what's wrong with the
above code?

Thanks!



-- 


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

Date: Sun, 18 Jan 1998 21:19:26 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: Brad McFarlane <Brad_McFarlane@qmail.newbridge.com>
Subject: Re: Book review wanted
Message-Id: <34C2C63E.71029C2B@mail.uca.edu>

Brad McFarlane wrote:
> 
> Teach Yourself CGI Programming with Perl 5 in a week, 2nd Ed.
> 
> Has anybody got it or read it? If so, how is it? I figure for $20 it > won't be a big loss, but if it's as bad as some of
> the books mentioned in the "Camel Critiques", I want to steer clear.
> 
> Any info would be appreciated.

I guess it depends on what you want it for. It does explain some things
to the total CGI newbie, but you're not that, from what you say. It does
use Perl 5, and comes with a CD with one of the older perl 5.x on it.
But, I got this book on the recommendation of a friend, never having
done any web stuff nor having used perl, and for learning perl, it's
pretty much useless IMHO. I couldn't do anything until I got to a
bookstore and bought the gecko (Win32) book. I haven't picked the SAMS
book up since. BTW, there are some shareware programs on the CD, also, I
don't remember what they were, because they were also older versions of
what you can get through tucows or another shareware site. Such is the
problem of having a CD in such a rapidly-changing environment, I guess.

Save the $20, spend it on books from O'Reilly (no, I don't work for
them, but I would be glad to accept a free copy of a title for the
unsolicited plug - the ones I have are all very good).

Cameron
camerond@mail.uca.edu


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

Date: Sun, 18 Jan 1998 19:27:04 -0500
From: "Xiaoyi Wu" <cxwu@email.msn.com>
Subject: Re: can anybody help me please?
Message-Id: <eaFYQFHJ9GA.206@upnetnews04>

what's wrong w/ a shell command

sort +3 file.dat > file.out

charlie :)



Jahnel Klaus wrote in message <34C2168B.9AE840BA@xarch.tu-graz.ac.at>...
>i ve a file with datas:
>232 klaus 2305
>258 klaus 2215
>596 klaus 2305
>108 klaus 1725
>698 klaus 0000
>487 klaus 0855
>
>I want to read the data in (one line is a data set)
>and then put it out again but sortedon the 3rd entry
>like this:
>698 klaus 0000
>487 klaus 0855
>596 klaus 1205
>108 klaus 1725
>232 klaus 2305
>258 klaus 2305
>
>How can i perform this (but please no linls to perlfaq i have read it no
>luck)
>klaus
>




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

Date: Mon, 19 Jan 1998 00:56:54 +0000 (GMT)
From: Rhodri James <rhodri@wildebst.demon.co.uk>
Subject: Re: Create file
Message-Id: <480aa1cda8rhodri@wildebst.demon.co.uk>

In article <34C283D8.3E82C946@coos.dartmouth.edu>,
 Chipmunk <rjk@coos.dartmouth.edu> wrote:
>       # We don't check for success of the open, because if there is
>       # no file yet, the new CGI(FILEHANDLE) call will return an empty
>       # parameter list, which is exactly what we want.

Is that the defined behaviour of the interface, or is Mr Stein setting
himself up for a fall?  Additionally, is there being "no file yet" the
only possible error?  I think not.

-- 
Rhodri James  *-*  Wildebeeste herder to the masses
If you don't know who I work for, you can't misattribute my words to them

 ... Aliens do it inside you


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

Date: Mon, 19 Jan 1998 00:29:54 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Create file
Message-Id: <34C2E4D1.4EC6645@coos.dartmouth.edu>

Rhodri James wrote:
> 
> In article <34C283D8.3E82C946@coos.dartmouth.edu>,
>  Chipmunk <rjk@coos.dartmouth.edu> wrote:
> >       # We don't check for success of the open, because if there is
> >       # no file yet, the new CGI(FILEHANDLE) call will return an empty
> >       # parameter list, which is exactly what we want.
> 
> Is that the defined behaviour of the interface, or is Mr Stein setting
> himself up for a fall?  Additionally, is there being "no file yet" the
> only possible error?  I think not.

I think it's safe to assume that is the defined behavior of the interface,
since Lincoln Stein is the author of CGI.pm.

It doesn't really matter what error occurs; the script has to do something,
so if it can't open the file it just assumes an empty parameter list.

BTW, when the script attempts to opens the file writing, it does check
the return value.

Chipmunk


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

Date: 19 Jan 1998 02:08:40 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Determining file type
Message-Id: <69ucj8$d4g$1@comdyn.comdyn.com.au>

In article <jMGlTRAHTqw0EwsN@worsdall.demon.co.uk>,
	Mark Worsdall <scriptabuser@127.0.0.1> writes:

> Now the program that has this file needs to work out what type of file
> it is, graphic, text, binary etc, then it will do this:-
> 
> if (html or text) print "Content-type: text/html\n\n";
> if (graphic) print "Content-type: image/gif\n\n";
> (Here though I want it to display any image including jpegs etc)
> if (binary) force broswer to download
> 
> Is there any modules to achieve my goal?

You seem to be a bit confused about what binary means. A GIF file
also contains binary data.

That aside: perl has the -T and -B operators (perldoc -f -X) to sort
of make an estimate wether a file contains text or binary data. For
the rest, you probably will have to rely on some mapping from file
extensions to mime types, like most web servers and browsers do. I'm
not sure if there is a module for that, but you might be able to find
one at CPAN, http://www.perl.com/CPAN/

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd.       | you come to the end; then stop.
NSW, Australia                      | 


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

Date: 19 Jan 1998 02:11:23 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Download Usenet group
Message-Id: <69ucob$d4g$2@comdyn.comdyn.com.au>

In article <34C2A93A.FF6@runge.uni-c.dk>,
	"Lars Kr. Lundin" <lkl@runge.uni-c.dk> writes:
> Can anybody tell me how I can use perl to download the postings
> in a Usenet group?

Use a nntp client. You could write one using modules like Net::NNTP,
News::NNTPClient, and related modules.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd.       | enough features yet.
NSW, Australia                      | 


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

Date: Sat, 17 Jan 1998 18:06:34 -0800
From: Preston Banzhaf <scwebREMOVE@scwebdesigns.com>
To: Colin Dixon <xvt28@dial.pipex.com>
Subject: Re: FrontPage 98
Message-Id: <34C163AA.602223B7@scwebdesigns.com>

This is a multi-part message in MIME format.
--------------BF1A00A3C3905AD555AD8B55
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Check This Site Out http://www.activestate.com

Colin Dixon wrote:

> Does anyone one have some intructions on configuring Perl to interface to
> the Web Server provided with Front Page 98



--
Sincerely,
Preston Banzhaf
SC Web Designs  <<<<<< GETTING YOU ON THE WEB AT WARP SPEED >>>>>>>

Hosting Microsoft Frontpage Extensions on NT4.0 iis3.0 Servers

http://www.scwebdesigns.com mailto:scweb@scwebdesigns.com
1.800.499.7261


--------------BF1A00A3C3905AD555AD8B55
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Preston Banzhaf
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Preston Banzhaf
n:              ;Preston Banzhaf
org:            SC Web Designs
email;internet: scwebREMOVE@scwebdesigns.com
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


--------------BF1A00A3C3905AD555AD8B55--



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

Date: Mon, 19 Jan 1998 00:54:21 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Hello... I need HELP!!!
Message-Id: <comdog-ya02408000R1901980054210001@news.panix.com>
Keywords: from just another new york perl hacker

Please read this information on how to choose a good subject for a post:
       <URL:http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post>

In article <34C18308.F5E013C2@att.net.hk>, Walter Archie <warchie@att.net.hk> posted:

>I have made this script. And I am positive that it should work I have
>gone through every bit of line and coding trying to figure out what is
>wrong. I have gone through the debugger process and all adn it seems
>fine. But when I run the script it just keep loading up the error sub.
>Could someone else help me test it? I would be very grateful. PS-Take
>the script and change it around in anyway you like... Thank you...
>
><!---Program Starts Here---!>
>#! use/perl/bin

perl helps those that help help themselves:

   #!/usr/bin/perl -w

along with checking the return values of your functions (i recommend
not die()-ing from within a subroutine, but that's just me).

using CGI.pm cures your woes from broken CGI implementations.

when that fails, easy to read code increases your chances of
free consulting.  you may want to convert all of those print
statements to use here documents.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Sun, 18 Jan 1998 21:51:19 -0600
From: "Aaron Young" <aaron@soltec.net>
Subject: MacPerl carriage returns
Message-Id: <aaron-1801982151190001@digi2-059.wwa.com>

Hello everyone

I am trying to write a client that talks to a pop server on a macintosh. 
When I send the USER command like this

USER username\n

The server seems to be timing out on me

Is there another way I should be sending the carriage return since it is
sitting on a macintosh?

If I point it at a pop server sitting on a unix box, it works

Aaron


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

Date: 19 Jan 1998 01:52:02 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl Library
Message-Id: <69ubk2$d1r$2@comdyn.comdyn.com.au>

In article <Pine.LNX.3.96.980118164512.3629A-100000@ieee.engg.uregina.ca>,
	"John R. Powell" <jpowell@*NOSPAM*ieee.engg.uregina.ca> writes:
> Where would one find sample 'database' perl scripts to be run on Linux?

Check the documentation that comes with the modules. Check the faq.
Check CPAN (http://www.perl.com/CPAN/)

> Please reply direct removing *NOSPAM*.

Don't think so. If you want email replies, remove the nospam yourself.

> Thanx,

x = ks

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In the fight between you and the world,
Commercial Dynamics Pty. Ltd.       | back the world - Franz Kafka
NSW, Australia                      | 


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

Date: Sun, 18 Jan 1998 22:04:16 -0700
From: Wei Tang <wtang@cs.ualberta.ca>
Subject: PL/SQL in Oraperl
Message-Id: <34C2DECF.5CFAE3D5@cs.ualberta.ca>

Hi, there:

I am using Oraperl for Perl4 :-<, 'cause I am not 'root'.

Could somebody tell me how to pass a PL/SQL block to Oracle in Oraperl?
I tried to pass the whole PL/SQL code as a
string. It gave me an error. I guess there must be another way to do it.

Thanks.





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

Date: Mon, 19 Jan 1998 02:06:28 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Puzzling behavior of c.l.p.* readers
Message-Id: <ebohlmanEn0Dus.61u@netcom.com>

Erik Y. Adams <erik@earthlink.net> wrote:
: >* People who try to fit Perl into their BASIC/C/whatever paradigms, and
: >have apparently looked at NO code besides their own, anywhere.  
: >"I want to see if the first character of a string is a Y.  Here's what I
: >have so far:
: >  $string = "Yes";
: >  $firstchar = substr( $string, 1, 1 );
: >  if ( $firstchar == "Y" ) || ( $firstchar == "y" ) { ...
: >but it doesn't work!  Why?"
: >
: >Sooner or later, you have to learn to use the tool you're using, no?

: Just because someone doesn't use a feature of Perl doesn't mean that
: they're doing it wrong.  All together now: there's more than one way to do
: it.  Now, not using regexps is particularly stunning, but if the code does
: what it's supposed to, who cares how it was written?

Except that the code Andy cited almost certainly *doesn't* do what it's 
supposed to.  It tests if the *second* character in the string is an 
upper- or lower-case "y," but this would *not* be immediately obvious to 
someone who's used to using a language where string indices are 1-based.



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

Date: 19 Jan 1998 02:24:57 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Puzzling behavior of c.l.p.* readers
Message-Id: <69udhp$d8g$1@comdyn.comdyn.com.au>

In article <ebohlmanEn0Dus.61u@netcom.com>,
	Eric Bohlman <ebohlman@netcom.com> writes:
> Erik Y. Adams <erik@earthlink.net> wrote:
>: >* People who try to fit Perl into their BASIC/C/whatever paradigms, and
>: >have apparently looked at NO code besides their own, anywhere.  
>: >"I want to see if the first character of a string is a Y.  Here's what I
>: >have so far:
>: >  $string = "Yes";
>: >  $firstchar = substr( $string, 1, 1 );
>: >  if ( $firstchar == "Y" ) || ( $firstchar == "y" ) { ...
>: >but it doesn't work!  Why?"
>: >
>: >Sooner or later, you have to learn to use the tool you're using, no?
> 
>: Just because someone doesn't use a feature of Perl doesn't mean that
>: they're doing it wrong.  All together now: there's more than one way to do
>: it.  Now, not using regexps is particularly stunning, but if the code does
>: what it's supposed to, who cares how it was written?
> 
> Except that the code Andy cited almost certainly *doesn't* do what it's 
> supposed to.  It tests if the *second* character in the string is an 
> upper- or lower-case "y," but this would *not* be immediately obvious to 
> someone who's used to using a language where string indices are 1-based.

Actually, not even that :) It compares the numeric value of $firstchar
to the numeric value of "Y", which is not exactly what was intended
either.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Inside every anarchy lurks an old boy
Commercial Dynamics Pty. Ltd.       | network - Mitchell Kapor
NSW, Australia                      | 


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

Date: Sun, 18 Jan 1998 23:36:46 -0500
From: Steve Ellis <sellis@vt.edu>
Subject: Question about outputting HTML w/ images
Message-Id: <34C2D84B.5B27B63E@vt.edu>

Greetings all!  Sorry to post in the wrong spot if this isn't an
appropriate question....but:

I'm trying to output an HTML page from a script.  The text parts are
just fine, but when it gets to an <IMG> tag, the browser window
(Netscape) goes black and then displays the picture.  After that, I have
to hit ESC to get away from the image, and the rest of the script is
locked up.
I'm definitely a rookie (total of 1 week as a perl user), so this may be
a simple answer.  I've searched extensively at perl.com, Sol's site,
etc. and haven't come across anything that helps (or didn't realize it
if I did).  I gather the problem is something to do with header line or
something, but don't know for sure.

What I want is a way to output a page onto the users screen (a quiz
actually, but I've got the forms part working fine now), complete with
pictures (the quiz is for anatomy and physiology and really needs
pictures).  I'm using a modified version of the Selena Sol
Multiple_Choice_3.0 script on a Win95 machine with the latest Perl32
installed.  (Incidentally, I added a password check and user
registration check if anyone wants these changes).  All hints, tips, or
recommendations would be greatly appreciated.

Please e-mail me at: sellis@vt.edu

Many thanks, in advance....Steve



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

Date: 19 Jan 1998 05:32:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Question about outputting HTML w/ images
Message-Id: <69uohj$hgt$1@client3.news.psi.net>

Steve Ellis (sellis@vt.edu) wrote on 1602 September 1993 in
<URL: news:34C2D84B.5B27B63E@vt.edu>:
++ Greetings all!  Sorry to post in the wrong spot if this isn't an
++ appropriate question....but:
++ 
++ I'm trying to output an HTML page from a script.  The text parts are
++ just fine, but when it gets to an <IMG> tag, the browser window
++ (Netscape) goes black and then displays the picture.  After that, I have
++ to hit ESC to get away from the image, and the rest of the script is
++ locked up.
++ I'm definitely a rookie (total of 1 week as a perl user), so this may be
++ a simple answer.  I've searched extensively at perl.com, Sol's site,
++ etc. and haven't come across anything that helps (or didn't realize it
++ if I did).  I gather the problem is something to do with header line or
++ something, but don't know for sure.

Of course you didn't find anything! Netscape wasn't produced by O'Reilly,
neither is Netscape written in Perl. If you have a problem getting your
images to appear on Netscape, you should search 'www.netscape.com';
probably their section of known bugs (although I do not know if they
make them available).

++ What I want is a way to output a page onto the users screen (a quiz
++ actually, but I've got the forms part working fine now), complete with
++ pictures (the quiz is for anatomy and physiology and really needs
++ pictures).

Did it cross your mind to crosspost this message in a group have
anatomy and physiology, or to rec.trivia? I guess not. And for 
perfectly good reasons. But why did you post this message to
comp.lang.perl.misc? For the same reason you shouldn't post
this message to rec.trivia, you shouldn't post it here.

Your problem seems to be with Netscape. Go to one of the many groups
related to Netscapes products, or to one of the browser groups.



Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: 19 Jan 1998 01:54:51 GMT
From: "Don" <dgoyette@NoMoreSPAMpcisys.net>
Subject: Random Access File Methods?
Message-Id: <01bd247d$3ea42a60$9d664ccf@586win95>

Hello,

Is there such a thing as random access files in CGI/PERL/Unix, without
having to buy and install a commercial database package?  By "random
access" I mean... where each record has a system-assigned record number
associated with it and any record can be "randomly" read via this record
number, instead of having to sequentially read the entire file to find a
single record.  Some form of ISAM would also be good.  Any ideas?

If there is a better newsgroup to post this question in, please provide the
address.

Thank you all!

-Don

Reply to: (dgoyette"at-sign"pcisys.net) and NOT the auto-reply address



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

Date: 19 Jan 1998 02:31:40 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Random Access File Methods?
Message-Id: <69uduc$d8g$2@comdyn.comdyn.com.au>

In article <01bd247d$3ea42a60$9d664ccf@586win95>,
	"Don" <dgoyette@NoMoreSPAMpcisys.net> writes:

> Is there such a thing as random access files in CGI/PERL/Unix, without
> having to buy and install a commercial database package?  By "random
> access" I mean... where each record has a system-assigned record number
> associated with it and any record can be "randomly" read via this record
> number, instead of having to sequentially read the entire file to find a
> single record.  Some form of ISAM would also be good.  Any ideas?

Any of the DBM modules will do something like that, most of them
through the use of Tied Hash interfaces. If you don't want
to have to pack and unpack data, you might try the MLDBM module. This
is not exactly what you need, probably, but comes close. There are
some other modules that give you these possibilities, but you'll have
to have a look at CPAN yourself to find out which ones. Go to

http://www.perl.com/CPAN/modules/00modlist.long.html

And have a look around. You might be able to find something good.
Specifically have a look at Section 7: Database Interfaces.

> Reply to: (dgoyette"at-sign"pcisys.net) and NOT the auto-reply address

No can do. If you want a reply, you will have to make sure the right
address is in your Reply-To or From field. I'm too lazy to type it.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | The gene pool could use a little
Commercial Dynamics Pty. Ltd.       | chlorine.
NSW, Australia                      | 


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

Date: 18 Jan 1998 22:02:20 -0500
From: Douglas McNaught <doug@tc.net>
Subject: Re: Random Access File Methods?
Message-Id: <m2oh19np37.fsf@ono.tc.net>

"Don" <dgoyette@NoMoreSPAMpcisys.net> writes:

> Is there such a thing as random access files in CGI/PERL/Unix, without
> having to buy and install a commercial database package?  By "random
> access" I mean... where each record has a system-assigned record number
> associated with it and any record can be "randomly" read via this record
> number, instead of having to sequentially read the entire file to find a
> single record.  Some form of ISAM would also be good.  Any ideas?

All Unix files are "random access"--they're a stream of bytes, of
which you can read and write chunks of any size at any offset.  See
the sections describing 'seek' and 'read' in the 'perlfunc' manpage.
Setting things up to behave as you specify above is just a SMOP.  ISAM
would be a bit more work.

> Reply to: (dgoyette"at-sign"pcisys.net) and NOT the auto-reply address

How about I just post to the newsgroup?

-Doug
-- 
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";


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

Date: Sun, 18 Jan 1998 22:51:39 -0500
From: "Eric Phillips" <e.phillips@mindspring.com>
Subject: Reading a .dat filefor a password
Message-Id: <69uin9$ppd@camel15.mindspring.com>


I have had some problems in the past reading a file called "users.dat" file
for a login and a password.  Here's the syntax of the users.dat file:

login|password

Could someone tell me how to read (with Perl) that users.dat file line by
line to confirm if the user is registered (login and password are correct)?
My problem in the past was that it would only read the bottom line, thus
only the user on the bottom could login.

Thanks!

--
Eric Phillips
e.phillips@mindspring.com




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

Date: Mon, 19 Jan 1998 01:31:57 +0000 (GMT)
From: Rhodri James <rhodri@wildebst.demon.co.uk>
Subject: Re: returning values out of a recursed sub
Message-Id: <480aa50318rhodri@wildebst.demon.co.uk>

In article <69r69p$mrf$1@winter.news.erols.com>,
 William Byrd <wcb4@erols.com> wrote:
> IF this is answered elsewhere, please forgive, but I need a little
> general purpose routine to collapse a variable changing all
> occourances of multiple spaces, regardless of how many into a single
> space. same goes for tabs.

You get different answers depending on exactly what that last sentence
means.  Tad McClellan has already suggested 'tr/ \011//s' in another post,
but judging from your example code this isn't quite what you want.  You
could use either:

$line ~= s/\s+/ /g; # Replace any consecutive whitespace characters with a
                    # single space.  This will do unneccessary work and
                    # also mashes newlines, but has the advantage of being
                    # pretty obvious when reading the code.

or:

$line ~= s/\t/ /g;  # Replace tabs with spaces, as you do currently.
$line ~= tr/ //s;   # Squash multiple spaces down to a single space.

> I have written this:


> $stringtocollapse="This	is    only    a                         test";
> print $stringtocollapse;
> &collapse($stringtocollapse);
> print $stringtocollapse;


> sub collapse {
> 	local ($line) = @_ if @_;
> 	print $line."\n";		#here for debugging only 
> 	$line =~ s/\t/ /gi;	#substitute spaces for tabs in line
> 	if ($line =~ m/  /i){					
> 		$line =~ s/  / /gi;	#substitute 1 space for 2
> 		&collapse($line);            #recurse this routine
> 	}	
> 	return($line);
> }

Um.  Yes.  Well.  You might have more joy with the value returned from the
sub if you assigned it to something?  Or returned it, in the case of the
recursive call?

-- 
Rhodri James  *-*  Wildebeeste herder to the masses
If you don't know who I work for, you can't misattribute my words to them

 ... Worse things happen in C


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

Date: 19 Jan 1998 02:53:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: source into binary code
Message-Id: <69uf6j$eku$2@client3.news.psi.net>

Dan Boorstein (danboo@negia.net) wrote on 1601 September 1993 in
<URL: news:34C28BCD.CA98628A@negia.net>:
++ Abigail wrote:
++ > 
++ > Dan Boorstein (danboo@negia.net) wrote on 1601 September 1993 in
++ > <URL: news:34C1AB37.2F7675C0@negia.net>:
++ > ++ Abigail wrote:
++ > ++ >
++ > ++ > Rubbish. If they want to "steal" your code, and there is an easier
++ > ++ > alternative available, they won't use your code at all.
++ > ++
++ > ++ am i reading this correctly? if they want to steal my code and there
++ > ++ is an easier alternative which they take then my security has been
++ > ++ successful, hasn't it? they have been thwarted.
++ > 
++ > Right. So, you are sitting there with your precious code, and
++ > noone buys/uses it. There are easier ways then encrypting to
++ > archieve that.
++ 
++ in your first comment above you clearly specified that i would prevent
++ people from "steal"ing my code. i agreed. now you have extrapolated from
++ there to include all who buy/use it. i now disagree. could you please
++ show the logical steps in this argument.


*sigh*

Here it goes. In tiny little, little steps. Pay attention.

Dan makes a program to do foo. Dan obscures his code.
Betty makes a program to do foo. Betty doesn't obscure her code.

Johnny wants to have a program that does foo, and possible "steal"
the code, without willing to do much effort. Now, whose code is Johnny
going to buy/use? Dan's, or Betty's?

Certainly Dan has succeeded in "protected" his code, by making it
harder to read the source than Betty's. So, why should people use
Dan's code at all?



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


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

Date: Mon, 19 Jan 1998 00:23:58 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: source into binary code
Message-Id: <34C2E36D.1C02218D@coos.dartmouth.edu>

Abigail wrote:
> 
> Dan makes a program to do foo. Dan obscures his code.
> Betty makes a program to do foo. Betty doesn't obscure her code.
> 
> Johnny wants to have a program that does foo, and possible "steal"
> the code, without willing to do much effort. Now, whose code is Johnny
> going to buy/use? Dan's, or Betty's?

Betty's.

And whose code is Johnny going to steal?  Betty's.

Which is just what Dan would want.  So, as Dan and I have already
pointed out, obscuring the code was successful.

Perhaps you should find an argument that actually proves your point.

> Certainly Dan has succeeded in "protected" his code, by making it
> harder to read the source than Betty's. So, why should people use
> Dan's code at all?

Now we're talking.

While you don't need to read the source to use the code, given the choice
I think most people would prefer to do so.  So, let's suppose a fourth
person, named Bob, who wants to use Dan's code, but does not want to steal
it.  Then he hears about Betty's code, and he realizes he wants to know what
the code is really doing before he runs it.  So he chooses Betty's code
instead.

The problem is that, while obscuring the code keeps out the bad guys, it
also turns away the good guys.

Chipmunk


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

Date: 19 Jan 1998 01:50:24 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Why does'nt this sub work
Message-Id: <69ubh0$d1r$1@comdyn.comdyn.com.au>

In article <34C281D0.2584@interworldnet.net>,
	Builders Connection <jim39@interworldnet.net> writes:

> the sub stordata in this program won't open and write to the file.

What exactly does happen? Any errors? Anything?

> but the whole program works except for that, got any Idea's.

[SNIPPED lots and lots of code]

It's too much work to try and read your code to figure out why
stordata isn't working. It's badly formatted, uses too many global
variables, which most likely should have been in hashes. You're not
saying what exactly goes wrong. Do you get an error message?

Some remarks: 

- You're not running perl with the -w flag

- You're not using strict.

- You use too many global variables, which are hard to keep track of
  and to debug.

- You use too many print statements, and should probably be using a
  here-document construction.

- You're using cgi-lib.pl, and should be using CGI.pm.

- in the line

	open(FILE, ">> $stordata")|| die ("I can't open: Database\n");

  you should include the $! variable to find out WHAT goes wrong:

	open(FILE, ">> $stordata") or die ("I can't open Database: $!");

- The only 'unix' specific thing that I see in the program on first
  glance is the use of a system call to send mail, instead of using
  one of the excellent modules that are available on CPAN. You'd
  probably be better off to write portable code.

If I had more time, I could probably point out some other things.

> Hope you like your e-mail!
> This is from Jim's wonderful box of replies!
> Remember to write back: <Jim39@interworldnet.net>

e-mail? This was a usenet posting.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd.       | clothes.
NSW, Australia                      | 


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

Date: Mon, 19 Jan 1998 01:41:32 +0000 (GMT)
From: Rhodri James <rhodri@wildebst.demon.co.uk>
Subject: Re: Why does'nt this sub work
Message-Id: <480aa5e404rhodri@wildebst.demon.co.uk>

In article <34C281D0.2584@interworldnet.net>,
 Builders Connection <jim39@interworldnet.net> wrote:
> the sub stordata in this program won't open and write to the file.
> but the whole program works except for that, got any Idea's.

Lots.  But about your script... :-)
What does $! say about it?

> #!/usr/bin/perl

Tsk.  Does adding " -w" tell you anything?

> require "cgi-lib.pl";

My understanding of CGI is limited, but I recall a few hundred posts
suggesting that cgi-lib.pl is deprecated in favour of CGI.pm (or whatever
case it's in).

Cheers!

-- 
Rhodri James  *-*  Wildebeeste herder to the masses
If you don't know who I work for, you can't misattribute my words to them

 ... Intel Outside


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 1669
**************************************

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