[28746] in Perl-Users-Digest
Perl-Users Digest, Issue: 10110 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 2 14:06:27 2007
Date: Tue, 2 Jan 2007 11:05:05 -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 Tue, 2 Jan 2007 Volume: 10 Number: 10110
Today's topics:
Re: dynamically loading perl modules <trwww@sbcglobal.net>
gtk2 treeview and threads : custom sort while updating erwan.barrier@gmail.com
Re: how can I access an array defined in another module <rod_mcban@yahoo.co.uk>
Re: how can I access an array defined in another module (on aioe)
Re: how can I access an array defined in another module <vaibhav.aparimit@gmail.com>
Re: MIDI::Score: Duration < 0, Adding Events, Native NR anno4000@radom.zrz.tu-berlin.de
Re: MIDI::Score: Duration < 0, Adding Events, Native NR <vtatila@mail.student.oulu.fi>
Net::Telnet and Tk prevent Perl from returning system c <gorbachev3@comcast.net>
Re: Net::Telnet and Tk prevent Perl from returning syst <stoupa@practisoft.cz>
Re: Net::Telnet and Tk prevent Perl from returning syst <gorbachev3@comcast.net>
Re: Net::Telnet and Tk prevent Perl from returning syst <usenet@MarcDashevsky.com>
Re: perl -V in 5.8.8 doesn't add architecture dependent <robert.nicholson@gmail.com>
Re: Perl LWP post to password protected script <tzz@lifelogs.com>
Re: Problems with use locale and regexp anno4000@radom.zrz.tu-berlin.de
Regular Expression <zowtar@gmail.com>
Re: Regular Expression <mritty@gmail.com>
Re: Regular Expression <josef.moellers@fujitsu-siemens.com>
Re: Regular Expression <zowtar@gmail.com>
Re: Why would I use Perl in place of C/C++? <een-niet-bestaande-kleineaap@xs4all.nl>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 2 Jan 2007 13:29:55 -0500
From: "Todd W" <trwww@sbcglobal.net>
Subject: Re: dynamically loading perl modules
Message-Id: <Dwxmh.24972$QU1.11867@newssvr22.news.prodigy.net>
"stig" <_nospam_stigerikson@yahoo.se> wrote in message
news:en6gcs$1ar$1@oden.abc.se...
> Hi.
>
> We are starting to build a small web portal in perl.
> Already at this stage we see the need to be able to plug-in certain
> functionality.
>
>
> strategy 1
> We have thought about a solution where we can put modules in a special
> directory.
> When the portal looks in that directory and find new modules it reads some
> information in via an API
> that each of the modules contains (eg: getName(), getVersion() ) and
> presents the modules on the web portal.
>
> strategy 2
> We have also though about a solution where we enable and disable modules
> based on information
> stored separately (in a database). This would be less dynamic but perhaps
> better for other reasons?
>
>
> The questions i have are:
> 1. Is the first strategy good at all, or should we aim for the second?
Without more details either is fine.
> 2. How can we dynamically load a module?
http://perldoc.perl.org/functions/require.html
> 3. Are there ways to ask a module which functions/methods it provides?
http://perldoc.perl.org/UNIVERSAL.html
Class->can( 'method' );
$obj->can( 'method' );
UNIVERSAL::can( $proto, 'method' );
> 4. Should i stop developing this in perl, and look for something else?
I'd use perl (mod_perl)...
Todd W.
------------------------------
Date: 2 Jan 2007 09:04:28 -0800
From: erwan.barrier@gmail.com
Subject: gtk2 treeview and threads : custom sort while updating rows
Message-Id: <1167757468.762345.55010@42g2000cwt.googlegroups.com>
hello
I have a timeout each 5 second who create a thread to update data to my
treeview.
it looks like
while (@data)
{
Gtk2::Gdk::Threads->enter;
push @{$tree->{data}}, \@data;
Gtk2::Gdk::Threads->leave;
}
i have 5 column automatically sorted and a column where i want custom
sorting.
it look like:
my $id=0;
map { $_->set_sort_column_id($id++)} $tree->get_columns;
$tree->get_model->set_sort_func(6, \&sort_variation);
with sort_variation who returns an integer equal to negative, 0, or
positive.
custom sort works if update is done without threads.
automatic sort works with or without threads.
custom sort DOESN'T work if update is done with threads.
the error message before is:
"Usage: set(list_store, iter, col1, val1, ...)"
any help needed
Thanks in advance
------------------------------
Date: 2 Jan 2007 03:33:39 -0800
From: "Rod MacBan" <rod_mcban@yahoo.co.uk>
Subject: Re: how can I access an array defined in another module
Message-Id: <1167737619.402403.127410@48g2000cwx.googlegroups.com>
Ah ok; somehow you have to cast the array_test before you can
dereference it, like that
foreach my $var ( @{$self->{batlibobj2}->{array_test}} )
Rod.
------------------------------
Date: Tue, 02 Jan 2007 05:18:14 -0600
From: "Mumia W. (on aioe)" <paduille.4060.mumia.w@earthlink.net>
Subject: Re: how can I access an array defined in another module
Message-Id: <endg4q$kuj$1@aioe.org>
On 01/02/2007 03:41 AM, vabby wrote:
> My problem scenario is as follows.
> I have a module BatLib1.pm and another module BatLib2.pm and a main
> perl module mod_main.pl . Inside BatLib2.pm, there is a function fn1()
> , where I declare and define an array like this:
> $self->{array_test}[0] = 0;
> $self->{array_test}[1] = 1;
> $self->{array_test}[2] = 2;
>
> INside mod_main.pl , I create a new instance of Batlib2,
> $batlibobj2 = new_Batlib2 Batlib2();
>
> and then a new instance of Batlib1, where I pass as arg the instance of
> Batlib2
> $batlibobj1 = new_Batlib1 Batlib1($batlibobj2);
>
> Inside Batlib1.pm
> I make a call to Batlib2::fn1() and it works so that the array_test
> gets populated. Now I have to access this array in Batlib1. How can I
> do it:
>
> I tried using $self->{batlibobj2}->{array_test}, but it doesnot work.
> Plz note that batlibobj2 is a member variable of Batlib1 which gets
> intilaized in the new_Batlib1 function.
>
> Tx
> Vabby
>
Create a method in Batlib2 that returns the value of array_test and let
Batlib1 use that value to access the array.
(I'm really bored right now ;-)
---------------cut----------------
#!/usr/bin/perl
use strict;
use warnings;
use Batlib1;
use Batlib2;
my $batlibobj2 = new Batlib2;
my $batlibobj1 = new Batlib1($batlibobj2);
$batlibobj1->show_test;
--------------cut-------------------
package Batlib1;
sub new {
my $class = shift;
my $self = { batlibobj2 => shift() };
$self->{batlibobj2}->fn1();
bless ($self, $class);
}
sub show_test {
my $self = shift;
my $at = $self->{batlibobj2}->array_test();
print "Array test element: $_\n" for (@$at);
}
1;
----------------cut------------
package Batlib2;
sub new {
my $class = shift;
bless ({}, $class);
}
sub fn1 {
my $self = shift;
$self->{array_test}[0] = 0;
$self->{array_test}[1] = 1;
$self->{array_test}[2] = 2;
$self;
}
sub array_test {
my $self = shift;
$self->{array_test} = $_[0] if @_;
$self->{array_test};
}
1;
---------------cut-------------
HTH
--
paduille.4060.mumia.w@earthlink.net
Windows Vista and your freedom in conflict:
http://www.badvista.org/
------------------------------
Date: 2 Jan 2007 03:43:00 -0800
From: "vabby" <vaibhav.aparimit@gmail.com>
Subject: Re: how can I access an array defined in another module
Message-Id: <1167738180.477637.163770@v33g2000cwv.googlegroups.com>
thnx, both the solns wrk,
Vabby
------------------------------
Date: 2 Jan 2007 12:25:56 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: MIDI::Score: Duration < 0, Adding Events, Native NRPNs?
Message-Id: <4vv1akF1duh79U1@mid.dfncis.de>
Veli-Pekka Tätilä <vtatila@mail.student.oulu.fi> wrote in comp.lang.perl.misc:
> Hi,
> In some MIDI files I receive negative note durations from MIDI::Score. I'm
> pretty certain it is some bug in my own code.
I don't think it's your bug.
> Here's a minimal version:
>
> test.plx:
>
> #!perl
> # This is perl, v5.8.8 built for MSWin32-x86-multi-thread.
> use strict; use warnings;
> use MIDI; # V0.81.
>
> (my($inFile, $outFile) = @ARGV) == 2 or die "2 files please.\n";
> my $opus = MIDI::Opus->new( { from_file => $inFile } );
> my $ticks = $opus->ticks();
> my $tracks = $opus->tracks_r();
> my $newTracks; # For output.
>
> for(@$tracks)
> { # Copy each one.
> # Convert only events.
> if($_->type() ne 'MTrk')
> { # Not events, but data in stead.
> push @$newTracks, $_->copy();
> next;
> } # if
>
> my $events = $_->events_r();
> my $score = MIDI::Score::events_r_to_score_r($events);
>
> # MIDI::Score says the format is:
> # ['note', starttime, duration, channel, note, velocity]
> my @bad = grep { $_->[0] eq 'note' and $_->[2] < 0 } @$score;
> if(@bad)
> { # No such thing as negative duration? At least in seqs.
> warn "Bad: [ @$_ ]\n" for @bad;
> # This reveals both note and note_on events.
> # print $_->dump;
> # die "Stopped.\n";
> } # if
>
> # Turn score back to events and tracks.
> my $newEvents = MIDI::Score::score_r_to_events_r($score);
> push @$newTracks, MIDI::Track->new( {events_r => $newEvents} );
> } # for
>
> # Now we can write out the file safely.
> my $newOpus = MIDI::Opus->new;
> $newOpus->tracks_r($newTracks);
> $newOpus->ticks($ticks); # Many seqs support > 96 PPQ.
> $newOpus->write_to_file($outFile);
> print "Done.\n";
>
> The check for negative note lengths appears to catch some note events in
> quite a number of MIDI files. Here's one nice piano boogie called sockhop
> which does this:
>
> http://netdancer.com/midis/Sockhop.mid
Nice Boogie with some chord tremolos a la Jerry Lee Lewis.
> Say we run:
>
> test.plx sockhop.mid test.mid
>
> The output would be:
>
> Bad: [ note 15344 -15344 2 64 88 ]
> Bad: [ note 15351 -15351 2 67 82 ]
[mode bad snipped]
> Oddly enough the Note duration and its start ttime are exactly the same
> absolute tick counts, according to this dump, though they have a different
> sign.
Not so odd after looking at the code. It would happen when a note_on
event is found but the corresponding note_off isn't recognized.
The way note events are built in MIDI::Score::events_r_to_score_r() (line
350 or thereabouts), a note_on event temporarily creates a note with the
duration equal to the negative start time. Later, note_off adds its time
to the duration, making it what it should be. If that doesn't happen you'd
see note events whose duration is equal to the negative start time, like
the ones your program prints out.
> Obviously this shouldn't happen and at any rate no MIDI sequencer I've
> ever used shows the lengths in the event list as being negative. Despite
> this a proper copy of the MIDI is written hinting at some problem in my
> usage of the SCore and Event structures.
[snippage]
> I wonder what might cause the negative length to show up. I'm suspecting
> some obvious error in my own code very first but if that's not the case,
> some other possibilities do come to mind.
>
> 1. Many sequencers support HiFi resolutions far exceeding 96 pulses per
> quarter note (PPQ). Sonar can do 960, for example, even if many hardware is
> 96 or 120. I've noticed that MIDI::Simple assumes 96 PPQ and thus Windows's
> default 192 PPQ MIDs play all too slowly after conversion. Unless you add
> the PPQ yourself as I did in the above example with MIDI::Score.
I don't think that's the reason.
> 2. Imagine a hypothetical scenario. That is hold down a note while you start
> recording and then release it. IF the sequencer is silly, and doesn't
> monitor active sensing, see:
>
> http://www.borg.com/~jglatt/tech/midispec/sense.htm
>
> then it might just record a note off event without a corresponding note on
> at all. A smarter sequencer might wait for you to release notes before
> beginning to record or insert the missing note on automatically. If
> MIDI::Score has been written under the assumption of strict note on/off
> pairs with note on always first, such mishaps, though arguably bugs in the
> MIDI performance, might affect matters.
It seems to be the other way round, you get a note_on with no corresponding
note_off.
> 3. Many synthesizers, Rolands in particular, have adopted a special
> convention for note off events. In stead of actually transmitting as many
> bytes as they'd have for a normal note off, they can use note on messages
> with velocity 0 and running status to compress data. See:
>
> http://www.borg.com/~jglatt/tech/midispec/run.htm
>
> and
>
> http://www.borg.com/~jglatt/tech/midispec/noteon.htm
>
> In addition to saving bytes, very few keyboards actually send out varying
> release velocity values anyway, so the note on method doesn't lose
> information. For MIDI::Score is a note on with velo 0 equivalent to a note
> off?
At least for MIDI::Score::events_r_to_score_r() it is, or that's how I
read this bit of code:
if($_->[0] eq 'note_off'
or($_->[0] eq 'note_on' &&
$_->[4] == 0) )
{ # End of a note
That seems to treat a note_on with velocity 0 as a note_off.
I have no idea why the code would miss some note_off events in some
score files but not in others, but that is what I believe is happening.
Anno
------------------------------
Date: Tue, 2 Jan 2007 20:43:50 +0200
From: "Veli-Pekka Tätilä" <vtatila@mail.student.oulu.fi>
Subject: Re: MIDI::Score: Duration < 0, Adding Events, Native NRPNs?
Message-Id: <ene95g$q3m$1@news.oulu.fi>
anno4000@radom.zrz.tu-berlin.de wrote:
> Veli-Pekka Tätilä <vtatila@mail.student.oulu.fi> wrote in
> comp.lang.perl.misc:
>> In some MIDI files I receive negative note durations from
>> MIDI::Score. I'm pretty certain it is some bug in my own code.
> I don't think it's your bug.
Hey, glad to know this might be the case, this is maybe the third time this
has ever happened to me in Perl. Well, about the time I wrote the original
post I also contacted the author using the e-mail address in the man page.
Let's see if he'll reply.
>> Here's a minimal version:
>> test.plx:
>> #!perl
>> # This is perl, v5.8.8 built for MSWin32-x86-multi-thread.
>> use strict; use warnings;
>> use MIDI; # V0.81.
>>
>> (my($inFile, $outFile) = @ARGV) == 2 or die "2 files please.\n";
>> my $opus = MIDI::Opus->new( { from_file => $inFile } );
>> my $ticks = $opus->ticks();
>> my $tracks = $opus->tracks_r();
>> my $newTracks; # For output.
>>
>> for(@$tracks)
>> { # Copy each one.
>> # Convert only events.
>> if($_->type() ne 'MTrk')
>> { # Not events, but data in stead.
>> push @$newTracks, $_->copy();
>> next;
>> } # if
>>
>> my $events = $_->events_r();
>> my $score = MIDI::Score::events_r_to_score_r($events);
>>
>> # MIDI::Score says the format is:
>> # ['note', starttime, duration, channel, note, velocity]
>> my @bad = grep { $_->[0] eq 'note' and $_->[2] < 0 } @$score;
>> if(@bad)
>> { # No such thing as negative duration? At least in seqs.
>> warn "Bad: [ @$_ ]\n" for @bad;
>> # This reveals both note and note_on events.
>> # print $_->dump;
>> # die "Stopped.\n";
>> } # if
>>
>> # Turn score back to events and tracks.
>> my $newEvents = MIDI::Score::score_r_to_events_r($score);
>> push @$newTracks, MIDI::Track->new( {events_r => $newEvents} );
>> } # for
>>
>> # Now we can write out the file safely.
>> my $newOpus = MIDI::Opus->new;
>> $newOpus->tracks_r($newTracks);
>> $newOpus->ticks($ticks); # Many seqs support > 96 PPQ.
>> $newOpus->write_to_file($outFile);
>> print "Done.\n";
>>
>> The check for negative note lengths appears to catch some note
>> events in quite a number of MIDI files. Here's one nice piano boogie
>> called sockhop which does this:
>>
>> http://netdancer.com/midis/Sockhop.mid
>
> Nice Boogie with some chord tremolos a la Jerry Lee Lewis.
Glad you liked it, <smile>. It's pretty good compared to most other piano
Boogies I've seen on the net but that's way OT, of course.
>> test.plx sockhop.mid test.mid
>> Bad: [ note 15344 -15344 2 64 88 ]
>> Bad: [ note 15351 -15351 2 67 82 ]
> [mode bad snipped]
>> Oddly enough the Note duration and its start ttime are exactly the
>> same absolute tick counts, according to this dump, though they have
>> a different sign.
> Not so odd after looking at the code. It would happen when a note_on
> event is found but the corresponding note_off isn't recognized.
>
> The way note events are built in MIDI::Score::events_r_to_score_r()
> (line 350 or thereabouts), a note_on event temporarily creates a note
> with the duration equal to the negative start time. Later, note_off
> adds its time
> to the duration, making it what it should be. If that doesn't happen
> you'd see note events whose duration is equal to the negative start
> time, like
> the ones your program prints out.
Ah I see now. As I've currently got no idea how to fix the problem any ideas
as to what I should do to work-around it. I ran the script for my 175 MIDI
files on disk most of which are from the net and it only succeeded for 108
MIDIs.
I'm actually building a very simple frontend that let's people write subs
that processs trackfuls of MIDI data at a time such that you can access the
event fields my name, copy events and create new ones with ease. I'm
thinking that it could be a more powerful and sequencer agnostic version of
Cakewalk's poor CAL language, whose implementation is terrible but the idea
was good. People have written all sorts of useful CAL scripts for off-line
processing only CAL has a horribly lispish syntax with none of the list
facilities and doesn't support floating point math or user sub-routines, for
instance. So Perl would provide lots of power for free even without extra
modules. I suppose I'd better skip all tracks with bad notes just to be on
the safe side and warn the user accordingly. I reckon I'll try to isolate a
small section of an individual track that causes the problem.
> I wonder what might cause the negative length to show up. <snip>
>> 3. Many synthesizers, Rolands in particular, have adopted a special
>> convention for note off events. In stead of actually transmitting as
>> many bytes as they'd have for a normal note off, they can use note
>> on messages with velocity 0 and running status to compress data. See:
>>
>> http://www.borg.com/~jglatt/tech/midispec/run.htm
>>
>> and
>>
>> http://www.borg.com/~jglatt/tech/midispec/noteon.htm
>>
>> In addition to saving bytes, very few keyboards actually send out
>> varying release velocity values anyway, so the note on method
>> doesn't lose information. For MIDI::Score is a note on with velo 0
>> equivalent to a note off?
> At least for MIDI::Score::events_r_to_score_r() it is, or that's how I
> read this bit of code:
>
> if($_->[0] eq 'note_off'
> or($_->[0] eq 'note_on' &&
> $_->[4] == 0) )
> { # End of a note
>
> That seems to treat a note_on with velocity 0 as a note_off.
Yes it looks the same to me. Velocity is the 5th field when note duration
is not included, and that's only part of MIDI::Score structures. The
abstracted event type is note not note_on or note_off.
--
With kind regards Veli-Pekka Tätilä (vtatila@mail.student.oulu.fi)
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila/
------------------------------
Date: Tue, 2 Jan 2007 11:57:08 -0500
From: "Alex Gorbachev" <gorbachev3@comcast.net>
Subject: Net::Telnet and Tk prevent Perl from returning system commands on Windows
Message-Id: <AfidnZXwdbV4EwfYnZ2dnUVZ_sudnZ2d@comcast.com>
This reduced version of my code fails in line 13 ( for (1..5) {system ("echo
syscall $_")}) -- Perl cannot close the system call. Running this with Perl
5.8.8 on Win XP and Win 2000 with same result.
use Tk;
use Net::Telnet;
$main = MainWindow->new;
$main->Button( -text => DO,-command => (sub{do_work()}))->pack(qw/-pady
15 -padx 20/);
MainLoop;
sub do_work {
my $t = new Net::Telnet (Port => 25);
$t->open("yahoo.com") or print "Cannot connect";
$t->close;
for (1..5) {system ("echo syscall $_")}
}
------------------------------
Date: Tue, 2 Jan 2007 18:41:39 +0100
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: Net::Telnet and Tk prevent Perl from returning system commands on Windows
Message-Id: <ene5hn$2skl$1@ns.felk.cvut.cz>
"Alex Gorbachev" <gorbachev3@comcast.net> píše v diskusním příspěvku
news:AfidnZXwdbV4EwfYnZ2dnUVZ_sudnZ2d@comcast.com...
> This reduced version of my code fails in line 13 ( for (1..5) {system
> ("echo
> syscall $_")}) -- Perl cannot close the system call. Running this with
> Perl
> 5.8.8 on Win XP and Win 2000 with same result.
>
>
> use Tk;
> use Net::Telnet;
>
> $main = MainWindow->new;
>
> $main->Button( -text => DO,-command => (sub{do_work()}))->pack(qw/-pady
> 15 -padx 20/);
> MainLoop;
>
> sub do_work {
> my $t = new Net::Telnet (Port => 25);
> $t->open("yahoo.com") or print "Cannot connect";
# maybe this can help you
$t->break;
$t->print('bye');
> $t->close;
> for (1..5) {system ("echo syscall $_")}
> }
>
------------------------------
Date: Tue, 2 Jan 2007 13:11:50 -0500
From: "Alex Gorbachev" <gorbachev3@comcast.net>
Subject: Re: Net::Telnet and Tk prevent Perl from returning system commands on Windows
Message-Id: <a8idnRiQR_D0PQfYnZ2dnUVZ_q-vnZ2d@comcast.com>
Unfortunately no improvement. It seems something in the code of Net::Telnet
is interfering with Perl core in combination with Tk, not the telnet process
itself. One thing to note that this problem (system call not ever returning
back to Perl) happens when the button is pressed (or via some other event in
Tk).
"Petr Vileta" <stoupa@practisoft.cz> wrote in message
news:ene5hn$2skl$1@ns.felk.cvut.cz...
> "Alex Gorbachev" <gorbachev3@comcast.net> píše v diskusním příspěvku
> news:AfidnZXwdbV4EwfYnZ2dnUVZ_sudnZ2d@comcast.com...
>> This reduced version of my code fails in line 13 ( for (1..5) {system
>> ("echo
>> syscall $_")}) -- Perl cannot close the system call. Running this with
>> Perl
>> 5.8.8 on Win XP and Win 2000 with same result.
>>
>>
>> use Tk;
>> use Net::Telnet;
>>
>> $main = MainWindow->new;
>>
>> $main->Button( -text => DO,-command => (sub{do_work()}))->pack(qw/-pady
>> 15 -padx 20/);
>> MainLoop;
>>
>> sub do_work {
>> my $t = new Net::Telnet (Port => 25);
>> $t->open("yahoo.com") or print "Cannot connect";
>
> # maybe this can help you
> $t->break;
> $t->print('bye');
>
>> $t->close;
>> for (1..5) {system ("echo syscall $_")}
>> }
>>
>
------------------------------
Date: Tue, 2 Jan 2007 13:22:55 -0500
From: Marc Dashevsky <usenet@MarcDashevsky.com>
Subject: Re: Net::Telnet and Tk prevent Perl from returning system commands on Windows
Message-Id: <MPG.20046d0b22bb82dd989b76@news.supernews.com>
In article <a8idnRiQR_D0PQfYnZ2dnUVZ_q-vnZ2d@comcast.com>, gorbachev3@comcast.net says...
> Unfortunately no improvement. It seems something in the code of Net::Telnet
> is interfering with Perl core in combination with Tk, not the telnet process
> itself. One thing to note that this problem (system call not ever returning
> back to Perl) happens when the button is pressed (or via some other event in
> Tk).
Maybe it uses threads?
--
Go to http://MarcDashevsky.com to send me e-mail.
------------------------------
Date: 2 Jan 2007 09:31:12 -0800
From: "Robert Nicholson" <robert.nicholson@gmail.com>
Subject: Re: perl -V in 5.8.8 doesn't add architecture dependent directories?
Message-Id: <1167759072.049202.102780@48g2000cwx.googlegroups.com>
Does this look right to you then?
$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=freebsd, osvers=6.2-release, archname=i386-freebsd-64int
uname='freebsd freebsd.org 6.2-release freebsd 6.2-release #0: sat
sep 2 11:35:58 pdt 2006 kris@freebsd.org:usrsrcsysmagickernelpath i386
'
config_args='-sde -Dprefix=/usr/local
-Darchlib=/usr/local/lib/perl5/5.8.8/mach
-Dprivlib=/usr/local/lib/perl5/5.8.8
-Dman3dir=/usr/local/lib/perl5/5.8.8/perl/man/man3
-Dman1dir=/usr/local/man/man1
-Dsitearch=/usr/local/lib/perl5/site_perl/5.8.8/mach
-Dsitelib=/usr/local/lib/perl5/site_perl/5.8.8
-Dscriptdir=/usr/local/bin
-Dsiteman3dir=/usr/local/lib/perl5/5.8.8/man/man3
-Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv
-Uinstallusrbinperl -Dcc=cc -Duseshrplib
-Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.8/BSDPAN"
-Doptimize=-O2 -fno-strict-aliasing -pipe -Ud_dosuid -Ui_gdbm
-Dusethreads=n -Dusemymalloc=y -Duse64bitint'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=y, bincompat5005=undef
Compiler:
cc='cc', ccflags
='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.8/BSDPAN" -DHAS_FPSETMASK
-DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe
-Wdeclaration-after-statement -I/usr/local/include',
optimize='-O2 -fno-strict-aliasing -pipe ',
cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.8/BSDPAN"
-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe
-Wdeclaration-after-statement -I/usr/local/include'
ccversion='', gccversion='3.4.4 [FreeBSD] 20050518',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -Wl,-E -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lcrypt -lutil
perllibs=-lm -lcrypt -lutil
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='
-Wl,-R/usr/local/lib/perl5/5.8.8/mach/CORE'
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MYMALLOC PERL_MALLOC_WRAP USE_64_BIT_INT
USE_LARGE_FILES USE_PERLIO
Locally applied patches:
defined-or
Built under freebsd
Compiled at Sep 2 2006 18:45:30
%ENV:
PERL5LIB="/home/elastica/lib/perl5/5.8.8:/home/elastica/lib/perl5/site_perl:/home/elastica/lib/perl5/site_perl/5.8.8:/home/elastica/lib/perl5/site_perl/5.8.8/mach"
@INC:
/home/elastica/lib/perl5/5.8.8
/home/elastica/lib/perl5/site_perl/5.8.8
/home/elastica/lib/perl5/site_perl
/home/elastica/lib/perl5/site_perl/5.8.8
/home/elastica/lib/perl5/site_perl/5.8.8/mach
/usr/local/lib/perl5/5.8.8/BSDPAN
/usr/local/lib/perl5/site_perl/5.8.8/mach
/usr/local/lib/perl5/site_perl/5.8.8
/usr/local/lib/perl5/site_perl
/usr/local/lib/perl5/5.8.8/mach
/usr/local/lib/perl5/5.8.8
.
$
Why "mach" for the architecture directory?
Robert Nicholson wrote:
> Hi,
>
> I've got two systems and one with 5.8.0 and another with 5.8.8
>
> in 5.8.0 perl -V includes architecture dependent directories added to
> site_perl where as 5.8.8 doesn't
>
> did this behaviour change in after 5.8.0?
>
> so on 5.8.8 I have to explicitly add the arch directories in PERL5LIB
> where as in 5.8.0 I don't.
------------------------------
Date: Tue, 02 Jan 2007 12:38:55 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Perl LWP post to password protected script
Message-Id: <g69hcv9qqfk.fsf@dhcp-65-162.kendall.corp.akamai.com>
On 31 Dec 2006, jcharth@hotmail.com wrote:
> Hello i have a form that posts to a password protected script. Is there
> a way to enter the username and password and post to a script with LWP?
> I manage to get the form out of a password protected link using the LWP
> username/password feature. but I dont think ill be lucky to post that
> way. thanks
Is the password protection part of the form, or is it a web browser
pop-up? The latter requires a different kind of authentication (basic
HTTP realm authentication, usually) than a form fill-in.
Ted
------------------------------
Date: 2 Jan 2007 13:35:50 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Problems with use locale and regexp
Message-Id: <4vv5dmF1d2dqtU1@mid.dfncis.de>
<felix.ostmann@thewar.de> wrote in comp.lang.perl.misc:
> It is realy strange!
>
> first the code:
> #####################################
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use locale; ## WONT WORK
> use Encode;
>
> my $content = Encode::decode("iso-8859-15","[[lmo:Met\xE0j
> alcal\xEDtt]]\n");
>
> $content =~ s!^\[\[[a-z]{2}:.*\]\]$!!gm; ## WONT WORK
> # $content =~ s!^\[\[[a-z]{2}:.*\]$!!gm; ## WORK
>
> print $content;
> #####################################
>
> This bug? shocked me when i was parsing wikipedia-data.
You don't say what "WONT WORK" actually means. Apparently the regex
match /^\[\[[a-z]{2}:.*\]\]/m never returns with your string and
locale in effect. That certainly is a bug and if it's still in the
newest bleadperl (it still is in v5.9.4 DEVEL28658) it ought to be
reported.
BTW, I assume you are aware that you regex doesn't match (it shouldn't
loop endlessly, though). The matching regex /^\[\[[a-z]{3}:.*\]\]/m
doesn't show the problem.
Anno
------------------------------
Date: 2 Jan 2007 07:16:14 -0800
From: "zowtar" <zowtar@gmail.com>
Subject: Regular Expression
Message-Id: <1167750974.613305.215270@k21g2000cwa.googlegroups.com>
<h1><a href="url" >bla bla bla</a></h1>
<h1><a href="url" >bla bla bla </a></h1>
<h1><a href="url" >bla bla bla <img
src=http://site.com/img.gif></a></h1>
^.*<h1><a[^>]+>(.+)(?:\s)?(?:<img .*>)?</a></h1>.*$
Why the code don't work for give me the "bla bla bla"? sometimes return
"bla bla bla "...
------------------------------
Date: 2 Jan 2007 07:22:47 -0800
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Regular Expression
Message-Id: <1167751367.181905.245290@k21g2000cwa.googlegroups.com>
zowtar wrote:
> <h1><a href="url" >bla bla bla</a></h1>
> <h1><a href="url" >bla bla bla </a></h1>
> <h1><a href="url" >bla bla bla <img
> src=http://site.com/img.gif></a></h1>
>
> ^.*<h1><a[^>]+>(.+)(?:\s)?(?:<img .*>)?</a></h1>.*$
>
> Why the code
There is no code there. There are fragments of HTML, and something
that could conceivably be a regular expression. You have not shown how
you are matching this pattern against this HTML. Please post a SHORT
but COMPLETE program that demonstrates your errors.
> don't work for give me the "bla bla bla"?
I have no idea what this means...
> sometimes return "bla bla bla "...
... but this seems to contradict it.
Please post, at minimum:
1) a short-but-complete script that demonstrates your error
2) sample data
3) desired output
4) actual output.
Have you read the posting guidelines that are posted here twice a week?
Please do so before posting again.
Paul Lalli
------------------------------
Date: Tue, 02 Jan 2007 16:33:13 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Regular Expression
Message-Id: <endu6a$47q$1@nntp.fujitsu-siemens.com>
zowtar wrote:
> <h1><a href=3D"url" >bla bla bla</a></h1>
> <h1><a href=3D"url" >bla bla bla </a></h1>
> <h1><a href=3D"url" >bla bla bla <img
> src=3Dhttp://site.com/img.gif></a></h1>
>=20
> ^.*<h1><a[^>]+>(.+)(?:\s)?(?:<img .*>)?</a></h1>.*$
>=20
> Why the code don't work for give me the "bla bla bla"? sometimes return=
> "bla bla bla "...
>=20
Perl's regexes are greedy, therefore the (.+) will match the blank at=20
the end while the (?:\s)? will happily match the nothing that follows.
Make the (.+) non-greedy: (.+?).
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 2 Jan 2007 09:06:03 -0800
From: "zowtar" <zowtar@gmail.com>
Subject: Re: Regular Expression
Message-Id: <1167757563.015111.120500@i12g2000cwa.googlegroups.com>
I try use non-greedy quantifiers in other case for filter the url...
but don't work...
MATCH:
href="http://site.com/0,,NEWS39104-EI8090,00.html"
href="javascript:abre('http://site.com/0,,NEWS39104-EI8090,00.html','Gallery39104','660','500','no');"
CODE:
href="(?:.*)?((?:ftp|http|https)://(?:[^:/]+)(?::[0-9]{1,5})?(?:/.*)?.+)"
return
OK - http://site.com/0,,NEWS39104-EI8090,00.html
ERROR -
http://site.com/0,,NEWS39104-EI8090,00.html','Gallery39104','660','500','no');
href="(?:.*)?((?:ftp|http|https)://(?:[^:/]+)(?::[0-9]{1,5})?(?:/.*)?.+?)(?:\',\'.*\',\'.*\',\'.*\',\'.*\'\);)?"
return
ERROR - None
------------------------------
Date: Tue, 02 Jan 2007 18:37:07 +0100
From: Kleine Aap <een-niet-bestaande-kleineaap@xs4all.nl>
Subject: Re: Why would I use Perl in place of C/C++?
Message-Id: <459a9836$0$29676$e4fe514c@dreader13.news.xs4all.nl>
blazar wrote:
>> Kleine Aap wrote:
>>
>> results in a 1 for the multiplication (x) operator. Next time it occurs
>
> "repetition"
Whoops... Indeed! :-)
------------------------------
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 10110
****************************************