[29453] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 697 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 29 11:10:12 2007

Date: Sun, 29 Jul 2007 08:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 29 Jul 2007     Volume: 11 Number: 697

Today's topics:
    Re: @arts <1usa@llenroc.ude.invalid>
    Re: @arts <1usa@llenroc.ude.invalid>
    Re: @arts <tadmc@seesig.invalid>
    Re: @arts <zaxfuuq@invalid.net>
        form script question <dnpyles@acousticmusic.com>
    Re: getting arguments (Jens Thoms Toerring)
    Re: getting arguments (Jens Thoms Toerring)
    Re: getting arguments <noreply@gunnar.cc>
    Re: getting arguments (Jens Thoms Toerring)
        new CPAN modules on Sun Jul 29 2007 (Randal Schwartz)
    Re: Objects/Structures in Perl <1usa@llenroc.ude.invalid>
        Variable dump <bill@ts1000.us>
    Re: Variable dump anno4000@radom.zrz.tu-berlin.de
    Re: Variable dump <sisyphus1@nomail.afraid.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 29 Jul 2007 03:26:47 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: @arts
Message-Id: <Xns997BEE7F47DDCasu1cornelledu@127.0.0.1>

"Wade Ward" <zaxfuuq@invalid.net> wrote in
news:nPOdnbYLBJHDIzbbnZ2dnUVZ_j-dnZ2d@comcast.com: 

> 
> "Michele Dondi" <bik.mido@tiscalinet.it> wrote in message 
> news:pd8ja3hrraji8k1uhjegf6i2v5jvdv7udt@4ax.com...
>> On Thu, 26 Jul 2007 18:32:50 -0700, "Wade Ward" <zaxfuuq@invalid.net>
>> wrote:
> 
>>>>  {
>>>>      my $i;
>>>>      sub i () : lvalue { $i }
>>>>  }
>>>How does this not have a name?
>>
>> What, precisely, doesn't have a name?
> I want to call the above a subroutine.  It doesn't have a label. 
> Apparently it switches i for $i.  I spent a couple hours looking for
> another instance of this in the literature without success.  Is this a
> subroutine? 

Note that the whole thing is its own scope which means $i is not visible 
to the rest of the program. However, subroutines don't have this 
restriction. So, the subroutine called i is visible to the rest of the 
program.

Now, $i has gone out of scope, but i is a closure on $i, so $i has not 
been garbage collected (that is, i still has access to $i, but the rest 
of the program cannot access the variable $i defined in the block 
above).

i is defined with the lvalue attribute, which means you can assign to 
its return value.

i is also defined with an empty prototype so that if you type

substr( $str, i, 5 );

you can be sure 5 will be the third argument to substr and not the first 
argument to i.

This way, your for loops can look more like C:

C:\Home\asu1\Src\test> cat i.pl
#!/usr/bin/perl

use strict;
use warnings;

{
    my $i;
    sub i() : lvalue { $i }
}

for( i = 0; i < 10; ++i ) {
    printf( "Hello world: %d\n", i );
}

__END__

C:\Home\asu1\Src\test> i
Hello world: 0
Hello world: 1
Hello world: 2
Hello world: 3
Hello world: 4
Hello world: 5
Hello world: 6
Hello world: 7
Hello world: 8
Hello world: 9

Of course, I don't much like lvalue subroutines and I don't like 
prototypes. I would consider this a cute trick rather than something you 
should emulate.

Anyway, you might want to read about closures:

perldoc -q closure

Sinan
-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>



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

Date: Sun, 29 Jul 2007 03:57:38 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: @arts
Message-Id: <Xns997BF3BADEEFasu1cornelledu@127.0.0.1>

"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in 
news:Xns997BEE7F47DDCasu1cornelledu@127.0.0.1:

> "Wade Ward" <zaxfuuq@invalid.net> wrote in
> news:nPOdnbYLBJHDIzbbnZ2dnUVZ_j-dnZ2d@comcast.com: 
> 
>> 
>> "Michele Dondi" <bik.mido@tiscalinet.it> wrote in message 
>> news:pd8ja3hrraji8k1uhjegf6i2v5jvdv7udt@4ax.com...
>>> On Thu, 26 Jul 2007 18:32:50 -0700, "Wade Ward" 
<zaxfuuq@invalid.net>
>>> wrote:
>> 
>>>>>  {
>>>>>      my $i;
>>>>>      sub i () : lvalue { $i }
>>>>>  }
>>>>How does this not have a name?
>>>

 ...

> This way, your for loops can look more like C:
> 

In fact, while you are at it, you can generalize the whole thing:

C:\Home\asu1\Src\test> cat Clikei.pm
package Clikei;

use strict;
use warnings;

sub import {
    my $package = shift;
    my $export_to = caller;

    for my $name ( @_ ) {
        my $sub_name = "${export_to}::${name}";
        {
            my $x;
            no strict 'refs';
            *{$sub_name} = sub () : lvalue { $x };
        }
    }
}

"I like C"

__END__

C:\Home\asu1\Src\test> cat i.pl
#!/usr/bin/perl

use strict;
use warnings;

use lib '.';
use Clikei qw( i j k );

for( i = 0; i < 10; ++i ) {
    printf( "Hello i: %d\n", i );
}

for( j = i; j < i + 10; ++j ) {
    printf( "Hello j: %d\n", j );
}

for( k = j; k < j + 10; ++k ) {
    printf( "Hello k: %d\n", k );
}

__END__

C:\Home\asu1\Src\test> i
Hello i: 0
Hello i: 1
Hello i: 2
Hello i: 3
Hello i: 4
Hello i: 5
Hello i: 6
Hello i: 7
Hello i: 8
Hello i: 9
Hello j: 10
Hello j: 11
Hello j: 12
Hello j: 13
Hello j: 14
Hello j: 15
Hello j: 16
Hello j: 17
Hello j: 18
Hello j: 19
Hello k: 20
Hello k: 21
Hello k: 22
Hello k: 23
Hello k: 24
Hello k: 25
Hello k: 26
Hello k: 27
Hello k: 28
Hello k: 29

This is all very silly. Aaaaanyway.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>



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

Date: Sat, 28 Jul 2007 19:11:44 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: @arts
Message-Id: <slrnfanmq0.lmp.tadmc@tadmc30.sbcglobal.net>

Wade Ward <zaxfuuq@invalid.net> wrote:
>
> "Michele Dondi" <bik.mido@tiscalinet.it> wrote in message 
> news:pd8ja3hrraji8k1uhjegf6i2v5jvdv7udt@4ax.com...
>> On Thu, 26 Jul 2007 18:32:50 -0700, "Wade Ward" <zaxfuuq@invalid.net>
>> wrote:
>
>>>>  {
>>>>      my $i;
>>>>      sub i () : lvalue { $i }
>>>>  }
>>>How does this not have a name?
>>
>> What, precisely, doesn't have a name?
> I want to call the above a subroutine.  It doesn't have a label.  


You are not being precise enough yet.

It is called a "naked block", but I expect you were precisely
referring to the single

   sub i () : lvalue { $i }

line.

_That_ has a name. It is called an "lvalue subroutine".


> I spent a couple hours looking for another instance 
> of this in the literature without success.


See the "Lvalue subroutines" section in:

   perldoc perlsub


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Sun, 29 Jul 2007 03:04:46 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: @arts
Message-Id: <3YSdnf_r4p6FoTHbnZ2dnUVZ_jqdnZ2d@comcast.com>


"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message 
news:Xns997BF3BADEEFasu1cornelledu@127.0.0.1...
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in
> news:Xns997BEE7F47DDCasu1cornelledu@127.0.0.1:
>
>> "Wade Ward" <zaxfuuq@invalid.net> wrote in
>> news:nPOdnbYLBJHDIzbbnZ2dnUVZ_j-dnZ2d@comcast.com:
>>
>>>
>>> "Michele Dondi" <bik.mido@tiscalinet.it> wrote in message
>>> news:pd8ja3hrraji8k1uhjegf6i2v5jvdv7udt@4ax.com...
>>>> On Thu, 26 Jul 2007 18:32:50 -0700, "Wade Ward"
> <zaxfuuq@invalid.net>
>>>> wrote:
>>>
>>>>>>  {
>>>>>>      my $i;
>>>>>>      sub i () : lvalue { $i }
>>>>>>  }
>>>>>How does this not have a name?
>>>>
>
> ...
>
>> This way, your for loops can look more like C:
>>
>
> In fact, while you are at it, you can generalize the whole thing:
>
> C:\Home\asu1\Src\test> cat Clikei.pm
> package Clikei;
>
> use strict;
> use warnings;
>
> sub import {
>    my $package = shift;
>    my $export_to = caller;
>
>    for my $name ( @_ ) {
>        my $sub_name = "${export_to}::${name}";
>        {
>            my $x;
>            no strict 'refs';
>            *{$sub_name} = sub () : lvalue { $x };
>        }
>    }
> }
>
> "I like C"
>
> __END__
>
> C:\Home\asu1\Src\test> cat i.pl
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use lib '.';
> use Clikei qw( i j k );
>
> for( i = 0; i < 10; ++i ) {
>    printf( "Hello i: %d\n", i );
> }
>
> for( j = i; j < i + 10; ++j ) {
>    printf( "Hello j: %d\n", j );
> }
>
> for( k = j; k < j + 10; ++k ) {
>    printf( "Hello k: %d\n", k );
> }
>
> __END__
>
> C:\Home\asu1\Src\test> i
> Hello i: 0
> Hello i: 1
> Hello i: 2
> Hello i: 3
> Hello i: 4
> Hello i: 5
> Hello i: 6
> Hello i: 7
> Hello i: 8
> Hello i: 9
> Hello j: 10
> Hello j: 11
> Hello j: 12
> Hello j: 13
> Hello j: 14
> Hello j: 15
> Hello j: 16
> Hello j: 17
> Hello j: 18
> Hello j: 19
> Hello k: 20
> Hello k: 21
> Hello k: 22
> Hello k: 23
> Hello k: 24
> Hello k: 25
> Hello k: 26
> Hello k: 27
> Hello k: 28
> Hello k: 29
>
> This is all very silly. Aaaaanyway.
To me, these are very interesting things.  When you routinely miss studying 
a given point in a new syntax, you study fundamental language concepts by 
accident.  I'll have to try out these new directions for myself.  Thanks for 
your reply.
--
Wade Ward 




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

Date: Sun, 29 Jul 2007 08:51:50 -0400
From: David Pyles <dnpyles@acousticmusic.com>
Subject: form script question
Message-Id: <f8i2h7$1o94$1@pyrite.mv.net>

I'm a web designer, but not a perl programmer.  I've been working on 
some forms using the form mail program that is part of VDeck.  The 
default set-up sends an email with a default Subject line.  Since I will 
have a number of forms, I would like to customize the Subject line to 
reflect the form that generated the email by entering a hidden subject 
field in the form with a value that would be entered in the subject line 
of the email.  My web host does not provide help in modifying their 
scripts.  The told me to modify the forms.cgi, but they wouldn't tell me 
how. I tried modifying the the script, but my mods just give me server 
errors.  I'm hoping to get some help here.

Here is the forms.cgi unmodified script:
#!/usr/bin/perl
############################################
#
# forms.cgi - form processor for forms created though admin panel
#
# (c) 2003 vDeck.com
#
############################################
use strict;
use warnings;
use CGI;
use vDeckPublic;
use DBI;

use constant F_ID               => 0;
use constant F_FORMID           => 1;
use constant F_FIELDNAME        => 2;
use constant F_FIELD_TYPE       => 3;
use constant F_FIELD_DEFAULT    => 4;
use constant F_FIELD_TAINTCHECK => 5; # for future use
use constant F_FIELD_RANK       => 6;

my $q = CGI->new();

# find homedir
my $homedir = '';
$ENV{DOCUMENT_ROOT} =~ m|(/home/[\w\-]+)| and $homedir = $1;

# print "Content-type: text/plain\n\n--$homedir--"; exit(0);

my $vdeck = vDeckPublic->new({ -db   => 
"DBI:CSV:f_dir=$homedir/.panel/data/;csv_eol=\n;",
                                      -user => '',
                                      -pass => '' });

$homedir || $vdeck->fatal_error("Can't determine home directory");

my $form_id='';

my %var = $q->Vars();
foreach my $f_name(keys %var){
         if($f_name =~ /^_(\w+)formid$/){
                 $q->param($f_name) =~ /(\d+)/ and $form_id = $1;
                 last;
         }
}

$form_id || $vdeck->fatal_error("Invalid form ID. Please check your SSI 
code!");

#  WHERE form_id='$form_id'
my $form_fields = $vdeck->db_query("SELECT * FROM form_fields WHERE 
form_id='$form_id'");
defined $form_fields->[0] or $vdeck->fatal_error("No form fields defined 
- please check your form design.");

my %form_field = ();

for (@{$form_fields}) {
     my $field_name = $_->[2];
     $field_name =~ s/\W/_/g;
     defined ( $q->param($field_name) ) and $form_field{$field_name} = 
$q->param($field_name);
}

# everything OK, so send e-mail
my $form_meta = $vdeck->db_query("SELECT * FROM form_meta WHERE 
id='$form_id'",'rowarray');
defined $form_meta->[0] or $vdeck->ssi_error("Invalid form ID. Please 
check your SSI code!");

my $to  = $form_meta->[3];
my $cc  = $form_meta->[4];
my $bcc = $form_meta->[5];
my $message = $form_meta->[6];
my $redirect = $form_meta->[7] || '/v-web/forms/thanks.htm';

while ($message =~ /\[% (\S+) %\]/s) {
     my $attr = $1;
     $message =~ s/\[% $attr %\]/$form_field{$attr}/gs;
}

$vdeck->send_email({ -to      => $to,
                    -from    => $to,
                    -cc      => [split ',', $cc],
                    -bcc     => [split ',', $bcc],
                    -subject => "Feedback: from $form_meta->[2]",
                    -message => $message
                 });

print $q->redirect($redirect);
exit(0);

Can someone tell me how to modify this script to make it pick-up the 
value of a hidden "subject" field in the form and place it's value in 
the subject line of the resulting email?

Thanks in advance.
Dave Pyles


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

Date: 29 Jul 2007 11:27:20 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: getting arguments
Message-Id: <5h3bsoF3hqgu7U1@mid.uni-berlin.de>

frytaz@gmail.com <frytaz@gmail.com> wrote:
> This script works, but when I'm trying to use it with some other array

> sub myagr {
>  my ($data, $server, $witem) = @_;
>  my ($cmd, @rest) = split(/ /, $data);

It's impossible to say what's happening here unless you tell
exactly with what arguments the function is called. But it
already looks suspicious that $data is a scalar. It only
could work if you call the function with something like

myagr( ( join ' ', ( $0, @ARGV ) ), ...)

but then I wouldn't know why you first join the scripts name and
the command line arguments into a single string to pass it to
the function, only to split it again within the function...

>  $opts = '^-(one|two|three|four|five)$';

>  $rest[0] =~ /$opts/ or $badarg=1;

>  if ($badarg eq 1) {
>   print "Bad arguments";
>  } else {
>   $state;
>   %args;
>   for ( @rest ) {
>    if ( /$opts/ ) {
>     $state = $1;
>     $args{ $state } = [ ];
>     next;
>    }
>    push @{ $args{ $state } }, $_;
>   }
>   my ( $one, $two, $three, $four, $five ) = map { join ' ',
> @{ $args{ $_ } } } qw/ one two three four five /;
>   # ^ in that line $_ doesn't contain any data

>   print "one $one two $two three $three four $four five $five";
>   #prints one  two  three  four  five
> }
> }

> why $_ losing data?

My best guess is @rest doesn't contain what you expect it to,
did you try to print it out to see what elements it actually
has?
                                Regards, Jens
-- 
  \   Jens Thoms Toerring  ___      jt@toerring.de
   \__________________________      http://toerring.de


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

Date: 29 Jul 2007 11:31:47 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: getting arguments
Message-Id: <5h3c53F3hqgu7U2@mid.uni-berlin.de>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Jens Thoms Toerring wrote:
> > 
> > my $state;
> > my %args;
> > for ( @ARGV ) {
> >     if ( /$opts/ ) {
> >         $state = $1;
> >         $args{ $state } = [ ];
> >         next;
> >     }
> >     push @{ $args{ $state } }, $_;
> > }
> > 
> > my ( $one, $two, $three ) = map { join ' ', @{ $args{ $_ } } }
> >                                 qw/ one two three /;

> Why the deep data structure? Why not just:

>      my ($state, %args);
>      for ( @ARGV ) {
>          if ( /$opts/ ) {
>              $state = $1;
>              next;
>          }
>          $args{ $state } = $_;

But then you would only store the last of the words, i.e. for the
command line argument "-one one test 1", would would only keep
the "1" and would not get "one test 1" as I understand the OP
wanted. Or am I missing something?

                             Regards, Jens
-- 
  \   Jens Thoms Toerring  ___      jt@toerring.de
   \__________________________      http://toerring.de


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

Date: Sun, 29 Jul 2007 13:49:52 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: getting arguments
Message-Id: <5h3ddeF3j6eh8U1@mid.individual.net>

Jens Thoms Toerring wrote:
> Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
>> Why the deep data structure? Why not just:
>> 
>>      my ($state, %args);
>>      for ( @ARGV ) {
>>          if ( /$opts/ ) {
>>              $state = $1;
>>              next;
>>          }
>>          $args{ $state } = $_;
> 
> But then you would only store the last of the words, i.e. for the
> command line argument "-one one test 1", would would only keep
> the "1" and would not get "one test 1" as I understand the OP
> wanted. Or am I missing something?

I understand now that your way would permit to _not_ group words 
together with e.g. quotes. OTOH you also say:

"The usual convention with atrguments is to have them enclosed in
(double) quotes when they contain spaces, so they arrive as a
whole in your program"

I think I tend to believe that a recommendation to use quotes for 
grouping is preferrable.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 29 Jul 2007 12:12:26 GMT
From: jt@toerring.de (Jens Thoms Toerring)
Subject: Re: getting arguments
Message-Id: <5h3ehaF3irhdfU1@mid.uni-berlin.de>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Jens Thoms Toerring wrote:
> > Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> >> Why the deep data structure? Why not just:
> >> 
> >>      my ($state, %args);
> >>      for ( @ARGV ) {
> >>          if ( /$opts/ ) {
> >>              $state = $1;
> >>              next;
> >>          }
> >>          $args{ $state } = $_;
> > 
> > But then you would only store the last of the words, i.e. for the
> > command line argument "-one one test 1", would would only keep
> > the "1" and would not get "one test 1" as I understand the OP
> > wanted. Or am I missing something?

> I understand now that your way would permit to _not_ group words 
> together with e.g. quotes. OTOH you also say:

> "The usual convention with atrguments is to have them enclosed in
> (double) quotes when they contain spaces, so they arrive as a
> whole in your program"

> I think I tend to believe that a recommendation to use quotes for 
> grouping is preferrable.

Definitely, but the OP may have his reasons to do it otherwise
and who am I to tell him what to do;-)

                               Regards, Jens
-- 
  \   Jens Thoms Toerring  ___      jt@toerring.de
   \__________________________      http://toerring.de


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

Date: Sun, 29 Jul 2007 04:42:13 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun Jul 29 2007
Message-Id: <JLxBqD.1pFo@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Business-BR-Ids-0.00_18
http://search.cpan.org/~ferreira/Business-BR-Ids-0.00_18/
Modules for dealing with Brazilian identification codes (CPF, CNPJ, ...) 
----
Date-EzDate-1.10
http://search.cpan.org/~miko/Date-EzDate-1.10/
Date and time manipulation made easy 
----
E-Mail-Acme-1349
http://search.cpan.org/~rjbs/E-Mail-Acme-1349/
----
FabForce-DBDesigner4-0.10
http://search.cpan.org/~reneeb/FabForce-DBDesigner4-0.10/
Parse/Analyse XML-Files created by DBDesigner 4 (FabForce) 
----
File-chmod-0.32
http://search.cpan.org/~pinyan/File-chmod-0.32/
Implements symbolic and ls chmod modes 
----
FileHandle-Rollback-1.06
http://search.cpan.org/~miko/FileHandle-Rollback-1.06/
FileHandle with commit, rollback, and journaled crash recovery 
----
Imager-Search-0.01
http://search.cpan.org/~adamk/Imager-Search-0.01/
Locate an image inside another image 
----
Imager-Search-0.02
http://search.cpan.org/~adamk/Imager-Search-0.02/
Locate an image inside another image 
----
Lingua-JA-Romanize-Japanese-0.15
http://search.cpan.org/~kawasaki/Lingua-JA-Romanize-Japanese-0.15/
Romanization of Japanese language 
----
Net-Dopplr-0.2
http://search.cpan.org/~simonw/Net-Dopplr-0.2/
interface with Dopplr.com's web service 
----
Net-Google-AuthSub-0.3
http://search.cpan.org/~simonw/Net-Google-AuthSub-0.3/
interact with sites that implement Google style AuthSub 
----
POE-Component-Client-SOCKS-0.05
http://search.cpan.org/~bingos/POE-Component-Client-SOCKS-0.05/
SOCKS enable any POE Component 
----
POE-Component-Proxy-SOCKS-0.04
http://search.cpan.org/~bingos/POE-Component-Proxy-SOCKS-0.04/
A POE based SOCKS 4 proxy server. 
----
POE-Component-Server-Ident-1.09
http://search.cpan.org/~bingos/POE-Component-Server-Ident-1.09/
A POE component that provides non-blocking ident services to your sessions. 
----
POE-Component-Server-NNTP-0.98
http://search.cpan.org/~bingos/POE-Component-Server-NNTP-0.98/
A POE component that provides NNTP server functionality. 
----
POE-Component-WWW-Shorten-1.07
http://search.cpan.org/~bingos/POE-Component-WWW-Shorten-1.07/
A non-blocking wrapper around WWW::Shorten. 
----
POE-Filter-Bzip2-1.52
http://search.cpan.org/~bingos/POE-Filter-Bzip2-1.52/
A POE filter wrapped around Compress::Bzip2 
----
POE-Filter-CSV-1.06
http://search.cpan.org/~bingos/POE-Filter-CSV-1.06/
A POE-based parser for CSV based files. 
----
POE-Filter-LZF-1.62
http://search.cpan.org/~bingos/POE-Filter-LZF-1.62/
A POE filter wrapped around Compress::LZF 
----
POE-Filter-LZO-1.62
http://search.cpan.org/~bingos/POE-Filter-LZO-1.62/
A POE filter wrapped around Compress::LZO 
----
POE-Filter-LZW-1.62
http://search.cpan.org/~bingos/POE-Filter-LZW-1.62/
A POE filter wrapped around Compress::LZW 
----
POE-Filter-Zlib-1.91
http://search.cpan.org/~bingos/POE-Filter-Zlib-1.91/
A POE filter wrapped around Compress::Zlib 
----
Stack-Persistent-0.02
http://search.cpan.org/~kesteb/Stack-Persistent-0.02/
A persistent stack 
----
TM-1.30
http://search.cpan.org/~drrho/TM-1.30/
Topic Maps, Base Class 
----
Test-BinaryData-0.005
http://search.cpan.org/~rjbs/Test-BinaryData-0.005/
compare two things, give hex dumps if they differ 
----
UID-0.21
http://search.cpan.org/~plato/UID-0.21/
? Create unique identifier constants 
----
WWW-Facebook-API-v0.4.4
http://search.cpan.org/~unobe/WWW-Facebook-API-v0.4.4/
Facebook API implementation 
----
WWW-Myspace-Data-0.14
http://search.cpan.org/~oalders/WWW-Myspace-Data-0.14/
WWW::Myspace database interaction 
----
XML-TreePP-0.22
http://search.cpan.org/~kawasaki/XML-TreePP-0.22/
Pure Perl implementation for parsing/writing xml files 
----
makepp-1.50-cvs-070728
http://search.cpan.org/~pfeiffer/makepp-1.50-cvs-070728/
Compatible but improved replacement for make 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
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: Sun, 29 Jul 2007 03:14:16 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Objects/Structures in Perl
Message-Id: <Xns997BEC605478Aasu1cornelledu@127.0.0.1>

"O. Olson" <olson_ord@yahoo.it> wrote in news:1185660191.933549.6190
@k79g2000hse.googlegroups.com:

>      You seem to be a student like myself.

Well, I am a perpetual student but my official studies ended 24 years 
after enrolling in grade school almost eight years ago.

> How do you handle these things i.e. we guys have to do C++, Java,
> Perl etc. in addition to other

Programming has been a hobby of mine since I was ten and learned Z80 
assembly. 

I have never formally studied anything related to computer science. I 
learned whatever I was interested in and whatever I needed to get stuff 
done.

At any one point in time, I only remember a small subset of the most 
essential information about each thing/topic I am interested in.

> software programs like Matlab and others.

I always look up anything and everything I am going to use. If I am 
going to write a C program, I'll have Plauger's Standard C Library book 
by my side, I check the man page of each library function I call etc.

When programming Perl, I always look at the documentation first. Perl 
has great documentation.

Python does not. Ruby does not. PHP does not. At least, what is 
available is not suitable for me and I have avoided those languages.

Java has good API documentation but it is very hard to get a good big 
picture. Also, now that I have been spoiled by Perl, I really find it 
exhausting to write Java unless absolutely necessary.

The API has improved a lot but I rarely use Java these days because I 
find that Perl satisfies write-once / run everywhere much better than 
Java (especially with PAR these days).

Before the STL, I found C++ a drag. Not too much benefit, a lot of cost. 
With the STL (and Boost), I almost enjoy writing C++.

I don't write platform specific stuff and I haven't written a GUI 
program in a long time, so there aren't a lot of APIs to remember.

As for things like MatLab (well, I prefer Octave), when you know what 
you want to do, it is very easy to figure out how to do it. 

The idea is to first describe what you want to do in words. Then 
identify the tasks that need to be accomplished for that, find out if 
there are APIs or other modules that help with the building blocks and 
then glue everything together.

And, of course, mistakes are made. Mistakes are identified. I find it 
harder to forget stuff I learned by making mistakes.

> How do you keep track of
> everything i.e. once I leave something for a month I almost forget it.

I don't keep track of everything. All non-essential stuff can be looked 
up. In my spare time, I read a lot. Some of it sticks.

I tend to read FAQ lists every now and then. I don't necessarily 
remember the contents for a long time, but when I hit a snag, something 
in the back of my mind leads me to the document which has the solution.

With Perl, I read and participate in this group to learn. 

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>



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

Date: Sun, 29 Jul 2007 05:08:30 -0700
From:  Bill H <bill@ts1000.us>
Subject: Variable dump
Message-Id: <1185710910.829375.64370@b79g2000hse.googlegroups.com>

Is there a way in perl to dump all the variables used and their
current values to a file without printing everyone of them
individually?

Bill H



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

Date: 29 Jul 2007 14:29:59 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Variable dump
Message-Id: <5h3mj7F3ige7vU1@mid.dfncis.de>

Bill H  <bill@ts1000.us> wrote in comp.lang.perl.misc:
> Is there a way in perl to dump all the variables used and their
> current values to a file without printing everyone of them
> individually?

Not easily.  You'd have a chance with package variables.  For
lexicals you'd need something like PadWalker, which is a bit
tricky to use.

Most people settle for printing selected values at selected
places for debugging.  The module Data::Dumper helps with
viewing complex data structures.

I have a module Report.pm in my private Perl library which
applies Data::Dumper to a list of Perl expressions.  I find
that I never use it, but I'm appending it anyway.  It uses
a little-known feature to evaluate expressions in the caller's
context.

Anno

--------------------------------------------------------------------
package Report;
use strict; use warnings; # @^~`
use base 'Exporter';
our @EXPORT = qw( report);

{
    # evaluate in caller context
    package DB;
    sub _reporter_report {
        for my $expr ( @_ ) {
            print Report::answer( $expr, eval $expr);
        }
    }
}
*Report::report = \ &DB::_reporter_report;

use Data::Dumper ();
use Scalar::Util ();

sub answer {
    my ( $expr, @val) = @_;
    my $ans;
    if ( $@  ) {
        $ans = "$expr: $@" if $@;
        $ans =~ s/ at \(eval .*$//;
    } else {
        if ( @val == 1 ) {
            $ans = answer_scalar( $expr, @val);
        } else {
            $ans =join ', ' => map answer_scalar( $expr, $_), @val;
            $ans = "($ans)";
        }
    }
    $ans;
}

sub answer_scalar {
    my ( $expr, $val) = @_;
    my $ans;
    if ( !defined $val ) {
        $ans = "$expr = undef;\n";
    } elsif ( ref $val ) {
        ( $ans = Data::Dumper::Dumper $val) =~ s/\$VAR1\b/$expr/g;
        my $indent = ' ' x ( 8 + length( $expr) - length( '$VAR'));
        $ans =~ s/^ {8}/$indent/mg;
    } elsif (
        Scalar::Util::looks_like_number( $val) or
        ref( \ $val) eq 'GLOB'
    ) {
        $ans = "$expr = $val;\n";
    } else {
        $ans = "$expr = '$val';\n";
    }
    $ans;
}

'@^~`'; # it's true
__END__

Use like this:

#!/usr/local/bin/perl
use strict; use warnings; $| = 1;

use Report;

my $x = 123;
my $y = [ qw( one two)];
my %z = (
    hihi => [ 456, 789],
    haha => { hoho => 'huhu'},
);  

report qw( $x $y $z{haha});


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

Date: Mon, 30 Jul 2007 00:57:31 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Variable dump
Message-Id: <46acaad6$0$7087$afc38c87@news.optusnet.com.au>


"Bill H" <bill@ts1000.us> wrote in message 
news:1185710910.829375.64370@b79g2000hse.googlegroups.com...
> Is there a way in perl to dump all the variables used and their
> current values to a file without printing everyone of them
> individually?
>

Closest I could find is PadWalker ( 
http://search.cpan.org/~robin/PadWalker-1.5/PadWalker.pm ).

It handles lexical variables, but not globals (afaict) :

--------------------------------
use PadWalker;
use warnings;

my $s = 'hello world';
my @array = (1, 3, 5);
our $t = 'hello again';
our @array2 = (5, 7, 9);

$h1 = PadWalker::peek_my(0);
%deref = %{$h1};

print "\n\"my\" variables\n";

for(keys(%deref)) {
   print "$_ : $deref{$_} \n";
   print "@{$deref{$_}}  \n" if ref($deref{$_}) eq "ARRAY";
   print ${$deref{$_}}, "\n" if ref($deref{$_}) eq "SCALAR";
}


print "\n\"our\" variables\n";

$h1 = PadWalker::peek_our(0);
%deref = %{$h1};

for(keys(%deref)) {
   print "$_ : $deref{$_} \n";
   print "@{$deref{$_}}  \n" if ref($deref{$_}) eq "ARRAY";
   print ${$deref{$_}}, "\n" if ref($deref{$_}) eq "SCALAR";
}
--------------------------------

Which outputs:

--------------------------------
"my" variables
@array : ARRAY(0xb54914)
1 3 5
$s : SCALAR(0xb54944)
hello world

"our" variables
$t : SCALAR(0x26aa184)
hello again
@array2 : ARRAY(0x2716884)
5 7 9
--------------------------------

Faik, there may well be something better.

Hope this helps.

Cheers,
Rob 



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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 697
**************************************


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