[17080] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4492 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 2 14:07:12 2000

Date: Mon, 2 Oct 2000 11:05:19 -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: <970509919-v9-i4492@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 2 Oct 2000     Volume: 9 Number: 4492

Today's topics:
        (read) function query... <stephen@bcl.com>
    Re: (read) function query... (Clay Irving)
    Re: (read) function query... <philipg@atl.mediaone.net>
    Re: (read) function query... <jeff@vpservices.com>
    Re: Add on nobull@mail.com
    Re: Arrogant kid takes on huge group of programmers (wa <kperrier@blkbox.com>
    Re: benefits of arrays over hashes(associative arrays)  (Randal L. Schwartz)
    Re: benefits of arrays over hashes(associative arrays)  <bart.lateur@skynet.be>
    Re: CGI script to enter info into MySql database (Rafael Garcia-Suarez)
    Re: CGI script to enter info into MySql database <tward10@jaguar.com>
    Re: CGI script to enter info into MySql database <michael.segulja@sgi-lsi.com>
        Correctie: Bijeenkomst Amsterdam Perl Mongers, Dinsdag  (Johan Vromans)
        create JavaScipt source file with perl <nospam@jillanddirk.com>
    Re: create JavaScipt source file with perl <jeff@vpservices.com>
    Re: DBI.pm for MySQL & Perl 5 kellymartin@my-deja.com
    Re: How to get length of scalar? (David H. Adler)
    Re: How to get length of scalar? <nospam@david-steuber.com>
    Re: How to realize new or malloc in perl nobull@mail.com
    Re: Is this is Regexp bug? <glynFOOdwr@FSCKdeleteEmeD.co.uk>
    Re: Just Another Perl Hacker <yanick@babyl.sympatico.ca>
    Re: Module Install on Solaris 8? <kperrier@blkbox.com>
    Re: moving files and chmod via perl <bmb@ginger.libs.uga.edu>
    Re: moving files and chmod via perl nobull@mail.com
    Re: multiple file scoping <bmb@ginger.libs.uga.edu>
        multiple search and replace looking for a better way  <hillr@ugsolutions.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 02 Oct 2000 17:38:38 +0100
From: Steve Howe <stephen@bcl.com>
Subject: (read) function query...
Message-Id: <JrnYOWF4=IyHP6Kuo1Ebpmr1suJF@4ax.com>

        while ($Bytes = read($File_Handle,$Buffer,1024)) {

This, I need explained.. from any kind clever people out there..

trying to use a file-upload script. Using the script itself is fine,
but I am trying to manipulate the script so that I can replace the
automatically generated "$File_Handle" with an artificially generated
(Ie one written in by me) variable such as this:

(using a windows operating system as client and linux operating system
as cgi server)

$File_Handle="C:\\$operator\\digsig.jpg";

I've tried this, but the read function seems not to appreciate me
meddling with the script I obtained from a prewritten site.

Anyone know the proper format for the $File_Handle path to have
please?

Thank you sincerely in advance for any replies.

Steve Howe


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

Date: 2 Oct 2000 16:57:24 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: (read) function query...
Message-Id: <slrn8thfjk.4np.clay@panix2.panix.com>

On Mon, 02 Oct 2000 17:38:38 +0100, Steve Howe <stephen@bcl.com> wrote:

>        while ($Bytes = read($File_Handle,$Buffer,1024)) {
>
>This, I need explained.. from any kind clever people out there..

perldoc -f read

-- 
Clay Irving <clay@panix.com>
The truth is out there? Anyone knows the URL? 


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

Date: Mon, 02 Oct 2000 17:23:41 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: (read) function query...
Message-Id: <xw3C5.9775$jJ4.2378350@typhoon.southeast.rr.com>

Steve Howe <stephen@bcl.com> wrote in message
news:JrnYOWF4=IyHP6Kuo1Ebpmr1suJF@4ax.com...
>         while ($Bytes = read($File_Handle,$Buffer,1024)) {
>
> This, I need explained.. from any kind clever people out there..
>
> trying to use a file-upload script. Using the script itself is fine,
> but I am trying to manipulate the script so that I can replace the
> automatically generated "$File_Handle" with an artificially generated
> (Ie one written in by me) variable such as this:
>
> (using a windows operating system as client and linux operating system
> as cgi server)
>
> $File_Handle="C:\\$operator\\digsig.jpg";
>
> I've tried this, but the read function seems not to appreciate me
> meddling with the script I obtained from a prewritten site.
>
> Anyone know the proper format for the $File_Handle path to have
> please?

The problem is that you're trying to use a file name where you should be
using a file handle.  Get the filehandle first with open(), then use it in
read().
perldoc -f open

hth
p




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

Date: Mon, 02 Oct 2000 10:33:41 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: (read) function query...
Message-Id: <39D8C6F5.68FA5AE2@vpservices.com>

Philip Garrett wrote:
> 
> Steve Howe <stephen@bcl.com> wrote in message
> news:JrnYOWF4=IyHP6Kuo1Ebpmr1suJF@4ax.com...
> >         while ($Bytes = read($File_Handle,$Buffer,1024)) {
> >
> > This, I need explained.. from any kind clever people out there..
> >
> > trying to use a file-upload script. Using the script itself is fine,
> > but I am trying to manipulate the script so that I can replace the
> > automatically generated "$File_Handle" with an artificially generated
> > (Ie one written in by me) variable such as this:
> >
> > (using a windows operating system as client and linux operating system
> > as cgi server)
> >
> > $File_Handle="C:\\$operator\\digsig.jpg";
> >
> > I've tried this, but the read function seems not to appreciate me
> > meddling with the script I obtained from a prewritten site.
> >
> > Anyone know the proper format for the $File_Handle path to have
> > please?
> 
> The problem is that you're trying to use a file name where you should be
> using a file handle.  Get the filehandle first with open(), then use it in
> read().
> perldoc -f open


And the other problem is that you are trying, from the server side to
specify a file to upload from the client side.  Would you really want to
program in a language that allowed you to do that?

-- 
Jeff


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

Date: 02 Oct 2000 18:23:59 +0100
From: nobull@mail.com
Subject: Re: Add on
Message-Id: <u9aecngnrk.fsf@wcl-l.bham.ac.uk>

kily@my-deja.com writes:

> Subject: Add on

Huh?  Nonsense subject line!

> I'm wondering for a script which can read a file
> containing two columns seperated by unknown number of tabulation or
> space, then delete the first column (which is a complete name of
> unsers). The second column is the user-ID as: 008253A, 008256X,...etc.
> I want script to be able to delete the first two charecters and
> transform majuscule (A, X, B,...etc) to minuscules ones.

perl -pe 's/.*\s+..(.*)/\L$1/' <infile >outfile


> PS: I'm workong under Windows NT Server 4.

Oh, then command line may not work:

#!perl -p
s/.*\s+..(.*)/\L$1/

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 02 Oct 2000 11:02:06 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: Arrogant kid takes on huge group of programmers (was Re: How to  get length of scalar?)
Message-Id: <E42F45CB38B5EE60.2C24BABE46E79AFB.B2830543A602CD3E@lp.airnews.net>

Brad Baxter <bmb@ginger.libs.uga.edu> writes:

> Don't feel that you have to answer EVERY comment/attack that comes along.  
> Sometimes it's better to simply let the water run off your back like a
> duck.  It also makes you look smarter. :-)

Its better to let people think that you are a fool than to open your 
mouth and remove all doubt.

Kent
-- 
Only two things are infinite, the universe and human stupidity, and I'm
not sure about the former.

						-- Albert Einstein


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

Date: 01 Oct 2000 23:25:34 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: benefits of arrays over hashes(associative arrays) and vice versa
Message-Id: <m13difoj35.fsf@halfdome.holdit.com>

>>>>> "Godzilla!" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

Godzilla!> It's an inside joke between Randall and myself.

The traditional meaning of "inside joke" is that the parties involved
(that'd be you and me) share some information that the rest of the
world does not share, and that makes the public communication (your
Usenet post) funnier to the parties involved, while the rest of the
world cannot participate.

I'm not laughing.  So, what meaning of "inside joke" did you intend
here?

Maybe you meant "inside bad joke" or "inside joke that bombed" or
something like that.

"Dying is easy.  Getting the laugh, that's hard!"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Mon, 02 Oct 2000 18:01:09 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: benefits of arrays over hashes(associative arrays) and vice versa
Message-Id: <t4jhtscdbipjr66h290dvd8cdvohecf1ot@4ax.com>

Cameron Elliott wrote:

>Can someone tell me which is better to use?
>I cant see the point of a hash except to store something by reference to a
>name which is possible to do through creative uses of arrays anyway.

You like looking up names by hand, do you?

Hashes are only intended to do a fast lookup, with an easy syntax, of
uniques names, and  finding the corresponding data. For example, this
implements a quick HTML encoder:

	%encode = ( '&' => '&amp;', '<' => '&lt;', '>' => '&gt;');
	foreach (@lines) {
	    s/([&<>])/$encode{$1}/g;
	}

Now, tell me how your creative solution with arrays can:

 * be so concise in the code it needs
 * work remotely as fast

Hashes are handy.

-- 
	Bart.


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

Date: Mon, 02 Oct 2000 15:09:16 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: CGI script to enter info into MySql database
Message-Id: <slrn8th9li.qbl.rgarciasuarez@rafael.kazibao.net>

Michael Segulja wrote in comp.lang.perl.misc:
>I am building a very simple (I mean VERY simple) help desk system for
>my company.  It's basically an excersice for me to learn Perl.  I have
>a MySql database created with one table.  I created a web page with
>fields to enter first and last name, phone extension, and a description
>of the problem.  My table has the following fields (not showing syntax
>here, just what fields are in the database):
>
>       id INT(4) AUTO_INCREMENT
>       FirstName VARCHAR(15)
>       LastName VARCHAR(25)
>       PHONE INT(4)
>       PROBLEM text
>
>My perl script has the following code:
>
>   # Connect to the database.
>   my $dbh = DBI->connect("DBI:mysql:database=$db;host=$host",
>        $user, $password, {RaiseError => 1} );
>   # Insert data into table hdInfo
>   my $sth=$dbh->prepare("INSERT INTO hdInfo
>                        VALUES (?,?,?,?,?)" );
>   $sth->execute('1',$firstname,$lastname,$phone,$problem) ||
>die "failed";
>$sth->finish();
>   #Disconnect from database.
>   $dbh->disconnect();
>
>The $firstname, $lastname, etc. variables come from the webpage form.
>I can succesfully connect to the database and enter the data into the
>fields based on what is entered on the form.  My problem is that I had
>to enter a '1' in my cgi script for the first id field in the database,
>even though I have it set as AUTO_INCREMENT.  I don't know how to write
>my Perl code so that the id field increments each time a record is
>stored in the database, and the rest of the fields are filled out
>according to the variables gotten from the webpage form.

This is more a MySQL question than a perl question.
Your INSERT statement should be rewritten as:
  INSERT INTO hdInfo (FirstName,LastName,PHONE,PROBLEM) VALUES (?,?,?,?)
You can then remove the '1' parameter from your $sth->execute()
statement. The value of the autoincremented id can then be retrieved with:
  my $id = $dbh->{'mysql_insertid'};
which is MySQL-specific.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Mon, 2 Oct 2000 16:26:21 +0100
From: "Trevor Ward" <tward10@jaguar.com>
Subject: Re: CGI script to enter info into MySql database
Message-Id: <8ra9et$2602@eccws12.dearborn.ford.com>

Well can point you in the right direction but not the correct syntax for
MySql.

You have to define all fields being updated tus you have to inform the
database that you are adding data into this autoincrement field.

so where you are defining your 5 ? use the field names and find the syntax
to create the next number in the list.

hope this helps but SQL problem

Michael Segulja <michael.segulja@sgi-lsi.com> wrote in message
news:8ra7el$lcu$1@nnrp1.deja.com...
> I am building a very simple (I mean VERY simple) help desk system for
> my company.  It's basically an excersice for me to learn Perl.  I have
> a MySql database created with one table.  I created a web page with
> fields to enter first and last name, phone extension, and a description
> of the problem.  My table has the following fields (not showing syntax
> here, just what fields are in the database):
>
>        id INT(4) AUTO_INCREMENT
>        FirstName VARCHAR(15)
>        LastName VARCHAR(25)
>        PHONE INT(4)
>        PROBLEM text
>
> My perl script has the following code:
>
>    # Connect to the database.
>    my $dbh = DBI->connect("DBI:mysql:database=$db;host=$host",
>         $user, $password, {RaiseError => 1} );
>    # Insert data into table hdInfo
>    my $sth=$dbh->prepare("INSERT INTO hdInfo
>                         VALUES (?,?,?,?,?)" );
>    $sth->execute('1',$firstname,$lastname,$phone,$problem) ||
> die "failed";
> $sth->finish();
>    #Disconnect from database.
>    $dbh->disconnect();
>
> The $firstname, $lastname, etc. variables come from the webpage form.
> I can succesfully connect to the database and enter the data into the
> fields based on what is entered on the form.  My problem is that I had
> to enter a '1' in my cgi script for the first id field in the database,
> even though I have it set as AUTO_INCREMENT.  I don't know how to write
> my Perl code so that the id field increments each time a record is
> stored in the database, and the rest of the fields are filled out
> according to the variables gotten from the webpage form.
>
> Can somebody help me out?  I really appreciate any advice and/or help.
>
> Thanks,
>
> Michael Segulja
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Mon, 02 Oct 2000 16:49:43 GMT
From: Michael Segulja <michael.segulja@sgi-lsi.com>
Subject: Re: CGI script to enter info into MySql database
Message-Id: <8raeb4$rit$1@nnrp1.deja.com>

Thank you SO much for your help. That was exactly it.  I knew it must
be simple, but I wasn't sure if it was a MySql question or Perl.
Thanks for clarifing that.


Thanks again,

Michael


In article <slrn8th9li.qbl.rgarciasuarez@rafael.kazibao.net>,
  rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> Michael Segulja wrote in comp.lang.perl.misc:
> >I am building a very simple (I mean VERY simple) help desk system for
> >my company.  It's basically an excersice for me to learn Perl.  I
have
> >a MySql database created with one table.  I created a web page with
> >fields to enter first and last name, phone extension, and a
description
> >of the problem.  My table has the following fields (not showing
syntax
> >here, just what fields are in the database):
> >
> >       id INT(4) AUTO_INCREMENT
> >       FirstName VARCHAR(15)
> >       LastName VARCHAR(25)
> >       PHONE INT(4)
> >       PROBLEM text
> >
> >My perl script has the following code:
> >
> >   # Connect to the database.
> >   my $dbh = DBI->connect("DBI:mysql:database=$db;host=$host",
> >        $user, $password, {RaiseError => 1} );
> >   # Insert data into table hdInfo
> >   my $sth=$dbh->prepare("INSERT INTO hdInfo
> >                        VALUES (?,?,?,?,?)" );
> >   $sth->execute('1',$firstname,$lastname,$phone,$problem) ||
> >die "failed";
> >$sth->finish();
> >   #Disconnect from database.
> >   $dbh->disconnect();
> >
> >The $firstname, $lastname, etc. variables come from the webpage form.
> >I can succesfully connect to the database and enter the data into the
> >fields based on what is entered on the form.  My problem is that I
had
> >to enter a '1' in my cgi script for the first id field in the
database,
> >even though I have it set as AUTO_INCREMENT.  I don't know how to
write
> >my Perl code so that the id field increments each time a record is
> >stored in the database, and the rest of the fields are filled out
> >according to the variables gotten from the webpage form.
>
> This is more a MySQL question than a perl question.
> Your INSERT statement should be rewritten as:
>   INSERT INTO hdInfo (FirstName,LastName,PHONE,PROBLEM) VALUES
(?,?,?,?)
> You can then remove the '1' parameter from your $sth->execute()
> statement. The value of the autoincremented id can then be retrieved
with:
>   my $id = $dbh->{'mysql_insertid'};
> which is MySQL-specific.
>
> --
> # Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
>


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


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

Date: 02 Oct 2000 12:55:40 +0200
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Correctie: Bijeenkomst Amsterdam Perl Mongers, Dinsdag 3 Oktober 2000
Message-Id: <wl3bsx3v7f7.fsf@plume.nl.compuware.com>

[English version follows the dutch text]

Dit bericht is eerder gepost met een foutieve datum. De juiste datum
is dindsag 3 oktober.
Excuses voor het ongemak. 
 
Amsterdam.pm staat voor de "Amsterdamse Perl Mongers", een groep van
gebruikers van Perl. In tegenstelling tot wat de naam suggereert is
Amsterdam.pm niet beperkt tot alleen Amsterdam, maar functioneert, tot
er meer gebruikersgroepen in Nederland zijn, als Nederlandse
gebruikersgroep.
 
Amsterdam.pm organiseert informele bijeenkomsten waar Perl gebruikers
kunnen samenkomen en informatie en gebruikservaringen met betrekking
tot Perl kunnen uitwisselen. Deze bijeenkomsten vinden normaliter
plaats op elke eerste dinsdag van de maand. De voertaal binnen
Amsterdam.pm is in pricipe Nederlands, maar indien nodig zal Engels
worden gebruikt, b.v. om te communiceren met niet-Nederlandssprekende
aanwezigen.
 
De eerstvolgende bijeenkomst vindt plaats op dinsdag 3 oktober 2000 van   
20:00 tot 22:00 uur op het kantoor van Dijkmat, Sarfatistraat 708,
Amsterdam. Deze bijeenkomst onder meer:

 - verslag van de YAPC::Europe in Londen
 - voortgang planning YAPC::Europe 2001, in Nederland
 - laatste nieuws over Perl6
 - en een heleboel Perl gezelligheid

Voor meer details, waaronder een routebeschrijving, zie 
http://www.amsterdam.pm.org/Meetings/next_meeting.html

Liefhebbers van een etentje vooraf kunnen tussen 17:45 en 18:15
verzamelen bij Dijkmat. Om 18:15 (écht om 18:15!) zoeken we een
restaurantje in de buurt om een hapje te eten.
 
Bezoek onze Web site http://www.Amsterdam.pm.org voor meer details.
 
[English version]
 
This article was originally posted with a wrong date. The correct date
is Tuesday, October 3rd.
Sorry for the inconvenience. 

Amsterdam.pm stands for the Amsterdam Perl Mongers. We're basically a
Perl user group. Despite its name, it is not local to the Amsterdam
environment, but it welcomes Perl mongers from all over the
Netherlands.
 
Amsterdam.pm organises informal meetings where Perl users can meet,
and exchange information and experiences with regard to using Perl.
The meetings are normally held every first Tuesday of the month.
Although the preferred language for communication is Dutch, English
will be spoken if necessary.
 
Our next meeting is Tuesday October 3rd, 2000, from 20:00 till 22:00  
at the office of Dijkmat, Sarfatistraat 708, Amsterdam. This meeting
will have:

 - report on the YAPC::Europe in Londen
 - planning YAPC::Europe 2001, in the Netherlands
 - latest news about Perl6
 - and lots of Perl fun

See http://www.amsterdam.pm.org/Meetings/next_meeting.html for
more detail and the directions to get there.

Should you want to join some of us for dinner, please gather between
17:45 and 18:15 at Dijkmat. At 18:15 sharp we'll leave for a
restaurant somewhere nearby for dinner.

See http://www.Amsterdam.pm.org for more details.


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

Date: Mon, 2 Oct 2000 12:35:10 -0400
From: "dirk" <nospam@jillanddirk.com>
Subject: create JavaScipt source file with perl
Message-Id: <8radfn$hhg$1@merrimack.Dartmouth.EDU>

In order to pass variable from a CGI script to JavaScript I thought of
using an external source file (*.js). In this file I can store variables
from my CGI script that can be accessed by JavaScript.

Has anyone done this and does it work? If so is their an example available
that I can have a look at? I know how to read a *.js file with javascript
but do not know enough to write a *.js file with perl.

Thanks for any help,

Dirk Koppers




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

Date: Mon, 02 Oct 2000 10:35:12 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: create JavaScipt source file with perl
Message-Id: <39D8C750.70882C7F@vpservices.com>

dirk wrote:
> 
> In order to pass variable from a CGI script to JavaScript I thought of
> using an external source file (*.js). In this file I can store variables
> from my CGI script that can be accessed by JavaScript.
> 
> Has anyone done this 

Yes.

> and does it work? 

Yes.

> If so is their an example available
> that I can have a look at? I know how to read a *.js file with javascript
> but do not know enough to write a *.js file with perl.

There is absolutely no mystery. Figure out what you want the .js file to
look like and have Perl print it.  As far as Perl goes, it is just
printing another file so whatever questions you might have about the
process have to do with JavaScript and should be asked in a JavaScript
related newsgroup.  (unless, of course you do not know how to print a
file in Perl, in which case, try any introductory tutorial or book and
feel free to come back here if you  have problems with that part of it).

-- 
Jeff


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

Date: Mon, 02 Oct 2000 15:15:34 GMT
From: kellymartin@my-deja.com
Subject: Re: DBI.pm for MySQL & Perl 5
Message-Id: <8ra8qg$mid$1@nnrp1.deja.com>

In article <YmYB5.1549$Qu1.137482@news000.worldonline.dk>,
  Anders Lund <anders@wall.alweb.dk> wrote:
> kellymartin@my-deja.com wrote:
>
> > Can someone please help me? Ideally, if you could send me a DBI.pm
> > binary for i386 linux and tell me where to put it (assuming that I
> > only need one file).
>
> Go to http://rpmfind.net and see if there is a rpm for it from the
> same source that your perl came from (your dist?).
>
> On my Mandrake system, the package is perl-DBI-1.13-2mdk.rpm (it's
> perl 5.6)

Wow, that was easy - I found the i386 binary, thanks for the
suggestion! I've also bookmarked that site for future use...


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


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

Date: 2 Oct 2000 17:03:52 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: How to get length of scalar?
Message-Id: <slrn8thfvo.4s3.dha@panix2.panix.com>

On Mon, 02 Oct 2000 12:38:40 GMT, Brendon Caligari
<bcaligari@my-deja.com> wrote:

>In the good old days of BBSes we had a lot of technical forums.
>Most threads used to decay into lame conversations, and being
>a closely knit community (I live on an island) messages such
>as "managed to crack problem such and such...where are we
>going for a binge?" were not uncommon.  We had a board set
>up specifically for transferrign such threads.....conveniently
>named "Idle chatter".  Something like alt.perl.culture would
>be nice... <sigh>

And here I thought that was what your local Perl Mongers list was
for... :-)

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"You can lead a bigot to water, but if you don't tie him up, you can't
make him drown." - The Psychodots


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

Date: Mon, 02 Oct 2000 17:44:53 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: How to get length of scalar?
Message-Id: <m34s2vyw6j.fsf@solo.david-steuber.com>

Drew Simonis <simonis@myself.com> writes:

' c.l.p is a dead NG, and has been that way for a very long time.
' The fact that it is still active is a shame on the many news admins
' out there who haven't removed it yet.

I'll unsubscribe from it then.  If it is dead, it probably doesn't
propagate well.  Not without some green gas or Worcestershire sauce
poured on it.

' I wouldn't post to alt.perl either.

I'll trim my headers next time I see it there.

I take it this group would prefer _not_ to have xposts?  If so, I will
make sure that I do not xpost here.  In leu of an answer, I will cease
that practice now.

In the "how long is a piece of string?" catagory, what does the length
function do with scalers that are references?  Will it return the
numerical length of the address of the referenced item if it were
expressed the way Perl returns these things?

-- 
David Steuber | Perl apprentice, Apache/mod_perl user,
NRA Member    | and general Internet web wannabe.
ICQ# 91465842
***         http://www.david-steuber.com/          ***


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

Date: 02 Oct 2000 18:33:18 +0100
From: nobull@mail.com
Subject: Re: How to realize new or malloc in perl
Message-Id: <u98zs7gnc1.fsf@wcl-l.bham.ac.uk>

i0519@my-deja.com writes:

>   I want to new some object in perl.

To explicity create new ARRAYs or HASHs respectively use [] or {}
respectively.  You can also use autovivification - simply use a scalar
lvalue in a context that implies it contains an ARRAYref or a HASHref
and a new ARRAY or HASH will automagically be created.

For more complex objects call a constructor method (conventionally
named "new").

For details perlref/Making References

>   Could andbody please give me some advice?

Read manuals.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 2 Oct 2000 18:19:23 +0100
From: "Glyndwr" <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Subject: Re: Is this is Regexp bug?
Message-Id: <xq3C5.8841$L12.172580@news2-win.server.ntlworld.com>

"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:3d3htsklu2ndu94i9ub6ghdo6ru4pdtdc3@4ax.com...
> Glyndwr wrote:
> >> You forgot a backslash in front of the '@'.
> >
> >I didn't think '@' was a metacharacter in regexps? Mind you, I always
have
> >trouble remembering what is and isn't a metacharacter...
> >/me digs out Perl Bookshelf CD
> >"The list of metacharacters is: \ | ( ) [  {  ^ $ * + ? ."
> >
> >So, possibly not that.
>
> Not exactly... regexes are interpolated as double quotish strings.

Hmm, yes, OK. I shall try it.
(two minutes later)
Well, it doesn't stop my test script working, either. I'll try it on the
webserver next time I talk to my friend.

> Guess what. I tried your pattern, and it works (under 5.6). That is
> surprising: it shouldn't have worked.

Yes, I think that's why it worked OK for me but not my friend.

>Well, you forgot a anchoring '$'
> at the end.

Fair point.

> And remove the hyphen between 'z' and 'A'.

Oops. Spot the typo.

> But a backslash in front of the '@' definitely doesn't hurt.

Thanks.

--
                                           -=G=-
print join " ",reverse split /\s+/,'hacker. Perl another Just',"\n";
Web: http://www.fscked.co.uk                             ICQ: 66545073




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

Date: Mon, 02 Oct 2000 15:11:48 GMT
From: Yanick Champoux <yanick@babyl.sympatico.ca>
Subject: Re: Just Another Perl Hacker
Message-Id: <UA1C5.310484$1h3.7341183@news20.bellglobal.com>

amonotod <amonotod@netscape.net> wrote:
: In article <m1bsx731f9.fsf@halfdome.holdit.com>,
:   merlyn@stonehenge.com (Randal L. Schwartz) wrote:
:> >>>>> "Graham" == Graham Wood <graham.wood@iona.com> writes:
:>
:> Graham> It obviously isn't infinite or you wouldn't have finished
: reading it.
:>
:> Nor would I have finished writing it. :)
:>
: In the hope that it may be appendable, I submit:

: $_="074117115116032097110111116104101114".
: "032080101114108032104097099107101114044";
: for ($i=0; $i < length(); ($i+=3))
: { print chr(substr($_, $i, 3)); }

If it can appended, can it also be golfed?

$_="074117115116032097110111116104101114".
"032080101114108032104097099107101114044";
print map chr, /.../g;

Joy,
Yanick

-- 
($_,$y)=('Yhre lo  .kePnarhtretcae',     '(.) (.)');
$y=~s/\(/(./gwhile s/$y/$2$1/xg;print #      @ 
                                      #    `---'


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

Date: 02 Oct 2000 11:09:34 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: Module Install on Solaris 8?
Message-Id: <021741285830A9BA.B9A196203B176E6A.56E4A25B0FB071E9@lp.airnews.net>

Patrick Durusau <pdurusau@emory.edu> writes:

> Hello,
> 
> I am running gcc version 2.95.2 on a Solaris 8 box and cannot get
> several Perl modules to compile.
> 
> HTML-Parser-3.13, for example returns:
> 
> cc -c   -xO3 -xdepend     -DVERSION=\"3.13\"  -DXS_VERSION=\"3.13\"
> -KPIC -I/usr
> /perl5/5.00503/sun4-solaris/CORE -DMARKED_SECTION Parser.c
> cc: unrecognized option `-KPIC'
> cc: language depend not recognized
> 
> Similar errors from other modules. I have a symbolic link from gcc to
> cc.
> 
> I have compiled apache and qmail today so I don't think it is a problem
> with the compiler.
> 
> Suggstions, comments?

The version of perl that comes with Sol8 was compiled with Sun Workshop, not
gcc.  The compiler options are being taken from the ones that were used to
compile perl.

At one time there was a post that listed the files that you could change so
that you can use the Sol8 default perl and compile new modules with gcc.
Perhaps a search through deja can lead you to it.

Kent
-- 
Al Gore is a risky scheme.


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

Date: Mon, 2 Oct 2000 11:06:01 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: moving files and chmod via perl
Message-Id: <Pine.A41.4.21.0010021104120.14510-100000@ginger.libs.uga.edu>

On Mon, 2 Oct 2000, pete wrote:

> Hi,
> 
> I'm looking for the perl commands which moves a file to another directory to
> be followed by a chmod to stop people from reading/writing/executing the
> file.
> This must be done within a perl script.
> Thanks for any response.
> 
> Bye,
> Pete

Where have you looked?

perldoc -f chmod
perldoc File::Copy

Brad



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

Date: 02 Oct 2000 18:36:17 +0100
From: nobull@mail.com
Subject: Re: moving files and chmod via perl
Message-Id: <u97l7rgn72.fsf@wcl-l.bham.ac.uk>

"pete" <pete@alphanetcoms.co.uk> writes:

> I'm looking for the perl commands which moves a file to another
> directory

The Perl rename function is rename().

This only works if the old and new directories are on the same
filesystem.

To move between filesystems use the move() function from the
File::Copy module.

> to
> be followed by a chmod to stop people from reading/writing/executing the
> file.

In Perl the chmod function has the obvious name.


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

Date: Mon, 2 Oct 2000 11:12:03 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: multiple file scoping
Message-Id: <Pine.A41.4.21.0010021106560.14510-100000@ginger.libs.uga.edu>

On Mon, 2 Oct 2000, Bruce Schiller wrote:

> Is there a way to use lexical variables (my declarations) across multiple
> files or am I restricted to using fully qualified global declarations
> using local?  I want to use strict vars.
> 
> The way I interpreted the docs I thought this might work:
> 
> {
>     my $var;
>     require 'afile.pl';
>     ...
> }
> 
> but the $var in afile.pl is still different from this one.
> 

The short answer is no.  This is a Good Thing.  You may find the why's and
the how's in the following:

         perlmod             Perl modules: how they work
         perlmodlib          Perl modules: how to write and use

Brad



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

Date: Mon, 02 Oct 2000 09:40:49 -0700
From: Ron Hill <hillr@ugsolutions.com>
Subject: multiple search and replace looking for a better way 
Message-Id: <39D8BA90.C4148C70@ugsolutions.com>

Hello,

I have this script which searches and replaces chars. This does work but
I was wondering is there a better way?
Thanks

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

while (<main::DATA>)  {
print "before processing: $_";
  s/\&/\&#38/g || s/</\&lt\;/g || s/\"/\&quot\;/g || s/>/\&gt\;/g;
print "After processing:$_";
}


__END__
&&&&this is a test
<this is a test<<<<
""""this is a test""
>this is>>>a>test>



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

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


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