[30034] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1277 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 14 03:09:42 2008

Date: Thu, 14 Feb 2008 00:09:06 -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           Thu, 14 Feb 2008     Volume: 11 Number: 1277

Today's topics:
    Re: A Gtk2 IRC Chat Client <deadpickle@gmail.com>
    Re: Fast checksums? <g_adams27@hotmail.SPAMBGONE.com>
    Re: Fast checksums? <usenet@davidfilmer.com>
    Re: Fast checksums? <ben@morrow.me.uk>
    Re: Fast checksums? <john@castleamber.com>
    Re: Fast checksums? <ced@blv-sam-01.ca.boeing.com>
    Re: Help: Display the specific line in a file <tadmc@seesig.invalid>
        new CPAN modules on Thu Feb 14 2008 (Randal Schwartz)
        Newbie question <mbmsv@yahoo.com>
    Re: Newbie question <noreply@gunnar.cc>
    Re: Newbie question <mbmsv@yahoo.com>
    Re: Newbie question <jurgenex@hotmail.com>
    Re: Regex /(X*)/ ulrich_martin@seznam.cz
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 13 Feb 2008 20:43:10 -0800 (PST)
From: deadpickle <deadpickle@gmail.com>
Subject: Re: A Gtk2 IRC Chat Client
Message-Id: <69bd8fc0-67b1-4efb-bfbb-6a5d712fb2b4@z17g2000hsg.googlegroups.com>

On Feb 12, 10:06 am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth deadpickle <deadpic...@gmail.com>:
>
> > I noticed a few things:
> > I tested the program using mIRC. I logged into the channel with the
> > client and under another name with mIRC. Logging in works fine, I can
> > see the clients nickname in the channel. What the problem seems to be
> > is when the MOTD is displayed. It seems that only a few lines of the
> > MOTD are displayed before the 'in' condition is stopped and the
> > message stops displaying in the terminal window. When I type in mIRC,
> > a line of the MOTD is displayed in terminal window. The $input
> > variable seems to be behind the real-time sending of the messages. I'm
> > not sure how to remove this lag and I'm looking for ideas.
>
> You are reading the filehandle in buffered mode, which is not compatible
> with select (which is used by Glib::IO->add_watch). Either switch to
> sysread, or push a :unix layer to switch to unbuffered mode.
>
> Ben

Yep your both right. Adding sysread corrected the problem and now I
have another question. I am trying to complete the IRC Client with
giving the user the ability to disconnect and reconnect to the IRC
server. The problem I am encountering is that when the user
disconnects the Glib::IO tries to read from the closed socket. I tried
to undefine the Glib::IO but that hasent work.

#!/usr/local/bin/perl -w

use strict;
use Gtk2 '-init';
use Glib qw/TRUE FALSE/;
use IO::Socket;

#-------------------Global Variables-------------------
my $chat_state = 'Connect';
my $sock;
my $channel;
my $nick;
my $irc;
my $chat_entry;
my $chat_send_sig;
my $chat_textview;
my $chat_button;
my $watch;

#############################################
#specials that will be input by the efault file
$channel = '#GRRUVI';
$nick = 'Lahowetz';
$irc = 'irc.freenode.net';
my $login = $nick;

#############################################

#-------------------Main Loop-------------------
&chat_build;

Gtk2->main;

#-------------------chat Build-------------------
sub chat_build {
    my $chat_window = Gtk2::Window->new('toplevel');
    $chat_window->set_title('Chat Client');
    $chat_window->set_position('center');
    $chat_window->set_default_size( 300, 200 );
    $chat_window->signal_connect(delete_event=> sub{exit});

    my $chat_scroll = Gtk2::ScrolledWindow->new;
    $chat_textview = Gtk2::TextView->new;
    $chat_entry = Gtk2::Entry->new;
    my $chat_vbox = Gtk2::VBox->new;

    my $chat_buffer = $chat_textview->get_buffer;
    $chat_buffer->create_mark( 'end', $chat_buffer->get_end_iter,
FALSE );
    $chat_buffer->signal_connect(insert_text => sub {
        $chat_textview->scroll_to_mark( $chat_buffer->get_mark('end'),
0.0, TRUE, 0, 0.5 );
    });
    $chat_button = Gtk2::Button->new;
    $chat_button->set_label($chat_state);

    $chat_scroll->add($chat_textview);
    $chat_vbox->add($chat_scroll);
    $chat_vbox->pack_start( $chat_entry, FALSE, FALSE, 0 );
    $chat_vbox->pack_start( $chat_button, FALSE, FALSE, 0 );
    $chat_window->add($chat_vbox);

    # allows for sending each line with an enter keypress
    $chat_send_sig = $chat_entry->signal_connect ('key-press-event' =>
sub {
        my ($widget,$event)= @_;
        if( $event->keyval() == 65293){  # a return key press
                my $text = $chat_entry->get_text;
                if(defined $sock){ print $sock "PRIVMSG $channel :$text
\r\n";}
                $chat_entry->set_text('');
                $chat_entry->set_position(0);
                post($nick, $text);
        }
    });

    $chat_entry->signal_handler_block($chat_send_sig); #not connected
yet
    $chat_entry->set_editable(0);
    $chat_textview->set_editable(0);
    $chat_textview->set_cursor_visible(0);

    $chat_window->show_all;

    $chat_button->signal_connect("clicked" => sub {
        if ($chat_state eq 'Connect') {
            $chat_button->set_label('Disconnect');
            $chat_state='Disconnect';
            connecting();
        }
        else {
            $chat_button->set_label('Connect');
            $chat_state='Connect';
            close $sock;
            undef $watch;
        }
    });

    return;
}

#-------------------Connect to IRC Server-------------------
sub connecting {
    # Connect to the IRC server.
    $sock = new IO::Socket::INET(
        PeerAddr => $irc,
        PeerPort => 6667,
        Proto => 'tcp',
    ) or die "Can't connect\n";

    if (defined $sock){
        my $sys_msg = "Connected to $irc ...";
        post($nick, $sys_msg);
    }

    # Log on to the server.
    print $sock "NICK $nick\r\n";
    print $sock "USER $login 8 * :Just a Tester\r\n";

    # Read lines from the server until it tells us we have connected.
    while (my $input = <$sock>) {
        # Check the numerical responses from the server.
        if ($input =~ /004/) {
            # We are now logged in.
            my $sys_msg = "Logged in to $irc ...";
            post($nick, $sys_msg);
            print $sock "JOIN $channel\r\n";
            $watch = Glib::IO->add_watch( fileno $sock, [qw/in hup
err/], \&incoming_data, $sock );
            $chat_entry->set_editable(1);
            $chat_entry->grab_focus;
            $chat_entry->signal_handler_unblock ($chat_send_sig);
            last;
        }
        elsif ($input =~ /433/) {
            my $sys_msg = "Nickname is already in use";
            post($nick, $sys_msg);
            $chat_state = 'Connect';
            $chat_button->set_label($chat_state);
            $chat_entry->signal_handler_block($chat_send_sig);
            close $sock;
            last;
        }
    }

    Gtk2->main_iteration while Gtk2->events_pending;
}

#-------------------Watch for IRC Inputs-------------------
sub incoming_data {
    my ( $fd, $condition, $fh ) = @_;

    if ( $condition eq 'in' ) {
    my $input;
        sysread $fh, $input, 1000000;
        chop $input;

        if ($input =~ /^PING(.*)$/i) {
            # We must respond to PINGs to avoid being disconnected.
            print $sock "PONG $1\r\n";
        }
        if ($input =~ m/PRIVMSG\s($channel)/) {
            print "$input\n";
            my @sender = split(/!/, $input);
            my @message = split(/:/, $input);
            my $length = length($sender[0]);
            my $who = substr($sender[0], 1, $length);
            post($who, $message[2]);
        }
        if ($input =~ m/QUIT/) {
            print "$input\n";
            my @sender = split(/!/, $input);
            my $length = length($sender[0]);
            my $who = substr($sender[0], 1, $length);
            my $sys_msg = "$who has QUIT!";
            post($who, $sys_msg);
        }
        if ($input =~ m/JOIN/) {
            print "$input\n";
            my @sender = split(/!/, $input);
            my $length = length($sender[0]);
            my $who = substr($sender[0], 1, $length);
            my $sys_msg = "$who has JOINED $channel!";
            post($who, $sys_msg);
        }
        else {
            # Print the raw line received by the bot.
            print "$input\n";
        }
    }
    return TRUE;
}

#-------------------Post messages in the Window-------------------
sub post{
    my ($name, $msg) = @_;

    my $chat_buffer = $chat_textview->get_buffer;
    $chat_buffer->insert( $chat_buffer->get_end_iter, "$name: $msg
\n" );
}


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

Date: Wed, 13 Feb 2008 21:18:15 -0500
From: George Adams <g_adams27@hotmail.SPAMBGONE.com>
Subject: Re: Fast checksums?
Message-Id: <fp08db02tnc@enews2.newsguy.com>

Thank you all for the replies.  Let me explain more why I originally 
decided against relying on ctime/mtime (this program will mainly be 
mainly run in a Windows environment)

1) First, I decided to use mtime, which worked fine... until I 
discovered that for some reason, certain Windows files didn't HAVE a 
mtime.  In Windows file properties, they were listed as "September 10, 
1956, 6:13:51 AM".  In Perl, the mtime was -1.

2) Still, I figured I could still use mtime, and just assume that if it 
was greater than ctime (which always exists under Windows, even if mtime 
does not), then the mtime was usable.  If it was -1, I would just use 
the ctime as the baseline instead.

3) The final blow, however, was the discovery that Windows apparently 
sets a new mtime for a file *even when no changes have taken place*  . 
I discovered this when trying to backup some MP3s.  After some research, 
I discovered that when certain media programs load an MP3 file, they 
will go out to retrieve additional info about that file (perhaps storing 
the info they find in the ID3 tags?).  Even if no changes are ultimately 
made to the file, the mtime is still changed, fooling my Perl script 
into thinking it needs backing up.  And that's just for MP3s.

So finally I decided to give up on ctime/mtime and work with something I 
was sure would be accurate - hashing.  But now I've hit this stumbling 
block.

Anyway, that's why I was hoping to find a hashing shortcut.  This is a 
fairly fault-tolerant program - if files are occassionally tagged 
false-positive, then the worst that happens is that it is backed up even 
when it wasn't needed.  So I don't necessarily need SHA-512 or anything. 
  But still, even the humble CRC32 is awfully slow for really large files...

Again, thanks for the help - any other suggestions are welcomed!


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

Date: Wed, 13 Feb 2008 18:29:36 -0800
From: David Filmer <usenet@davidfilmer.com>
Subject: Re: Fast checksums?
Message-Id: <KeOdnZVkXf7POi7a4p2dnAA@giganews.com>

George Adams wrote:
> Obviously backup software makers have solved this problem to 
 > make incremental backups pretty fast - what's the trick to it?

Indeed.  The rsync program, for example, is able to determine which 
files have changed.  It's really fast and really smart (it is able to 
syncronize changed files by only transmitting the delta, not the whole 
file).  I don't know how it works, but you could possibly use rsync (in 
dry-run mode) to make the determination of which files have changed.  Or 
you could just use rsync do do the whole backup and forget about trying 
to code it yourself.


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

Date: Thu, 14 Feb 2008 03:14:11 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Fast checksums?
Message-Id: <39oc85-9pf2.ln1@osiris.mauzo.dyndns.org>


Quoth George Adams <g_adams27@hotmail.SPAMBGONE.com>:
> Thank you all for the replies.  Let me explain more why I originally 
> decided against relying on ctime/mtime (this program will mainly be 
> mainly run in a Windows environment)
> 
> 1) First, I decided to use mtime, which worked fine... until I 
> discovered that for some reason, certain Windows files didn't HAVE a 
> mtime.  In Windows file properties, they were listed as "September 10, 
> 1956, 6:13:51 AM".  In Perl, the mtime was -1.

Weird... I've never seen that... Was this FAT or NTFS, and were the
files created under Win9x or NT?

> 2) Still, I figured I could still use mtime, and just assume that if it 
> was greater than ctime (which always exists under Windows, even if mtime 
> does not), then the mtime was usable.  If it was -1, I would just use 
> the ctime as the baseline instead.

The ctime slot under Win32 holds the file create time, and Windows does
some weird things with the create time. In particular, if you copy a
file in Explorer the new file has a new ctime but the old mtime, so
ctime > mtime is not uncommon. It makes some sense, I guess: the file's
contents are 'older' than the file itself, since they used to be
somewhere else.

> 3) The final blow, however, was the discovery that Windows apparently 
> sets a new mtime for a file *even when no changes have taken place*  . 

This is a very common occurrence. Lots of programs stupidly update a
file when they didn't need to. One way out (presumably) is to make such
files read-only: in the case of an MP3 collection, I'd want to make all
files and directories involved read-only anyway, to avoid accidentally
deleting them.

> Anyway, that's why I was hoping to find a hashing shortcut.  This is a 
> fairly fault-tolerant program - if files are occassionally tagged 
> false-positive, then the worst that happens is that it is backed up even 
> when it wasn't needed.  So I don't necessarily need SHA-512 or anything. 
>   But still, even the humble CRC32 is awfully slow for really large files...

One (slightly evil) suggestion would be to use the archive flag, and
write a daemon that sits in the background (hah!) and uses
Win32::ChangeNotify or some such to watch for files that have been
changed, recalculate the hash, and fix up the flag if needed. It's still
doing the same work (well, more, actually) but if it's done in the
background it might not be so noticeable. Of course, you'd then have
lots of fun sychronisation issues... (your backup program needs to know
that all the files are in a valid state, and the daemon isn't playing
with any of them, while it works) :).

Ben



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

Date: 14 Feb 2008 03:39:21 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Fast checksums?
Message-Id: <Xns9A43DC4AE10F6castleamber@130.133.1.4>

David Filmer <usenet@davidfilmer.com> wrote:

> George Adams wrote:
>> Obviously backup software makers have solved this problem to 
> > make incremental backups pretty fast - what's the trick to it?
> 
> Indeed.  The rsync program, for example, is able to determine which 
> files have changed.  It's really fast and really smart (it is able to 
> syncronize changed files by only transmitting the delta, not the whole 
> file).  I don't know how it works,

Me neither, but 
http://en.wikipedia.org/wiki/Rsync

has some information on the check sum method used, and has also a
link to the algorithm: http://rsync.samba.org/tech_report/node2.html

-- 
John

Arachnids near Coyolillo - part 1
http://johnbokma.com/mexit/2006/05/04/arachnids-coyolillo-1.html


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

Date: Wed, 13 Feb 2008 20:26:49 -0800 (PST)
From: "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: Fast checksums?
Message-Id: <2ae7ec7b-6314-4a96-9b35-f70725b907ca@v67g2000hse.googlegroups.com>

On Feb 13, 3:54 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> "comp.llang.perl.moderated" <c...@blv-sam-01.ca.boeing.com> wrote innews:a7d0b237-4a83-4c86-8f84-5d1cb09cbccd@e10g2000prf.googlegroups.com:
>
>
>
> > On Feb 13, 2:25 pm, George Adams <g_adam...@hotmail.SPAMBGONE.com>
> > wrote:
> >> Hi, all.  I'm trying to make a simple backup program for myself that
> >> will check to see if certain files have been modifed before backing
> >> them up.  (It's got to be portable to multiple OSes that have Perl,
> >> but possibly not other handy tools like, say, rsync or some such).
>
> >> Anyway, I had originally planned to use the Windows archive bit, or
> >> else file modification dates to determine if a file had been changed.
> >>  That turned out to be unreliable, though (and, in the case of the
> >> archive bit, impossible on Linux).  So I decided instead to create a
> >> checksum of the original file, then compare future versions of the
> >> file with the stored checksum to see if it's changed (and hence needs
> >> to be backed up).
>
> >> This works... except it's really, really slow.  I started with SHA-1,
> >> but it was taking just too long.  I switched to MD5 and then CRC32,
> >> but even that was fairly slow.  And when the backup directory
> >> contains several gigs of files to check, it was just too much.
>
> >> So, given the problem of "how can I tell if a file has been changed",
> >> am I tackling it the wrong way?  Should I be using some other method
> >> besides simply hashing an entire file (using whatever algorithm) and
> >> comparing it to a stored value?  Obviously backup software makers
> >> have solved this problem to make incremental backups pretty fast -
> >> what's the trick to it?
>
> > Maybe timestamp as well as file size with a
> > fallback to SHA-1 or MD5 only if time/size are
> > unchanged.
>
> That is not going to save work.
>
> If either file size or time stamp has changed, then the checksum needs
> to be recomputed (so that it can be checked the next time).
>
> If neither has changed, the checksum needs to be recomputed just to be
> sure.
>
> That is, the checksum needs to be recomputed for all the files on each
> run.
>

True, to be really thorough, you'd need to checksum each time. From
the original problem description, I guessed that mtimes were not
being
updated so backup's were being missed and a size check would usually
catch the update even if the mtime was unchanged -- particularly with
checksumming as a last resort. Of course, the size check might still
help, if as the OP mentions, Win32 spuriously updates mtime when there
wasn't any change.

However, the problem under Win32 with a non-existent mtime for some
files or a ctime more current than mtime for others certainly makes
the problem more complicated than that :)


--
Charles DeRykus


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

Date: Wed, 13 Feb 2008 20:25:46 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Help: Display the specific line in a file
Message-Id: <slrnfr79la.gq9.tadmc@tadmc30.sbcglobal.net>

Amy Lee <openlinuxsource@gmail.com> wrote:

> I wanna show the cpuinfo file and just two
> items "vendor_id" and "model name". 


> Could you give me some tips?


    perl -ne 'print if /^(vendor_id|model name)/' /proc/cpuinfo 


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


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

Date: Thu, 14 Feb 2008 05:42:21 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Feb 14 2008
Message-Id: <Jw7ruL.1s9x@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.

AI-MaxEntropy-0.10
http://search.cpan.org/~laye/AI-MaxEntropy-0.10/
Perl extension for learning Maximum Entropy Models 
----
ASNMTAP-3.000016
http://search.cpan.org/~asnmtap/ASNMTAP-3.000016/
----
Bundle-MARCEL-0.06
http://search.cpan.org/~marcel/Bundle-MARCEL-0.06/
install (nearly) all modules by MARCEL 
----
Bundle-Music-Tag-0.02
http://search.cpan.org/~ealleniii/Bundle-Music-Tag-0.02/
Music::Tag bundle for quick installation 
----
CGI-FormBuilderX-More-0.020
http://search.cpan.org/~rkrimen/CGI-FormBuilderX-More-0.020/
Additional input gathering/interrogating functionality for CGI::FormBuilder 
----
CORBA-XMLSchemas-2.62
http://search.cpan.org/~perrad/CORBA-XMLSchemas-2.62/
----
Catalyst-Plugin-CookiedSession-0.31
http://search.cpan.org/~lbrocard/Catalyst-Plugin-CookiedSession-0.31/
Store sessions in a browser cookie 
----
Catalyst-Plugin-SimpleAuth-0.31
http://search.cpan.org/~lbrocard/Catalyst-Plugin-SimpleAuth-0.31/
Simple authentication for Catalyst 
----
Class-Accessor-Complex-0.13
http://search.cpan.org/~marcel/Class-Accessor-Complex-0.13/
arrays, hashes, booleans, integers, sets and more 
----
Coro-4.4
http://search.cpan.org/~mlehmann/Coro-4.4/
coroutine process abstraction 
----
Crypt-OpenSSL-CA-0.15
http://search.cpan.org/~domq/Crypt-OpenSSL-CA-0.15/
The crypto parts of an X509v3 Certification Authority 
----
Data-Conveyor-0.02
http://search.cpan.org/~marcel/Data-Conveyor-0.02/
stage-based conveyor-belt-like ticket handling system 
----
Date-Extract-0.02
http://search.cpan.org/~sartak/Date-Extract-0.02/
extract probable dates from strings 
----
Dist-Joseki-0.12
http://search.cpan.org/~marcel/Dist-Joseki-0.12/
tools for the prolific module author 
----
Dist-Joseki-0.13
http://search.cpan.org/~marcel/Dist-Joseki-0.13/
tools for the prolific module author 
----
Egg-Release-3.00
http://search.cpan.org/~lushe/Egg-Release-3.00/
Version of Egg WEB Application Framework. 
----
Egg-Release-DBI-0.01
http://search.cpan.org/~lushe/Egg-Release-DBI-0.01/
Package kit of model DBI. 
----
Fey-0.04
http://search.cpan.org/~drolsky/Fey-0.04/
Better SQL Generation Through Perl 
----
File-MimeInfo-0.15
http://search.cpan.org/~pardus/File-MimeInfo-0.15/
Determine file type 
----
Finance-Bank-HDFC-v0.13.0
http://search.cpan.org/~rohan/Finance-Bank-HDFC-v0.13.0/
Interface to the HDFC netbanking service 
----
Forest-0.01
http://search.cpan.org/~stevan/Forest-0.01/
A collection of n-ary tree related modules 
----
HTML-Entities-ConvertPictogramMobileJp-0.06
http://search.cpan.org/~tokuhirom/HTML-Entities-ConvertPictogramMobileJp-0.06/
convert pictogram entities 
----
HTML-FillInForm-Lite-0.032
http://search.cpan.org/~gfuji/HTML-FillInForm-Lite-0.032/
Fills in HTML forms with data 
----
JSON-Any-1.16
http://search.cpan.org/~perigrin/JSON-Any-1.16/
Wrapper Class for the various JSON classes. 
----
JSON-XS-VersionOneAndTwo-0.31
http://search.cpan.org/~lbrocard/JSON-XS-VersionOneAndTwo-0.31/
Support versions 1 and 2 of JSON::XS 
----
LWP-UserAgent-Keychain-0.01
http://search.cpan.org/~miyagawa/LWP-UserAgent-Keychain-0.01/
UserAgent that looks up passwords on Mac OS X keychain 
----
LaTeX-Pod-0.16
http://search.cpan.org/~schubiger/LaTeX-Pod-0.16/
Transform LaTeX source files to POD (Plain old documentation) 
----
Lingua-Translit-0.01
http://search.cpan.org/~alinke/Lingua-Translit-0.01/
transliterates text between writing systems 
----
Log-Log4perl-1.15
http://search.cpan.org/~mschilli/Log-Log4perl-1.15/
Log4j implementation for Perl 
----
MOBY-Client-1.0
http://search.cpan.org/~ekawas/MOBY-Client-1.0/
----
Mail-Builder-1.05
http://search.cpan.org/~maros/Mail-Builder-1.05/
Easily create e-mails with attachments, html and inline images 
----
Module-Depends-0.14
http://search.cpan.org/~rclamp/Module-Depends-0.14/
identify the dependencies of a distribution 
----
Number-Phone-NO-0.09
http://search.cpan.org/~andremar/Number-Phone-NO-0.09/
Norwegian subclass of Number::Phone 
----
POE-Component-IRC-Plugin-Google-PageRank-0.01
http://search.cpan.org/~zoffix/POE-Component-IRC-Plugin-Google-PageRank-0.01/
non-blocking access to Google's PageRank via IRC 
----
POE-Component-Server-SimpleHTTP-1.42
http://search.cpan.org/~bingos/POE-Component-Server-SimpleHTTP-1.42/
Perl extension to serve HTTP requests in POE. 
----
POEIKCdaemon-0.00_08
http://search.cpan.org/~suzuki/POEIKCdaemon-0.00_08/
POE IKC daemon 
----
SOAP-Lite-0.70_05
http://search.cpan.org/~mkutter/SOAP-Lite-0.70_05/
Perl's Web Services Toolkit 
----
SVN-Class-0.07
http://search.cpan.org/~karman/SVN-Class-0.07/
manipulate Subversion workspaces with Perl objects 
----
String-Clean-0.022
http://search.cpan.org/~notbenh/String-Clean-0.022/
use data objects to clean strings 
----
Template-Plugin-CPAN-Packages-0.03
http://search.cpan.org/~marcel/Template-Plugin-CPAN-Packages-0.03/
Template plugin to help generate CPAN bundles 
----
Test-Fixture-DBIC-Schema-0.01
http://search.cpan.org/~tokuhirom/Test-Fixture-DBIC-Schema-0.01/
load fixture data to storage. 
----
ThreatNet-DATN2004-0.02
http://search.cpan.org/~adamk/ThreatNet-DATN2004-0.02/
Proposal: The Decentralised Active Threat Network 
----
Tk-TextHighlight-1.0.4
http://search.cpan.org/~turnerjw/Tk-TextHighlight-1.0.4/
a TextUndo widget with syntax highlighting capabilities. 
----
Tree-Simple-View-0.17
http://search.cpan.org/~stevan/Tree-Simple-View-0.17/
A set of classes for viewing Tree::Simple hierarchies 
----
WWW-RapidShare-v0.1.0
http://search.cpan.org/~rohan/WWW-RapidShare-v0.1.0/
Download files from Rapidshare 
----
WikiText-0.06
http://search.cpan.org/~ingy/WikiText-0.06/
Wiki Text Conversion Tools 
----
WikiText-Socialtext-0.05
http://search.cpan.org/~ingy/WikiText-Socialtext-0.05/
Socialtext WikiText Module 
----
Win32-EnvProcess-0.01
http://search.cpan.org/~clive/Win32-EnvProcess-0.01/
Perl extension to set or get environment variables from other processes 
----
Win32-GUI-1.06
http://search.cpan.org/~robertmay/Win32-GUI-1.06/
Perl Win32 Graphical User Interface Extension 
----
Win32-MSI-HighLevel-1.0002
http://search.cpan.org/~grandpa/Win32-MSI-HighLevel-1.0002/
Perl wrapper for Windows Installer API 
----
sofu-0.2.8
http://search.cpan.org/~maluku/sofu-0.2.8/
----
sofu-0.2.8.1
http://search.cpan.org/~maluku/sofu-0.2.8.1/
----
sofu-config-0.4
http://search.cpan.org/~maluku/sofu-config-0.4/


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: Wed, 13 Feb 2008 23:00:51 -0500
From: "MM" <mbmsv@yahoo.com>
Subject: Newbie question
Message-Id: <61hspqF1ui8gvU1@mid.individual.net>

Hi all,

I am trying to write a perl script to do some simple modifications to a text 
file. Amongst other things it has to delete a few lines. Here is a relevant 
part of my script:

LINE: while ($line = <OF>) {
    if ((/END_ADDRESS_SPACE/) && ($count2 < 3)) {
      $count2 += 1;
      $line = <OF>;
      do {
        $line = <OF>;
      } until ($line == /ADDRESS_SPACE/);
      next LINE;
    }
    print NF $line;
}

The lines that I am trying to skip contain forward slashes and that seems to 
confuse the match in the until statement...

    END_ADDRESS_SPACE;

    ///////////////////////////////////////////////////////////////////////////////
    //
    // Processor 'ppc405_0' address space 
'plb_bram_if_cntlr_1_bram_combined' 0xFFFE8000:0xFFFEFFFF (32 KB).
    //
    ///////////////////////////////////////////////////////////////////////////////

    ADDRESS_SPACE plb_bram_if_cntlr_1_bram_combined RAMB16 
[0xFFFE8000:0xFFFEFFFF]



Thanks,
/Mikhail 




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

Date: Thu, 14 Feb 2008 05:20:42 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Newbie question
Message-Id: <61htt5F1uncgjU1@mid.individual.net>

MM wrote:
> I am trying to write a perl script to do some simple modifications to a text 
> file. Amongst other things it has to delete a few lines. Here is a relevant 
> part of my script:
> 
> LINE: while ($line = <OF>) {
>     if ((/END_ADDRESS_SPACE/) && ($count2 < 3)) {

     if (($line =~ /END_ADDRESS_SPACE/) && ($count2 < 3)) {
---------^^^^^^^^

>       $count2 += 1;
>       $line = <OF>;
>       do {
>         $line = <OF>;
>       } until ($line == /ADDRESS_SPACE/);

     } until ($line =~ /ADDRESS_SPACE/);
--------------------^

>       next LINE;
>     }
>     print NF $line;
> }
> 
> The lines that I am trying to skip contain forward slashes and that seems to 
> confuse the match in the until statement...

What makes you think that would have anything to do with it?

You should enable strictures and warnings, which will help you detect 
many types of errors.

     use strict;
     use warnings;

I marked a couple of obvious things above.

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


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

Date: Thu, 14 Feb 2008 00:14:43 -0500
From: "MM" <mbmsv@yahoo.com>
Subject: Re: Newbie question
Message-Id: <61i14bF1v4lucU1@mid.individual.net>

"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message 
news:61htt5F1uncgjU1@mid.individual.net...
>
> I marked a couple of obvious things above.

Thanks a lot. It works as expected now.

/Mikhail




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

Date: Thu, 14 Feb 2008 05:17:18 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Newbie question
Message-Id: <5dj7r391gcjj6h7ojirlgi15u6vmk0mrnn@4ax.com>

"MM" <mbmsv@yahoo.com> wrote:
>      } until ($line == /ADDRESS_SPACE/);

Are you absolutely certain that you want to compare the numerical(!) value
of $line with the logical return value of the pattern match against $_ ?
That seems wrong to me.

jue


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

Date: Wed, 13 Feb 2008 23:18:55 -0800 (PST)
From: ulrich_martin@seznam.cz
Subject: Re: Regex /(X*)/
Message-Id: <bbd317ed-195c-4fc4-b1bc-56deffc17310@n19g2000hsd.googlegroups.com>

On Feb 13, 11:59 pm, Abigail <abig...@abigail.be> wrote:
>                                                            _
> ulrich_mar...@seznam.cz (ulrich_mar...@seznam.cz) wrote on VCCLXXIX
> September MCMXCIII in <URL:news:d33c34f4-2e9a-4760-97f1-ff2637e82d4c@v46g2000hsv.googlegroups.com>:
> $$  Hello,
> $$
> $$  I would like to ask you for help. Could anybody explain me, why regex
> $$  "/(X*)/" is not able to catch X in string "aXXXb". Quantifier "*" in
> $$  this regex is a greedy one and there is not anchor "^", so I would
> $$  expect, that $1 would contain XXX. I know (I have read it), that it is
> $$  possible to use + instead of *, but I would like to know, why the "*"
> $$  quantifier doesn't catch it.
>
> Because if a regexp can match in more than one way in the subject string,
> it will match at the left most position.
>
> /(X*)/ matches 0 or more X's. "aXXXb" starts with zero X's. So it matches
> at the beginning of the string. With 0 X's.
>
> $$  I have found this example in perlretut:
> $$  Finally,
> $$  "aXXXb" =~ /(X*)/; # matches with $1 = ''
> $$  because it can match zero copies of 'X' at the beginning of
> $$  the string.  If you definitely want to match at least one
> $$  'X', use "X+", not "X*".
>
> Right.
>
> Abigail
> --
> use   lib sub {($\) = split /\./ => pop; print $"};
> eval "use Just" || eval "use another" || eval "use Perl" || eval "use Hacker";

Thank you very much for perfects explanations to all of you.


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

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


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