[19041] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1236 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 3 14:05:39 2001

Date: Tue, 3 Jul 2001 11:05:14 -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: <994183514-v10-i1236@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 3 Jul 2001     Volume: 10 Number: 1236

Today's topics:
        Announce: ICFP programming contest <damien.doligez@inria.fr>
    Re: array of arrays of arrays <pne-news-20010703@newton.digitalspace.net>
    Re: array of arrays of arrays <Graham.T.Wood@oracle.com>
    Re: arrays in XS... (Anno Siegel)
    Re: FAQ 9.15:   How do I decode a CGI form? newbie ?s (Tad McClellan)
    Re: FAQ Multidimensional Arrays <mjcarman@home.com>
    Re: FAQ Multidimensional Arrays <Graham.T.Wood@oracle.com>
        Generating Image Thumbnail Files <bobbitt@nortelnetworks.com>
        Gtk or Tk or ? <newspost@coppit.org>
    Re: Havin' some trouble with sockets... <uri@sysarch.com>
        hideen fields <loboaguia@yahoo.com>
    Re: hideen fields (Droogie)
    Re: hideen fields <loboaguia@yahoo.com>
    Re: hideen fields <ab496@chebucto.ns.ca>
    Re: hideen fields <loboaguia@yahoo.com>
    Re: How can I convert decimals to binary and binary to  <joeybach@hotmail.com>
        How can I convert decimals to binary and binary to deci <joeybach@hotmail.com>
    Re: How can I convert decimals to binary and binary to  (Anno Siegel)
    Re: How can I convert decimals to binary and binary to  (Villy Kruse)
    Re: How can I convert decimals to binary and binary to  <ren@tivoli.com>
        How I came to love Perl... <lmoran@wtsg.com>
        How to upgrade to newest (stable) version of Perl? (new <Athera@yahoo.com>
    Re: lvalue functions nobull@mail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 3 Jul 2001 15:37:49 GMT
From: Damien Doligez <damien.doligez@inria.fr>
Subject: Announce: ICFP programming contest
Message-Id: <9hsosd$lq6$1@ites.inria.fr>

We are pleased to announce:

                         The Fourth Annual

                     ICFP PROGRAMMING CONTEST

                         July 26-29, 2001

             http://cristal.inria.fr/ICFP2001/prog-contest/

Convinced your favorite programming language provides unbeatable
productivity?  Convinced you and your friends are world-class programmers?

If so, we're providing you the opportunity to prove it! We are pleased
to announce the Fourth Annual ICFP Programming Contest to be held in
conjunction with the 2001 International Conference on Functional
Programming (ICFP 2001). All programmers are invited to enter the
contest, either individually or in teams; we especially encourage
students to enter.  You may use any programming language (or
combination of languages) to show your skill.

On Thursday, July 26, 2001 at 15:00 UTC, we will publish a challenge
task on the Web site and by e-mail to registered participants.  Teams
will have until Sunday, 29 July 2001, 15:00 UTC (72 hours) to
implement a program to perform this task and submit it to the contest
judges.  We've designed the contest for direct, head-to-head
comparison of language technology and programming skill.  We have a
range of prizes for the winners: cash awards, special student prizes,
and, of course, unlimited bragging rights.

For more information about the contest, prizes, and registration,
point your browser to:

   http://cristal.inria.fr/ICFP2001/prog-contest/

For more information about ICFP 2001, see:

   http://cristal.inria.fr/ICFP2001/


-- 
Damien Doligez, Luc Maranget, Pierre Weis


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

Date: Tue, 03 Jul 2001 15:40:02 +0200
From: Philip Newton <pne-news-20010703@newton.digitalspace.net>
Subject: Re: array of arrays of arrays
Message-Id: <vdi3ktote86camul7gi5tbe9a3sdfbdrcu@4ax.com>

On 03 Jul 2001 11:34:53 GMT, alexvalara@aol.com (Alexvalara) wrote:

> I have the following data structure: @A=(@B,@C...), where @B=(@B1,@B2),
>  @C=(@C1,@C2).
> How can i store an element in @B1

    $B1[42] = 'content';

> and how can i print the content of that array?

    print "@B1";  # prints the elements space-separated[1]

However, you probably want something else. If you have the following:

    @B1 = ('a', 'b', 'c');
    @B2 = ('x', 'y', 'z');
    @C1 = ('A', 'B', 'C');
    @C2 = ('X', 'Y', 'Z');
    @B  = (@B1, @B2);
    @C  = (@C1, @C2);
    @A  = (@B,  @C);

then the contents of @A will be

    ('a', 'b', 'c', 'x', 'y', 'z', 'A', 'B', 'C', 'X', 'Y', 'Z')

-- that is, you won't be able to tell which element came from which
original array, because the arrays were 'flattened' into one list. (Or,
put a little differently, Perl isn't Python.) You'll almost certainly
want to learn about references; instead of storing an array's elements
in another array, store a reference to the array. The documents perlref,
perllol, and perldsc should be helpful. In this example:

    @B1 = ('a', 'b', 'c');
    @B2 = ('x', 'y', 'z');
    @C1 = ('A', 'B', 'C');
    @C2 = ('X', 'Y', 'Z');
    @B  = (\@B1, \@B2);
    @C  = (\@C1, \@C2);
    @A  = (\@B,  \@C);

Now you can access the 'z' as $A[0]->[1]->[2] (or $A[0][1][2], if you
prefer). You can add an element onto the end of @B1, using only @A, like
this:

    push @{$A[0][0]}, 'd';

Hope this helps.

Cheers,
Philip    

[1] Actually, $"-separated.
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Tue, 03 Jul 2001 16:11:10 +0100
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: array of arrays of arrays
Message-Id: <3B41E08E.2E8C10FC@oracle.com>

This is a multi-part message in MIME format.
--------------13EFB6A0985BBF08C27BC774
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit



Alexvalara wrote:

> I have the following data structure: @A=(@B,@C...), where @B=(@B1,@B2),
>  @C=(@C1,@C2).
> How can i store an element in @B1 and how can i print the content of that
> array?

Use references to prevent the array structures from being flattened.  See
perldoc perldsc for how.

Graham Wood


--------------13EFB6A0985BBF08C27BC774
Content-Type: text/x-vcard; charset=UTF-8;
 name="Graham.T.Wood.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Graham Wood
Content-Disposition: attachment;
 filename="Graham.T.Wood.vcf"

begin:vcard 
n:;Graham
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:Graham.T.Wood@oracle.com
fn:Graham Wood
end:vcard

--------------13EFB6A0985BBF08C27BC774--



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

Date: 3 Jul 2001 14:02:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: arrays in XS...
Message-Id: <9hsj8q$op0$2@mamenchi.zrz.TU-Berlin.DE>

According to Jim Lewis  <jrl@ast.cam.ac.uk>:
> Anno Siegel wrote:
> 
> > According to Jim Lewis  <jrl@ast.cam.ac.uk>:
> > > Hi,
> > >
> > > Consider the following:
> > >
> > > a C subroutine...
> > >
> > > extern int aaa(char *a[]) {
> > > .
> > > .
> > > .
> > > }
> > >
> > > How do I write the interface .xs routine so that I can call this from
> > > perl using:
> > >
> > > $returnval = &aaa(\@array);
> >
> > What have you tried?
> >
> > Anno
> 
> So far nothing much.  Just doing
> 
> int
> cir_test(yuk)
>     char ** yuk
> 
>     CODE:
>         RETVAL = cir_test(yuk);
>     OUTPUT:
>         RETVAL
> 
> fails with an error like 'unable to call XS_unpack_charPtrPtr'

Well, you will have to do more than that, at least for the input
parameter.  Supposing you want to call the function with a Perl
array of strings "cir_test( @strings)",  you will have to extract
the actual string addresses from the AV and put them together in
a char **.  See perlguts for how to deal with an AV and how to
get at the real string from the contained SVs.

Also note that Perl strings aren't necessarily terminated with
'\0', so if cir_test expects that, you'll have to take care of
that yourself.

Since the return value is an integer, XS knows how to deal with
that.  Your code should be fine in that respect.

Anno



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

Date: Tue, 3 Jul 2001 08:38:33 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: FAQ 9.15:   How do I decode a CGI form? newbie ?s
Message-Id: <slrn9k3f69.a1j.tadmc@tadmc26.august.net>

Jason Goodrow <@opencity.com> wrote:

[ there is an attribution missing here...]

>> I don't follow. A beginner's instinct says to write your own function
>> rather than use an already written-reviewed-debugged function?
>>
>> I would think that beginners would want to write less code, not more...
>
>Just to explain - I'm a newbie/hobbiest and none of my coding is mission
>critical. I enjoy programming and plan to keep learning.


>Hopefully this isn't flame-bait.


Heavens no.

It is just that the overwhelming majority of posters are using
Perl "on the job", so advice tends to take that into account.

If you are in "learning mode" rather than "production mode", you
should probably just mention that you are not in the "default mode",
then post away.

:-)


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 03 Jul 2001 07:47:13 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: FAQ Multidimensional Arrays
Message-Id: <3B41BED1.79F16E2C@home.com>

"J.D. Fieldsend" wrote:
> 
> Is it possible to use multidimensional arrays in Perl?

Not directly, but you can emulate them (and any other arbitrarily
complex data structure) using references. There is a ton of info on
doing this sort of thing in the standard docs. Take a look at the
perldsc, perllol, perlref, and perlreftut manpages.

-mjc


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

Date: Tue, 03 Jul 2001 16:46:23 +0100
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: FAQ Multidimensional Arrays
Message-Id: <3B41E8CF.B61F7A60@oracle.com>

This is a multi-part message in MIME format.
--------------6B555C3C31F53C41110FADEE
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit



"J.D. Fieldsend" wrote:

> Is it possible to use multidimensional arrays in Perl?

Yes.  You use array references to prevent perl from "flattening" your
arrays into one long one.  See perldoc perldsc for details. (I have a
strange feeling of deja vu!)

Graham Wood


--------------6B555C3C31F53C41110FADEE
Content-Type: text/x-vcard; charset=UTF-8;
 name="Graham.T.Wood.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Graham Wood
Content-Disposition: attachment;
 filename="Graham.T.Wood.vcf"

begin:vcard 
n:;Graham
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:Graham.T.Wood@oracle.com
fn:Graham Wood
end:vcard

--------------6B555C3C31F53C41110FADEE--



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

Date: Tue, 3 Jul 2001 11:33:45 -0400
From: "Mike Bobbitt" <bobbitt@nortelnetworks.com>
Subject: Generating Image Thumbnail Files
Message-Id: <9hsond$c4f$1@bcarh8ab.ca.nortel.com>

Hello.

I have a PERL CGI that I'd *really* like to generate image thumbnails for
me. (It's for an uploadable photo gallery, so I have to keep manually
generating new thumbnails each time someone uploads a pic.) I've done a fair
amount of searching, and so far, I haven't been able to find any way to do
this, except from scratch (which seems like a big job).

If anyone has any hints or pearls of wisdom on this, I'd greatly appreciate
it!

Thanks




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

Date: Tue, 3 Jul 2001 10:09:32 -0400
From: David Coppit <newspost@coppit.org>
Subject: Gtk or Tk or ?
Message-Id: <Pine.SUN.4.33.0107031004470.2698-100000@mamba.cs.Virginia.EDU>

Can anyone say a couple words comparing Gtk and Tk? I'm looking for a
cross-platform GUI toolkit, and I find Tk a bit ugly. Tk's been around
a while, but Gtk development has been pretty rapid the past couple
years. Has Gtk's widgets, documentation, and support "caught up" to
Tk?

Also, I see Curses, Gimp, Gnome, Glade, QT, and other directories in
CPAN's user interfaces category. Are these other good alternatives, or
are Tk and Gtk pretty much the best out there?

Thanks,
David



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

Date: Tue, 03 Jul 2001 13:59:09 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Havin' some trouble with sockets...
Message-Id: <x7u20u5d1t.fsf@home.sysarch.com>

>>>>> "KR" == Kevin Reid <kpreid@attglobal.net> writes:

  >> $socket = IO::Socket::INET->new("10.0.0.218:518") || die "Couldn't
  >> open printer : $!\n";

  KR> Also, IO::Socket::INET->new requires arguments in key-value form:

not if there is only one argument and it is in the form of host:port. it
is a documented short cut.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Tue, 03 Jul 2001 15:17:11 +0100
From: Luis <loboaguia@yahoo.com>
Subject: hideen fields
Message-Id: <6uk3kts9r4glbqkiv2u3kl5uhkiql0p1st@4ax.com>


Hi people,


 How do I get the information of a HIDDEN FIELD?
 
 The problem is the following:
 
 I send a request from the SHTML to the CGI. 
 The answer is a query of two columns.
 I want to capture the two columns the user will mark.
 
 All this in inside a form.
 
 Could anyone, please, give a help?
 
 Thamks.
 
 Luis Augusto


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

Date: Tue, 03 Jul 2001 16:01:22 GMT
From: Ireally@dontthinkso.com (Droogie)
Subject: Re: hideen fields
Message-Id: <3b41e950.14170763@reading.news.pipex.net>

do you mean <INPUT TYPE="hidden" ....  ?
if so it should operate just like any other <INPUT>.

I always include in the HTML:

NAME="something" within <INPUT> and use a <FORM METHOD= "POST" ...> 

then within the recieving perl script use:

        while(<STDIN>) {
                %INPUT = split /[&=]/, $_ ;
        }

The hash (%INPUT) then contains the inputted form data (hidden fields
as well)
sooooo ...... if I had a <INPUT TYPE="hidden" NAME="hiddenfield"
VALUE="splodge"> tag within my form, after submission I could access
the value of "splodge" with $INPUT{hiddenfield}

if this isn't what you're getting at, re-post the query and we'll have
another look.
Hope that helps

Cheers

Andy

On Tue, 03 Jul 2001 15:17:11 +0100, Luis <loboaguia@yahoo.com> wrote:

>
>Hi people,
>
>
> How do I get the information of a HIDDEN FIELD?
> 
> The problem is the following:
> 
> I send a request from the SHTML to the CGI. 
> The answer is a query of two columns.
> I want to capture the two columns the user will mark.
> 
> All this in inside a form.
> 
> Could anyone, please, give a help?
> 
> Thamks.
> 
> Luis Augusto



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

Date: Tue, 03 Jul 2001 17:20:52 +0100
From: Luis <loboaguia@yahoo.com>
Subject: Re: hideen fields
Message-Id: <q3s3ktsl5fejcpda81otenmjf6f3khrqtp@4ax.com>


Hi,

<td width="50%"><!-- #exec cgi="listaramo.pl"--><span
id="a1"></span><font color="#0000FF">*</font>
	</td>

	<input type="hidden" name="Ramo" value = "$ramo">
	<input type="hidden" name="Tipo" value = "$tipo">

This is my problem.
At the moment my DBI is not working. How can I assign a value to $ramo
and  $tipo to test the <input ...>?

Thanks

Luis Augusto




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

Date: Tue, 3 Jul 2001 14:29:01 -0300
From: "Daniel A. Johnson" <ab496@chebucto.ns.ca>
To: Luis <loboaguia@yahoo.com>
Subject: Re: hideen fields
Message-Id: <Pine.GSO.3.95.iB1.0.1010703142401.8514B-100000@halifax.chebucto.ns.ca>


Hi Luis,

If you want to add a value from your html code then you could simply
replace the variable names with real values. i.e.:

 	<input type="hidden" name="Ramo" value = "some value">

Otherwise in your script prior to generating the form page simply assign a
value to the variables with a command like:

my $ramo = "some value";

- Dan

P.S. The "my", above, is used as I am assuming that you "use strict;" at
the beginning of your script.

----------------------------------------------------------------------------
email     : booner@tkc.bilby.com
Home Page : http://tkc.bilby.com/~booner/

Voice Line : (902) 455-9677
-----------------------------------------------------------------------------

On Tue, 3 Jul 2001, Luis wrote:

> 
> Hi,
> 
> <td width="50%"><!-- #exec cgi="listaramo.pl"--><span
> id="a1"></span><font color="#0000FF">*</font>
> 	</td>
> 
> 	<input type="hidden" name="Ramo" value = "$ramo">
> 	<input type="hidden" name="Tipo" value = "$tipo">
> 
> This is my problem.
> At the moment my DBI is not working. How can I assign a value to $ramo
> and  $tipo to test the <input ...>?
> 
> Thanks
> 
> Luis Augusto
> 
> 
> 
> 



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

Date: Tue, 03 Jul 2001 18:38:50 +0100
From: Luis <loboaguia@yahoo.com>
Subject: Re: hideen fields
Message-Id: <pj04kt8nk6nnupmrafd0j080qsf9o0ubvs@4ax.com>


Hi Dan,

I would better explain me a little better.

From the SHTML we will call a CGI that will return the result of query
with 4 columns. Three of them will be displayed.
Depending on the user selection I want to assign the value of two of
those columns to two variables, this part, I think, will have to be
made on the SHTML.

If you could help me I would appreciate.

Thanks,

Luis

On Tue, 3 Jul 2001 14:29:01 -0300, "Daniel A. Johnson"
<ab496@chebucto.ns.ca> wrote:

>
>Hi Luis,
>
>If you want to add a value from your html code then you could simply
>replace the variable names with real values. i.e.:
>
> 	<input type="hidden" name="Ramo" value = "some value">
>
>Otherwise in your script prior to generating the form page simply assign a
>value to the variables with a command like:
>
>my $ramo = "some value";
>
>- Dan
>
>P.S. The "my", above, is used as I am assuming that you "use strict;" at
>the beginning of your script.
>
>----------------------------------------------------------------------------
>email     : booner@tkc.bilby.com
>Home Page : http://tkc.bilby.com/~booner/
>
>Voice Line : (902) 455-9677
>-----------------------------------------------------------------------------
>
>On Tue, 3 Jul 2001, Luis wrote:
>
>> 
>> Hi,
>> 
>> <td width="50%"><!-- #exec cgi="listaramo.pl"--><span
>> id="a1"></span><font color="#0000FF">*</font>
>> 	</td>
>> 
>> 	<input type="hidden" name="Ramo" value = "$ramo">
>> 	<input type="hidden" name="Tipo" value = "$tipo">
>> 
>> This is my problem.
>> At the moment my DBI is not working. How can I assign a value to $ramo
>> and  $tipo to test the <input ...>?
>> 
>> Thanks
>> 
>> Luis Augusto
>> 
>> 
>> 
>> 



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

Date: Tue, 03 Jul 2001 17:26:37 GMT
From: "joeybach" <joeybach@hotmail.com>
Subject: Re: How can I convert decimals to binary and binary to decimals? ---Yup I got it
Message-Id: <20010703.133520.188213258.8795@stink.cfl.rr.com>

Thanks for the advice, I found out how to do it right after I posted.



In article <slrn9k3q8l.24n.vek@pharmnl.ohout.pharmapartners.nl>, "Villy
Kruse" <vek@pharmnl.ohout.pharmapartners.nl> wrote:

> On 3 Jul 2001 15:16:32 GMT,
>     Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> 
> 
>>According to joeybach <joeybach@hotmail.com>:
>>> I am looking for a way to convert a number like 66 to 01000010 and
>>> then convert the 01000010 back to 66.
>>
>>If you mean the string "01000010",
>>
>>perldoc -f sprintf
>>perldoc -f oct
>>
>>
> 
> Also, look at the pack and unpack functions.
> 
> 
> 
> Villy


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

Date: Tue, 03 Jul 2001 15:08:58 GMT
From: "joeybach" <joeybach@hotmail.com>
Subject: How can I convert decimals to binary and binary to decimals?
Message-Id: <20010703.111745.492067917.8795@stink.cfl.rr.com>

I am looking for a way to convert a number like 66 to 01000010 and then
convert the 01000010 back to 66.  

Thanks in advance


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

Date: 3 Jul 2001 15:16:32 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How can I convert decimals to binary and binary to decimals?
Message-Id: <9hsnkg$op0$4@mamenchi.zrz.TU-Berlin.DE>

According to joeybach <joeybach@hotmail.com>:
> I am looking for a way to convert a number like 66 to 01000010 and then
> convert the 01000010 back to 66.  

If you mean the string "01000010",

perldoc -f sprintf
perldoc -f oct

Anno



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

Date: 03 Jul 2001 15:47:33 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: How can I convert decimals to binary and binary to decimals?
Message-Id: <slrn9k3q8l.24n.vek@pharmnl.ohout.pharmapartners.nl>

On 3 Jul 2001 15:16:32 GMT,
    Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:


>According to joeybach <joeybach@hotmail.com>:
>> I am looking for a way to convert a number like 66 to 01000010 and then
>> convert the 01000010 back to 66.  
>
>If you mean the string "01000010",
>
>perldoc -f sprintf
>perldoc -f oct
>


Also, look at the pack and unpack functions.



Villy


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

Date: 03 Jul 2001 11:02:07 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: How can I convert decimals to binary and binary to decimals?
Message-Id: <m33d8engqo.fsf@dhcp9-173.support.tivoli.com>

On 03 Jul 2001, vek@pharmnl.ohout.pharmapartners.nl wrote:

> On 3 Jul 2001 15:16:32 GMT,
>     Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>>According to joeybach <joeybach@hotmail.com>:
>>> I am looking for a way to convert a number like 66 to 01000010 and
>>> then convert the 01000010 back to 66.
>>
>>If you mean the string "01000010",
>>
>>perldoc -f sprintf
>>perldoc -f oct
> 
> Also, look at the pack and unpack functions.

While you can accomplish this with pack and unpack, it's not clear to
my why you would want to.  sprintf() and oct() are very
straight-forward.  It would be one thing if there were a format
specifier that allowed you to directly convert between these formats,
but as it is you must pass through some intermediate format.  It also
introduces issues about what size of data you want to be able to
handle ("c", "s", "l", etc.) for the decimal representation.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Tue, 03 Jul 2001 09:53:12 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: How I came to love Perl...
Message-Id: <27i3kto5maorj6npje5m835gfej2km505i@4ax.com>

--Quick background...

--I get an Apple IIe in 1985, and A500 in 1987.

--After 2 years of working I go to college fully prepared to leave an
English teacher.  While there I join the school newspaper and end up
"fixing" the computers constantly.  I graduate with an English Degree,
a History degree a Linguistics minor and a Communications BS (it's a
long story.)

--I end up finding out that I am making A LOT more at Coctco than I
can as a first year teacher.  I am still fixing computers.  I decide
"This Java sounds like a good idea."  I buy two Java books.  They
still look like new.  I am too stupid to learn Java.

--I get a job (after some time in the field) as a Network Guy (really
was my title.)   I find I need scripting to keep my sanity.  I am
running NT I use NT Shell Scripting and KiXart.  I hear about this
Perl a lot.

--I start learning Perl.  It's great.  I love everything about it.
Programmers I know disparage it greatly (you should use:  Python,
Eiffel, Ruby, C) and often.  I can't find anything I "get" as much.

--I still want to learn Java.  I "decide" that if I get up to speed
with "C" I can then move onto Java.  (At this point I have to admit I
don't even know why I want to learn Java anymore, but that's not
important now... here comes the epiphany.)

--I start my journey with C and recognize a lot of things.  I am
"getting" it... then the modulo (sp?) (read math stuff) starts and I
tune out and start looking for something I can "grasp".  Then I see
it!  When I was learning Perl it was all about text, words, data and
what I could do with it.  Math (the bad thing) wasn't involoved!
Whenever I opened a programming book there was all this math (which I
didn't get in high school and avoided in college) that muddied things
up for me.

--So inconclusion I fell in love with Perl b/c _for me_ it's all about
words, text and data with which I am particularly comfortable.     


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

Date: Tue, 03 Jul 2001 15:28:34 GMT
From: Athera <Athera@yahoo.com>
Subject: How to upgrade to newest (stable) version of Perl? (newbie)
Message-Id: <eqo3ktcv0qtca9df8cktaj8li0jd3fmmm7@4ax.com>

I would like to upgrade the Perl on my FreeBSD system.  I thought the
instructions for doing that would be easy enough to come by, but I
didn't find it anywhere in the FAQs or TFM. (Probably in there
somewhere, but I couldn't find it -- and couldn't find it with search
engines -- Maybe a good candidate for the FAQ?)

My goal: To get threads enabled (and install the standard packages for
them) without screwing up any of the modules like DBI I already have
installed.

It seemed like upgrading would be the best route -- since recompiling
Perl should give me the option to compile with threads...

Thank You,
 ..


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

Date: 03 Jul 2001 18:14:00 +0100
From: nobull@mail.com
Subject: Re: lvalue functions
Message-Id: <u9bsn2szon.fsf@wcl-l.bham.ac.uk>

Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:

> [A complimentary Cc of this posting was sent to
> 
> <nobull@mail.com>], who wrote in article <u9ae2mik7f.fsf@wcl-l.bham.ac.uk>:
> > > [A complimentary Cc of this posting was sent to
> > 
> > Would you please stop that.
> 
> Cannot promise to remember this.  But my setup grants Mail-Copies-To: never.

I don't want CC "never".  That would be throwing the baby out with the
bathwater.  I want CC "only when appropriate".  If I'd wanted copies
_always_ I'd have set a Mail-Copies-To header accordingly.

> > Where?  It's not in the standard docs.  A web and Usenet search finds
> > uses of the word but does not define it.  From context it appears to
> > be an obfuscated way of saying "subroutine call context".
> 
> It means that using context to implement DWIM is evil, since the
> context is quite often not what naive heuristics suggest.

So you are now changing your claim from saying that my solution
doesn't achieve exactly what was desired, to saying it does but does
so by using black magic that not everyone understands.  This is a
completely different claim and one I would not dispute.

> > >   sub foo {print shift}
> > >   sub bar {...}
> > > 
> > >   foo bar;
> > > 
> > > What is the context of bar()?
> > 
> > List, because &foo has no prototype.
> 
> Nope. It is an lvalue-list, not list.

Eh... "This is a not a car, it is a green car".

I am fully aware that function arguments are lvalues.  I _had_, worked
through the ramifiations of this in my head (immediately after I
posted as I was walking home) and relised to my great delight that my
solution exactly DWIM!

The decision as to which method is to be called is not made until the
the lvalue is _used_.  This, incidently, means that this sort of
lvalue function is a no-op if called in a void context or if passed as
an unused argument to a function.  This again is totally consistant
with what it means to have a function that has distinct fetch/store
semantics.

#!/usr/bin/perl
use strict;
use warnings;

{
    my $private;
    use LvalueSubWithSeperateFetchAndStoreMethods func => {
	FETCH => sub { print "func-FETCH\n"; $private },
	STORE => sub { print "func-STORE\n"; $private = shift },
    };
}

sub store { $_[0] = $_[1] };
sub fetch { my $q = $_[0] };
sub add { $_[0] += $_[1] };
sub noop {};

print "store...\n";
store(func() => 4);

print "fetch...\n";
print fetch(func()),"\n";

print "inc...\n";
add(func() => 2 );

print "noop...\n";
noop(func());

__END__

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


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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


------------------------------
End of Perl-Users Digest V10 Issue 1236
***************************************


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