[14023] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1433 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 19 14:31:02 1999

Date: Fri, 19 Nov 1999 11:30:49 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <943039849-v9-i1433@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 19 Nov 1999     Volume: 9 Number: 1433

Today's topics:
        Problems with module CPAN; was: MD5 encryption <gehring.u@zdf.de>
    Re: Problems with module CPAN; was: MD5 encryption <gellyfish@gellyfish.com>
        Programming Language Comparison <tedshieh@monmouth.com>
    Re: Q: DBI.pm (odd warnings) <jeff@vpservices.com>
    Re: REgarding the "x-httpd-cgi" <mehkri@yahoo.com>
    Re: REgarding the "x-httpd-cgi" (Kragen Sitaker)
        RFC: Second German Perl-Workshop 2000 <richter@ecos.de>
    Re: Save As box... printing an image to the screen" <freddy@zepolstudios.com>
    Re: Script Effiency (Kragen Sitaker)
    Re: Serious memory leak in MacPERL? (Anno Siegel)
    Re: Setting Environment variables from a perl script <dan@tuatha.sidhe.org>
    Re: Setting Environment variables from a perl script <ggarrisonsrNOggSPAM@hotmail.com.invalid>
    Re: Setting Environment variables from a perl script <tony_curtis32@yahoo.com>
    Re: Setting Environment variables from a perl script <uri@sysarch.com>
    Re: Several Perl questions related to speed and memory  <rick.delaney@home.com>
    Re: signature question (was Re: Help with Stoopid Nutsc (Abigail)
    Re: Simple help <mcts@backwoods.org>
    Re: Simple help <tomclark@btinternet.com>
    Re: Simple help <rhardicr@mail.ford.com>
    Re: Simple help <gellyfish@gellyfish.com>
        socket programming? <bsilver@sosbbs.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 19 Nov 1999 12:19:12 +0100
From: "Uwe W. Gehring" <gehring.u@zdf.de>
Subject: Problems with module CPAN; was: MD5 encryption
Message-Id: <38353230.990DB773@zdf.de>



Gisle Aas schrieb:

> "Uwe W. Gehring" <gehring.u@zdf.de> writes:
>
> > I am running Apache on NT and build AuthFiles with htpasswd.exe which
> > uses MD5 encryption. How can I create the same strings using Perl?
> > Digest::MD5 does not create the same strings. I am using the ActiveState
> > Port of Perl 5, Build 522.
>
> Apache use an algorithm very similar to the one of in the
> Crypt::PasswdMD5 module.
>
>

While trying to install this module with the module CPAN, I encountered a lot
of errors:

First, I am instructed to install a new version of the CPAN module with

"install Bundle::CPAN"

but if I do that, the final message is:

"Couldn't find a Bundle file in \.cpan\build\CPAN-1.50\. at
C:/Perl/lib/CPAN.pm l
ine 1717"

If I try to install Crypt::PasswdMD5, I get

"Writing Makefile for Crypt::PasswdMD5
    -- OK
Running make test
   test -- NOT OK
Running make install
install: too few arguments
Try `install --help' for more information.
   install  -- NOT OK"

And if I do as advised, I get

"cpan> install --help
Warning: Cannot install --help, don't know what it is.
Try the command

    i /--help/

to find objects with similar identifiers."


Weired...



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

Date: 19 Nov 1999 11:56:45 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Problems with module CPAN; was: MD5 encryption
Message-Id: <38353afd_2@newsread3.dircon.co.uk>

Uwe W. Gehring <gehring.u@zdf.de> wrote:
> 
> 
> Gisle Aas schrieb:
> 
>> "Uwe W. Gehring" <gehring.u@zdf.de> writes:
>>
>> > I am running Apache on NT and build AuthFiles with htpasswd.exe which
>> > uses MD5 encryption. How can I create the same strings using Perl?
>> > Digest::MD5 does not create the same strings. I am using the ActiveState
>> > Port of Perl 5, Build 522.
>>
>> Apache use an algorithm very similar to the one of in the
>> Crypt::PasswdMD5 module.
>>
>>
> 
> While trying to install this module with the module CPAN, I encountered a lot
> of errors:
> 
> First, I am instructed to install a new version of the CPAN module with
> 
> "install Bundle::CPAN"
> 
> but if I do that, the final message is:
> 
> "Couldn't find a Bundle file in \.cpan\build\CPAN-1.50\. at
> C:/Perl/lib/CPAN.pm l
> ine 1717"
> 

Hoo - if this was me I would probably delete the .cpan directory and its
contents and start again from scratch ...

> If I try to install Crypt::PasswdMD5, I get
> 
> "Writing Makefile for Crypt::PasswdMD5
>     -- OK
> Running make test
>    test -- NOT OK


If you change directory to .cpan/build/Crypt-Passwd* and run 'make test'
you might get a better idea of what is going on here - It could be that
one of the modules dependecies is missing or something else but from
this it is impossible to tell.

> Running make install
> install: too few arguments

This is a message from your systems install not from CPAN - I have seen this
before - what system are you on ?  You might want to grap gnu install and
put that somewhere in your path before your real install .


> Try `install --help' for more information.
>    install  -- NOT OK"
> 
> And if I do as advised, I get
> 
> "cpan> install --help
> Warning: Cannot install --help, don't know what it is.
> Try the command
> 

Well thats because of what I said above ...

If you are having trouble with using CPAN you might try installing this
manually - read the README file in the directory I alluded to above.

/J\
-- 
"I was the chief make-up artist on the Titanic" - Tina Earnshaw, Chief
Make-Up Artist, Titanic


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

Date: Thu, 18 Nov 1999 23:11:49 -0500
From: "Ted Shieh" <tedshieh@monmouth.com>
Subject: Programming Language Comparison
Message-Id: <812i8v$re2$1@news.monmouth.com>

I have re-posted the Programming Language Comparison referred to at
http://www.perl.com/pub/1999/08/onion/talk1.html at a new location:
http://www.lmarkets.com.

BTW: I am looking for a job in California, preferably near Pasadena and with
a salary of at least $75,000 per year.

Ted




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

Date: 19 Nov 1999 04:20:09 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Q: DBI.pm (odd warnings)
Message-Id: <3834CFAF.84A48EB1@vpservices.com>

Scott Lanning wrote:
> 
> Jeff Zucker <jeff@vpservices.com> writes:
> 
> > Scott Lanning wrote:
> > > erik_lembke@my-deja.com writes:
> > > > Use of uninitialized value at (eval 21) line 18.
> > > >
> > > > (my line 18 is empty)
> > >
> > > Or so you claim! Hmmph!
> 
> > And why shouldn't we believe that claim?  The error message refers
> > to line 18 of the eval, not line 18 of the code.
> 
> Hmmph!
> You're pretty easy to persuade.

Well, sure, why shouldn't I believe line 18 is empty?  Now if he had
said his line 17 was empty, I would know he was mistaken, because as
everyone knows, any script that "doesn't work" has a bug on line 17.

-- 
Jeff


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

Date: Fri, 19 Nov 1999 05:31:02 -0800 (PST)
From: Mohammad Akram Ali Mehkri <mehkri@yahoo.com>
To: "comp.lang.perl.misc@list.deja.com" <comp.lang.perl.misc@list.deja.com>
Subject: Re: REgarding the "x-httpd-cgi"
Message-Id: <19991119133102.11776.rocketmail@web214.mail.yahoo.com>

in ur perl script 
add this line before u print any html output

print "Content-type:text/html\n\n\n";
it should solve the problem


--- Aparna Ramachandran <aparnar@imap4.asu.edu> wrote:
>  Message from the Deja.com forum: 
>  comp.lang.perl.misc
>  Your subscription is set to individual email delivery
> > 
> 
> Hi,
>   WE are trying to create a discussion borad for educational
> purposes.In doing
> so, I came up with an error during the posting of messages.The
> error is
> 
> "You have started to download the file "Myfilename.cgi" of type
> "application /x-httpd/cgi-bin".Click more info to learn about
> Navigator's
> capabilites.
> 
> More info   Pick Appl    Save File    Cancel
>  I came across your replies in one of the discussion groups in the
> web.I would
> be very grateful if you could help me out.
> 
> Regards
> Aparna
>    
>
-------------------------------------------------------------------------------
>                         APARNA RAMACHANDRAN
> 			Graduate Assistant				
> 			MATI Computing Lab
> 			Hispanic Research Center	
> 			Arizona State University
> 			Email: aparnar@asu.edu
> 			Phone: 480-965-5642(O)
> 			       480-921-0176(R)
>
-------------------------------------------------------------------------------
> 
> 
> 
> 
> 
>  _____________________________________________________________
>  Deja.com: Before you buy.
>  http://www.deja.com/
>  * To modify or remove your subscription, go to
>  http://www.deja.com/edit_sub.xp?group=comp.lang.perl.misc
>  * Read this thread at
> 
>
http://www.deja.com/thread/%3CPine.GSO.3.96.991110121944.24219B-100000%40general2.asu.edu%3E
> 
> 


=====
Mohammad Akram Ali Mehkri
System Admin 	Saehan India
Webmaster	www.prizeclub.com
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


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


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

Date: Fri, 19 Nov 1999 18:46:45 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: REgarding the "x-httpd-cgi"
Message-Id: <pWgZ3.28564$YI2.1315943@typ11.nn.bcandid.com>

In article <19991119133102.11776.rocketmail@web214.mail.yahoo.com>,
Mohammad Akram Ali Mehkri  <mehkri@yahoo.com> wrote:
>in ur perl script 
>add this line before u print any html output
>
>print "Content-type:text/html\n\n\n";
>it should solve the problem

Wrong in three ways, which is pretty amazing, considering you only
wrote four lines of text, in contrast to the amazing SIXTY-SIX LINES OF
FUCKING GARBAGE at the end of your post, including the ENTIRE MESSAGE
YOU WERE REPLYING TO, **INCLUDING** **THE** **SIGNATURE**, plus your
own rudely-long signature, plus a stupid two-line advert for your
brain-dead dejanews posting service.

The three ways are:
- The header you have included is missing a space after the :, and is
  therefore not a valid CGI header.
- The header you have included includes an extra \n which will be
  unintentionally included in the body of the response.  Not much of a
  problem for HTML; very bad for e.g. GIF.
- the problem is that the script is NOT EVEN BEING RUN, not that the
  output is incorrect.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Fri, 19 Nov 1999 06:45:16 +0100
From: Gerald Richter <richter@ecos.de>
Subject: RFC: Second German Perl-Workshop 2000
Message-Id: <3834E3EC.22E52A66@ecos.de>

[German text follows below]

We, the participants and organizers of the "First German Perl Workshop"
held in February of this year, are planning to hold a second workshop
next
year from March 8th-10th.

The aim of this workshop is the exchange of information and
experience among Perl developers.

This year the workshop took place at the GMD in Sankt Augustin, near
Bonn in Germany. This was only possible thanks to the generous support
of GMD and O'Reilly & Associates, Inc. The number of participants was
limited due to the availability of rooms. However, we had the
advantages of a personal atmosphere and the event was possible without
the need for registration fees.

We would like to organize next year's workshop under similar
conditions if possible. This means that everybody pays their own
travel, board and lodging expenses. In order to make better estimates
(for rooms and their financing), we ask seriously interested people
for a short response by November 30th to:
"ws2000-feedback@port25.com".  Please mention an amount you would
consider reasonable or acceptable as a registration fee.

Should many more people be interested in participating in our
workshop, then we would have to change the conditions to cope with the
increased organizational and financial load. This should not prevent
you from expressing your (firm) interest in participating. The main
goal of this request for comments is to find out whether we can
continue with the present form of organization or whether we need
larger rooms and more supporters.

We will gladly accept suggestions for lectures and volunteers for the
workshop preparation. The workshop will be held mainly in german,
although english presentations are also most welcome.

For those interested there is a mailing list under "perl-ws2000@gmd.de".

You can subscribe to it with an e-mail to "majordomo@gmd.de" with the
text "subscribe perl-ws2000" in the body.

More information about this year's workshop can be found at the
following
URLs :
                http://www.gmd.de/Events/Perl-WS99/
                http://alice.gmd.de/Perl-WS99/

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

Subject: RFC: Zweiter deutschsprachiger Perl-Workshop 2000

Wir, d.h. die Teilnehmer und Organisatoren des Ersten Deutschen
Perl-Workshops vom Februar diesen Jahres planen, im naechsten Jahr vom
08.
bis 10. Maerz 2000 einen zweiten solchen Workshop stattfinden zu lassen.

Das Ziel dieses Workshops war und ist der Informations- und Erfahrungs-
austausch zwischen Perl-Entwicklern.

Dieses Jahr konnte der Workshop dank Sponsoring durch die GMD sowie den
O'Reilly Verlag in den Raeumen der GMD stattfinden. Dadurch war jedoch
die
Zahl der moeglichen Teilnehmer aufgrund der vorhandenen Raeumlichkeiten
beschraenkt. Der Vorteil war dafuer, dass wir ohne Teilnahmegebuehren
ausgekommen sind.

Wir wollen den naechsten Workshop auch wieder zum Selbstkostenpreis
durchfuehren. Das heisst, jeder zahlt selbst fuer Anreise, Uebernachtung

und Verpflegung. Damit wir besser planen koennen (Raeume und ggfs. deren

Finanzierung), bitten wir ernsthafte Interessenten um eine kurze
Rueckmeldung bis zum 30.11. an ws2000-feedback@port25.com. Bitte
erwaehnt
insbesondere auch, welche Teilnehmergebuehr akzeptabel ist.

Wenn nun sehr viel mehr Leute als dieses Jahr an einem solchen Workshop
teilnehmen moechten, waechst der Organisations- und Finanzaufwand
natuerlich betraechtlich. Das soll Euch jedoch nicht davon abhalten,
Euer
(festes) Interesse zur Teilnahme kundzutun, damit wir sehen koennen, ob
wir
mit der bisherigen Organisationsform auch das naechste Mal wieder
auskommen, oder ob wir uns nach groesseren Raeumen und weiteren
Sponsoren
umschauen muessen.

Gerne nehmen wir auch Vortragsvorschlaege und Angebote zur Mitarbeit bei

den Vorbereitungen an. Die Sprache des Workshop wird in Deutsch sein,
es sind aber auch englische Vorträge möglich. Fuer ernsthaft
Interessierte
gibt es eine Mailingliste unter perl-ws2000@gmd.de, in die sie sich
mittels
einer E-Mail an majordomo@gmd.de mit dem Text "subscribe perl-ws2000" im

Body eintragen koennen.

Weitere Informationen ueber den diesjaehrigen Workshop sind in Wort und
Bild :-) unter den folgenden Adressen zu finden:

 http://www.gmd.de/Events/Perl-WS99/
 http://alice.gmd.de/Perl-WS99/


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

Date: Thu, 18 Nov 1999 20:49:53 -0600
From: Freddy <freddy@zepolstudios.com>
Subject: Re: Save As box... printing an image to the screen"
Message-Id: <3834BAD1.74D1C59E@zepolstudios.com>

it sounds like you're using the script as the image itself..
ie. img src="/cgi-bin/imagescript.pl"
I don't think there's any way around that unless you generate the entire
page using perl and just call the images normally.
ie if
($solution="1"){$image="one.jpg"}
($solution="2"){$image="two.jpg"}
then use those in an image tag or something..

hope this helps..

-Freddy



Slim wrote:

> Hey!
>
> I just made a script that will get an image and print it out to the
> screen...
> when I choose save as to save the image the  name of the image will be
> the script name... is there a way to make it say the real name of the
> image in the save as box"
>
> thanks...
> -Slim-

--
Alfredo Lopez Jr.
 ------------------------------
Zepol Studios
Illustration|Design|Multimedia
http://www.zepolstudios.com
 ------------------------------




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

Date: Fri, 19 Nov 1999 18:42:06 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Script Effiency
Message-Id: <2SgZ3.28551$YI2.1315535@typ11.nn.bcandid.com>

In article <slrn83ae1l.1ug.tadmc@magna.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>On Wed, 17 Nov 1999 17:47:14 -0800, Steven Lybeck <alanis@softhome.net> wrote:
>>There are a few things that
>>could be done more efficiently. Like when you are reading the file, you can
>>take out the entire "while ($person=<ALUMNI>) {}" loop and do exactly the
>>same thing with "@people = <ALUMNI>;"
>
>   1) that is _less_ (memory) efficient, not more efficient.

Can you elucidate?  Do you mean because it builds the whole list before
storing it in @people, thus using twice as much memory, or something
else?

It is probably more time-efficient.

>   2) they do NOT do exactly the same thing.

True, if @people already has something in it.  push @people, <ALUMNI>
would do exactly the same thing.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 19 Nov 1999 10:18:34 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Serious memory leak in MacPERL?
Message-Id: <81385q$61r$1@lublin.zrz.tu-berlin.de>

Tom Sheppard <sheppard@magma.ca> wrote in comp.lang.perl.misc:
>In article <810r3u$49g$1@lublin.zrz.tu-berlin.de>,
>anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
>
>> You can preallocate hash space by assigning the estimated number of
>> keys to the keys() function:
>> 
>>   keys( %hash) = 1000;
>> 
>> assigns 1024 buckets (the next power of two) to %hash.
>
>Thanks. I'll try that and see if it helps. I should be doing another build
>of the database this weekend.

Oh, and of course you can always tie the hash to a disk database, which
would rid you of all memory woes at the cost of run time.  Though I
must admit that I am not at all certain about the status of the DB*
modules in MacPerl.  One would expect that at least one of them has
been ported.  If you have the choice, I'd recommend DB_File.

Anno


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

Date: Fri, 19 Nov 1999 18:23:55 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Setting Environment variables from a perl script
Message-Id: <%AgZ3.1710$Pj3.4058@news.rdc1.ct.home.com>

bj <bradw@newbridge.com> wrote:
> ps123@my-deja.com writes:

>> Hi,
>> 
>> I would like to set a user-defined environment variable from a
>> perl script, and export it to the parent shell (I am converting a shell
>> script to a perl script). Can someone tell me as to how I can achieve
>> it?

> 1) source a shell wrapper script that calls your perl program
> 2) have the program write a shell appropriate tmpfile
> 3) have the wrapper script source this tmpfile

You forgot:

4) Run on VMS

					Dan


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

Date: Fri, 19 Nov 1999 04:56:40 -0800
From: ggarrison <ggarrisonsrNOggSPAM@hotmail.com.invalid>
Subject: Re: Setting Environment variables from a perl script
Message-Id: <11f733ec.768e13f1@usw-ex0102-009.remarq.com>

Throw the guy a bone Man!  In cron - execute a shell script (which will
load the environment) which executes your perl script.  Done!
In article <lrvh6zl9by.fsf@yoda.wg.waii.com>, Art Haas
<arthur.haas@westgeo.com> wrote:
> ps123@my-deja.com writes:
> > Hi,
> >
> > I would like to set a user-defined environment variable from a
> > perl script, and export it to the parent shell (I am converting
> a shell
> > script to a perl script). Can someone tell me as to how I can
> achieve
> > it?
> >
> > I have tried the following and they have not worked:
> >
> > system(export ENV_VAR=VALUE);  -- perl aborts with the message
> that it
> >                                   cannot find the object 'export'
> > $ENV{ENV_VAR}=VALUE; -- the value is set, but not visible in the
> parent
> >                         shell
> >
> Short answer - you can't do what you're trying to do. See perlfaq8.
> --
> ###############################
> # Art Haas
> # (713) 689-2417
> ###############################



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: 19 Nov 1999 14:39:24 +0100
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Setting Environment variables from a perl script
Message-Id: <831z9m4n3n.fsf@vcpc.univie.ac.at>

Re: Re: Setting Environment variables from a perl
script, ggarrison
<ggarrisonsrNOggSPAM@hotmail.com.invalid> said:

ggarrison> Throw the guy a bone Man!  In cron -
ggarrison> execute a shell script (which will load
ggarrison> the environment) which executes your perl
ggarrison> script.  Done!

This isn't what was wanted.  Yo could invoke the
perl program from a shell script but what's the
point?  perl can manage its own environment.

>> you can't do what you're trying to do. See
>> perlfaq8.

This answer is correct.  The child's environment
does not affect its parent upon termination.

tony


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

Date: 19 Nov 1999 13:54:57 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Setting Environment variables from a perl script
Message-Id: <x7u2mipb0d.fsf@home.sysarch.com>

>>>>> "DS" == Dan Sugalski <dan@tuatha.sidhe.org> writes:

  DS> You forgot:

  DS> 4) Run on VMS

i forgot vms. period.

:-)

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Fri, 19 Nov 1999 04:38:14 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Several Perl questions related to speed and memory use
Message-Id: <3834D455.81C2CE91@home.com>

[posted & mailed]

HIS Newsgroups wrote:
> 
> I am developing a Perl script (5.00503 on NT) that processes many lines of
> text. I am looking into ways to speed it up.

Then you will want to determine where it's slow.

perldoc perlfaq3

    How do I profile my Perl programs?

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 19 Nov 1999 12:07:51 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: signature question (was Re: Help with Stoopid Nutscrape (Netscape))
Message-Id: <slrn83b4m1.l1a.abigail@alexandra.delanet.com>

John McNamara (jmn.ac.delete@abanet.it) wrote on MMCCLXX September
MCMXCIII in <URL:news:=vYzOCo=h4C4KzBxKaXHLLf5olLP@4ax.com>:
== 
== The regex (and Abagail) are discussed in Chapter 10 of Andrew L.
== Johnson's Book. In Section 10.6.1 "Prime number regex".
== 
== Try  http://www.manning.com/Johnson/


Hmmm, I wonder if they send me a copy of the book then.
Probably not, times seem to have changed.


Abigail
-- 
tie $" => A; $, = " "; $\ = "\n"; @a = ("") x 2; print map {"@a"} 1 .. 4;
sub A::TIESCALAR {bless \my $A => A} #  Yet Another silly JAPH by Abigail
sub A::FETCH     {@q = qw /Just Another Perl Hacker/ unless @q; shift @q}


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Thu, 18 Nov 1999 23:03:03 -0500
From: MC <mcts@backwoods.org>
Subject: Re: Simple help
Message-Id: <3834CBF7.EF241FC0@backwoods.org>

Sheesh, talk about slick and compact. I love it. Im gonna try that technique in
my latest program, which also takes a data file and dumps it into a hash.

Thanks

MC

Larry Rosler wrote:
> 
> In article <81221a$ak$1@uranium.btinternet.com> on Thu, 18 Nov 1999
> 23:27:27 -0000, Tom Clark <tomclark@btinternet.com> says...
> > Was wondering if some kind soul could help me.
> 
> 'Kind' is my middle name (not!).
> 
> > Am trying to write a Perl script that will extract data from a text file and
> > present it in a new one.
> >
> > The (beginning of the) original file from which the data has to extracted
> > looks like this:
> >
> > A0: Astronomy - Advanced
> >   S6300 Professor Alethia Williams
> >     9901770 Cory Peterson                  56
> >     9911224 Frances Fowler                51
> >     9920645 Sarah Watt                      59
> >     9921786 Henry Peterson                72
> >     9925656 William Peterson              62
> >
> > The lines with numbers that begin 99 are records of students taking the
> > course unit (its fairly self-explanatory).
> >
> > I need to extract all the lines with students (ignoring the lines with the
> > teachers and the unit title), and put this into a text file that looks like
> > this:
> >
> >     9901770 Cory Peterson
> >     9911224 Frances Fowler
> >     9920645 Sarah Watt
> >     9921786 Henry Peterson
> >     9925656 William Peterson
> 
> I would use a regex instead of all those column numbers.  Read 'perlre'
> or a regex tutorial for explanations.
> 
> Here is the code, less all the file manipulations.  (BTW, include $! in
> all those excellent file-open-error diagnostics.)  As you can see, the
> data collection takes exactly one line of code.  :-)
> 
> #!/usr/local/bin/perl -w
> use strict;
> 
> my %students;
> 
> / 99(\d{5}) (.+?)  / and $students{$1} = $2 while <DATA>;
> 
> while (my ($id, $name) = each %students) {
>     print "99$id\t$name\n";
> }
> __END__
> A0: Astronomy - Advanced
>   S6300 Professor Alethia Williams
>     9901770 Cory Peterson                  56
>     9911224 Frances Fowler                51
>     9920645 Sarah Watt                      59
>     9921786 Henry Peterson                72
>     9925656 William Peterson              62
> B1: Bowling - Advanced
>   S6300 Professor Jack Nicklaus
>     9901770 Cory Peterson                  56
>     9911224 Frances Fowler                51
>     9920645 Sarah Watt                      59
>     9921787 Henry James                   72
>     9925656 William Petersen              62
> 
> Note that the last time an ID is found is the name that sticks, if they
> are different (Peterson => Petersen).
> 
> > Its adapted from another program written by someone else.  I'm no Perl
> > genius - as I'm sure is apparent!.  I understand pretty much what's going
> > on - its just selecting the right bits of the lines that is eluding me.  The
> > file (ultimately) is going to put the students data into an 'insert into'
> > command in SQL.
> 
> Then presumably you don't care what order the output list is.  As shown,
> it will be essentially random.  But there are ways to sort it, if that
> matters.
> 
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com

-- 
--==[ Šetroit to the SuperBowl ]==--

Time is nature's way of keeping
everything from happening at once


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

Date: Fri, 19 Nov 1999 00:44:47 -0000
From: "Tom Clark" <tomclark@btinternet.com>
Subject: Re: Simple help
Message-Id: <81314i$og3$1@neptunium.btinternet.com>

Guys,

Even with your help, I'm foundering in my own ineptitude.  I've tried
cutting and pasting all the code that has been posted and have got nowhere.
:((

I dunno if this is my own incompetence (I suspect that it is!) or something
that I'm missing.  In case its important I'm using Win98...

Any further assistance much appreciated.

Tom
Stirling, Scotland

MC <mcts@backwoods.org> wrote in message
news:3834CBF7.EF241FC0@backwoods.org...
> Sheesh, talk about slick and compact. I love it. Im gonna try that
technique in
> my latest program, which also takes a data file and dumps it into a hash.
>
> Thanks
>
> MC
>
> Larry Rosler wrote:
> >
> > In article <81221a$ak$1@uranium.btinternet.com> on Thu, 18 Nov 1999
> > 23:27:27 -0000, Tom Clark <tomclark@btinternet.com> says...
> > > Was wondering if some kind soul could help me.
> >
> > 'Kind' is my middle name (not!).
> >
> > > Am trying to write a Perl script that will extract data from a text
file and
> > > present it in a new one.
> > >
> > > The (beginning of the) original file from which the data has to
extracted
> > > looks like this:
> > >
> > > A0: Astronomy - Advanced
> > >   S6300 Professor Alethia Williams
> > >     9901770 Cory Peterson                  56
> > >     9911224 Frances Fowler                51
> > >     9920645 Sarah Watt                      59
> > >     9921786 Henry Peterson                72
> > >     9925656 William Peterson              62
> > >
> > > The lines with numbers that begin 99 are records of students taking
the
> > > course unit (its fairly self-explanatory).
> > >
> > > I need to extract all the lines with students (ignoring the lines with
the
> > > teachers and the unit title), and put this into a text file that looks
like
> > > this:
> > >
> > >     9901770 Cory Peterson
> > >     9911224 Frances Fowler
> > >     9920645 Sarah Watt
> > >     9921786 Henry Peterson
> > >     9925656 William Peterson
> >
> > I would use a regex instead of all those column numbers.  Read 'perlre'
> > or a regex tutorial for explanations.
> >
> > Here is the code, less all the file manipulations.  (BTW, include $! in
> > all those excellent file-open-error diagnostics.)  As you can see, the
> > data collection takes exactly one line of code.  :-)
> >
> > #!/usr/local/bin/perl -w
> > use strict;
> >
> > my %students;
> >
> > / 99(\d{5}) (.+?)  / and $students{$1} = $2 while <DATA>;
> >
> > while (my ($id, $name) = each %students) {
> >     print "99$id\t$name\n";
> > }
> > __END__
> > A0: Astronomy - Advanced
> >   S6300 Professor Alethia Williams
> >     9901770 Cory Peterson                  56
> >     9911224 Frances Fowler                51
> >     9920645 Sarah Watt                      59
> >     9921786 Henry Peterson                72
> >     9925656 William Peterson              62
> > B1: Bowling - Advanced
> >   S6300 Professor Jack Nicklaus
> >     9901770 Cory Peterson                  56
> >     9911224 Frances Fowler                51
> >     9920645 Sarah Watt                      59
> >     9921787 Henry James                   72
> >     9925656 William Petersen              62
> >
> > Note that the last time an ID is found is the name that sticks, if they
> > are different (Peterson => Petersen).
> >
> > > Its adapted from another program written by someone else.  I'm no Perl
> > > genius - as I'm sure is apparent!.  I understand pretty much what's
going
> > > on - its just selecting the right bits of the lines that is eluding
me.  The
> > > file (ultimately) is going to put the students data into an 'insert
into'
> > > command in SQL.
> >
> > Then presumably you don't care what order the output list is.  As shown,
> > it will be essentially random.  But there are ways to sort it, if that
> > matters.
> >
> > --
> > (Just Another Larry) Rosler
> > Hewlett-Packard Laboratories
> > http://www.hpl.hp.com/personal/Larry_Rosler/
> > lr@hpl.hp.com
>
> --
> --==[ Šetroit to the SuperBowl ]==--
>
> Time is nature's way of keeping
> everything from happening at once




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

Date: Fri, 19 Nov 1999 09:12:16 +0000
From: Richard H <rhardicr@mail.ford.com>
Subject: Re: Simple help
Message-Id: <38351470.F70B8CAF@mail.ford.com>

Tom Clark wrote:
> 
> Guys,
> 
> Even with your help, I'm foundering in my own ineptitude.  I've tried
> cutting and pasting all the code that has been posted and have got nowhere.
> :((
> 
> I dunno if this is my own incompetence (I suspect that it is!) or something
> that I'm missing.  In case its important I'm using Win98...
> 
> Any further assistance much appreciated.
> 
<snip>

What you need more expliciity I guess is Larry's code with:

> > > #!/usr/local/bin/perl -w
> > > use strict;
> > >
> > > my %students;

open(DATA, "mydatafile") or die "cant open my file $!";

> > >
> > > / 99(\d{5}) (.+?)  / and $students{$1} = $2 while <DATA>;
> > >

close DATA;
open(OUTPUT, ">myoutputfile") or die "cant open output  $!";

> > > while (my ($id, $name) = each %students) {
> > >     print "99$id\t$name\n";

change to :
print OUTPUT "99$id\t$name\n";

> > > }

close OUTPUT;

Any clearer?

Richard H


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

Date: 19 Nov 1999 09:32:08 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Simple help
Message-Id: <38351918_1@newsread3.dircon.co.uk>

[ You will notice that I have gone to some lengths to restore some sense
to the quoting in this thread. Please put quoted material above your reply ]

In comp.lang.perl.misc Tom Clark <tomclark@btinternet.com> wrote:
> MC <mcts@backwoods.org> wrote in message
> news:3834CBF7.EF241FC0@backwoods.org...
>> Larry Rosler wrote:
>> >
>> > #!/usr/local/bin/perl -w
>> > use strict;
>> >
>> > my %students;
>> >
>> > / 99(\d{5}) (.+?)  / and $students{$1} = $2 while <DATA>;
>> >
>> > while (my ($id, $name) = each %students) {
>> >     print "99$id\t$name\n";
>> > }
>> > __END__
>> > A0: Astronomy - Advanced
>> >   S6300 Professor Alethia Williams
>> >     9901770 Cory Peterson                  56

<snip data>

>> >
>>
>> Sheesh, talk about slick and compact. I love it. Im gonna try that
> technique in
>> my latest program, which also takes a data file and dumps it into a hash.
>>
>>
> Even with your help, I'm foundering in my own ineptitude.  I've tried
> cutting and pasting all the code that has been posted and have got nowhere.
> :((
> 
> I dunno if this is my own incompetence (I suspect that it is!) or something
> that I'm missing.  In case its important I'm using Win98...
> 

Both the examples that have been posted here have used the DATA filehandle
that reads from the stuff after the __END__ in a Perl program file - you
will need to open the file and use that filehandle of course.  If you are
still having problems perhaps you might post the actual code you are using.

/J\
-- 
"I want to be like Oprah" - Sarah, Duchess of York


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

Date: Fri, 19 Nov 1999 01:44:41 -0500
From: "Bart Silverstrim" <bsilver@sosbbs.com>
Subject: socket programming?
Message-Id: <812rku$479$1@usenet01.srv.cis.pitt.edu>

Hello,

I'm new to network programming, and am attempting to make a network server
in PERL that will accept a connection over TCP/IP, get a chunk of text to
process, and send a response with the results (unless the command is to exit
the connection).

I had it to a point where it looked like it was working if I telnetted in
and manually entered the commands.  The thing is that now I'm working on the
windows client part, and the Windows side (written in VB5 with Winsock) is
acting up; I can get it to connnect and process the first time, but the
second time it just sits there, and it acts like it's not getting a response
from the PERL server.  I have to kill the daemon and restart the process to
re-enable it.  I have posted the winsock code and aske dfor help from the
comp.lang.basic.visual.misc group, but I also wondered if it was a problem
from the PERL side.  I am new to this, and would greatly appreciate any help
anyone can give...
Here's some fo the network code in the PERL daemon:
***************
# Loop until we get interrupted...
until ($DieNow) {

 # Create the socket to listen to or error out
 $Server = IO::Socket::INET->new(LocalPort => 1000,
     Proto     => "tcp",
     Type      => SOCK_STREAM,
     Reuse     => 1,
     Listen    => 0 )
 or die "Couldn't be a tcp server on port 1000 : $@\n";

 # Each iteration through the loop will keep this variable
 # Clean.
 # Note: this is to kill the connection, not exit the Daemon
 $ExitNow = 0;

 # While able to accept data from the stream,...
 while ($Client = $Server->accept()) {

  # The routine to get data from the remote client
  while($ExitNow != 1){

   # Clean up the variable
   $text = "";
   $Func = "";
   $TestExit = "";

   # Set the temp variable equal to stream data
   $text = <$Client>;

   # Eliminate carriage returns, etc.
   chomp($text);
******* Parser stuff chopped
********* below is what is outside the parser at the end of the loop we set
up above
   # Send this to the client for bidirectional
   # Info over the socket
   print $Client @GlobalArray1;

  }

  # Close the server handle explicitly
  close($Server);
# I put this in for troubleshooting; I seem to be missing the mark still...
close($Client);
 }
********
End of networking portion


After attempting to use the Windows client twice, this is what Netstat says:
*******
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp       19      0 katana.helpme.com:1000  broadsw.winclient.com:1264
ESTABLISHED
tcp        0      0 katana.helpme.com:1000  broadsw.winclient.com:1262
CLOSE_WAIT





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

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 1433
**************************************


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