[29588] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 832 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 8 09:09:42 2007

Date: Sat, 8 Sep 2007 06:09:06 -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           Sat, 8 Sep 2007     Volume: 11 Number: 832

Today's topics:
    Re: FAQ 4.32 How do I strip blank space from the beginn sln@netherlands.co
        Match repeating pattern <serman_d@hotmail.com>
    Re: Match repeating pattern  usenet@DavidFilmer.com
    Re: Match repeating pattern <serman_d@hotmail.com>
    Re: Match repeating pattern <No_4@dsl.pipex.com>
    Re: Match repeating pattern <tadmc@seesig.invalid>
    Re: Match repeating pattern <tadmc@seesig.invalid>
        new CPAN modules on Sat Sep  8 2007 (Randal Schwartz)
    Re: Regular Expression <joe@inwap.com>
        Sharing object between threads - howto? <bastard_operator@gmx.li>
    Re: Switching with case in perl ? <joe@inwap.com>
    Re: Temporary filename <joe@inwap.com>
    Re: usenet posting of perl release <dsimil@gmail.com>
        We urgently require SAP consultant with 5 year of SAP e <msmanu78@yahoo.com>
    Re: We urgently require SAP consultant with 5 year of S  usenet@DavidFilmer.com
    Re: We urgently require SAP consultant with 5 year of S <tadmc@seesig.invalid>
    Re: We urgently require SAP consultant with 5 year of S <uri@stemsystems.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 07 Sep 2007 21:37:13 -0700
From: sln@netherlands.co
Subject: Re: FAQ 4.32 How do I strip blank space from the beginning/end of a   string?
Message-Id: <el94e314fkq8rrur912k77ho9a9v41u2ql@4ax.com>

On Tue, 04 Sep 2007 05:14:50 GMT, "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:

>"Petr Vileta" <stoupa@practisoft.cz> wrote in
>news:fbh13i$1upj$2@ns.felk.cvut.cz: 
>
>> Anno Siegel wrote:
>>> On 2007-09-03 03:17:24 +0200, Uri Guttman <uri@stemsystems.com> said:
>>>
>>>> like michele said, this is too trivial to need a sub or a library.
>>>
>>> That too.
>>>
>> As the case may be ;-) When you remove blanks 50 times in 50kb source
>> code then is better to use sub or library.
>
>That is some bad code you write then.
>
>Referring back to your example about normalizing parameter values 
>obtained from a CGI form, you could do all the required normalization in 
>one and only place in the code. In fact, you could trim all the CGI 
>parameters passed in a few lines:
>
>
>my $cgi = CGI->new
>my @form_params = $cgi->param;
>
>for my $p ( @form_params ) {
>   for my $v ( $cgi->param( $p ) ) {
>      next unless defined $v;
>      $v =~ s/^\s+//;
>      $v =~ s/\s+$//;
>   }
>}
>
>How can it be that you need to do this in fifty different places? Did 
>you know about lists and loops?
>
>Sinan

Maybe you should try writing more than 1 liners and stop
'Pontificating'





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

Date: Fri, 07 Sep 2007 23:41:33 -0700
From:  "Serman D." <serman_d@hotmail.com>
Subject: Match repeating pattern
Message-Id: <1189233693.526099.150460@19g2000hsx.googlegroups.com>

$ perl -wle 'print 1/7'
0.142857142857143

How do I match the a repeating pattern within a string? Of the above
string I want to match '142857'.

Thanks.

Serman D.
--



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

Date: Sat, 08 Sep 2007 06:51:41 -0000
From:  usenet@DavidFilmer.com
Subject: Re: Match repeating pattern
Message-Id: <1189234301.863174.323380@22g2000hsm.googlegroups.com>

On Sep 7, 11:41 pm, "Serman D." <serma...@hotmail.com> wrote:
> How do I match the a repeating pattern within a string? Of the above
> string I want to match '142857'.

Please clarify:  What if the string is 0.2323232323232323

Would you want to match 23?  or 2323?  or 232323?  Or 232232323?

All of these patterns are repeated in the string.

If the string is:  0.111A111B111

Would you expect to match 111?  (ie, matches not sequential)

--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)



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

Date: Sat, 08 Sep 2007 00:07:57 -0700
From:  "Serman D." <serman_d@hotmail.com>
Subject: Re: Match repeating pattern
Message-Id: <1189235277.277214.247550@50g2000hsm.googlegroups.com>

On Sep 8, 8:51 am, use...@DavidFilmer.com wrote:

> Please clarify:  What if the string is 0.2323232323232323

I want to match the longest, sequential repeating pattern within the
string.

--
Serman D.



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

Date: Sat, 08 Sep 2007 10:23:25 +0100
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: Match repeating pattern
Message-Id: <iuudnfblgIGO93_bnZ2dnUVZ8tKsnZ2d@pipex.net>

Serman D. wrote:
> 
>> Please clarify:  What if the string is 0.2323232323232323
> 
> I want to match the longest, sequential repeating pattern within the
> string.

    So, for that string you'd want 23232323?

    Try this:

#!/usr/bin/perl
#

while (<>) {
     if (/(.+)\1/) {
         print "Found $1\n";
     }
     else {
         print "No Repeat\n";
     }
}

If you actually want just 23 above then change the .+ to .+?.

This isn't perfect, as it will actually find the first repeat, rather than 
the longest, but it might help you.


-- 
              Just because I've written it doesn't mean that
                   either you or I have to believe it.


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

Date: Sat, 08 Sep 2007 10:22:17 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Match repeating pattern
Message-Id: <slrnfe4s6s.dm1.tadmc@tadmc30.sbcglobal.net>

Serman D. <serman_d@hotmail.com> wrote:
> On Sep 8, 8:51 am, use...@DavidFilmer.com wrote:
>
>> Please clarify:  What if the string is 0.2323232323232323
>
> I want to match the longest, sequential repeating pattern within the
> string.


What if the string is 12341234.567567 ?

   perl -le 'print $1 if "12341234.567567" =~ /(\d+)\1+/'


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


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

Date: Sat, 08 Sep 2007 10:22:16 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Match repeating pattern
Message-Id: <slrnfe4s24.dm1.tadmc@tadmc30.sbcglobal.net>

Serman D. <serman_d@hotmail.com> wrote:
> $ perl -wle 'print 1/7'
> 0.142857142857143
>
> How do I match the a repeating pattern within a string? Of the above
> string I want to match '142857'.


    perl -le 'print $1 if (1/7) =~ /\.(\d+)\1+/'


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


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

Date: Sat, 8 Sep 2007 04:42:13 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Sep  8 2007
Message-Id: <Jo192D.1EAy@zorch.sf-bay.org>

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

Authen-PhoneChallenge-0.02
http://search.cpan.org/~speshak/Authen-PhoneChallenge-0.02/
Module that does simple challenge/response using only numbers, for use in phone systems. 
----
Bundle-AndyA-1.000
http://search.cpan.org/~andya/Bundle-AndyA-1.000/
Basic working environment. 
----
CGI-Bus-0.62
http://search.cpan.org/~makarow/CGI-Bus-0.62/
Web and DBI Application object 
----
CSS-Moonfall-0.01
http://search.cpan.org/~sartak/CSS-Moonfall-0.01/
port of Lua's Moonfall for dynamic CSS generation 
----
Chart-Math-Axis-1.01
http://search.cpan.org/~adamk/Chart-Math-Axis-1.01/
Implements an algorithm to find good values for chart axis 
----
Class-Fields-0.203
http://search.cpan.org/~mschwern/Class-Fields-0.203/
Inspect the fields of a class. 
----
DBIx-Web-0.70
http://search.cpan.org/~makarow/DBIx-Web-0.70/
Active Web Database Layer 
----
Devel-PerlySense-0.01_12
http://search.cpan.org/~johanl/Devel-PerlySense-0.01_12/
IntelliSense for Perl 
----
Eludia-07.09.06
http://search.cpan.org/~dmow/Eludia-07.09.06/
----
JSON-DWIW-0.14
http://search.cpan.org/~dowens/JSON-DWIW-0.14/
JSON converter that Does What I Want 
----
Module-Cloud-0.04
http://search.cpan.org/~marcel/Module-Cloud-0.04/
Generates a tag cloud for modules used in given code 
----
Net-TacacsPlus-1.05
http://search.cpan.org/~jkutej/Net-TacacsPlus-1.05/
Tacacs+ library 
----
Net-Whois-Raw-1.32
http://search.cpan.org/~despair/Net-Whois-Raw-1.32/
Get Whois information for domains 
----
Object-Exercise-1.06
http://search.cpan.org/~lembark/Object-Exercise-1.06/
Generic execution & benchmark harness for method calls. 
----
Object-InsideOut-3.22
http://search.cpan.org/~jdhedden/Object-InsideOut-3.22/
Comprehensive inside-out object support module 
----
Ogre-0.25
http://search.cpan.org/~slanning/Ogre-0.25/
Perl binding for the OGRE C++ graphics library 
----
POD2-CN-0.01
http://search.cpan.org/~fayland/POD2-CN-0.01/
Chinese translation of Perl core documentation 
----
POD2-CN-0.02
http://search.cpan.org/~fayland/POD2-CN-0.02/
Chinese translation of Perl core documentation 
----
POE-Filter-Slim-CLI-0.02
http://search.cpan.org/~agrundma/POE-Filter-Slim-CLI-0.02/
A POE filter for talking with SlimServer over CLI 
----
Perl-Critic-1.076
http://search.cpan.org/~elliotjs/Perl-Critic-1.076/
Critique Perl source code for best-practices 
----
Perl-Version-v1.001
http://search.cpan.org/~andya/Perl-Version-v1.001/
Parse and manipulate Perl version strings 
----
Perl-Version-v1.002
http://search.cpan.org/~andya/Perl-Version-v1.002/
Parse and manipulate Perl version strings 
----
Sort-Key-Top-0.02
http://search.cpan.org/~salva/Sort-Key-Top-0.02/
select and sort top n elements 
----
Sphinx-Search-0.01
http://search.cpan.org/~jjschutz/Sphinx-Search-0.01/
Sphinx search engine API Perl client 
----
Sphinx-Search-0.02
http://search.cpan.org/~jjschutz/Sphinx-Search-0.02/
Sphinx search engine API Perl client 
----
Sys-Manage-0.57
http://search.cpan.org/~makarow/Sys-Manage-0.57/
Systems management commands/scripts environment 
----
TAP-Convert-TET-0.2.1
http://search.cpan.org/~andya/TAP-Convert-TET-0.2.1/
Convert TAP to TET 
----
Test-Harness-2.99_02
http://search.cpan.org/~andya/Test-Harness-2.99_02/
Run Perl standard test scripts with statistics 
----
Text-ASCIIMathML-0.4
http://search.cpan.org/~nodine/Text-ASCIIMathML-0.4/
Perl extension for parsing ASCIIMathML text into MathML 
----
Tk-RotatingGauge-0.10
http://search.cpan.org/~jquelin/Tk-RotatingGauge-0.10/
a rotating gauge for Tk 
----
Tk-RotatingGauge-0.11
http://search.cpan.org/~jquelin/Tk-RotatingGauge-0.11/
a rotating gauge for Tk 
----
VCI-0.1.0_4
http://search.cpan.org/~mkanat/VCI-0.1.0_4/
A generic interface for interacting with various version-control systems. 
----
W3C-LogValidator-1.1
http://search.cpan.org/~oliviert/W3C-LogValidator-1.1/
The W3C Log Validator - Quality-focused Web Server log processing engine 
----
XML-MyXML-0.09851
http://search.cpan.org/~karjala/XML-MyXML-0.09851/
A simple-to-use XML module, for parsing and creating XML documents 


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

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

print "Just another Perl hacker," # the original

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


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

Date: Fri, 07 Sep 2007 21:50:45 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Regular Expression
Message-Id: <M_OdnazFMNHFt3_bnZ2dnUVZ_gCdnZ2d@comcast.com>

fritz-bayer@web.de wrote:

> I'm looking for a regular expression, which is plattform independet
> and works for java, perl or net.

I'd say you have an impossible task.  The advanced parts of perl
regular expressions that almost do what you want are not implemented
the same way (if at all) on the other platforms.

	-Joe


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

Date: Sat, 08 Sep 2007 13:47:14 +0200
From: Lejf Diecks <bastard_operator@gmx.li>
Subject: Sharing object between threads - howto?
Message-Id: <5kfgfmF3epjiU1@mid.uni-berlin.de>

Hi,

is it possible to share an object between the main program and a thread?

I wrote a class "SuperSnoop.pm" with the following constructor:

-- <snip> ---
package PlugIn::SuperSnoop;

sub new {
	my $this = shift;
	my $class = ref($this) || $this;
	my $self = {};
	bless $self, $class;
	return $self;
}
-- <snip> ---

In the main program I create a new "SuperSnoop"-object and pass it to a 
thread:

-- <snip> ---
use threads;

sub startThread {
   my ($obj) = @_;
   print "Object inside thread: $obj\n";
}

my $obj = SuperSnoop->new();
print "Object outside thread (1): $obj\n";
my $thr = threads->create("startThread", $obj);
print "Object outside thread (2): $obj\n";
-- <snip> ---

Problem: It seems to me that "threads" creates a copy (!) of the object, 
because the reference changes INSIDE the thread:

-- <snip> ---
Object outside thread (1): PlugIn::SuperSnoop=HASH(0x10413d4c)
Object inside thread:      PlugIn::SuperSnoop=HASH(0x106ea164)
Object outside thread (2): PlugIn::SuperSnoop=HASH(0x10413d4c)
-- <snip> ---

I tried "threads::shared" from CPAN, but it does'nt work for me. The 
perldoc for "threads::shared" points out:

"BUGS: bless is not supported on shared references. In the current 
version, bless will only bless the thread local reference and the 
blessing will not propagate to the other threads. This is expected to be 
implemented in a future version of Perl."

Is there a way to get it work anyway? I need only one instance of each 
object at runtime.

Regards,
Lejf


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

Date: Fri, 07 Sep 2007 21:43:38 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Switching with case in perl ?
Message-Id: <M_Odna3FMNEwtX_bnZ2dnUVZ_gCdnZ2d@comcast.com>

lerameur wrote:
>    if($minutes_count<10) {
>       $minutes_count="0$minutes_count";
>    } else {
>       $minutes_count=$minutes_count;
>    }

Yarg!  Haven't you ever used sprintf?

> $logTime = $year$month$day$hours;

   $logTime = sprintf "%04d/%02d/%02d_%02d:%02d",
                  $year, $month, $day, $hour, $minute;


And are you aware that Perl has the ability to increment strings?

   perl -le '$n="00";$s="cw";print $n++," ",$s++ for (0..12)'

That comes into play if you have
   $value = "00";
instead of
   $value = 0;
and then use $value++ or ++$value.

	-Joe


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

Date: Fri, 07 Sep 2007 21:27:00 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Temporary filename
Message-Id: <TeWdnS9wKYFauX_bnZ2dnUVZ_sOrnZ2d@comcast.com>

Bill H wrote:
> temporary file (a jpg image) and then deleting that one and creating a
> new one (with a new name) when things change,

Here's how I did it at a previous job:

   my $img_file = "WCOM-stock-price.gif";
   my $mtime = (stat $img_file)[9];         # Changes if file was changed.
   print qq(<img src="$img_file?$mtime">\n);

Whenever the stock price changed, the HTML being presented to the
browser would be slightly different, encouraging browsers to forget
about the cached version and fetch the new data.

	-Joe


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

Date: Sat, 08 Sep 2007 02:11:08 -0700
From:  simil <dsimil@gmail.com>
Subject: Re: usenet posting of perl release
Message-Id: <1189242668.136439.47220@y42g2000hsy.googlegroups.com>

On Sep 8, 4:36 am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth simil <dsi...@gmail.com>:
>
> > "Larry Wall released the first released version 1.0 of perl to the
> > comp.sources.misc newsgroup on December 18, 1987". Almost everybody
> > must have seen this line when they first start learning perl. But
> > where the hell is that posting? I have been trying to find out that
> > posting but in vain. Can anybody point me to that? I am just curious.
>
> Seehttp://history.perl.org/PerlTimeline.html(a potted history of Perl, the
> Internet, and Unix);http://sources.isc.org/devel/lang/perl.txt(the
> original perl-1 posting without the source code), andhttp://history.perl.org/src/perl-1.0.tar.gz(the original source).
>
> Ben

hi,
   Thanks for the links. But, I was looking for the exact posting made
by larry wall in comp.sources.misc usenet group. I searched the group
but couldn't find anything :(. And regarding the content of the first
post at http://sources.isc.org/devel/lang/perl.txt ,why is the date
Jan 31, 1988 and not Dec 18, 1987?

simil




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

Date: Fri, 07 Sep 2007 18:39:33 -0700
From:  HR Head <msmanu78@yahoo.com>
Subject: We urgently require SAP consultant with 5 year of SAP experience
Message-Id: <1189215573.299220.56620@w3g2000hsg.googlegroups.com>

Hi,

We urgently require SAP consultant with 5 year of SAP experience

Qualification: -   recognized Bachelors or Masters degree.

Experience

1) 5 years of SAP work experience and a minimum of 3 full SAP
implementation cycles in one or more modules SD, MM, PP, HR, FICO, BW,
ABAP, SEM.

2) Candidates able to travel within Malaysia/Singapore and overseas.

3) Proficiency in Japanese language would be an added advantage.

Locations: - Singapore/Malaysia.

Please email your resume stating your current salary, expected salary
and notice period  to
Isoft_staff@yahoo. com
isoftsolutions@yahoo. com

HR Team
I-soft Asia .



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

Date: Sat, 08 Sep 2007 07:13:09 -0000
From:  usenet@DavidFilmer.com
Subject: Re: We urgently require SAP consultant with 5 year of SAP experience
Message-Id: <1189235589.287520.272150@57g2000hsv.googlegroups.com>

On Sep 7, 8:53 pm, Uri Guttman <u...@stemsystems.com> wrote:
> does SAP stand for:

No, it doesn't stand for anything, Uri.  The maroon OP held his shift
key down, making you think 'SAP' is an acronym.  It's just a plain
word.  What he's looking for is a sap:
   sap[n]: A gullible person; a fool; a dupe.   (dictionary.com)


--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)



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

Date: Sat, 08 Sep 2007 10:22:16 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: We urgently require SAP consultant with 5 year of SAP experience
Message-Id: <slrnfe4tl0.dm1.tadmc@tadmc30.sbcglobal.net>

usenet@DavidFilmer.com <usenet@DavidFilmer.com> wrote:
> On Sep 7, 8:53 pm, Uri Guttman <u...@stemsystems.com> wrote:
>> does SAP stand for:
>
> The maroon OP held his shift
> key down,


That is simply the

   Law of Case Conservation

in action.

The uc()'s missing in Uri's posts show up in spammer's posts.

:-)


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


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

Date: Sat, 08 Sep 2007 03:53:35 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: We urgently require SAP consultant with 5 year of SAP experience
Message-Id: <x7bqcdhkxt.fsf@mail.sysarch.com>

>>>>> "HH" == HR Head <msmanu78@yahoo.com> writes:

  HH> We urgently require SAP consultant with 5 year of SAP experience

does SAP stand for:

	stupid anal programmer
	send asian pythonista
	security ain't perfect
	spamming all people

  HH> Qualification: -   recognized Bachelors or Masters degree.

i recognize my degree. i don't recognize yours.

  HH> 1) 5 years of SAP work experience and a minimum of 3 full SAP
  HH> implementation cycles in one or more modules SD, MM, PP, HR, FICO, BW,
  HH> ABAP, SEM.

i see no perl listed there.

  HH> 2) Candidates able to travel within Malaysia/Singapore and overseas.

travelling within seas? do you want submariners?

  HH> 3) Proficiency in Japanese language would be an added advantage.

how about proficiency in perl?

  HH> Locations: - Singapore/Malaysia.

too long a commute.

  HH> Please email your resume stating your current salary, expected salary
  HH> and notice period  to
  HH> Isoft_staff@yahoo. com
  HH> isoftsolutions@yahoo. com

you can't afford me. nor anyone else i bet.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

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


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