[29621] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 865 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 19 14:09:44 2007

Date: Wed, 19 Sep 2007 11:09:08 -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           Wed, 19 Sep 2007     Volume: 11 Number: 865

Today's topics:
        are you using Perl in your job? <Summercoolness@gmail.com>
    Re: are you using Perl in your job? <1usa@llenroc.ude.invalid>
    Re: could you use array or string as hash key in Perl? <mritty@gmail.com>
    Re: could you use array or string as hash key in Perl? <bik.mido@tiscalinet.it>
    Re: could you use array or string as hash key in Perl? <benkasminbullock@gmail.com>
    Re: could you use array or string as hash key in Perl? <bik.mido@tiscalinet.it>
    Re: could you use array or string as hash key in Perl? <pgovern@u.washington.edu>
    Re: could you use array or string as hash key in Perl? <benkasminbullock@gmail.com>
    Re: could you use array or string as hash key in Perl? <ben@morrow.me.uk>
    Re: could you use array or string as hash key in Perl? <Summercoolness@gmail.com>
    Re: could you use array or string as hash key in Perl? <ben@morrow.me.uk>
    Re: FAQ 4.51 How do I permute N elements of a list? <brian.d.foy@gmail.com>
    Re: how to remove duplicate header line in CGI  dmedhora@gmail.com
    Re: how to remove duplicate header line in CGI <benkasminbullock@gmail.com>
    Re: how to remove duplicate header line in CGI <paduille.4061.mumia.w+nospam@earthlink.net>
    Re: I  need help ! <ben@morrow.me.uk>
        PERL PACKAGE IN MODULE <eser@libero.it>
    Re: PERL PACKAGE IN MODULE <bik.mido@tiscalinet.it>
    Re: PERL PACKAGE IN MODULE <ben@morrow.me.uk>
    Re: Question on input password on ssh prompt <mluvw47@gmail.com>
        Question to B::Lint <bol@adv.magwien.gv.at>
    Re: utf8 and HTML Entities <benkasminbullock@gmail.com>
        wholesale sport shoes,clothing,electronics in china www <shopbb@hotmail.com>
        wholesale sport shoes,clothing,electronics in china www <shopbb@hotmail.com>
    Re: Writing a C++ Style Checker <benkasminbullock@gmail.com>
    Re: Writing a C++ Style Checker <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 19 Sep 2007 17:30:10 -0000
From:  Summercool <Summercoolness@gmail.com>
Subject: are you using Perl in your job?
Message-Id: <1190223010.878187.150140@i38g2000prf.googlegroups.com>

I heard there are many many Perl programmers.  But the job interviews
I went to lately, they either use Java, PHP, Python, or Ruby.  So I
wonder for all the people who know Perl quite well, are you using Perl
in your job?



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

Date: Wed, 19 Sep 2007 17:36:55 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: are you using Perl in your job?
Message-Id: <Xns99B08A711DB6asu1cornelledu@127.0.0.1>

Summercool <Summercoolness@gmail.com> wrote in 
news:1190223010.878187.150140@i38g2000prf.googlegroups.com:

> I heard there are many many Perl programmers.  But the job interviews
> I went to lately, they either use Java, PHP, Python, or Ruby.  So I
> wonder for all the people who know Perl quite well, are you using Perl
> in your job?

Sorry, all the good jobs are taken.

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: Wed, 19 Sep 2007 07:01:41 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: could you use array or string as hash key in Perl?
Message-Id: <1190210501.269848.311570@y42g2000hsy.googlegroups.com>

On Sep 19, 8:50 am, Summercool <Summercooln...@gmail.com> wrote:
> could you use array or string as hash key in Perl?

Array, no.  String, yes.

Keys are scalars.  If you try to use a non-scalar as a key, that non-
scalar is evaluated in scalar context.

> and then what if you modify the array or string internally?
>
> i tried
>
> @a = (3,4);
>
> $h{@a} = "ha";
>
> and it took @a as the number 2.

Right.  Because an array in scalar context returns its size.  The size
of @a is 2.

I suppose you could use the stringified version of a reference to the
array as the key:
$h{\@a} = "ha";
but I have no idea why you would want to do such a thing.

What are you *trying* to do?  What is your end goal?

If you're trying to make a multidimensional structure, you should read
up on references:
perldoc perlreftut
perldoc perllol
perldoc perldsc

Paul Lalli



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

Date: Wed, 19 Sep 2007 16:07:02 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: could you use array or string as hash key in Perl?
Message-Id: <kca2f3paeehc3v9fajndvpc2s0e7iki4v5@4ax.com>

On Wed, 19 Sep 2007 12:50:10 -0000, Summercool
<Summercoolness@gmail.com> wrote:

>could you use array or string as hash key in Perl?

A hash key in current Perl can *only* be a string.

If you want to use an array you have to specify your own array to
string conversion facility in a way that is suitable for the problem
at hand. A simple "@array" may be appropriate or totally wrong,
depending on the actual situation.

>and then what if you modify the array or string internally?

"Internally" as opposed to... what?

>i tried
>
>@a = (3,4);
>
>$h{@a} = "ha";
>
>and it took @a as the number 2.

Of course, because the array is evaluated in a scalar context and in a
scalar context an array is its size.

You may want to use the reference to the array, in which case the key
will stay the same also if you modify the array later. You just have
to know that the key will *not* be the reference, but also in this
case, its stringification: i.e. do not hope to recover the array
directly from the key, although that is not what you were asking for.
Incidentally, if you want to, then there's a suitable module to do
exactly that.


  cognac:~ [16:06:18]$ perl -MData::Dumper -e '@a=3..4; print Dumper \
  { "@a" =>1, \@a => 2 }'
  $VAR1 = \{
              'ARRAY(0x814fe34)' => 2,
              '3 4' => 1
            };
  cognac:~ [16:06:25]$ perl -le '@a=3..4; $h{"@a"}=3; push @a,1; \
  print $h{"@a"} || "undef"'
  undef
  cognac:~ [16:06:33]$ perl -le '@a=3..4; $h{\@a}=3; push @a,1; \
  print $h{\@a} || "undef"'
  3


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Wed, 19 Sep 2007 14:06:52 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: could you use array or string as hash key in Perl?
Message-Id: <fcrads$j1b$2@ml.accsnet.ne.jp>

On Wed, 19 Sep 2007 12:50:10 +0000, Summercool wrote:

> could you use array or string as hash key in Perl?
> 
> and then what if you modify the array or string internally?
> 
> i tried
> 
> @a = (3,4);
> 
> $h{@a} = "ha";
> 
> and it took @a as the number 2.

That is the answer to your question, in fact. Perl doesn't like your array
in its hash argument, so it decides to change your array into a scalar. The
number 2 is the "scalar value" of your array, which is the number of
elements in the array.

Thus Perl has already told you that you can't use an array as a hash key.

Of course you can use a string as a hash reference. To find out what Perl
does if you change the value of the string, write a simple test, run it
and see what happens.

#!/usr/bin/perl
use warnings; use strict;
my $string = "frog";
my %animals;
$animals{$string} = "amphibian";
$string = "dolphin";
print $animals{$string}, "\n";
print $animals{frog}, "\n";


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

Date: Wed, 19 Sep 2007 16:49:10 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: could you use array or string as hash key in Perl?
Message-Id: <qid2f3ljk9qivl24okdc8k0pii1b575vng@4ax.com>

On Wed, 19 Sep 2007 14:06:52 +0000 (UTC), Ben Bullock
<benkasminbullock@gmail.com> wrote:

>That is the answer to your question, in fact. Perl doesn't like your array
>in its hash argument, so it decides to change your array into a scalar. The
>number 2 is the "scalar value" of your array, which is the number of
>elements in the array.
>
>Thus Perl has already told you that you can't use an array as a hash key.

This is misleading: using a bare array as hash key is perfectly valid
syntax with an acceptable semantics. So you *can* "use an array as a
hash key": it simply won't do what the OP wanted, whatever it was.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Wed, 19 Sep 2007 08:33:18 -0700
From:  patrick <pgovern@u.washington.edu>
Subject: Re: could you use array or string as hash key in Perl?
Message-Id: <1190215998.827469.133920@q5g2000prf.googlegroups.com>

On Sep 19, 5:50 am, Summercool <Summercooln...@gmail.com> wrote:
> could you use array or string as hash key in Perl?
>
> and then what if you modify the array or string internally?
>
> i tried
>
> @a = (3,4);
>
> $h{@a} = "ha";
>
> and it took @a as the number 2.

If you want to try and keep the array values you can always use

$h{ join('.', @a) } = 'ha';

print " $h{ join('.', @a) }\n";

====>Patrick



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

Date: Wed, 19 Sep 2007 15:26:19 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: could you use array or string as hash key in Perl?
Message-Id: <fcrf2r$j1b$4@ml.accsnet.ne.jp>

On Wed, 19 Sep 2007 16:49:10 +0200, Michele Dondi wrote:

> On Wed, 19 Sep 2007 14:06:52 +0000 (UTC), Ben Bullock
> <benkasminbullock@gmail.com> wrote:
> 
>>That is the answer to your question, in fact. Perl doesn't like your
>>array in its hash argument, so it decides to change your array into a
>>scalar. The number 2 is the "scalar value" of your array, which is the
>>number of elements in the array.
>>
>>Thus Perl has already told you that you can't use an array as a hash
>>key.
> 
> This is misleading: using a bare array as hash key is perfectly valid
> syntax with an acceptable semantics. So you *can* "use an array as a
> hash key": it simply won't do what the OP wanted, whatever it was.

In the original poster's post he says

> i tried
> @a = (3,4);
> $h{@a} = "ha";
> and it took @a as the number 2.

so he clearly already knows that using an array as a hash key isn't a
syntax error.


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

Date: Wed, 19 Sep 2007 16:53:24 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: could you use array or string as hash key in Perl?
Message-Id: <k8t7s4-e81.ln1@osiris.mauzo.dyndns.org>


Quoth Paul Lalli <mritty@gmail.com>:
> On Sep 19, 8:50 am, Summercool <Summercooln...@gmail.com> wrote:
> > could you use array or string as hash key in Perl?
> 
> Array, no.  String, yes.
> 
> Keys are scalars.

No, keys are strings (except in tied hashes). This is important, as it
is why using a ref as a key doesn't work.

> If you try to use a non-scalar as a key, that non- scalar is evaluated
> in scalar context.

 ...and then stringified.

Ben



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

Date: Wed, 19 Sep 2007 17:27:19 -0000
From:  Summercool <Summercoolness@gmail.com>
Subject: Re: could you use array or string as hash key in Perl?
Message-Id: <1190222839.789148.298890@y27g2000pre.googlegroups.com>

yes, i tried using

$h{(3,4)} = "hee";

and print out all the key value pairs.
the key "3 4" show up with a strange character between them.




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

Date: Wed, 19 Sep 2007 18:36:14 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: could you use array or string as hash key in Perl?
Message-Id: <e938s4-on2.ln1@osiris.mauzo.dyndns.org>


Quoth Summercool <Summercoolness@gmail.com>:
> yes, i tried using
> 
> $h{(3,4)} = "hee";
> 
> and print out all the key value pairs.
> the key "3 4" show up with a strange character between them.

That character is the value of $; (by default "\034"), and is how Perl 4
used to do multi-level hashes before Perl 5 and refs were invented.
Using a (literal) list as a key is well worth avoiding nowadays.

Ben



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

Date: Wed, 19 Sep 2007 09:09:45 -0700
From: brian d  foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 4.51 How do I permute N elements of a list?
Message-Id: <190920070909455168%brian.d.foy@gmail.com>

In article <1kp1f3lektuk0tkb0mut0ftp572mr2sr91@4ax.com>, Michele Dondi
<bik.mido@tiscalinet.it> wrote:

> On Tue, 18 Sep 2007 18:03:02 -0700, PerlFAQ Server
> <brian@stonehenge.com> wrote:
> 
> >    Use the "List::Permutor" module on CPAN. If the list is actually an
> >    array, try the "Algorithm::Permute" module (also on CPAN). It's written

> If there's some interest in this I may try to concoct a patch to the
> faq entry.

Yes, please do. You can post it here and I should find it. 

Alternatively, you could also just patch the faq directly according to
the instructions in perlfaq. The latest version is always at
http://faq.perl.org , so ignore any installed perlfaq.pod that mentions
CVS instead of SVN :)


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

Date: Wed, 19 Sep 2007 06:46:05 -0700
From:  dmedhora@gmail.com
Subject: Re: how to remove duplicate header line in CGI
Message-Id: <1190209565.949339.190990@o80g2000hse.googlegroups.com>

On Sep 18, 4:41 pm, "Mumia W." <paduille.4061.mumia.w
+nos...@earthlink.net> wrote:
> On 09/18/2007 08:40 AM, Ben Bullock wrote:
>
> > On Tue, 18 Sep 2007 06:24:37 -0700, dmedhora wrote:
>
> >> Hi and Thanks for your posts, Well, to add more details to this
> >> It happens only when I use CGI::FormBuilder
> >> So, if I use CGI.pm there is no duplication but if I use
> >> CGI::FormBuilder then I get that duplicate.
>
> > I ran the script you supplied, but I only got the offending message once.
>
> Same here.

Hi,
Well when I run the script on the command line I get two headers i.e
"Content Type" lines
printed out, is that good or bad ?
I have a cat and head display below:
[root@localhost cgi-bin]# cat h.pl
#!/usr/bin/perl
use CGI::FormBuilder;

my @fields = qw(category task status notes);

my $form = CGI::FormBuilder->new(
             method => 'post',
             fields => \@fields,
             validate => {
                status => 'INT',    # validate
             },
             required => 'ALL',
        );

if ($form->submitted)
{
    print $form->confirm(header => 1);
} else {
    print $form->render(header => 1);
}
[root@localhost cgi-bin]# ./h.pl | head
Content-Type: text/html; charset=iso-8859-1

Content-Type: text/html; charset=iso-8859-1

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US"
xml:lang="en_US">

[root@localhost cgi-bin]#



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

Date: Wed, 19 Sep 2007 16:04:05 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: how to remove duplicate header line in CGI
Message-Id: <fcrh9l$kn0$1@ml.accsnet.ne.jp>

On Wed, 19 Sep 2007 06:46:05 -0700, dmedhora wrote:


> Well when I run the script on the command line I get two headers i.e
> "Content Type" lines
> printed out, is that good or bad ?

That's bad.

> I have a cat and head display below:

> [root@localhost cgi-bin]# ./h.pl | head
> Content-Type: text/html; charset=iso-8859-1
> 
> Content-Type: text/html; charset=iso-8859-1

It might be a bug in your version of CGI::FormBuilder. I'm using the
latest version, including dependencies. One suggestion which might fix
this is you could try using "cpan upgrade" to make sure that you're up to
date with all the modules you're using. Also it might be a good idea to
try running the same script on a different machine.


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

Date: Wed, 19 Sep 2007 12:50:09 -0500
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: how to remove duplicate header line in CGI
Message-Id: <13f2ovj8vb8r491@corp.supernews.com>

On 09/19/2007 08:46 AM, dmedhora@gmail.com wrote:
> 
> Hi,
> Well when I run the script on the command line I get two headers i.e
> "Content Type" lines
> printed out, is that good or bad ? [...]

As Mr. Morrow said, that's bad.

When I run the following script on the command line, I get only one 
Content-Type header:

----------------------script------------------
#!/usr/bin/perl

use CGI::FormBuilder;
use Module::Versions::Report;

my @fields = qw(category task status notes);

my $form = CGI::FormBuilder->new(
              method => 'post',
              fields => \@fields,
              validate => {
                 status => 'INT',    # validate
              },
              required => 'ALL',
         );

if ($form->submitted)
{
     print $form->confirm(header => 1);
} else {
     print $form->render(header => 1);
}
----------------------end---------------------

Here is the output:

Content-Type: text/html; charset=ISO-8859-1

<html><head><title>Form Build</title>
<script language="JavaScript1.3"><!-- hide from old browsers
function validate (form) {
     var alertstr = '';
     var invalid  = 0;

     // standard text, hidden, password, or textarea box
     var category = form.elements['category'].value;
     if ( ((! category && category != 0) || category === "")) {
         alertstr += '- You must enter a valid value for the "Category" 
field\n';
         invalid++;
     }
     // standard text, hidden, password, or textarea box
     var task = form.elements['task'].value;
     if ( ((! task && task != 0) || task === "")) {
         alertstr += '- You must enter a valid value for the "Task" 
field\n';
         invalid++;
     }
     // standard text, hidden, password, or textarea box
     var status = form.elements['status'].value;
     if ( (! status.match(/^-?\s*[0-9]+$/)) ) {
         alertstr += '- You must enter a valid value for the "Status" 
field\n';
         invalid++;
     }
     // standard text, hidden, password, or textarea box
     var notes = form.elements['notes'].value;
     if ( ((! notes && notes != 0) || notes === "")) {
         alertstr += '- You must enter a valid value for the "Notes" 
field\n';
         invalid++;
     }
     if (invalid > 0 || alertstr != '') {
         if (! invalid) invalid = 'The following';   // catch for 
programmer error
         alert(''+invalid+' error(s) were encountered with your 
submission:'+'\n\n'+alertstr+'\n'+'Please correct these fields and try 
again.');
         // reset counters
         alertstr = '';
         invalid  = 0;
         return false;
     }
     return true;  // all checked ok
}
//-->
</script><noscript><font color="red"><b>Please enable JavaScript or use 
a newer browser</b></font></noscript><p></head><body 
bgcolor="white"><h3>Form Build</h3><p>Fields shown in <b>bold</b> are 
required.
<!-- Generated by CGI::FormBuilder v2.12 available from 
www.formbuilder.org -->
<form action="form-build.cgi" method="post" onSubmit="return 
validate(this);"><input name="_submitted" type="hidden" value="1" 
/><input name="_sessionid" type="hidden" value="" /><table>
<tr valign="middle"><td align="left"><b>Category</b></td><td><input 
name="category" type="text" /></td></tr>
<tr valign="middle"><td align="left"><b>Task</b></td><td><input 
name="task" type="text" /></td></tr>
<tr valign="middle"><td align="left"><b>Status</b></td><td><input 
name="status" type="text" /></td></tr>
<tr valign="middle"><td align="left"><b>Notes</b></td><td><input 
name="notes" type="text" /></td></tr>
<tr valign="middle"><td colspan="2"><center><input name="_reset" 
type="reset" value="Reset" /><input name="_submit" type="submit" 
value="Submit" /></center></td></tr></table>
</form></body></html>


Perl v5.8.4 under linux
  Modules in memory:
   attributes;
   Carp v1.02;
   CGI v3.04;
   CGI::FormBuilder v2.12;
   CGI::Util v1.4;
   CGITempFile;
   constant v1.04;
   DynaLoader;
   Exporter v5.58;
   Fh;
   Internals;
   Module::Versions::Report v1.02;
   MultipartBuffer;
   overload v1.01;
   PerlIO;
   PerlIO::Layer;
   Regexp;
   strict v1.03;
   UNIVERSAL;
   utf8;
   vars v1.01;
   warnings v1.03;
   warnings::register v1.00;
[at Wed Sep 19 12:41:01 2007 (local) / Wed Sep 19 17:41:01 2007 (GMT)]



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

Date: Wed, 19 Sep 2007 16:50:11 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: I  need help !
Message-Id: <j2t7s4-e81.ln1@osiris.mauzo.dyndns.org>


Quoth Jeet A <dumpe2fs@gmail.com>:
> I made a package in perl . that is working great the only problem is i
> am not able to run iton custom linux system where i cant install perl
> modules which  my package uses . that custom linux  system dont have
> make , gcc , and all that are needed to install required perl modules
> for my package. at least perl is installed .
> 
> How can I run my package on that custom linux system

If you can build a Perl on a different, compatible, system that is
configured in *exactly* the same way (see perl -V:config_args from your
embedded perl: note that you will also need to arrange to link against
the same libraries; e.g. if your embedded system uses one of the minimal
libcs you will need to build your perl against that rather than glibc),
you should be able to copy the whole of lib/perl5/site_perl (or wherever
you keep it) onto your embedded system. This is effectively what
package systems like ActiveState's ppm and Debian's dpkg end up doing.

Alternatively if your embedded system has a package manager you may be
able to create packages for it, and install them. Most package managers
come with a tool to create a package out of a CPAN distribution, with or
without some amount of manual intervention.

Ben



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

Date: Wed, 19 Sep 2007 06:44:35 -0700
From:  colli <eser@libero.it>
Subject: PERL PACKAGE IN MODULE
Message-Id: <1190209475.053268.308320@50g2000hsm.googlegroups.com>

Hi
I need to load one of mine perl template module whose package (which
is evoked at the head of each module) at the head of the code should
change to be the same of the name of the module I decided to call.
Each time I load it I would like to change the name of my module (but
the template still remain the same)
It is a default module template but can assume different MYNAME.pm so
a different package should be evoked for different module
name...Instead of MYNAME I would be able to change into MYNAME1 and to
change dinamically the package.
Is there a perl function to insert in my module instead of the static
expression:   package MYNAME;  ?

Thank you in advance



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

Date: Wed, 19 Sep 2007 16:50:08 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: PERL PACKAGE IN MODULE
Message-Id: <2od2f3h9n5baecjsm4h7g2avbtggd1etti@4ax.com>

On Wed, 19 Sep 2007 06:44:35 -0700, colli <eser@libero.it> wrote:

>I need to load one of mine perl template module whose package (which
>is evoked at the head of each module) at the head of the code should
>change to be the same of the name of the module I decided to call.
>Each time I load it I would like to change the name of my module (but
>the template still remain the same)
>It is a default module template but can assume different MYNAME.pm so
>a different package should be evoked for different module
>name...Instead of MYNAME I would be able to change into MYNAME1 and to
>change dinamically the package.
>Is there a perl function to insert in my module instead of the static
>expression:   package MYNAME;  ?

I'm not sure I understand your question, but chances may be that
you're after __PACKAGE__.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Wed, 19 Sep 2007 17:24:48 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: PERL PACKAGE IN MODULE
Message-Id: <g3v7s4-to1.ln1@osiris.mauzo.dyndns.org>


Quoth colli <eser@libero.it>:
> Hi
> I need to load one of mine perl template module whose package (which
> is evoked at the head of each module) at the head of the code should
> change to be the same of the name of the module I decided to call.
> Each time I load it I would like to change the name of my module (but
> the template still remain the same)
> It is a default module template but can assume different MYNAME.pm so
> a different package should be evoked for different module
> name...Instead of MYNAME I would be able to change into MYNAME1 and to
> change dinamically the package.
> Is there a perl function to insert in my module instead of the static
> expression:   package MYNAME;  ?

There are various ways you could do this, none of which are for the
faint of heart :). One simple way would be to put the entire module into
a string eval: then you can perform any replacements you like on the
code before evalling it. Another would be to use a source filter. Both
these approaches would fall foul of the fact that Perl will only load a
given file once, but that can be got around.

However, before you do this you should take a step back. What are you
actually trying to achieve here? Chances are you can do it without
resorting to rewriting your module on the fly, say by creating a
'package factory' module that will, on request, create a new package and
import some functions into it.

Ben



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

Date: Wed, 19 Sep 2007 17:25:23 -0000
From:  Mav <mluvw47@gmail.com>
Subject: Re: Question on input password on ssh prompt
Message-Id: <1190222723.364243.123230@e9g2000prf.googlegroups.com>

On Sep 17, 5:02 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth Mav <mluv...@gmail.com>:
>
>
>
> > On Sep 17, 10:23 am, Ben Morrow <b...@morrow.me.uk> wrote:
> > > Quoth "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>:
>
> > > > Mav wrote:
>
> > > > > In fact, The actual script I am working actually first generates the
> > > > > public key on the PC side(for that PC), then append the public key
> > > > > into linux (.ssh/authorized_key) entry thru ssh command. So next time,
> > > > > if the PC invokes a command from the PC to linux side thru ssh, it
> > > > > will not prompt the password. Any suggestion?
>
> > > > You have to authenticate to have SSH work.  That authentication
> > > > can be public key or by providing the password.  You might want
> > > > to look at the Expect module, to automate the initial authentication
> > > > with the password. Probably the best route is if the ssh keys don't
> > > > exist, then to have the script prompt for the password when it
> > > > runs, and have it pass it to SSH, using Expect.
>
> > > No, that won't work, as Expect requires ptys, which WinXP doesn't have.
> > > I think the OP's best way forward is to try Net::SSH::W32Perl, which can
> > > log in with a password.
>
> > I looks into the Net::SSH::W32Perl, when I tried to use that I got the
> > error:
>
> > use Net::SSH::W32Perl;
> > my $ssh = new Net::SSH::W32Perl($host, protocol => 2, debug=>1);
>
> > The getpwuid function is unimplemented at C:/Perl/site/lib/Net/SSH/
> > Perl.pm line
> > 110.
>
> > line 110 on Perl.pm regarding to environment variable $HOME on PC. Do
> > you encounter the same problem? That means that I have to set the
> > $HOME in my script?
>
> Err... yes, looks like it. I always have %HOME% set to my profile
> directory anyway under Win32... I guess this could be reported as a bug
> in N:S:W32Perl or N:S:Perl: the correct answer would be to use
> File::HomeDir. You should probably put
>
>     use File::HomeDir;
>     BEGIN { $ENV{HOME} ||= File::HomeDir->my_data }
>
> at the top, which will cause N:S:Perl to look for its config file in
> Local Settings\Application Data\.ssh\config . Alternatively, if you
> already have an OpenSSH config file elsewhere, simply direct N:S:W32Perl
> at it: you will still need to set $ENV{HOME}, even though it will be
> ignored.
>
> Ben

Thanks Ben. Look like when I download the package from here:
http://www.soulcage.net/ppds/

It doesn't have that problem.

Thanks,
Mav



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

Date: Wed, 19 Sep 2007 16:48:39 +0200
From: "Ferry Bolhar" <bol@adv.magwien.gv.at>
Subject: Question to B::Lint
Message-Id: <1190213322.961862@proxy.dienste.wien.at>

Hi folks,

when checking a script with B::Lint

perl -MO=Lint,all <script>.pl

I get this message:

Implicit scalar context for array in shift at semper.pl line 332

Looking at this line, this is (the previous line is shown
as well):

331 sub force_term {
332   my $test = shift;

which gets parsed internally as:

my $test = shift @_;

In fact, that's what I see when using B::Deparse.

Adding "@_" to the shift() function will make B::Lint
happy, no message is shown.

However, I tought, the "Implicit scalar context" message
is given in situations like this

my $elem_num = @array;

which should be written exactly as

my $elem_num = scalar @array;

But this isn't the case here. Where's the "implicit scalar
context" in

my $test = shift;

Is this a bug in B::Lint?

BTW: This is Perl 5.8.6, B::Lint 1.09

Kind greetings, Ferry

-- 
Ing Ferry Bolhar
Magistrat der Stadt Wien - MA 14
A-1010 Wien
E-Mail: bol@adv.magwien.gv.at




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

Date: Wed, 19 Sep 2007 13:58:40 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: utf8 and HTML Entities
Message-Id: <fcr9ug$j1b$1@ml.accsnet.ne.jp>

On Wed, 19 Sep 2007 14:59:02 +0200, Nick Gerber wrote:


> I have a string encodet in utf8 with part HTML Entities and part 
> characters in utf-8.
> 
> How do I translate the HTML Entities into proper utf-8?

Since this must be a commonly encountered problem, my first guess would be
to try cpan to save myself the bother of writing it myself. I rapidly found:

http://search.cpan.org/~gaas/HTML-Parser-3.56/lib/HTML/Entities.pm
 
Please note that I can't vouch for this software since I have not tried it.

As far as utf8 goes you need to use the "Encode" module.


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

Date: Wed, 19 Sep 2007 08:01:36 -0700
From:  "shopbb.com" <shopbb@hotmail.com>
Subject: wholesale sport shoes,clothing,electronics in china www.shopbb.com
Message-Id: <1190214096.167287.100130@i13g2000prf.googlegroups.com>

Dear my friend
It is our pleasure to meet you here.
we are wholesaler sport shoes,clothing,electrons in Fujian of China.
our website: http://www.shopbb.com
We are professional and honest wholesaler of all kinds of brand
sneaks and apparel.the products
our company supply are as follows:
 1).Nike Jordans
 Jordan 1 jordan 1.5 jordan 2 jordan 3 jordan 3.5 jordan 4 jordan 5
jordan 5.5 jordan 6 jordan 6.5 jordan 7 jordan 8 jordan 9 jordan 9.5
jordan 10 jordan 11 jordan 12 jordan 13 jordan 13.5 jordan 14 jordan
15 jordan 16 jordan 17 jordan 18 jordan 18.5 jordan 19 jordan 20
jordan 21 jordan 21.5 jordan 22 jordan King jordan Dub Zero Jordan 23
Jordan 7.5
2).Air Force One Air Force one (low) Air Force one (High) Air Force
one (Mid) Air Force one (clear) Air Force One 25 year
3).SHOX  Shox R3 Shox R4 Shox R5 Shox TL1 Shox TL2 Shox TL3 Shox NZ
Shox OZ Shox Turbo Show GO Shox CL Shox Coqnescenti Shox Energia Shox
Explodine Shox Monster Shox Rhythmic Shox Warrior
4).Bape Shoes Bape  Bape (transparent)
5).Air max AirMax 90 AirMax 95 AirMax 97 AirMax 2003 AirMax 2004
AirMax 2005 Air Max 2006 AirMax 180 AirMax LTD AirMax TN AirMax solas
AirMax 87 AirMax Rift
6).Puma Puma Rpt2 Puma SK6 Puma Jayfi Puma Cir Puma Speed Puma Repli
Puma Future Cat Puma Mostro Puma Lifestyle
7).Dunk SB Dunk High Dunk Low
8).Timberland Timberland High Timberland Low
9).Adidas Adidas 35 Adicolor Country  city sense  Adidas NBA
11).Prada & Gucci  Prada  Gucci
12).Footballer Shoes  Footballer
13).Locaste
14).converse & Reebok converse Reebok
15).D&G shoes
16).Dsquared2 shoes
17).James shoes
18).Nike King
9).Children shoes Jordan Shox
20).Women shoes Women Jordans Women Shox R3 Women Shox R4 Women AirMax
95&97 Women AirMax 03&06 Women Dunk Women Shox NZ Women AF1
21).sandal & baboosh Nike Puma Gucci Prada
CLOTHES 1).Bape 2).ED Hardy 3).BBC 4).CLH 5).LRG 6).Artful Dodger
Hoodies 7).GINO GREEN GLOBAL 8).10 Deep 9).A&F Coat 11).Jersey NBA
Jersey Football Jersey 12).Juicy Bikini 13).Adidas Coat 14).F1 Coat
15).D&G Coat 16).Superman Coat 17).NBA Coat
JEAN 1).E&D Jeans 2).BBC Jeans 3).BAPE Jeans 4).D&G Jeans 5).EVSIU
Jeans 6).Red monkey 7).COOGI Jeans
T-shirt 1).POLO  2007 polo(women) 2007 POLO IIII(Men) POLO (stripe)
polo (small )
2).Lacoste Lacoste (LONG) Lacoste (SHORT) 3).Name Brand shirt D&G
Shirt Giorgio Armani TN Shirt 4).BBC T-shirt 5).LRG & gina green
glalal 6).Triumvir 7).ED handy 8).Evsiu 9).R.M.B 10).CLOT
Burse & Handbag 1).LV Bag 2).Gucci Bag 3).Dior Bag 4).Chanel Bag
5).Fendi Bag 6).Coach Bag 7).Burberrys Bag 8).Prada Bag 9).Man Leisure
Bag 11).D&G bag 12).nike bag 13).Wallet 14).Suitcase
Electronics 1).Vertu Mobile 2).New iphone Mobile 3).Nokia Mobile
4).moto Mobile 5).PSP Game & memory card 6).Sony Mobile 7).Samsung
Mobile 8).Ipod nano 9).Sony PS3 10).Laptops IBM laptops DELL laptops
Sony laptops ASUS laptops
CAP 1).ED Hardy Cap 2).New Bape & NY Cap 3).RMC Cap 4).New era NBA
5).F1 6).Chanel 7).D&G 8).gucci 9).LV 10).Prada 11).PUMA 12).wool
WATCH 1).Rolex 2).Omega 3).Cartier 4).Chanel 5).Piaget 6).Breitling
7).Bvlgari 8).Corum
Sunglasses 1).Gucci Sunglasses 2).D&G Sunglasses 3).Dior Sunglasses
4).LV Sunglasses 5).Chanel Sunglasses 6).Prada Sunglasses 7).Versace
Sunglasses 8).Giorgio Armani
Strap 1).Bape Strap 2).D&G Strap 3).Gucci Strap 4).LV Strap 5).Scarf
Other 1).Lighter

size chart
Men Size:
US: 7 8 8.5 9 9.5 10 10.5 11 11.5 12 13 14 15
UK: 6 7 7.5 8 8.5 9 9.5 10 10.5 11 12 13 14
EUR: 40 41 42 42.5 43 44 44.5 45 45.5 46 47.5 48 49
Women Size:
US: 5 5.5 6 6.5 7 7.5 8 8.5
UK: 2.5 3 3.5 4 4.5 5 5.5 6
EUR: 35.5 36 36.5 37.5 38 38.5 39 40

Kid's
US: 1 2 3 4 5 6 7 7.5 8 8.5 9 9.5 10 10.5 11 11.5 12 12.5 13 13.5
UK: 13 1 2 3 4 5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5 11 11.5 12 12.5
EUR:17 18 19 20 21 22 23 24 24.5 25 25.5 26 26.5 27 27.5 28 29 30 30.5
31

Clothing Size:
S M L XL XXL XXXL XXXXL XXXXXL

7.because the space of the website is limited,we can also supply many
other products which be not showed out in our site. if you have the
photos of the products you need , we are pleasure to supply for your
orders.
And our company can supply for our customers ,as follow:
1. top quality.all our products have top quality.
2. most rational price.  we offer the most competitive price to you to
open your market. So today most of our products have sold well in the
America, Europe, Middle East, Southeast Asia etc..
3. safe and fast shipment. As different country you are in, we will
deliver the products to you by different ways and pledge to arrive to
your address 100%.and we will send the products to you within 24h
after we get your payment.
4.many products in stock. We have many products in stock and kinds of
size you need , also include kid's.
5.our credit. If the products can be not delivered to your address as
our reason, we will refund the money you paid.
Hope sincerely to have glad and long term business relationship with
you.
If you are interested in our products and have any problem, welcome
to
contact us.
Please trust us , we will be your best choice !!!
Website : http://www.shopbb.com
MSN and E-mail: shopbb@hotmail.com
Yahoo ID:mallinchina@yahoo.com.cn
Michael



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

Date: Wed, 19 Sep 2007 08:06:31 -0700
From:  "shopbb.com" <shopbb@hotmail.com>
Subject: wholesale sport shoes,clothing,electronics in china www.shopbb.com
Message-Id: <1190214391.865987.110010@i13g2000prf.googlegroups.com>

Dear my friend
It is our pleasure to meet you here.
we are wholesaler sport shoes,clothing,electrons in Fujian of China.
our website: http://www.shopbb.com
We are professional and honest wholesaler of all kinds of brand
sneaks and apparel.the products
our company supply are as follows:
 1).Nike Jordans
 Jordan 1 jordan 1.5 jordan 2 jordan 3 jordan 3.5 jordan 4 jordan 5
jordan 5.5 jordan 6 jordan 6.5 jordan 7 jordan 8 jordan 9 jordan 9.5
jordan 10 jordan 11 jordan 12 jordan 13 jordan 13.5 jordan 14 jordan
15 jordan 16 jordan 17 jordan 18 jordan 18.5 jordan 19 jordan 20
jordan 21 jordan 21.5 jordan 22 jordan King jordan Dub Zero Jordan 23
Jordan 7.5
2).Air Force One Air Force one (low) Air Force one (High) Air Force
one (Mid) Air Force one (clear) Air Force One 25 year
3).SHOX  Shox R3 Shox R4 Shox R5 Shox TL1 Shox TL2 Shox TL3 Shox NZ
Shox OZ Shox Turbo Show GO Shox CL Shox Coqnescenti Shox Energia Shox
Explodine Shox Monster Shox Rhythmic Shox Warrior
4).Bape Shoes Bape  Bape (transparent)
5).Air max AirMax 90 AirMax 95 AirMax 97 AirMax 2003 AirMax 2004
AirMax 2005 Air Max 2006 AirMax 180 AirMax LTD AirMax TN AirMax solas
AirMax 87 AirMax Rift
6).Puma Puma Rpt2 Puma SK6 Puma Jayfi Puma Cir Puma Speed Puma Repli
Puma Future Cat Puma Mostro Puma Lifestyle
7).Dunk SB Dunk High Dunk Low
8).Timberland Timberland High Timberland Low
9).Adidas Adidas 35 Adicolor Country  city sense  Adidas NBA
11).Prada & Gucci  Prada  Gucci
12).Footballer Shoes  Footballer
13).Locaste
14).converse & Reebok converse Reebok
15).D&G shoes
16).Dsquared2 shoes
17).James shoes
18).Nike King
9).Children shoes Jordan Shox
20).Women shoes Women Jordans Women Shox R3 Women Shox R4 Women AirMax
95&97 Women AirMax 03&06 Women Dunk Women Shox NZ Women AF1
21).sandal & baboosh Nike Puma Gucci Prada
CLOTHES 1).Bape 2).ED Hardy 3).BBC 4).CLH 5).LRG 6).Artful Dodger
Hoodies 7).GINO GREEN GLOBAL 8).10 Deep 9).A&F Coat 11).Jersey NBA
Jersey Football Jersey 12).Juicy Bikini 13).Adidas Coat 14).F1 Coat
15).D&G Coat 16).Superman Coat 17).NBA Coat
JEAN 1).E&D Jeans 2).BBC Jeans 3).BAPE Jeans 4).D&G Jeans 5).EVSIU
Jeans 6).Red monkey 7).COOGI Jeans
T-shirt 1).POLO  2007 polo(women) 2007 POLO IIII(Men) POLO (stripe)
polo (small )
2).Lacoste Lacoste (LONG) Lacoste (SHORT) 3).Name Brand shirt D&G
Shirt Giorgio Armani TN Shirt 4).BBC T-shirt 5).LRG & gina green
glalal 6).Triumvir 7).ED handy 8).Evsiu 9).R.M.B 10).CLOT
Burse & Handbag 1).LV Bag 2).Gucci Bag 3).Dior Bag 4).Chanel Bag
5).Fendi Bag 6).Coach Bag 7).Burberrys Bag 8).Prada Bag 9).Man Leisure
Bag 11).D&G bag 12).nike bag 13).Wallet 14).Suitcase
Electronics 1).Vertu Mobile 2).New iphone Mobile 3).Nokia Mobile
4).moto Mobile 5).PSP Game & memory card 6).Sony Mobile 7).Samsung
Mobile 8).Ipod nano 9).Sony PS3 10).Laptops IBM laptops DELL laptops
Sony laptops ASUS laptops
CAP 1).ED Hardy Cap 2).New Bape & NY Cap 3).RMC Cap 4).New era NBA
5).F1 6).Chanel 7).D&G 8).gucci 9).LV 10).Prada 11).PUMA 12).wool
WATCH 1).Rolex 2).Omega 3).Cartier 4).Chanel 5).Piaget 6).Breitling
7).Bvlgari 8).Corum
Sunglasses 1).Gucci Sunglasses 2).D&G Sunglasses 3).Dior Sunglasses
4).LV Sunglasses 5).Chanel Sunglasses 6).Prada Sunglasses 7).Versace
Sunglasses 8).Giorgio Armani
Strap 1).Bape Strap 2).D&G Strap 3).Gucci Strap 4).LV Strap 5).Scarf
Other 1).Lighter

size chart
Men Size:
US: 7 8 8.5 9 9.5 10 10.5 11 11.5 12 13 14 15
UK: 6 7 7.5 8 8.5 9 9.5 10 10.5 11 12 13 14
EUR: 40 41 42 42.5 43 44 44.5 45 45.5 46 47.5 48 49
Women Size:
US: 5 5.5 6 6.5 7 7.5 8 8.5
UK: 2.5 3 3.5 4 4.5 5 5.5 6
EUR: 35.5 36 36.5 37.5 38 38.5 39 40

Kid's
US: 1 2 3 4 5 6 7 7.5 8 8.5 9 9.5 10 10.5 11 11.5 12 12.5 13 13.5
UK: 13 1 2 3 4 5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5 11 11.5 12 12.5
EUR:17 18 19 20 21 22 23 24 24.5 25 25.5 26 26.5 27 27.5 28 29 30 30.5
31

Clothing Size:
S M L XL XXL XXXL XXXXL XXXXXL

7.because the space of the website is limited,we can also supply many
other products which be not showed out in our site. if you have the
photos of the products you need , we are pleasure to supply for your
orders.
And our company can supply for our customers ,as follow:
1. top quality.all our products have top quality.
2. most rational price.  we offer the most competitive price to you to
open your market. So today most of our products have sold well in the
America, Europe, Middle East, Southeast Asia etc..
3. safe and fast shipment. As different country you are in, we will
deliver the products to you by different ways and pledge to arrive to
your address 100%.and we will send the products to you within 24h
after we get your payment.
4.many products in stock. We have many products in stock and kinds of
size you need , also include kid's.
5.our credit. If the products can be not delivered to your address as
our reason, we will refund the money you paid.
Hope sincerely to have glad and long term business relationship with
you.
If you are interested in our products and have any problem, welcome
to
contact us.
Please trust us , we will be your best choice !!!
Website : http://www.shopbb.com
MSN and E-mail: shopbb@hotmail.com
Yahoo ID:mallinchina@yahoo.com.cn
Michael



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

Date: Wed, 19 Sep 2007 15:34:10 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Writing a C++ Style Checker
Message-Id: <fcrfhi$j1b$5@ml.accsnet.ne.jp>

On Wed, 19 Sep 2007 13:00:42 +0000, ids wrote:

> I'm new to Perl. I'm trying to use Perl to write a C++ Style Checker
> to validate various coding standards followed in our organization.
> 
> Some of the things I need to do in this tool include:
> - verifying whether identifier naming conventions have been followed
> - differentiating between member variables and local variables
> (because their naming conventions are different)
> - determining method/function boundaries
> - identifying control structures such as 'if', 'while' etc to see
> whether they are written with code blocks (i.e. { }) all the time

Well, as a start (probably misses some cases):

print "Aw shucks" if ($mycode =~ /(if|while)[^{}]*?;/s);

> - check whether statements are more than a given width (say 100
> column)

That doesn't sound hard:

#!/usr/bin/perl
use warnings; use strict;
while (<>) {
    print "Line $.: Oops! Too long!\n" if (/^.{100,}$/);
}

> - etc. etc.
> 
> This need not go in to semantics of the program; what I need is a
> basic style checker.
> 
> What I see is that parsing line by line independently is not going to
> help.

Well, it can do some of this stuff very rapidly.

> This parser needs to build context and remember stuff across
> lines to satisfy above goals.
> 
> Are there any existing Perl based style checkers? If not, can you give
> some advice on how best to structure this program? Or else can you
> give some good references on *design* aspects of Perl?



> (I have a C/C++ background. So I'm familiar with OO design. I'm trying
> to develop a *similar mental model* for Perl programs.)

Are you sure your problem is difficult enough to warrant developing a
mental model? Sounds like a relatively simple job for Perl to me. Why not
just code something up and see how it goes?


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

Date: Wed, 19 Sep 2007 17:18:21 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Writing a C++ Style Checker
Message-Id: <dnu7s4-to1.ln1@osiris.mauzo.dyndns.org>


Quoth ids <ishan.desilva@gmail.com>:
> Hi,
> 
> I'm new to Perl. I'm trying to use Perl to write a C++ Style Checker
> to validate various coding standards followed in our organization.
> 
> Some of the things I need to do in this tool include:
> - verifying whether identifier naming conventions have been followed
> - differentiating between member variables and local variables
> (because their naming conventions are different)
> - determining method/function boundaries
> - identifying control structures such as 'if', 'while' etc to see
> whether they are written with code blocks (i.e. { }) all the time
> - check whether statements are more than a given width (say 100
> column)
> - etc. etc.
> 
> This need not go in to semantics of the program; what I need is a
> basic style checker.
> 
> What I see is that parsing line by line independently is not going to
> help. This parser needs to build context and remember stuff across
> lines to satisfy above goals.

This is going to be seriously hard work. What you need is a parser for
C++, and as C++ is a *very* complex language this is not going to be
easy to get right, unless you are content to only recognize simple
constructions without parsing the code properly.

There is a Parse::RecDescent grammar for some subset of C++ included in
the Inline::CPP distribution. You may find it useful to start there.

Alternatively, you may be able to persuade your compiler to do the
parsing for you. While some of your criteria above (such as blocks on
ifs) will be lost by such an approach, you may be able to handle these
with a relatively simple parser, leaving the hard work of 'is this
identifier a local or member variable' to the compiler.

What you need to do is either persuade your compiler to produce some
intermediate parsed form of output (such as from gcc's -fdump-* and -d*
options), or compile objects with debugging info and then parse that.
One example of a (now very old) program that does this is c2ph in the
Perl distribution, which was intended to allow access to C structures by
parsing stabs debugging information.

> Are there any existing Perl based style checkers?

There is Perl::Critic, for style-checking Perl, but that is based on the
excellent PPI, a Perl module that parses Perl, which took a *lot* of
work to produce.

Basically: you have set yourself an *extremely* hard problem :(. You can
either produce a very 'shallow' and rather incomplete solution, or
produce a proper solution only after a lot of work. OTOH, a proper C++
parser for Perl would probably be a good thing... :)

Ben



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

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


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