[28957] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 201 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 7 14:10:45 2007

Date: Wed, 7 Mar 2007 11:09:07 -0800 (PST)
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, 7 Mar 2007     Volume: 11 Number: 201

Today's topics:
    Re: ActiveState Perl User Guide -- how can I add an ent clyde.ingram@edl.uk.eds.com
        Async. server using Perl <howachen@gmail.com>
    Re: Congratulations Randal <abigail@abigail.be>
        Exit Telnet session chandrasekhar.karanam@gmail.com
        Hey! i've done a Free Global Bad Words Dictionary, <tal396j@gmail.com>
        Hey! i've done a Free Global Bad Words Dictionary, <tal396j@gmail.com>
    Re: Hey! i've done a Free Global Bad Words Dictionary, <uri@stemsystems.com>
    Re: IPC::Open2 - Bad File Descriptor <ced@blv-sam-01.ca.boeing.com>
        Killing threads in perl joergwenzel@gmx.de
    Re: Killing threads in perl <greg.ferguson@icrossing.com>
    Re: Killing threads in perl <emschwar@pobox.com>
        LWP Package issue in my script.. schimata@gmail.com
        MIME::Lite, getting a warning. <justin.0703@purestblue.com>
        Newbie question re initialization <edMbj@aes-intl.com>
    Re: Newbie question re initialization <spamtrap@dot-app.org>
        predeclare module sub star_night@my-deja.com
    Re: predeclare module sub star_night@my-deja.com
    Re: Question about wizard Perl programmers <bik.mido@tiscalinet.it>
    Re: Question about wizard Perl programmers <bik.mido@tiscalinet.it>
        Splitting a filename <noel@sant.me.uk>
    Re: Splitting a filename <DJStunks@gmail.com>
    Re: Subroutines and Callbacks in Perl/Tk <bik.mido@tiscalinet.it>
    Re: Subroutines and Callbacks in Perl/Tk <bik.mido@tiscalinet.it>
    Re: Subroutines and Callbacks in Perl/Tk <bik.mido@tiscalinet.it>
    Re: Tk::DropSite question <zentara@highstream.net>
    Re: Unexpected RegEx results (Broke)
    Re: Unexpected RegEx results <bik.mido@tiscalinet.it>
    Re: Using Substr and Regular expressions. (Broke)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 7 Mar 2007 10:20:28 -0800
From: clyde.ingram@edl.uk.eds.com
Subject: Re: ActiveState Perl User Guide -- how can I add an entry to the list of Programs?
Message-Id: <1173291628.325869.102540@s48g2000cws.googlegroups.com>

On 5 Mar, 20:50, Ben Morrow <b...@morrow.me.uk> wrote:
> > When I access the ActiveState User Guide c:/Perl/html/index.html, the
> > file c:/Perl/html/perltoc.html seems to be regenerated to update the
> > Modules and Programs panels.
>
> Err.. no. That's impossible. What happens is that whenever you install
> something with PPM, the TOC page is regenerated.

I agree.  My error.  I've been installing modules at this time too.

> > What do I have to configure so that my
> > new program is picked up in the Programs part of perltoc.html?
>
> If you put your HTML page in the correct place (C:\Perl\html\bin), you
> should be able to run
>
>     perl -MActivePerl::DocTools -eActivePerl::DocTools::WriteTOC
>
> to just update the TOC.
Ben, that works for me.  Thank-you.

A supplementary problem is how to link to other pages in the manual.
Eventually I want to link to one of my new modules in ActiveState.
But to start with somethin simple (!), the perlpod page tells me I can
insert, for example:

<QUOTE>
L<name> -- a hyperlink <> >>
There are various syntaxes, listed below. In the syntaxes given, text,
name, and section cannot contain the characters '/' and '|'; and any
'<' or '>' should be matched.

L<name>

Link to a Perl manual page (e.g., L<Net::Ping>). Note that name should
not contain spaces.
</QUOTE>

So, I insert this POD paragraph:

L<Net::Ping>

just like the man said.  But the link on my new "ckscan" page in
ActiveState under "Programs" looks like this (underlined):

the Net::Ping manpage

but resolves to this URL:

file:///Net/Ping.html

That URL does not work.  What should L<Net::Ping> resolve to, and how
can I make it resolve in this way?

Regards,
Clyde Ingram



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

Date: 7 Mar 2007 06:54:03 -0800
From: "howa" <howachen@gmail.com>
Subject: Async. server using Perl
Message-Id: <1173279243.027178.255410@q40g2000cwq.googlegroups.com>

Hello,

Are there any good resources abt using Perl to write an Async, event
notification server? Something which is different from threaded or pre-
fork server, which take the advantage of Linux ePoll, allow program to
handle large number of connection using one thread.


Thanks.



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

Date: 07 Mar 2007 10:55:50 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Congratulations Randal
Message-Id: <slrneut6h0.r1r.abigail@alexandra.abigail.be>

Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMMMCMXXXVI September
MCMXCIII in <URL:news:864poxbu0r.fsf@blue.stonehenge.com>:
__ >>>>> "Michael" == Michael Vilain <vilain@spamcop.net> writes:
__  
__ Michael> When the judge expunged your conviction, he didn't, by chance order
__ Michael> that you be reimbursed for your legal expenses?  Or perhaps the
__ Michael> prosecutor and judge on the case should pay your expenses out of
__ Michael> their own pockets?
__  
__  Expungement means only that the records have been sealed.  This was more
__  of a technical operation than any sort of statement about the justification
__  of the original conviction.  As in, it is really simply a cap on the
__  punishment I receive - not "felon for life" but "felon for 10 years".


Will you now do a grand tour of "Perl conferences I've always wanted to
visit, but wasn't allowed to"?


Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


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

Date: 7 Mar 2007 04:49:22 -0800
From: chandrasekhar.karanam@gmail.com
Subject: Exit Telnet session
Message-Id: <1173271762.237276.17680@h3g2000cwc.googlegroups.com>

Hi,

I wrote a perl file to telnet to Windows host using Net::Telnet.
Once I telnet to remote host I execute a perl script.
I am facing the problem with timeout, If I give default time out the
script fails to execute within the time, if I give more time out then
perl script executes but still it will not close the telnet session
until the time out reaches.

Below is the script
my $tel_obj = new Net::Telnet (errmode => 'return', Binmode =>0);
    $tel_obj->buffer_empty;
    $tel_obj->input_log($LOG_FILE);
    if(!($tel_obj->open($ARGV[1]))) {
        print "Unable to telnet...\n";
        return 0;
    }
    $tel_obj->login(Name => $ARGV[2],
                    Password => $ARGV[3]);
    $tel_obj->cmd(String => "cd $SOURCE_PATH");
    my $sec = $tel_obj->timeout(99);
    print $sec;
    my $cmd_str = "perl $ARGV[4]";
    $tel_obj->buffer_empty;
    $tel_obj->cmd($cmd_str);
    $tel_obj->close;

Please help me in solving this issue.



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

Date: 7 Mar 2007 01:48:38 -0800
From: "tal396j@gmail.com" <tal396j@gmail.com>
Subject: Hey! i've done a Free Global Bad Words Dictionary,
Message-Id: <1173260917.876014.123460@v33g2000cwv.googlegroups.com>

Hey! i've done a Free Global Bad Words Dictionary,
for developers, by developers!
visit http://www.tal.tl/words/
add swears/bad words and get them in to your script/site (for bad
words filtering etc...)!
PLEASE! add only words that you think ARE RELEVANT to keep the
database quality!

this is 100% FREE!! NO ADS/POPUPS ETC! :-)



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

Date: 7 Mar 2007 01:48:54 -0800
From: "tal396j@gmail.com" <tal396j@gmail.com>
Subject: Hey! i've done a Free Global Bad Words Dictionary,
Message-Id: <1173260934.077548.129450@64g2000cwx.googlegroups.com>

Hey! i've done a Free Global Bad Words Dictionary,
for developers, by developers!
visit http://www.tal.tl/words/
add swears/bad words and get them in to your script/site (for bad
words filtering etc...)!
PLEASE! add only words that you think ARE RELEVANT to keep the
database quality!

this is 100% FREE!! NO ADS/POPUPS ETC! :-)



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

Date: Wed, 07 Mar 2007 10:15:07 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Hey! i've done a Free Global Bad Words Dictionary,
Message-Id: <x7wt1tccg4.fsf@mail.sysarch.com>

>>>>> "tc" == tal396j@gmail com <tal396j@gmail.com> writes:

  tc> Hey! i've done a Free Global Bad Words Dictionary,
  tc> for developers, by developers!
  tc> visit http://www.tal.tl/words/
  tc> add swears/bad words and get them in to your script/site (for bad
  tc> words filtering etc...)!
  tc> PLEASE! add only words that you think ARE RELEVANT to keep the
  tc> database quality!

can it detect this:

all spammers should fuck off and die!

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: 7 Mar 2007 02:59:16 -0800
From: "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: IPC::Open2 - Bad File Descriptor
Message-Id: <1173265156.354081.311790@q40g2000cwq.googlegroups.com>

On Mar 6, 10:10 am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth "comp.llang.perl.moderated" <c...@blv-sam-01.ca.boeing.com>:
>
>
>
> >> ...
>
> > You were close...
>
> >  open2('>&=0', '<&=0', ... )
>
> Did you try it?
>
> ~% perl -MIPC::Open2 -e 'open2(">&=1", "<&=0", "ls", "-l", "/dev/shm")'
> total 0
> open2: close(=0) failed: Bad file descriptor at -e line 1
>
> Still get the warning, for the same reason: open2 is explicitly trying
> to close \*{"=0"}, which isn't open.
>
> > >From 'perldoc -f open' :
>
> >  If you specify '<&=X', where "X" is a file
> >  descriptor number or a filehandle, then Perl
> >  will do an equivalent of C's "fdopen" of that
> >  file
>
> open2 ne open.

Thanks, I did try it but lost the error. It is interesting though
that IPC::Open3 (but not IPC::Open2) says:

   ...
   The filehandles may also be integers, in which case they are
   understood as file descriptors.

which, for reasons I didn't follow in the code, avoids the error:

 $ perl -MIPC::Open2 -e 'open2(">&=1", ">&=0" , "ls", "-l", "/dev/
null")'
   lrwxrwxrwx   1 root     other         27 Oct  9  2001 /dev/null ->
   ../devices/pseudo/mm@0:null
   open2: close(=0) failed: Bad file number at -e line 1

vs.

 $ perl -MIPC::Open2 -e 'open2(">&=1", 0 , "ls", "-l", "/dev/null")'
   lrwxrwxrwx   1 root     other         27 Oct  9  2001 /dev/null ->
   ../devices/pseudo/mm@0:null

--
Charles DeRykus



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

Date: 7 Mar 2007 06:44:56 -0800
From: joergwenzel@gmx.de
Subject: Killing threads in perl
Message-Id: <1173278696.152228.310640@h3g2000cwc.googlegroups.com>

Hi,

who can help me, to kill the threads in this script.
I create lot of  thread with a tar. If the tar canceled with errors, i
have to kill the rest of
the threads with tar. I dont now what is the best way. I tested with
kill Hup, but doesn't work.

code:
 .
# fill my array with
 ....
  my $cmd =
      "GZIP=$gzip; $tar -C $startdir  -X $tapedir/exclude -czf
$tapedir/$dname"
    . ".tar.gz . ";
  push( @restore, "$tar -C (Please set path here!) -xzvf
$dname.tar.gz" );
  push( @todo,  $cmd  );    # push Task on TODO
 ...
 .
while ( $#todo >= 0 && $result == 0) {
  last if($result > 0);
  my $cmd  =  pop(@todo) ;
  $sem->down();                  # only  n threads on the same time
  if (  $result == 0) {
    my $thread = threads->new(
      \&Task,
      $cmd,            # create a new thread
        );
   $thread->detach();
      }
 ...
 .

#-------------------------------------------------------------------------
sub Task {
  my (
    $cmd,    # Parameter
      ) = @_;
  my $id = threads->self->tid;
  $thread_run++;
  my $result += system ($cmd)/256;;
  if ($debug == 1) { print " Return:  $result \n\n"; }
  $sem->up();
  #$thread_run--;
  printf "Thread %02d: fertig.\n", $id;
  kill ("HUP", -$$);
  if ($result >0){print "\n\n Fehler !!!!!!!!\n\n";
        kill ("HUP", -$$);

      }

}



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

Date: 7 Mar 2007 08:26:42 -0800
From: "gf" <greg.ferguson@icrossing.com>
Subject: Re: Killing threads in perl
Message-Id: <1173284802.874448.204290@q40g2000cwq.googlegroups.com>

On Mar 7, 7:44 am, joergwen...@gmx.de wrote:
> Hi,
>
> who can help me, to kill the threads in this script.
> I create lot of  thread with a tar. If the tar canceled with errors, i
> have to kill the rest of
> the threads with tar. I dont now what is the best way. I tested with
> kill Hup, but doesn't work.
>
Off the top of my head I'd say that you want to use fork() instead of
threads if you want to be able to kill the tar processes.

When I used threads I had multiple LWP sessions running and each
thread looped until a queued list of URLs was processed, then they'd
exit automatically. Your tar processes don't have the intelligence to
know when to quit, which is why you're in that corner.

perldoc -f fork

Also read through Perlfaq 8



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

Date: Wed, 07 Mar 2007 18:06:28 GMT
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Killing threads in perl
Message-Id: <87ejo1ug4o.fsf@beorn.i-did-not-set--mail-host-address--so-shoot-me>

A brief comment on a matter unrelated to your direct question:

joergwenzel@gmx.de writes:
> while ( $#todo >= 0 && $result == 0) {
>   last if($result > 0);
>   my $cmd  =  pop(@todo) ;

 ...

}

This is a more Perl-ish way to do that loop:

foreach my $cmd (@todo) {
    last if $result > 0;

    # do stuff with $cmd as per usual.
}

Note that you don't have to check $result in the condition, since you
do so in the loop.  You only need to check it one place, and doing it
in the loop makes the condition look cleaner.  And using $#array in a
conditional looks kinda wonky, and is unnecessary most of the time
(I'd say "all of the time", but then somebody would come along and
find the .0001% case where it matters :).

-=Eric


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

Date: 7 Mar 2007 10:15:37 -0800
From: schimata@gmail.com
Subject: LWP Package issue in my script..
Message-Id: <1173291337.286204.269840@h3g2000cwc.googlegroups.com>


Hi guys,

I ahve the following code:

++++++++++++++++++++++++

use Cwd;
use XML::Parser;
use LWP::Simple;
use HTTP::Status;
use LWP::UserAgent;

blah..blah..

blah..


my $ua = LWP::UserAgent->new;


$ua->timeout(1000);
$ua->env_proxy;
# $ua->credentials( 'tracker:80', 'tracker', 'hello' =>  'abcd@123' );

my $url ='http://tracker/cfdocs/proddev/admin/ws/api/
get_all_subfeatures.cfm';
print "hello";
my $response = $ua->get($url);

+++++++++++++++++++++++++++++++

Now when I run this script, I get the following error:
++++++++++++++++++++++++++++++++++++++++++++++++++++
Can't locate object method "get" via package "LWP::UserAgent" at C:\cq
\featurexml.pl line 37.
++++++++++++++++++++++++++++++++++++++++++++++++++++

I think that it is the issue with the LWP stuff here. I see the below
versions of perl and LWP:
++++++++++++++++++++++++++++++++++++++
C:\cq>perl -v
This is perl, v5.6.0 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2000, Larry Wall
Binary build 623 provided by ActiveState Tool Corp. http://www.ActiveState.com
Built 16:27:07 Dec 15 2000


C:\cq>perl -MLWP -e "print $LWP::VERSION"
5.48
+++++++++++++++++++++++++++++++++++++++

Do I need to re-compile LWP pachage? Any pointers here?

Thanks,
Srini



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

Date: Wed, 07 Mar 2007 12:52:51 -0000
From: Justin C <justin.0703@purestblue.com>
Subject: MIME::Lite, getting a warning.
Message-Id: <slrneutdd3.102.justin.0703@stigmata.purestblue.com>


I have a script that mails a zip file to a user, when I run it a warning
is generated: no data in this part

Ideally I'd like to have it run 'clean', can someone give me some clues
on how to make this work without generating a warning?

CODE START
my $sender = '[edit]' ;
my $recipient = '[edit]' ;
my $subject = 'monthly .zip mailing' ;
my $messageText = "Please find attached a .zip file containing Excel files\n";
my $fname = glob "pa206_*xls" ;

#       create the message
my $msg = MIME::Lite->new(
        From => $sender,
        To => $recipient,
        Subject => $subject,
        Type => 'TEXT',
        Data => $messageText
        ) ;

#       attach the zip file
$msg->attach (
        Type => 'application/zip',
        Path => $fname,
        Filename => $fname
        ) ;

#       send the message
$msg->send() ;
 
CODE END

Thank you for any help you can give with this.

	Justin.

-- 
Justin C, by the sea.


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

Date: Wed, 07 Mar 2007 10:36:37 -0800
From: Ed Jay <edMbj@aes-intl.com>
Subject: Newbie question re initialization
Message-Id: <ngttu2pkn4ssmlt2cv99vetj8iut0ctao8@4ax.com>

At the start of a script I have (without the line numbers):

17  my $username = param('usrnm');
18  @subList = param('ptList');
19  my $newUsername = $username."{";
20  my $user = $username.",";

When I submit my script for testing I receive the following warnings:

Use of uninitialized value in concatenation (.) or string at foo.pl line 19.
Use of uninitialized value in concatenation (.) or string at foo.pl line 20.

I don't understand the message, nor do I know what to do to resolve the
issue. Help!
-- 
Ed Jay (remove 'M' to respond by email)


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

Date: Wed, 07 Mar 2007 14:05:39 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Newbie question re initialization
Message-Id: <m2y7m87u2k.fsf@local.wv-www.com>

Ed Jay <edMbj@aes-intl.com> writes:

> At the start of a script I have (without the line numbers):
>
> 17  my $username = param('usrnm');
> 18  @subList = param('ptList');
> 19  my $newUsername = $username."{";
> 20  my $user = $username.",";
>
> When I submit my script for testing I receive the following warnings:
>
> Use of uninitialized value in concatenation (.) or string at foo.pl line 19.
> Use of uninitialized value in concatenation (.) or string at foo.pl line 20.
>
> I don't understand the message, nor do I know what to do to resolve the
> issue. Help!

What's not to understand? You're trying to concatenate two strings. One of
them is uninitialized - i.e. its value is undef. Obviously that isn't going
to be the "{" or "," strings, so that leaves $username.

Why is $username undef then? Check your form - make sure that it has some-
thing named 'usrnm' in it. And validate your input; sooner or later someone
*will* leave that form element blank.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: 7 Mar 2007 01:01:25 -0800
From: star_night@my-deja.com
Subject: predeclare module sub
Message-Id: <1173258085.004551.236960@8g2000cwh.googlegroups.com>

Hi,

 How can I predeclare moule functions? I tried

test.pm
---------------
package test;
use Exporter;
@EXPORT = qw(foo);
sub foo;

sub foo {
}


main.pl
-------------
use test;
sub foo;

foo "args";    <------  this looks for &main::foo

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

Thanks
SN



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

Date: 7 Mar 2007 01:40:50 -0800
From: star_night@my-deja.com
Subject: Re: predeclare module sub
Message-Id: <1173260450.420203.304410@j27g2000cwj.googlegroups.com>

On Mar 7, 4:01 am, star_ni...@my-deja.com wrote:
> Hi,
>
>  How can I predeclare moule functions? I tried
>
> test.pm
> ---------------
> package test;
> use Exporter;
> @EXPORT = qw(foo);
> sub foo;
>
> sub foo {
>
> }
>
> main.pl
> -------------
> use test;
> sub foo;
>
> foo "args";    <------  this looks for &main::foo
>
> ---------------------------------------------------
>
> Thanks
> SN

this is resolved. I wasn't gettong the module mechanics right.

Thanks



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

Date: Wed, 07 Mar 2007 19:36:59 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Question about wizard Perl programmers
Message-Id: <ht0uu29l4sodtmubblh57dpcuci602uic8@4ax.com>

On Tue, 6 Mar 2007 19:04:02 +0100, "Peter J. Holzer"
<hjp-usenet2@hjp.at> wrote:

>>   char code[] =
>>   "\xeb\x19\x31\xc0\x31\xdb\x31\xc9\x31\xd2\xb0"
>>   "\x04\xb3\x01\x59\xb2\x03\xcd\x80\x31\xc0\x31"
>>   "\xdb\xb0\x01\xcd\x80\xe8\xe2\xff\xff\xffG.\n"
>>   ;
>
>Shouldn't that be "char main[] = ..."?

It's not meant to be a full program. But yes, yours seems like a
"good" idea.


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, 07 Mar 2007 19:36:59 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Question about wizard Perl programmers
Message-Id: <eq0uu2h4lk420b48153vmo80ssd9vil8v1@4ax.com>

On Wed, 07 Mar 2007 12:58:05 +0800, Zhou <zhouyan1986@gmail.com>
wrote:

>Then, I will use perl to write a script to do that.

Or will you write a perl script to do that? (Not that the former is
totally unreasonable, but that doesn't seem your case.)
;-)


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, 07 Mar 2007 18:10:43 GMT
From: "Noel Sant" <noel@sant.me.uk>
Subject: Splitting a filename
Message-Id: <DeDHh.46060$Fm2.12157@newsfe1-gui.ntli.net>

I want to split a filename into the name itself and the extension. This:

 ($name, $extension) = split /\./, $input_file;

works fine, providing there's only one dot in the filename, but if there are 
more I just get the first two bits of name. I really want to get the last 
bit into $extension and all the rest, including dots, into $name.

I suppose I could use an array on the left-hand side, find out how many 
element there are and just build up $name from all the arrays bar the last, 
but this seems long-winded. I tried using "split /\.$/, ..." but then I got 
evrything in $name, and $extension was undefined. As though it's just 
looking at the end of the string and saying "Nope! no dot there" and not 
going any further back. Obviously I don't understand what $ does.

How do I say "just match on the last dot", please?




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

Date: 7 Mar 2007 11:02:40 -0800
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: Splitting a filename
Message-Id: <1173294160.754062.139820@c51g2000cwc.googlegroups.com>

On Mar 7, 10:10 am, "Noel Sant" <n...@sant.me.uk> wrote:
> I want to split a filename into the name itself and the extension

perldoc File::Basename

-jp



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

Date: Wed, 07 Mar 2007 19:49:29 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Subroutines and Callbacks in Perl/Tk
Message-Id: <131uu29c0j609gjajdvkbt4t8ti4vd1go7@4ax.com>

On 5 Mar 2007 16:19:33 -0800, "doni" <doni.sekar@gmail.com> wrote:

>I am right now learning about Perl/TK and have a basic question
>regarding subroutines and callbacks.

You may also consider asking in <news:comp.lang.perl.tk>

>$mw->Button(-text => "Test",
>            -command => sub{test()})->pack;

Why not \&test?

>sub test {
>    print "We have reached the subroutine part \n";
>}
>
>>From the above code, I wanted the print statement "We have reached the
>subroutine part" to display in the MainWindow when I press the "test"
>button.

You wanted it to, but that's not what print() does. You need some Tk
widget that displays text and have your callback update that.

>When I press the "Test" button the result is getting displayed on the
>command line and not on the MainWindow.

And if there were more complex stuff than a simple MW, where would you
expect print() to "display text"?


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, 07 Mar 2007 19:53:51 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Subroutines and Callbacks in Perl/Tk
Message-Id: <va2uu292n9tnukp0cakurmfip2o08nonf3@4ax.com>

On Tue, 6 Mar 2007 03:48:20 +0000, Ben Morrow <ben@morrow.me.uk>
wrote:

>I call the module BMORROW::Tie::TkWatch (I have a convention that
>modules for my own use are prefixed with my CPAN id); you probably want

Why don't you release it. It's cool, and certainly useful. Are you a
PerlMonks user too? If so, then you may also post it in the snippets
or code sections. If not, may I do so? (With attribution, of course!)
There are some people with some expertise in GUI programming there,
including zentara who is also active here, and I bet most "monks"
would be glad to swee it. It would be nice to see if anyone takes it
over to roll his or her own version, possibly doing other interesting
things...


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, 07 Mar 2007 20:04:16 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Subroutines and Callbacks in Perl/Tk
Message-Id: <243uu2hq63ccfrfsf6hatns6014ib2bt64@4ax.com>

On Wed, 7 Mar 2007 01:06:01 +0100, "Petr Vileta"
<stoupa@practisoft.cz> wrote:

>use Tk;
>use Tk::Label;
>use Tk::Button;

AFAIK (not much, really) the latter two are not necessary. (But I
checked and it seems like it's actually so.)


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, 07 Mar 2007 12:41:09 GMT
From: zentara <zentara@highstream.net>
Subject: Re: Tk::DropSite question
Message-Id: <bgctu2t1idbja4lm4488j3604m8dc1e19k@4ax.com>

On Sun, 4 Mar 2007 16:09:13 -0500, "~greg" <g_m@remove-comcast.net>
wrote:

>I have reduced the following script,
>but it's runnable. It's a way
>to make a Tk listbox that accepts
>a selection of files or folders
>from Windows Explorer.
>
>The drop handler (my "OnSourceDrop")
>is apparently called individually
>on each file or folder in a multiple selection.
>
>And my question is,
>
>is there any way to know when to call
>a group-drop-handler,
>to be called after all the individual
>calls to OnSourceDrop() are finished
>after a group drop?
>
>thank you,
>
>~greg

Hi, I waited to see if anyone answered first; but since no one has,
I suggest you post this to comp.lang.perl.tk  or perlmonks.org.

Tk Drop is not seen much, and in conjunction with Windows makes
it pretty esoteric. 

zentara


-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html


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

Date: Wed, 7 Mar 2007 16:56:18 +0100
From: nospam@tele2.fr (Broke)
Subject: Re: Unexpected RegEx results
Message-Id: <1hum6ub.ql5uyo1fz8esoN%nospam@tele2.fr>

Mirco Wahab <wahab-mail@gmx.de> wrote:

Very good job Mr. Wahab !
I didn't know yet the
secret of the qr in your
code and just learned it.
It's extremely useful.

Many thanks !
--
B.

> My first shot:
> 
> 
> ...
> my $data='
> Some Text:0000:0:More Text
> Text text
> Text text text
> ';
> 
> my $rg = qr/
>         ^([^:]+) : \d+ : \d+ : ([^\n]+)?\n
>     (?: ^([^:\n]+?) \n)?
>     (?: ^([^:\n]+?) (?:\n|$) )?/mx;
> 
> if( $data =~ /$rg/ ) {
>     print join "\n", map defined $_?$_:'undef', ($1, $2, $3, $4);
> }
> 
> 
> Regards
> 
> M.


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

Date: Wed, 07 Mar 2007 19:36:59 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Unexpected RegEx results
Message-Id: <l10uu21mvajvu4m69iv709k0nob6f7t1qc@4ax.com>

On Wed, 7 Mar 2007 16:56:18 +0100, nospam@tele2.fr (Broke) wrote:

>I didn't know yet the
>secret of the qr in your
>code and just learned it.

It's just to write the complex regex separately while still having a
simple C<if> condition.


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, 7 Mar 2007 19:47:50 +0100
From: nospam@tele2.fr (Broke)
Subject: Re: Using Substr and Regular expressions.
Message-Id: <1humead.j2wfi81itmerqN%nospam@tele2.fr>

kent.westmoreland@gmail.com <kent.westmoreland@gmail.com> wrote:

> > Try SAMS "Teach Yourself Perl in 24 hours" (Clinton Pierce).  Worked
> > for me.
> >
> > Dan Mercer
> >
> > :
> > :
> > :
> > :
For myself I would like to recommend the simply excellent
book or Randal L. Schwartz, & Tom Christiansen
Published by O'REILLY.

The book is carefully paced and you have corrected exercises
at the end of each chapter.
This was tremendously useful for me because I am the learn
by doing type of person.
In a few minutes you will be able to write useful scripts !

Many thanks to you Randal L. Swartz and the others I already
mentioned: without you I would never had learned Perl. The
book from Larry Wall was rather difficult for to digest because
I am also a beginner. This is in fact this book of Larry Wall:
programming Perl that you will need after reading the excellent 
book of Mr. Swartz and the others I already mentioned.

I simply love Perl it became my obsession !
--
B.


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

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


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