[24499] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6679 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 11 06:06:37 2004

Date: Fri, 11 Jun 2004 03:05: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           Fri, 11 Jun 2004     Volume: 10 Number: 6679

Today's topics:
        $array.fieldname question <a@b.c>
    Re: $array.fieldname question <postmaster@castleamber.com>
    Re: Extracting Text (Jake Gottlieb)
    Re: Extracting Text <peter@semantico.com>
    Re: Extracting Text (Anno Siegel)
    Re: Extracting Text <noreply@gunnar.cc>
    Re: How to get "perl -V"'s output programmatically? <tassilo.parseval@rwth-aachen.de>
    Re: How to get "perl -V"'s output programmatically? <usenet@morrow.me.uk>
    Re: match aaa but not 123aaa <ken_sington@nospam_abcdefg.com>
    Re: match aaa but not 123aaa (Anno Siegel)
    Re: Microsoft Word and Perl <usenet@morrow.me.uk>
    Re: Nameed pipes Vs sockets <usenet@morrow.me.uk>
        Operator overloading revisited <kalinaubears@iinet.net.au>
    Re: Operator overloading revisited (Anno Siegel)
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@augustmail.com
        Regular  expressions <feelkaushik@rediffmail.com>
    Re: Regular  expressions <usenet@morrow.me.uk>
        SOAP::Lite using HTTPS as a transport? (josh)
    Re: startting perl <simon@unisolve.com.au>
    Re: startting perl <bik.mido@tiscalinet.it>
        test script (Sree)
    Re: test script (Anno Siegel)
    Re: XML::DOM Query <usenet@morrow.me.uk>
    Re: XML::DOM Query <thesnake_123@-NO-S_P_A_M-hotmail.com>
    Re: XML::DOM Query <usenet@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 11 Jun 2004 09:54:22 +0200
From: ZZT <a@b.c>
Subject: $array.fieldname question
Message-Id: <caboff$6ba$1@news1.wdf.sap-ag.de>

Hello friends of perl,

have a problem and hope you can help me :)

okay, I have an ini-file looks like this:

------------------------------------------------------------------
[def]               # name of section is completly unknown
var1=value1
var2=value2

[ref]
var1=value3
var2=value4
---------------------------------------------------------------


#in result I create an array for the section names
@sections=("def","ref");
#while $sections[1] then eq to "ref" for instance

# following variables should then be defined
$def.var1=value1;
$def.var2=value2;
$ref.var1=value3;
$ref.var2=value4;

#then I'd like to apply several routines with the help of this variables
foreach (@sections)
{
   function1 ($$_.var1);      # -> function1($def.var1);
   # ...
}

How can I do this?

Thanks for your answers
bye



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

Date: Fri, 11 Jun 2004 03:24:43 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: $array.fieldname question
Message-Id: <40c96c50$0$199$58c7af7e@news.kabelfoon.nl>

ZZT wrote:

> Hello friends of perl,
> 
> have a problem and hope you can help me :)
> 
> okay, I have an ini-file looks like this:

[snip]

> How can I do this?

Search CPAN for INI

http://search.cpan.org/search?mode=all&query=ini

for example

http://search.cpan.org/~jenda/Config-IniHash-2.5/IniHash.pm

-- 
John                               MexIT: http://johnbokma.com/mexit/
                            personal page:       http://johnbokma.com/
    Experienced Perl programmer available:     http://castleamber.com/
             Happy Customers: http://castleamber.com/testimonials.html


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

Date: 11 Jun 2004 00:35:59 -0700
From: jakegottlieb@hotmail.com (Jake Gottlieb)
Subject: Re: Extracting Text
Message-Id: <986e0b6a.0406102335.bd506f9@posting.google.com>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<2irgdrFqh08hU1@uni-berlin.de>...
> Jake Gottlieb wrote:
> > I am trying to extract lines with:
> > 
> > GO:0009986
> 
> <snip>
> 
> > I have been trying to write a program for it, but can't seem to do
> > it. If someone could help, I would be very appreciative (I am sure
> > it's really easy, but Perl is new to me).
> 
>      http://learn.perl.org/

Here is my code. I am sure its wrong, and would be greatful if someone
could correct and complete it. I would like to extract lines from the
original code, and put them into another text file. I have been trying
for a while:

while (<file.txt>) { 
    $line = $_;
$yes  = (index $line, 'GO:000');
if ($yes  > -1) {
    print "YES  : $line";
}
    if ($line =~ /ENSG\d+.\d\s+\S+\s+GO:\d{7}\s+\d+\s+/){
    print "La GO! $line \n";
    }
}


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

Date: Fri, 11 Jun 2004 09:35:58 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: Extracting Text
Message-Id: <40c96eee$0$21762$afc38c87@news.easynet.co.uk>

Jake Gottlieb wrote:
> Here is my code. I am sure its wrong, and would be greatful if someone
> could correct and complete it. I would like to extract lines from the
> original code, and put them into another text file. I have been trying
> for a while:
> 
> while (<file.txt>) { 
>     $line = $_;
> $yes  = (index $line, 'GO:000');
> if ($yes  > -1) {
>     print "YES  : $line";
> }
>     if ($line =~ /ENSG\d+.\d\s+\S+\s+GO:\d{7}\s+\d+\s+/){
>     print "La GO! $line \n";
>     }
> }

If all you want is to display lines that contain the string GO:0009986 then this 
will do the trick.

[peter@wasabi xxx]$ cat prog
#!/usr/bin/perl -w

use strict;
use warnings;

while ( my $line = <> ) {
         next unless $line =~ m/\s+GO:0009986\s+/;

         print $line;
}
[peter@wasabi xxx]$

Basically it reads data from standard input and skips if the line does not match 
the regex otherwise it prints it to standard output.

[peter@wasabi xxx]$ perl prog file.txt
ENSG00000113494.3       AAH59392.1      GO:0009986      5618    216638_s_at
ENSG00000113494.3       AAA60174.1      GO:0009986              206346_at
ENSG00000113494.3       AAA60174.1      GO:0009986              211917_s_at
ENSG00000113494.3       AAD32032.1      GO:0009986              211917_s_at
ENSG00000113494.3       AAH59392.1      GO:0009986              211917_s_at
ENSG00000113494.3       AAA60174.1      GO:0009986              210476_s_at
ENSG00000113494.3       AAK32703.1      GO:0009986              210476_s_at
[peter@wasabi xxx]$

I'm not too sure what all the $yes stuff in your code was for and <file.txt> is 
not how you open or handle a file but you got the idea of regex although it 
would seem to be over specified for the problem.


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

Date: 11 Jun 2004 08:56:55 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Extracting Text
Message-Id: <cabs4n$es8$2@mamenchi.zrz.TU-Berlin.DE>

Peter Hickman  <peter@semantico.com> wrote in comp.lang.perl.misc:
> Jake Gottlieb wrote:

[...]

> If all you want is to display lines that contain the string GO:0009986
> then this 
> will do the trick.
> 
> [peter@wasabi xxx]$ cat prog
> #!/usr/bin/perl -w
> 
> use strict;
> use warnings;
> 
> while ( my $line = <> ) {
>          next unless $line =~ m/\s+GO:0009986\s+/;
                                    ^            ^
The "+"es make no difference here.

>          print $line;
> }

That can be simplified to

    /\sGO:0009986\s/ and print while <>;

Anno


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

Date: Fri, 11 Jun 2004 11:24:58 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Extracting Text
Message-Id: <2itc5oFrej6eU1@uni-berlin.de>

Jake Gottlieb wrote:
> Here is my code. I am sure its wrong,

Please be more specific about the problem. You'd better study the
posting guidelines for this group:

http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

> and would be greatful if someone could correct and complete it. I
> would like to extract lines from the original code, and put them
> into another text file.

Below please find a couple of comments. If you want to write something
to another file, you should open that file for writing...

> while (<file.txt>) {

That does not open the file for reading. This does:

     open my $fh, '< file.txt' or die $!;
     while (<$fh>) {

See

     perldoc -f open

>     $line = $_;
> $yes  = (index $line, 'GO:000');

You should have

     use strict;
     use warnings;

in the beginning of the program, and declare the variables you introduce:

     my $line = $_;
     my $yes  = (index $line, 'GO:000');
----^^

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



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

Date: Fri, 11 Jun 2004 06:25:07 +0200
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: How to get "perl -V"'s output programmatically?
Message-Id: <2isqh6Frb1ovU1@uni-berlin.de>

Also sprach Sherm Pendley:

> J Krugman wrote:
> 
>> Thanks.  Not that it's too important, but I wonder how I could find
>> out where in perl's code those "few insertions" are generated.
> 
> It's in perl.c. Look for "case 'V':" - in 5.8.4, it starts on line 1440.
> 
>> suspect they are nothing more than processed bits from %Config::Config,
>> but I can't figure out who/what is doing the processing.
> 
> Actually, it doesn't look that way. :-(
> 
> There are a series of #ifdefs, and in each one a call to sv_catpv() that
> appends the appropriate string to a print statement. It's not drawing those
> particular bits from Config.pm at all.
> 
> That's not to say that the info isn't available via Config.pm - just that
> it's not where -V gets it from.

It's relatively easy to get those information by mimicking what perl.c
does with Inline::C. Here's a script that gets the locally applied
patches:

    use Inline C;

    print join "\n", local_patches();

    __END__
    __C__
    void local_patches () {
	#include "patchlevel.h"
	Inline_Stack_Vars;
	int i;
    #ifdef LOCAL_PATCH_COUNT
	for (i = 0; i <= LOCAL_PATCH_COUNT; i++) {
	    if (PL_localpatches[i]) 
		Inline_Stack_Push(sv_2mortal(newSVpv(PL_localpatches[i++], 0)));
	}
    #endif
	Inline_Stack_Done;
    }
    
Some information however are not accessible, such as build-date and
-time as they rely on the __DATE__ and __TIME__ macros.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Fri, 11 Jun 2004 04:39:32 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: How to get "perl -V"'s output programmatically?
Message-Id: <cabd24$og7$1@wisteria.csv.warwick.ac.uk>


Quoth J Krugman <jkrugman345@yahbitoo.com>:
> In <caa858$eie$1@mamenchi.zrz.TU-Berlin.DE> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> 
> >J Krugman  <jkrugman345@yahbitoo.com> wrote in comp.lang.perl.misc:
> >> 
> >> Is there a better way to get, within a Perl script, the string
> >> generated by "perl -V" than going through sh: 
> >
> >But there is indeed a better way:
> 
> >    use Config;
> >    my $perl_V = Config::myconfig();
> 
> >That reproduces most of the text of "perl -V".  There are a few insertions
> >in "perl -V" that are not in myconfig (probably those you are complaining
> >about in the part I snipped).
> 
> Thanks.  Not that it's too important, but I wonder how I could find
> out where in perl's code those "few insertions" are generated.

From perl.c:

	case 'V':
	    if (!PL_preambleav)
		PL_preambleav = newAV();
	    av_push(PL_preambleav, 
                newSVpv("use Config qw(myconfig config_vars)",0));
	    if (*++s != ':')  {
		PL_Sv = newSVpv("print myconfig();",0);
#ifdef VMS
		sv_catpv(PL_Sv, "print \"\\nCharacteristics of this "
                    "PERLSHR image: \\n\",");
#else
		sv_catpv(PL_Sv,"print \"\\nCharacteristics of this "
                    "binary (from libperl): \\n\",");
#endif
		sv_catpv(PL_Sv,"\"  Compile-time options:");
#  ifdef DEBUGGING
		sv_catpv(PL_Sv," DEBUGGING");
#  endif
#  ifdef MULTIPLICITY
		sv_catpv(PL_Sv," MULTIPLICITY");
                
<snip more of the same>

#  endif
		sv_catpv(PL_Sv,"\\n\",");

#if defined(LOCAL_PATCH_COUNT)
		if (LOCAL_PATCH_COUNT > 0) {
		    int i;
		    sv_catpv(PL_Sv,"\"  Locally applied patches:\\n\",");
		    for (i = 1; i <= LOCAL_PATCH_COUNT; i++) {
			if (PL_localpatches[i])
			    Perl_sv_catpvf(aTHX_ PL_Sv,
                                "q\"  \t%s\n\",",PL_localpatches[i]);
		    }
		}
#endif
		Perl_sv_catpvf(aTHX_ PL_Sv,"\"  Built under %s\\n\"",OSNAME);
#ifdef __DATE__
#  ifdef __TIME__
		Perl_sv_catpvf(aTHX_ PL_Sv,
                    ",\"  Compiled at %s %s\\n\"",__DATE__,__TIME__);
#  else
		Perl_sv_catpvf(aTHX_ PL_Sv,
                    ",\"  Compiled on %s\\n\"",__DATE__);
#  endif
#endif
		sv_catpv(PL_Sv, "; \
$\"=\"\\n    \"; \
@env = map { \"$_=\\\"$ENV{$_}\\\"\" } sort grep {/^PERL/} keys %ENV; ");
#ifdef __CYGWIN__
		sv_catpv(PL_Sv,"\
push @env, \"CYGWIN=\\\"$ENV{CYGWIN}\\\"\";");
#endif
		sv_catpv(PL_Sv, "\
print \"  \\%ENV:\\n    @env\\n\" if @env; \
print \"  \\@INC:\\n    @INC\\n\";");
	    }
	    else {
		PL_Sv = newSVpv("config_vars(qw(",0);
		sv_catpv(PL_Sv, ++s);
		sv_catpv(PL_Sv, "))");
		s += strlen(s);
	    }
	    av_push(PL_preambleav, PL_Sv);
	    /* don't look for script or read stdin */
	    scriptname = BIT_BUCKET;
            goto reswitch;

So, by the looks of it, -V is pretty much the only way to get the info
that isn't in myconfig.

Ben

-- 
  Joy and Woe are woven fine,
  A Clothing for the Soul divine       William Blake
  Under every grief and pine          'Auguries of Innocence'
  Runs a joy with silken twine.                                ben@morrow.me.uk


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

Date: Fri, 11 Jun 2004 03:30:20 -0400
From: Ken Sington <ken_sington@nospam_abcdefg.com>
Subject: Re: match aaa but not 123aaa
Message-Id: <L7-cnZoOaeEUwlTdRWPC-w@speakeasy.net>

Tad McClellan wrote:
> Ken Sington <ken_sington@nospam_abcdefg.com> wrote:
> 
>>Jay Tilton wrote:
> 
> 
>>>    /(?<!123)YaaaY/
> 
> 
>>now to find out what ?<! means...
> 
> 
> 
> It is actually a 4-character opening token (?<! and a 1-char close token )
> 
> See "zero-width negative look-behind assertion" in perlre.pod.
> 
> 

I noticed in:
s/(?<!123)(1)(2)(3)/$1$2$3/
the first set of () dosen't seem to count.
I would have expected a forth one to be $4
what happened to $4? or should I say -$1?


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

Date: 11 Jun 2004 09:09:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: match aaa but not 123aaa
Message-Id: <cabssu$es8$3@mamenchi.zrz.TU-Berlin.DE>

Ken Sington  <ken_sington@nospam_abcdefg.com> wrote in comp.lang.perl.misc:
> Tad McClellan wrote:
> > Ken Sington <ken_sington@nospam_abcdefg.com> wrote:
> > 
> >>Jay Tilton wrote:
> > 
> > 
> >>>    /(?<!123)YaaaY/
> > 
> > 
> >>now to find out what ?<! means...
> > 
> > 
> > 
> > It is actually a 4-character opening token (?<! and a 1-char close token )
> > 
> > See "zero-width negative look-behind assertion" in perlre.pod.
> > 
> > 
> 
> I noticed in:
> s/(?<!123)(1)(2)(3)/$1$2$3/
> the first set of () dosen't seem to count.
> I would have expected a forth one to be $4
> what happened to $4? or should I say -$1?

Experimentation is fine, but you should complement it by Looking Things
Up.  The behavior you noted is described in perlre under the heading
"Extended Patterns".

Anno


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

Date: Fri, 11 Jun 2004 04:54:38 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Microsoft Word and Perl
Message-Id: <cabdue$og7$4@wisteria.csv.warwick.ac.uk>


Quoth Ilaiy@hotmail.com (Ilaiyarasan):
> I have been trying to update my word document using perl, i used 
> 
> $word->Selection->WholeStory;
> $word->Selection->Fields->{Update};
> 
> But this is a little slow and at times doesnot update completely. I
> modified the code and right now getting a wired error but the same in
> VBA works really well .
> 
> my $newdoc = $word->ActiveDocument;
> foreach my $obj_Story ($newdoc->StoryRanges ){
> 	$obj_Story->Fields->{Update};   ==> Cannot find object 

I don't know much about OLE, but surely that should be

$obj_Story->Fields->update;

? update is a method, not a property.

> 	while ($obj_Story->NextStoryrange != ""){
                                    ^^
                                    R, surely?

> 		$obj_Story = $obj_Story->NextStoryRange;
> 		$obj_Story->Fields->{Update};    ==> Cannot find object 
> 	}

I would write that loop the other way round:

$obj_Story->Fields->update
    while $obj_Story = $obj_Story->NextStoryRange;

That way you don't need the extra statement before the loop.

> The equivalent in VBA is .. 
> 
>     Dim obj_Story As Range
>     For Each obj_Story In ActiveDocument.StoryRanges
>         obj_Story.Fields.update
>         While Not (obj_Story.NextStoryRange Is Nothing)
>             Set obj_Story = obj_Story.NextStoryRange
>                 obj_Story.Fields.update
>         Wend
>     Next obj_Story
>         Set obj_Story = Nothing

Ben

-- 
I've seen things you people wouldn't believe: attack ships on fire off
the shoulder of Orion; I watched C-beams glitter in the dark near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die.                                                   ben@morrow.me.uk


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

Date: Fri, 11 Jun 2004 04:44:09 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Nameed pipes Vs sockets
Message-Id: <cabdao$og7$2@wisteria.csv.warwick.ac.uk>


Quoth palam_analog@yahoo.co.in (Palaniappan):
> Hi all,
> Now i am using two named pipes for Inter Process communication (IPC).
> will i get speed advantage if i use sockets ?. 

Benchmark it and see. Which is faster almost certainly depends
critically on your OS.

> which one is best for perl IPC ? 

They are different... with sockets, you get one filehandle for full
duplex communication, and you get proper connection handling; OTOH, you
have to mess with accepting connections. With fifos you can just open
them and get on with it, OTOH so can someone else and make a right mess
of your data. INET-domain sockets are also far more portable than either
fifos or Unix-domain sockets.

Decide based on your program's needs, rather than on some ficticious
idea that one approach will be significantly more performant than the
other.

Ben

-- 
           All persons, living or dead, are entirely coincidental.
ben@morrow.me.uk                                                  Kurt Vonnegut


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

Date: Fri, 11 Jun 2004 17:55:01 +1000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Operator overloading revisited
Message-Id: <40c96685$0$24185$5a62ac22@freenews.iinet.net.au>

Hi,

Say I have 2 modules, called module_x and module_y, and that both 
modules overload the * operator (with a subroutine named over_mul).

let's further assume that I run the following script:

use warnings;
use module_x;
use module_y;
my $x = module_x->new(10);
my $y = module_y->new(12);

my $z1 = $x * $y;
my $z2 = $y * $x;

It looks to me that the first multiplication will use the 
module_x::over_mul subroutine, and that the second multiplication will 
use the module_y::over_mul subroutine - and that there's nothing one can 
do to change that behaviour - ie I can't write 'my $z = $x * $y;' and 
"trick" it into using the module_y::over_mul subroutine.

Now that all seems quite sane to me, but I know from past experience 
that doesn't mean that I've necessarily got it right.

Basically, all I'm asking is that someone let me know if I'm wrong.

Cheers,
Rob

-- 
To reply by email u have to take out the u in kalinaubears.



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

Date: 11 Jun 2004 08:51:29 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Operator overloading revisited
Message-Id: <cabrqh$es8$1@mamenchi.zrz.TU-Berlin.DE>

Sisyphus  <kalinaubears@iinet.net.au> wrote in comp.lang.perl.misc:
> Hi,
> 
> Say I have 2 modules, called module_x and module_y, and that both 
> modules overload the * operator (with a subroutine named over_mul).
> 
> let's further assume that I run the following script:
> 
> use warnings;
> use module_x;
> use module_y;
> my $x = module_x->new(10);
> my $y = module_y->new(12);
> 
> my $z1 = $x * $y;
> my $z2 = $y * $x;
> 
> It looks to me that the first multiplication will use the 
> module_x::over_mul subroutine, and that the second multiplication will 
> use the module_y::over_mul subroutine - and that there's nothing one can 
> do to change that behaviour - ie I can't write 'my $z = $x * $y;' and 
> "trick" it into using the module_y::over_mul subroutine.
> 
> Now that all seems quite sane to me, but I know from past experience 
> that doesn't mean that I've necessarily got it right.
> 
> Basically, all I'm asking is that someone let me know if I'm wrong.

Ah... Cross-class overloading.  A lot of fun can be had with that.

Basically, you're right.  If the classes know nothing about each other,
the behavior you describe is what you get.  If both operands overload
an operator, the left operand wins out.  The name of the implementing
method is not relevant here, btw.

If the classes are allowed to know about each other, the overload
routine can check its second operand and implement a different
behavior.

Anno


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

Date: Fri, 11 Jun 2004 02:24:03 -0500
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
Message-Id: <idKdnT3z29SOw1TdRVn-hw@august.net>

Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Ask perl to help you
       - Do not re-type Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Sending a "stealth" Cc copy
      Be extra cautious when you get upset
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
    This newsgroup, commonly called clpmisc, is a technical newsgroup
    intended to be used for discussion of Perl related issues (except job
    postings), whether it be comments or questions.

    As you would expect, clpmisc discussions are usually very technical in
    nature and there are conventions for conduct in technical newsgroups
    going somewhat beyond those in non-technical newsgroups.

    The article at:

        http://www.catb.org/~esr/faqs/smart-questions.html

    describes how to get answers from technical people in general.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. It is
    available in POD, HTML and plain text formats at:

     http://mail.augustmail.com/~tadmc/clpmisc.shtml

    For more information about netiquette in general, see the "Netiquette
    Guidelines" at:

     http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

    A note to newsgroup "regulars":

       Do not use these guidelines as a "license to flame" or other
       meanness. It is possible that a poster is unaware of things
       discussed here.  Give them the benefit of the doubt, and just
       help them learn how to post, rather than assume 

    A note about technical terms used here:

       In this document, we use words like "must" and "should" as
       they're used in technical conversation (such as you will
       encounter in this newsgroup). When we say that you *must* do
       something, we mean that if you don't do that something, then
       it's unlikely that you will benefit much from this group.
       We're not bossing you around; we're making the point without
       lots of words.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must
    This section describes things that you *must* do before posting to
    clpmisc, in order to maximize your chances of getting meaningful replies
    to your inquiry and to avoid getting flamed for being lazy and trying to
    have others do your work.

    The perl distribution includes documentation that is copied to your hard
    drive when you install perl. Also installed is a program for looking
    things up in that (and other) documentation named 'perldoc'.

    You should either find out where the docs got installed on your system,
    or use perldoc to find them for you. Type "perldoc perldoc" to learn how
    to use perldoc itself. Type "perldoc perl" to start reading Perl's
    standard documentation.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

        You can use the "-q" switch with perldoc to do a word search of the
        questions in the Perl FAQs.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    "Subject:" header.

  Really Really Should
    This section describes things that you *really should* do before posting
    to clpmisc.

    Lurk for a while before posting
        This is very important and expected in all newsgroups. Lurking means
        to monitor a newsgroup for a period to become familiar with local
        customs. Each newsgroup has specific customs and rituals. Knowing
        these before you participate will help avoid embarrassing social
        situations. Consider yourself to be a foreigner at first!

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is:

         http://groups.google.com/advanced_group_search

  If You Like
    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information: there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?
    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community
    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines":

         http://www.cpan.org/authors/id/D/DM/DMR/subjects.post

        Part of the beauty of newsgroup dynamics, is that you can contribute
        to the community with your very first post! If your choice of
        Subject leads a fellow Perler to find the thread you are starting,
        then even asking a question helps us all.

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* each section of quoted text to
        which they relate. Unappreciated followup styles are referred to as
        "top-posting", "Jeopardy" (because the answer comes before the
        question), or "TOFU" (Text Over, Fullquote Under).

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see:

         http://web.presby.edu/~nnqadmin/nnq/nquote.html

    Speak Perl rather than English, when possible
        Perl is much more precise than natural language. Saying it in Perl
        instead will avoid misunderstanding your question or problem.

        Do not say: I have variable with "foo\tbar" in it.

        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
        or I have $var = <DATA> (and show the data line).

    Ask perl to help you
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).

        You should not bother the hundreds/thousands of readers of the
        newsgroup without first seeing if a machine can help you find your
        problem. It is demeaning to be asked to do the work of a machine. It
        will annoy the readers of your article.

        You can look up any of the messages that perl might issue to find
        out what the message means and how to resolve the potential mistake
        (perldoc perldiag). If you would like perl to look them up for you,
        you can put "use diagnostics;" near the top of your program.

    Do not re-type Perl code
        Use copy/paste or your editor's "import" function rather than
        attempting to type in your code. If you make a typo you will get
        followups about your typos instead of about the question you are
        trying to get answered.

    Provide enough information
        If you do the things in this item, you will have an Extremely Good
        chance of getting people to try and help you with your problem!
        These features are a really big bonus toward your question winning
        out over all of the other posts that you are competing with.

        First make a short (less than 20-30 lines) and *complete* program
        that illustrates the problem you are having. People should be able
        to run your program by copy/pasting the code from your article. (You
        will find that doing this step very often reveals your problem
        directly. Leading to an answer much more quickly and reliably than
        posting to Usenet.)

        Describe *precisely* the input to your program. Also provide example
        input data for your program. If you need to show file input, use the
        __DATA__ token (perldata.pod) to provide the file contents inside of
        your Perl program.

        Show the output (including the verbatim text of any messages) of
        your program.

        Describe how you want the output to be different from what you are
        getting.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid
    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similar to your question, folks will assume
        that you did not look at all. Don't become indignant at pointers to
        the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Sending a "stealth" Cc copy
        A "stealth Cc" is when you both email and post a reply without
        indicating *in the body* that you are doing so.

  Be extra cautious when you get upset
    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan <tadmc@augustmail.com> and many others on the
    comp.lang.perl.misc newsgroup.



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

Date: Fri, 11 Jun 2004 01:30:45 -0400
From: "kapil_kaushik" <feelkaushik@rediffmail.com>
Subject: Regular  expressions
Message-Id: <aedcdc9209a99b86ffb526ae6099468e@localhost.talkaboutprogramming.com>

in perl, to search for a ' we use \' but then i cannot
 understand, what the following code searches for.
/^\s*\'0'\s*$/
Here the 1st ' is preceded by a \ meaning it is a normal ' 
but the 2nd ' puts me in confusion
I am new to this language
Kindly help



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

Date: Fri, 11 Jun 2004 06:07:50 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Regular  expressions
Message-Id: <cabi7m$rtp$1@wisteria.csv.warwick.ac.uk>


Quoth "kapil_kaushik" <feelkaushik@rediffmail.com>:
> in perl, to search for a ' we use \'

No, you just use '. 's don't need escaping in regexen unless you are
using ' as your delimiter.

> but then i cannot
>  understand, what the following code searches for.
> /^\s*\'0'\s*$/
> Here the 1st ' is preceded by a \ meaning it is a normal '
> but the 2nd ' puts me in confusion

The first is unnecessarily (but harmlessly) escaped.
The second isn't.
Both simply match a literal '.

Ben

-- 
$.=1;*g=sub{print@_};sub r($$\$){my($w,$x,$y)=@_;for(keys%$x){/main/&&next;*p=$
$x{$_};/(\w)::$/&&(r($w.$1,$x.$_,$y),next);$y eq\$p&&&g("$w$_")}};sub t{for(@_)
{$f&&($_||&g(" "));$f=1;r"","::",$_;$_&&&g(chr(0012))}};t    # ben@morrow.me.uk
$J::u::s::t, $a::n::o::t::h::e::r, $P::e::r::l, $h::a::c::k::e::r, $.


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

Date: 11 Jun 2004 02:24:46 -0700
From: josh.kuo@prioritynetworks.net (josh)
Subject: SOAP::Lite using HTTPS as a transport?
Message-Id: <66001607.0406110124.1a2ce7f0@posting.google.com>

According to http://cookbook.soaplite.com/, it should be as easy as
this:

my ( $soap ) = SOAP::Lite
      -> uri('Demo')
#      -> proxy('http://localhost/cgi-bin/soap.cgi')
      -> proxy('https://localhost/cgi-bin/soap.cgi')

But this is the error I get:

500 Can't locate object method "new" via package
"LWP::Protocol::https::Socket" at ./client.pl line 8

I am running Mandrake 10.0 Community, with all default RPMs (urpmi
perl-SOAP-Lite).

My goal is to have secure (preferrably SSL) communication between the
SOAP server and client(s). Is there a better way than HTTPS? I just
thought HTTPS makes a natural choice since I already got HTTP working.


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

Date: Fri, 11 Jun 2004 17:31:45 +1000
From: Simon Taylor <simon@unisolve.com.au>
Subject: Re: startting perl
Message-Id: <cabnan$2t46$1@otis.netspace.net.au>

Hello Sree,

> Hi all,
>   It would be appreciated if anyone can explain me how to start

> writing program (i,e including downloading and installing the perl,how
> to run the scripts).

See Simon Cozen's book, "Beginning Perl", which you can download from 
learn.perl.org at:

     http://learn.perl.org/library/beginning_perl/

- Simon Taylor
-- 
Unisolve Pty Ltd - Melbourne, Australia


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

Date: Fri, 11 Jun 2004 09:43:05 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: startting perl
Message-Id: <9pjhc0571gc6api28pub7g02kuka4ln7er@4ax.com>

On Thu, 10 Jun 2004 08:34:43 -0500, Web Surfer
<raisin@delete-this-trash.mts.net> wrote:

>If you are using a PC then you can go to http://www.activestate.com

As someone else said, it's not PC to call win* systems PC...
;-)


Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: 10 Jun 2004 22:53:43 -0700
From: serverin2000@yahoo.com (Sree)
Subject: test script
Message-Id: <e9936b79.0406102153.7ec65e4c@posting.google.com>

Hi all,
  I was doing manually of building and execution of some tests. How
can I automate this using perl features.(for regression testing)

   regards
    Sree


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

Date: 11 Jun 2004 09:11:40 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: test script
Message-Id: <cabt0c$es8$4@mamenchi.zrz.TU-Berlin.DE>

Sree <serverin2000@yahoo.com> wrote in comp.lang.perl.misc:
> Hi all,
>   I was doing manually of building and execution of some tests. How
> can I automate this using perl features.(for regression testing)

perldoc Test, perldoc Test::Simple, perldoc Test::More

Anno


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

Date: Fri, 11 Jun 2004 04:49:31 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: XML::DOM Query
Message-Id: <cabdkr$og7$3@wisteria.csv.warwick.ac.uk>


Quoth "-Brad-" <thesnake_123@-NO-S_P_A_M-hotmail.com>:
> Hi all, Im using the XML::DOM module to process an xml document but having a
> few problems.
> Im trying to loop though all the node attributes and retreive their values.
> But having a few promlems.
> 
> The Perl code I have so far is
> 
<snip>
> 
> ----------------When Run it gives me this. ---------------------
> 
> RequestID => XML::DOM::Attr=ARRAY(0x84d5908)
> LetterHasSignatory => XML::DOM::Attr=ARRAY(0x84d699c)
> LetterHasParameters => XML::DOM::Attr=ARRAY(0x84d6c3c)
> ActionCode => XML::DOM::Attr=ARRAY(0x84d5740)
> 
> ------------------------------------------------------------------
> 
> So as you can see it prints the $key valus out correctly, but the $value
> seems to be an array.
> How would I go about printing that out?

perldoc Data::Dumper
perldoc Data::Dump (get it from CPAN: I much prefer it to Dumper).

Ben

-- 
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk


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

Date: Fri, 11 Jun 2004 05:52:32 GMT
From: "-Brad-" <thesnake_123@-NO-S_P_A_M-hotmail.com>
Subject: Re: XML::DOM Query
Message-Id: <AMbyc.2066$sj4.1805@news-server.bigpond.net.au>

Hi Ben thanks for your reply, I've used Dumer to have a look at the array
and its quite confusing. I can attach a sample if you wish.
But all I would like to retreive is the value, so the end result is.

RequestID => 11112
LetterHasSignitory => True
etc ....

Thank you!

"Ben Morrow" <usenet@morrow.me.uk> wrote in message
news:cabdkr$og7$3@wisteria.csv.warwick.ac.uk...

Quoth "-Brad-" <thesnake_123@-NO-S_P_A_M-hotmail.com>:
> Hi all, Im using the XML::DOM module to process an xml document but having
a
> few problems.
> Im trying to loop though all the node attributes and retreive their
values.
> But having a few promlems.
>
> The Perl code I have so far is
>
<snip>
>
> ----------------When Run it gives me this. ---------------------
>
> RequestID => XML::DOM::Attr=ARRAY(0x84d5908)
> LetterHasSignatory => XML::DOM::Attr=ARRAY(0x84d699c)
> LetterHasParameters => XML::DOM::Attr=ARRAY(0x84d6c3c)
> ActionCode => XML::DOM::Attr=ARRAY(0x84d5740)
>
> ------------------------------------------------------------------
>
> So as you can see it prints the $key valus out correctly, but the $value
> seems to be an array.
> How would I go about printing that out?

perldoc Data::Dumper
perldoc Data::Dump (get it from CPAN: I much prefer it to Dumper).

Ben

-- 
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by
an
increasing number of user complaints ... As of June,... the Arpanet
contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] *
ben@morrow.me.uk




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

Date: Fri, 11 Jun 2004 06:14:04 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: XML::DOM Query
Message-Id: <cabijc$rtp$2@wisteria.csv.warwick.ac.uk>

[please learn to quote properly]

Quoth "-Brad-" <thesnake_123@-NO-S_P_A_M-hotmail.com>:
> "Ben Morrow" <usenet@morrow.me.uk> wrote in message
> > Quoth "-Brad-" <thesnake_123@-NO-S_P_A_M-hotmail.com>:
> > >
> > > RequestID => XML::DOM::Attr=ARRAY(0x84d5908)
> > > LetterHasSignatory => XML::DOM::Attr=ARRAY(0x84d699c)
> > > LetterHasParameters => XML::DOM::Attr=ARRAY(0x84d6c3c)
> > > ActionCode => XML::DOM::Attr=ARRAY(0x84d5740)
> > >
> > > So as you can see it prints the $key valus out correctly, but the $value
> > > seems to be an array.
> > > How would I go about printing that out?
> > 
> > perldoc Data::Dumper
> > perldoc Data::Dump (get it from CPAN: I much prefer it to Dumper).
> 
> Hi Ben thanks for your reply, I've used Dumer to have a look at the array
> and its quite confusing. I can attach a sample if you wish.
> But all I would like to retreive is the value, so the end result is.
> 
> RequestID => 11112
> LetterHasSignitory => True
> etc ....

Hmmm... I have misunderstood the problem :).
Try reading perldoc XML::DOM::Attr.

Ben

-- 
I've seen things you people wouldn't believe: attack ships on fire off
the shoulder of Orion; I watched C-beams glitter in the dark near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die.                                                   ben@morrow.me.uk


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

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 V10 Issue 6679
***************************************


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