[26008] in Perl-Users-Digest
Perl-Users Digest, Issue: 8226 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 8 16:19:50 2005
Date: Mon, 4 Jul 2005 15:05: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 Mon, 4 Jul 2005 Volume: 10 Number: 8226
Today's topics:
Re: <%@ language=PerlScript%> 500 err <by @request.only>
Re: ActivePerl build 813 broken? <rm@nospam.popeslane.clara.co.uk>
Re: ActivePerl build 813 broken? <pilkowsk@informatik.uni-marburg.de>
Re: ActiveState license: I can't distribute perl with m (Richard Williams)
Re: ActiveState license: I can't distribute perl with m <nomail@sorry.com>
Re: Gtk2 radio buttons problem <zentara@highstream.net>
Help With Pattern Matching <NOSPAMcarvinabuser@highstream.net>
Re: Help With Pattern Matching (Anno Siegel)
Re: Help With Pattern Matching axel@white-eagle.invalid.uk
Re: Help With Pattern Matching <NOSPAMcarvinabuser@highstream.net>
Re: Photo does not recognize format of Archive::Zip con <tj1@earthdome.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 4 Jul 2005 14:50:17 -0500
From: "Wayne B" <by @request.only>
Subject: Re: <%@ language=PerlScript%> 500 err
Message-Id: <7qgye.92164$yV4.8321@okepread03>
FYI
Ok, reinstall current version of Active Perl did the trick for IIS. The
newest version handles the config in IIS. Apache on the other hand is a mod
add. mod_perl and mod_asp. Less then simple for newbe but managable. I'm
still working on it.
Thanks for the help!
--
----------------------------------------------------------------------------
-------------------------
LYNX WEB DESIGNER - Unique user interface.
FREE-ON-LINE! http://members.cox.net/wlbragg
----------------------------------------------------------------------------
-------------------------
------------------------------
Date: Mon, 04 Jul 2005 19:24:37 +0100
From: Rob <rm@nospam.popeslane.clara.co.uk>
Subject: Re: ActivePerl build 813 broken?
Message-Id: <h6SdneniE9ed4lTfRVnysg@pipex.net>
Richard Trahan wrote:
> I have been using build 811 since its release, and it has worked fine
> on W98. With build 813, all my scripts cause page faults in MSVCRT.dll,
> so I've gone back to 811. I don't want to waste my time hunting for
> errors that may be ActiveState's fault; does anybody know what the
> problem is with build 813 on W98?
C:\Development\envs>perl -v
This is perl, v5.8.7 built for MSWin32-x86-multi-thread
(with 7 registered patches, see perl -V for more detail)
Copyright 1987-2005, Larry Wall
Binary build 813 [148120] provided by ActiveState http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Jun 6 2005 13:36:37
I've been using this on W98 for the last few weeks with no problems yet.
Rob.
------------------------------
Date: Mon, 4 Jul 2005 21:15:23 +0200
From: Fabian Pilkowski <pilkowsk@informatik.uni-marburg.de>
Subject: Re: ActivePerl build 813 broken?
Message-Id: <3itg4tFmuasrU1@individual.net>
* Richard Trahan schrieb:
> I have been using build 811 since its release, and it has worked fine
> on W98. With build 813, all my scripts cause page faults in MSVCRT.dll,
> so I've gone back to 811. I don't want to waste my time hunting for
> errors that may be ActiveState's fault; does anybody know what the
> problem is with build 813 on W98?
Recently I have read the release notes for this build on ActiveState's
website. I remember that there was something mentioned with relation to
"MSVCRT.DLL".
http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/RELEASE.html
In the beginning of paragraph "Windows" is a link wherewith you could
download that file from Microsoft if it isn't installed properly. Sure,
this file should be already installed on your Win98 system, but perhaps
anyone has replaced the original one with something else.
regards,
fabian
------------------------------
Date: Mon, 4 Jul 2005 18:27:45 +0000 (UTC)
From: rdwillia@hgmp.mrc.ac.uk (Richard Williams)
Subject: Re: ActiveState license: I can't distribute perl with my Windows application?
Message-Id: <dabv31$nla$1@helium.hgmp.mrc.ac.uk>
In article <42c90189$0$11224$bb690d87@news.main-rheiner.de>,
Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de> wrote:
>Arvin Portlock wrote:
>
>[ redistribution and copyright issues with AS perl]
>
>> Does anybody know whether ActiveState looks favorably on
>> written requests for my type of distribution? Is my only other
>> alternative to use perl2exe?
>
>In addition to the other good advice about compiling your own perl for
>windows, have a look at the PAR module to generate distributable
>standalone executables from your perl script (like perl2exe but free).
One thing to bear in mind about PAR is that it includes binary components
from your installed perl bundled into the executable it outputs, so if
you're running ActiveState there could still (I think) be licensing
issues. Of course, there's no reason you can't use PAR with your own
compiled perl just for the packaging convenience.
One other option is TinyPerl:
http://tinyperl.sourceforge.net/
which includes a perl binary (unfortunately not updated in a while) with
no restrictions beyond the standard license. Like PAR, it can be used to
generate executables, but it's trickier to add modules to them.
There are a few other Win32 binaries that might be worth a look (though
some are rather old):
http://www.cpan.org/ports/index.html#win32
I suspect compiling your own perl is still the best option (which, as
others have noted, isn't difficult).
Richard.
------------------------------
Date: Mon, 04 Jul 2005 14:19:28 -0700
From: Arvin Portlock <nomail@sorry.com>
Subject: Re: ActiveState license: I can't distribute perl with my Windows application?
Message-Id: <dac953$1vpl$1@agate.berkeley.edu>
> There are a few other Win32 binaries that might be worth a look (though
> some are rather old):
>
> http://www.cpan.org/ports/index.html#win32
>
> I suspect compiling your own perl is still the best option (which, as
> others have noted, isn't difficult).
>
> Richard.
I guess I'm lazy after all. The Apache perls seem distributable,
even if modules and files are removed. Plus they seem pretty up
to date:
http://www.apache.org/dyn/closer.cgi/perl/win32-bin
But if anyone notices licensing problems there I have overlooked
then I'm definitely going the gcc route and making my own.
Now, does anyone know about a good distributable Python for
Windows?
PAR is fascinating. It seems the most flexible of the lot,
but most importantly it looks like it can create Macintosh
executables (I try and stay as cross-platform as I can). Anyway,
I've made note of all of these suggestions in my tutorial.
Thank you everyone, for all of your advice.
Arvin
------------------------------
Date: Mon, 04 Jul 2005 09:17:38 -0400
From: zentara <zentara@highstream.net>
Subject: Re: Gtk2 radio buttons problem
Message-Id: <gcdic1pgs0i87ggufnbl8es0k75aujh42c@4ax.com>
On Mon, 4 Jul 2005 11:25:57 +0200, "Sylvie" <no@reply.invalid> wrote:
>Hi group,
>
>I try to use radio buttons in my Gtk2 perl script so that when the user
>clicks one a variable changes of value and a sub routine is called. This is
>my code:
>The problem I'm having is that everytime a new radio button is toggled, the
>sighandler gets called twice: once for the old value of the radio button and
>one for the new value. So if I start the script and click on Radio Button 2
>it prints:
You can setup signal blockers. I did it manually here, but if you had
alot of buttons, you could do it all by putting the buttons in a hash,
and looping through the hash to set the blockers/unblockers:
#!/usr/bin/perl
use warnings;
use strict;
use Glib qw/TRUE FALSE/;
use Gtk2 '-init';
my $window = Gtk2::Window->new('toplevel');
$window->set_title('Z');
$window ->signal_connect( 'destroy' => \&delete_event );
$window->set_border_width(10);
$window->set_size_request(300,200);
my $vbox = Gtk2::VBox->new( FALSE, 6 );
$window->add($vbox);
$vbox->set_border_width(2);
my $hbox= Gtk2::HBox->new( FALSE, 6 );
$vbox->pack_end($hbox,FALSE,FALSE,0);
$hbox->set_border_width(2);
$vbox->pack_end (Gtk2::HSeparator->new, FALSE, FALSE, 0);
my $button = Gtk2::Button->new_from_stock('gtk-quit');
$hbox->pack_end( $button, FALSE, FALSE, 0 );
$button->signal_connect( clicked => \&delete_event );
my $value;
my $button1 = Gtk2::RadioButton->new(undef,"Radio Button 1");
my $but1_sigid = $button1->signal_connect(
"toggled" => sub { $value = "button1";
sighandler();
},
"Radio Button 1" );
$button1->signal_handler_block ($but1_sigid);
$vbox->pack_start($button1, TRUE, TRUE, 0);
$button1->set_active(TRUE);
$button1->show;
my @group = $button1->get_group;
my $button2 = Gtk2::RadioButton->new_with_label(@group,"Radio Button
2");
my $but2_sigid = $button2->signal_connect(
"toggled" => sub {$value = "button2";
sighandler();
},
"Radio Button 2" );
$button2->signal_handler_block ($but2_sigid);
$button1->signal_connect(
"enter" => sub { $button1->signal_handler_unblock ($but1_sigid) });
$button1->signal_connect(
"leave" => sub { $button1->signal_handler_block ($but1_sigid) });
$button2->signal_connect(
"enter" => sub { $button2->signal_handler_unblock ($but2_sigid) });
$button2->signal_connect(
"leave" => sub { $button2->signal_handler_block ($but2_sigid)});
$vbox->pack_start($button2, TRUE, TRUE, 0);
$button2->show;
$window->show_all();
Gtk2->main;
#####################################
sub delete_event {
Gtk2->main_quit;
return FALSE;
}
########################################
sub sighandler {
print "value-> $value\n";
}
######################################
__END__
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
------------------------------
Date: Mon, 4 Jul 2005 16:27:50 -0400
From: "Craig" <NOSPAMcarvinabuser@highstream.net>
Subject: Help With Pattern Matching
Message-Id: <11cj6p7k3vuvb32@corp.supernews.com>
Hello and happy 4th,
I'm trying to write a Perl script that processes each word in a file and
prints only the words that contain the letter p (case insensitive). I'm not
getting the correct output. Any help would be appreciated. My script is
below.
#!/usr/local/bin/perl
$file = $ARGV[0];
open (DATA, "+<$file");
while (<DATA>)
{
foreach $word (m/\w+p/gi)
{
print "$word\n";
}
}
close(DATA);
------------------------------
Date: 4 Jul 2005 21:21:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Help With Pattern Matching
Message-Id: <dac98v$orj$1@mamenchi.zrz.TU-Berlin.DE>
Craig <NOSPAMcarvinabuser@highstream.net> wrote in comp.lang.perl.misc:
> Hello and happy 4th,
>
> I'm trying to write a Perl script that processes each word in a file and
> prints only the words that contain the letter p (case insensitive). I'm not
> getting the correct output. Any help would be appreciated. My script is
> below.
>
> #!/usr/local/bin/perl
>
> $file = $ARGV[0];
> open (DATA, "+<$file");
Why do you open the file for writing (in addition to reading)? That
mode is rarely useful on unformatted text files.
If you want to read from a file whose name is in @ARGV, Perl has a
shortcut: Use the empty file handle for reading, that is
while ( <> ) {
# ....
}
On the other hand, DATA is a pre-defined filehandle that shouldn't
be used for something else without reason. See "__END__" and "__DATA__"
in perldata for the full story.
> while (<DATA>)
> {
> foreach $word (m/\w+p/gi)
You should declare your variables:
foreach my $word ( ... )
Put "use strict; use warnings;" early in you Perl programs, so you
won't forget.
> {
> print "$word\n";
> }
> }
>
> close(DATA);
Also, you should indent your program properly. What you have written
is hard to read. Re-writing it, (and using DATA in its original role)
your program becomes:
while (<DATA>) {
foreach my $word ( m/\w+p/gi ) {
print "$word\n";
}
}
__END__
some perfectly good words,
some with a "p" in them, but none in upper case.
That prints "upp" on a single line. It fails to match "perfectly"
because you require at least one character before the "p". It also
fails to match the rest of the word, because you don't provide
anything to match it. Change your regex to
m/\w*p\w*/
and the output becomes
perfectly
p
upper
If that is exactly what you expect I don't know. If it is, your regex
wasn't all that far off.
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
Date: Mon, 04 Jul 2005 21:47:49 GMT
From: axel@white-eagle.invalid.uk
Subject: Re: Help With Pattern Matching
Message-Id: <98iye.73872$Vo6.735@fe3.news.blueyonder.co.uk>
Craig <NOSPAMcarvinabuser@highstream.net> wrote:
> I'm trying to write a Perl script that processes each word in a file and
> prints only the words that contain the letter p (case insensitive). I'm not
> getting the correct output. Any help would be appreciated. My script is
> below.
> #!/usr/local/bin/perl
>
> $file = $ARGV[0];
> open (DATA, "+<$file");
>
> while (<DATA>)
> {
> foreach $word (m/\w+p/gi)
> {
> print "$word\n";
> }
> }
>
> close(DATA);
Do you have a sample of input and also what out you wanted?
Currently you are in /\w+p/ asking for a match which is at least
one word letter followed as many as possible upto and including
the final p in the word. So any further letters in the word will
not be returned. No will any part of a word which begins with
a p but has no other p within the word.
I suggest matching the word boundaries by the use of \b :
/\b\w*p\w*\b/
Axel
------------------------------
Date: Mon, 4 Jul 2005 17:49:13 -0400
From: "Craig" <NOSPAMcarvinabuser@highstream.net>
Subject: Re: Help With Pattern Matching
Message-Id: <11cjbhqhva6j941@corp.supernews.com>
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:dac98v$orj$1@mamenchi.zrz.TU-Berlin.DE...
> Craig <NOSPAMcarvinabuser@highstream.net> wrote in comp.lang.perl.misc:
> > Hello and happy 4th,
> >
> > I'm trying to write a Perl script that processes each word in a file and
> > prints only the words that contain the letter p (case insensitive). I'm
not
> > getting the correct output. Any help would be appreciated. My script
is
> > below.
> >
> > #!/usr/local/bin/perl
> >
> > $file = $ARGV[0];
> > open (DATA, "+<$file");
>
> Why do you open the file for writing (in addition to reading)? That
> mode is rarely useful on unformatted text files.
>
> If you want to read from a file whose name is in @ARGV, Perl has a
> shortcut: Use the empty file handle for reading, that is
>
> while ( <> ) {
> # ....
> }
>
> On the other hand, DATA is a pre-defined filehandle that shouldn't
> be used for something else without reason. See "__END__" and "__DATA__"
> in perldata for the full story.
>
> > while (<DATA>)
> > {
> > foreach $word (m/\w+p/gi)
>
> You should declare your variables:
>
> foreach my $word ( ... )
>
> Put "use strict; use warnings;" early in you Perl programs, so you
> won't forget.
>
> > {
> > print "$word\n";
> > }
> > }
> >
> > close(DATA);
>
> Also, you should indent your program properly. What you have written
> is hard to read. Re-writing it, (and using DATA in its original role)
> your program becomes:
>
> while (<DATA>) {
> foreach my $word ( m/\w+p/gi ) {
> print "$word\n";
> }
> }
>
> __END__
> some perfectly good words,
> some with a "p" in them, but none in upper case.
>
> That prints "upp" on a single line. It fails to match "perfectly"
> because you require at least one character before the "p". It also
> fails to match the rest of the word, because you don't provide
> anything to match it. Change your regex to
>
> m/\w*p\w*/
>
> and the output becomes
>
> perfectly
> p
> upper
>
> If that is exactly what you expect I don't know. If it is, your regex
> wasn't all that far off.
>
> Anno
> --
> If you want to post a followup via groups.google.com, don't use
> the broken "Reply" link at the bottom of the article. Click on
> "show options" at the top of the article, then click on the
> "Reply" at the bottom of the article headers.
Anno,
Thanks a lot for the help. My script works correctly now and I understand
regex better now also.
Craig
------------------------------
Date: Mon, 04 Jul 2005 21:07:12 GMT
From: Tim <tj1@earthdome.com>
Subject: Re: Photo does not recognize format of Archive::Zip contents
Message-Id: <Xns9689AE29613F5tj1earthdomecom@207.69.189.191>
Richard,
The answer to your question is that the "-data" option in the Photo
method requires that the picture be base64 encoded. Add the following
to your code:
use MIME::Base64 qw(encode_base64);
and change
# -data => $contents, # this doesn't work
to
# -data => encode_base64($contents), # this doesn't work
And I think you will find that this now works. It would have been nice
if the other posters had bothered to answer the question insted of
getting into arguments about net-etiquette.
Richard Trahan <rtrahan@optonline.net> wrote in
news:cEype.70207$NZ1.53010@fe09.lga:
> Consider the following sub. On entry, $tl is a Toplevel, $rmn is an
> index into an array of Archive::Zip object member names; comments
> explain the others.
>
> sub display_image
> {
> my ($tl,$rmn) = @_; # Toplevel, requested member number
> my $mnref = $tl->{'member_names'}; # ref to member names array
> my $zip = $tl->{'zip'}; # Archive::Zip object
>
> my $membername = $mnref->[$rmn];
> my $member = $zip->memberNamed($membername);
> $tl->{'current_member_number'} = $rmn; # reset current member
> my $fh;
> my $fn = "C:/windows/temp/temp.jpg";
> open $fh,">",$fn;
> $member->extractToFileHandle($fh); # this works ok
> close $fh;
> # my $contents = $zip->contents($member); # (binary) jpeg data
> # open $fh,">","C:/temp/temp2.jpg";
> # binmode $fh;
> # print $fh $contents; # this works ok
> # close $fh;
> my $image = $tl->Photo(
> '-format' => 'jpeg',
> # -data => $contents, # this doesn't work
> -file => $fn, # this works ok
> );
> my $button = $tl->{'button'}; # button where image is displayed
> $button->configure(-image => $image); # set image
> $tl->configure(-title => $tl->{'file_name'} .
> ":" . $tl->{'sequence'} . " - $membername");
> }
>
> Commented sections show that I can successfully extract the "contents"
> of a Zip::Archive member (all of which are jpeg files), and write it
> to a file (it displays perfectly in a browser, PhotoEditor, etc.). I
> can also "extract" that member to another file and specify that file
> name to the Photo object, whereupon it displays just fine. But when I
> take the "contents", which is supposed to be pure jpeg binary data,
> and feed it to the Photo object, the system complains that it doesn't
> recognize the file format.
>
> Any help, please.
>
------------------------------
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 8226
***************************************