[28648] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 10012 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 28 03:05:59 2006

Date: Tue, 28 Nov 2006 00:05: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           Tue, 28 Nov 2006     Volume: 10 Number: 10012

Today's topics:
        are wombats good? wombat@fancier.net
    Re: Expression problem <tadmc@augustmail.com>
    Re: Help improving IO::Socket script response xhoster@gmail.com
    Re: Help improving IO::Socket script response <glex_no-spam@qwest-spam-no.invalid>
    Re: Interactive programs & Teeing <tbmoore9@verizon.net>
    Re: Interactive programs & Teeing (reading news)
    Re: Interactive programs & Teeing conrado.blasco@gmail.com
        interested in wombats wombat@fancier.net
    Re: modPerl, Apache, and REMOTE_USER <trwww@sbcglobal.net>
        Multi Line Match and Regex <bradbrockman@yahoo.com>
    Re: Multi Line Match and Regex <john@castleamber.com>
        new CPAN modules on Tue Nov 28 2006 (Randal Schwartz)
        run a perl program using actviveperl quakewang@mail.whut.edu.cn
    Re: run a perl program using actviveperl <john@castleamber.com>
        Simple regex question <b@bcc.com>
    Re: Simple regex question <noreply@gunnar.cc>
    Re: Simple regex question <john@castleamber.com>
    Re: Simple regex question <zzzhc.starfire@gmail.com>
        Validation with XSD using XML::LibXML::Schema, and XML: huntingseasonson@gmail.com
        where are wombats? wombat@fancier.net
    Re: Windows CE, Windows Mobile <noreply@invalid.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 28 Nov 2006 03:16:15 GMT
From: wombat@fancier.net
Subject: are wombats good?
Message-Id: <m06102804105345@4ax.com>

I'm not really sure whether Wombats are any good.

The picture on Wikipedia looks like a horrid little Pig.

Quite Obscene.

Just not English.

436


-- 
Posted via a free Usenet account from http://www.teranews.com



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

Date: Mon, 27 Nov 2006 18:35:31 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Expression problem
Message-Id: <slrnemn12j.tm1.tadmc@tadmc30.august.net>

Christian Winter <thepoet_nospam@arcor.de> wrote:

> So the first piece of code could be cut down to
> if( $details[$i] =~ /\bworkstation\sname:\s([0-9A-Za-z_\-]+)/i )
> {
> 	$hostName[$i] = $1;
> }
>
> There's still room for improvement, like 


adding an //x modifier, particularly if you are "not very good" 
at grokking regexes:

   if ( $details[$i] =~ /\bworkstation
                         \s
                         name:
                         \s
                         (
                             [0-9A-Za-z_-]+
                         )
                        /ix 
      )


> e.g. removing A-Z from
> the character class, as you are giving the /i modifier anyway,
> so both upper and lowercase characters will be matched.


and removing the backslash. Hyphen is not meta in a character
class if it is first or last in the class.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 27 Nov 2006 23:28:20 GMT
From: xhoster@gmail.com
Subject: Re: Help improving IO::Socket script response
Message-Id: <20061127182945.756$hY@newsreader.com>

Marc Bissonnette <dragnet\_@_/internalysis.com> wrote:
> Hi all;
>
> I'm not sure where/what I've gone wrong here; The purpose of the code
> below is to get the server type (Apache/IIS/etc) from a list of URLs.
> In the SQL query (whose results are used in the IO::Socket call), the
> data from 'cname' will be a string, like "Foo Internet", the data from
> 'mainurl' will be a url like "www.foo.com"
>
> The problem lies in massive time-outs (I don't know what the longest
> is/can be: I've killed the process after ten minutes, however);

If you had time-outs, you wouldn't have to kill the process, it would
kill itself (or the connection).  It seems to me the problem is that you
*don't* have timeouts, rather you have long periods of blocking.  But
where is the blocking taking place, upon connecting the socket or upon
reading from it?

> The only
> sanity-saving option so far is to run it in batches of ten URLs, but I've
> got a list of ~400 to go through.

If the long blocking is in the reads, see IO::Select.
Or just use LWP::Parallel and let it handle all of that stuff.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Mon, 27 Nov 2006 17:30:34 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Help improving IO::Socket script response
Message-Id: <456b756a$0$503$815e3792@news.qwest.net>

Marc Bissonnette wrote:
> Hi all;
> 
> I'm not sure where/what I've gone wrong here; The purpose of the code 
> below is to get the server type (Apache/IIS/etc) from a list of URLs.
> In the SQL query (whose results are used in the IO::Socket call), the 
> data from 'cname' will be a string, like "Foo Internet", the data from 
> 'mainurl' will be a url like "www.foo.com"
> 
> The problem lies in massive time-outs (I don't know what the longest 
> is/can be: I've killed the process after ten minutes, however); The only 
> sanity-saving option so far is to run it in batches of ten URLs, but I've 
> got a list of ~400 to go through.
> 
> I've googled for somehow using a timeout with IO::Socket, but all the 
> responses seem to be that timeout is deprecated and only applies to the 
> handshake, not the listen/read. I'd be *really* happy if I could simply 
> get this to work with giving each url 5 seconds to respond with the first 
> 8 lines to get the Server: header. 
> 
> I've trimmed my code to get rid of all the HTML output for legibility's 
> sake; The reason for this little script is merely curiosity; A thread in 
> can.internet.highspeed was asking what OS the majority of ISPs in Canada 
> are running, so I thought I'd take a crack at it. 
> 
> Many thanks for any provided insights or suggested reading! (I've gone 
> over the CPAN entries for IO::Socket and IO::Socket::INET several times, 
> but don't seem to be absorbing what it is that's causeing the timeouts)
> 
> #!/usr/bin/perl
> use CGI;
> use IO::Socket;
> use URI::Escape;
> use CGI::Carp qw(fatalsToBrowser);
> use DBI;
> use strict;
> 
> my $row;
> my $keys;
> my $key;
> my $sock;
> my %hosts;
> my $hosts;
> my $host;
> my $dbname;
> my $dbuser;
> my $dbpass;
> my @row;
> my $foo;
> my $line;
> my $count;
> my $found;

Define them in the smallest scope.

> Define();
init(); ???

> 
> my $query="SELECT `cname`,`mainurl` FROM `ispdata` WHERE `mainurl` IS NOT 
> NULL  AND `mainurl` != \"http://\" AND `approved` = 1 ORDER BY `cname`";

No need for all that extra noise.

my $query = qq{
	select cname, mainurl
	from ispdata
	where mainurl is not NULL and
		mainurl != "http://" and
		approved = 1
	order by cname
	};
> my $dbh;
> my $sth;
> $dbh = DBI->connect("DBI:mysql:$dbname", $dbuser, $dbpass,{PrintError => 
> 1, RaiseError => 1});
> $sth=$dbh->prepare($query);
> $sth->execute();
> while (@row=$sth->fetchrow()) {
> 	$row[0]=uri_unescape($row[0]);
> 	$row[1]=uri_unescape($row[1]);

Set these to something that makes sense.... $cname and $mainurl???

> 	$foo='http://';
> 	$row[1]=~ s/$foo//g;
Since you're using the same value, either define
$foo outside the while, probably using a better name,
or simply use it in the substitution.

> 	my @url;
You could place that within the following if() and if you simply want 
the first item from split you don't need it at all.
	$row[1] = ( split '/', $row[1] ) [0]; # or $row[1] =~ s{/.*}{};
> 	if ($row[1] =~ /\//) {
> 		@url=split /\//,$row[1];
> 		$row[1]=$url[0];
> 	}
> 	$row[1]=~ s/ //g;
> 	$hosts{$row[0]}=$row[1];
> }
> $sth->finish;
> $dbh->disconnect;

For the rest I'd suggest taking a look at an article written by Randal 
Schwartz, especially the validate_links subroutine:

http://www.stonehenge.com/merlyn/UnixReview/col56.html

adding a call to HEAD, which you can parse as needed, you could replace 
your entire loop by a slightly modified version of that subroutine.


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

Date: Mon, 27 Nov 2006 23:22:25 GMT
From: boyd <tbmoore9@verizon.net>
Subject: Re: Interactive programs & Teeing
Message-Id: <tbmoore9-A477CF.18222527112006@news.verizon.net>

In article <1164665393.691544.228200@l39g2000cwd.googlegroups.com>,
 conrado.blasco@gmail.com wrote:

> I'm trying to write an interactive script that gets commands from
> STDIN, prints the results to STDOUT, *and* tees the results to a log
> file.
> 
> My problem is that when I add the teeing line to the program (see
> below), the script doesn't print anything to STDOUT anymore (not even
> the prompt). When I comment out that line, everything works fine
> (except that I don't get the log file).
> 
> (Well, it actually still prints something, but only when the session is
> over.)
> 
> It seems to me that I'm missing something very obvious, but I can't
> figure out... Any help appreciated.
> 
> Relevant excerpt below:
> 
> #!/usr/bin/env perl
> use warnings; # Needed since '-w' won't work on the shebang line
> use strict;
> use File::Basename;
> 
> my $my_name = fileparse($0);
> 
> # STDOUT prints on the screen as well as on to log file
> open (STDOUT, "| tee ./" . $my_name . ".log")
>   or die "Teeing error: $!\n";
> 
> my $prompt = "$my_name > ";
> 
> # Main loop, read and parse standard input
> print $prompt;
> while (<STDIN>) {
>   parse_cmdline($_);
>   print $prompt;
> }

It sounds like a buffering problem.  Try adding $|++; near the top.

Boyd


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

Date: Tue, 28 Nov 2006 00:20:41 GMT
From: "Mumia W. (reading news)" <paduille.4060.mumia.w@earthlink.net>
Subject: Re: Interactive programs & Teeing
Message-Id: <thLah.3915$ql2.3576@newsread3.news.pas.earthlink.net>

On 11/27/2006 04:09 PM, conrado.blasco@gmail.com wrote:
> I'm trying to write an interactive script that gets commands from
> STDIN, prints the results to STDOUT, *and* tees the results to a log
> file. [...]
> 
> (Well, it actually still prints something, but only when the session is
> over.)
> [...]

It's best just to open the log file and print twice: once to STDOUT and 
once to the log file.

The combination of Perl's buffering and tee's buffering result in your 
inability to get immediate output if STDOUT is sending to tee.


-- 
paduille.4060.mumia.w@earthlink.net


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

Date: 27 Nov 2006 16:52:54 -0800
From: conrado.blasco@gmail.com
Subject: Re: Interactive programs & Teeing
Message-Id: <1164675174.020587.276220@j72g2000cwa.googlegroups.com>


boyd wrote:
> In article <1164665393.691544.228200@l39g2000cwd.googlegroups.com>,
>  conrado.blasco@gmail.com wrote:
>
> > I'm trying to write an interactive script that gets commands from
> > STDIN, prints the results to STDOUT, *and* tees the results to a log
> > file.
> >
> > My problem is that when I add the teeing line to the program (see
> > below), the script doesn't print anything to STDOUT anymore (not even
> > the prompt). When I comment out that line, everything works fine
> > (except that I don't get the log file).
> >
> > (Well, it actually still prints something, but only when the session is
> > over.)
> >
> > It seems to me that I'm missing something very obvious, but I can't
> > figure out... Any help appreciated.
> >
> > Relevant excerpt below:
> >
> > #!/usr/bin/env perl
> > use warnings; # Needed since '-w' won't work on the shebang line
> > use strict;
> > use File::Basename;
> >
> > my $my_name = fileparse($0);
> >
> > # STDOUT prints on the screen as well as on to log file
> > open (STDOUT, "| tee ./" . $my_name . ".log")
> >   or die "Teeing error: $!\n";
> >
> > my $prompt = "$my_name > ";
> >
> > # Main loop, read and parse standard input
> > print $prompt;
> > while (<STDIN>) {
> >   parse_cmdline($_);
> >   print $prompt;
> > }
>
> It sounds like a buffering problem.  Try adding $|++; near the top.
> 
> Boyd

That worked, thanks,

Conrado



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

Date: 27 Nov 2006 23:55:33 GMT
From: wombat@fancier.net
Subject: interested in wombats
Message-Id: <m06102800501245@4ax.com>

Can someone tell me whether Wombats live only in Australia,
or also on other continents?

Apart from zoos, of course.

162


-- 
Posted via a free Usenet account from http://www.teranews.com



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

Date: Tue, 28 Nov 2006 03:29:53 GMT
From: "Todd W" <trwww@sbcglobal.net>
Subject: Re: modPerl, Apache, and REMOTE_USER
Message-Id: <R2Oah.126$Ga1.63@newssvr12.news.prodigy.net>


"Brian Wakem" <no@email.com> wrote in message 
news:4t0pn0F11l2qvU1@mid.individual.net...
> Todd W wrote:
>> "Brian Wakem" <no@email.com> wrote in message
>> news:4srnc3F10valiU1@mid.individual.net...
>>> snakedjip@yahoo.com wrote:
>>>> Is that due to some Xampp configuration in httpd.conf or elsewhere, or
>>>> is it just me that should know that $ENV{REMOTE_USER} is not set in
>>>> modPerl ?
>>>>
>>>> My question would then be : how do I know, in modPerl, what user is
>>>> accessing my script ?
>>>>
>>> $ENV{REMOTE_USER} *is* set in mod_perl.
>>
>> Well, not by default, because mod_perl provides an API to the 
>> environment.
>> Search at http://perl.apache.org/ for PerlPassEnv or something like that.
>
> I think it must be set by default, as I've never heard of PerlPassEnv let
> alone changed it, and $ENV{REMOTE_USER} has worked on every mod_perl
> install I've done.

Yep. According to this:

http://perl.apache.org/docs/1.0/guide/performance.html#PerlSetupEnv_Off

It is on by default. Perhaps the app he is using is turning it off.

Todd W.




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

Date: 27 Nov 2006 19:08:04 -0800
From: "banker123" <bradbrockman@yahoo.com>
Subject: Multi Line Match and Regex
Message-Id: <1164683283.952463.35800@h54g2000cwb.googlegroups.com>

I am trying to while through a file extract the batch and seq number
which corresponds to each invoice number (35246,35247) and amount.  My
code extracts the second invoice number, and creates a one-to-one
relationship.  I would like a one to many, one batch and seq and many
invoices.  Please help.


DATA
   Batch:00123456 Seq:0001        35246         1.00
                                                  35247       10.00

while ( <DATA> ) {
    if (/\s\sBatch/ ) {
    $batch = substr($_,9,8);
    $seq = substr($_,22,4);
}
    elsif (/\s{8}\d{5}/) {
    $invoice = substr($_,32,14);
    print "$batch $seq $invoice\n";
}
}



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

Date: 28 Nov 2006 03:42:14 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Multi Line Match and Regex
Message-Id: <Xns9888DCC929512castleamber@130.133.1.4>

"banker123" <bradbrockman@yahoo.com> wrote:

> I am trying to while through a file extract the batch and seq number
> which corresponds to each invoice number (35246,35247) and amount.  My
> code extracts the second invoice number, and creates a one-to-one
> relationship.  I would like a one to many, one batch and seq and many
> invoices.  Please help.
> 
> 
> DATA
>    Batch:00123456 Seq:0001        35246         1.00
>                                                   35247       10.00


my %batches;
 
> while ( <DATA> ) {
>     if (/\s\sBatch/ ) {
>     $batch = substr($_,9,8);
>     $seq = substr($_,22,4);


    	$batches{ $batch } = {

    	    seq      => $seq,
    	    invoices => [],
    	};

> }
>     elsif (/\s{8}\d{5}/) {
>     $invoice = substr($_,32,14);
>     print "$batch $seq $invoice\n";
> }

    	push @{ $batches{ $batch }{ invoices } }, $invoice;

> }


$batches{ $batch }{ seq } now contains seq, and
@{ $batches{ $batch }{ invoices } } 0 or more invoices.

You might want to study

perldoc perldsc

-- 
John                Experienced Perl programmer: http://castleamber.com/

          Perl help, tutorials, and examples: http://johnbokma.com/perl/


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

Date: Tue, 28 Nov 2006 05:42:23 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Tue Nov 28 2006
Message-Id: <J9FEIn.1w6M@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.

Apache-Voodoo-1.21
http://search.cpan.org/~maverick/Apache-Voodoo-1.21/
or just Voodoo for short; is a web application framework for Apache 1.3 and mod_perl 1
----
CGI-PathRequest-1.08
http://search.cpan.org/~leocharre/CGI-PathRequest-1.08/
get file info in a cgi environment
----
CGI-Session-Submitted-1.07
http://search.cpan.org/~leocharre/CGI-Session-Submitted-1.07/
Automatic session and persistence of query data.
----
CQL-Parser-1.0
http://search.cpan.org/~esummers/CQL-Parser-1.0/
compiles CQL strings into parse trees of Node subtypes.
----
Class-MOP-0.37_002
http://search.cpan.org/~stevan/Class-MOP-0.37_002/
A Meta Object Protocol for Perl 5
----
Crypt-Rijndael-0.06_07
http://search.cpan.org/~bdfoy/Crypt-Rijndael-0.06_07/
Crypt::CBC compliant Rijndael encryption module
----
DBIx-Class-HTMLWidget-0.08
http://search.cpan.org/~andremar/DBIx-Class-HTMLWidget-0.08/
Like FromForm but with DBIx::Class and HTML::Widget
----
Data-ICal-0.11
http://search.cpan.org/~jesse/Data-ICal-0.11/
Generates iCalendar (RFC 2445) calendar files
----
DateTime-Format-Natural-0.18
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.18/
Create machine readable date/time with natural parsing logic
----
DateTime-Format-Natural-0.19
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.19/
Create machine readable date/time with natural parsing logic
----
DateTime-Format-Natural-0.20
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.20/
Create machine readable date/time with natural parsing logic
----
DateTime-TimeZone-0.57
http://search.cpan.org/~drolsky/DateTime-TimeZone-0.57/
Time zone object base class and factory
----
Email-MIME-1.856
http://search.cpan.org/~rjbs/Email-MIME-1.856/
Easy MIME message parsing.
----
Email-MIME-1.857
http://search.cpan.org/~rjbs/Email-MIME-1.857/
Easy MIME message parsing.
----
Email-MIME-Modifier-1.441
http://search.cpan.org/~rjbs/Email-MIME-Modifier-1.441/
Modify Email::MIME Objects Easily
----
Email-Simple-1.996
http://search.cpan.org/~rjbs/Email-Simple-1.996/
Simple parsing of RFC2822 message format and headers
----
Email-Valid-0.179
http://search.cpan.org/~rjbs/Email-Valid-0.179/
Check validity of Internet email addresses
----
FabForce-DBDesigner4-0.07
http://search.cpan.org/~reneeb/FabForce-DBDesigner4-0.07/
Parse/Analyse XML-Files created by DBDesigner 4 (FabForce)
----
Geo-Cartogram-0.01
http://search.cpan.org/~lfagundes/Geo-Cartogram-0.01/
Perl extension for generating cartograms
----
HTML2XHTML-0.03.06
http://search.cpan.org/~oembry/HTML2XHTML-0.03.06/
Wrapper to command-line program that converts from HTML 3.x/4.x to XHTML 1.0
----
List-Pairwise-0.23
http://search.cpan.org/~tdrugeon/List-Pairwise-0.23/
map/grep arrays and hashes pairwise
----
Logger-Syslog-1.1
http://search.cpan.org/~sukria/Logger-Syslog-1.1/
an intuitive wrapper over Syslog for Perl
----
Mail-SPF-2.000_003
http://search.cpan.org/~jmehnle/Mail-SPF-2.000_003/
An object-oriented implementation of Sender Policy Framework
----
Mail-SimpleList-0.93
http://search.cpan.org/~chromatic/Mail-SimpleList-0.93/
module for managing simple, temporary, easy mailing lists
----
Math-Intersection-StraightLine-0.04
http://search.cpan.org/~reneeb/Math-Intersection-StraightLine-0.04/
Calculate intersection point for two lines
----
Math-RandomOrg-0.04
http://search.cpan.org/~gwilliams/Math-RandomOrg-0.04/
Retrieve random numbers and data from random.org.
----
Module-Pluggable-3.4
http://search.cpan.org/~simonw/Module-Pluggable-3.4/
automatically give your module the ability to have plugins
----
Moose-0.18_002
http://search.cpan.org/~stevan/Moose-0.18_002/
A complete modern object system for Perl 5
----
Object-InsideOut-2.24
http://search.cpan.org/~jdhedden/Object-InsideOut-2.24/
Comprehensive inside-out object support module
----
POE-Component-AtomAggregator-1.0
http://search.cpan.org/~xantus/POE-Component-AtomAggregator-1.0/
Watch Muliple Atom Feeds for New Headlines
----
Perl-Metrics-Simple-0.022
http://search.cpan.org/~matisse/Perl-Metrics-Simple-0.022/
Count packages, subs, lines, etc. of many files.
----
Plagger-0.7.16
http://search.cpan.org/~miyagawa/Plagger-0.7.16/
Pluggable RSS/Atom Aggregator
----
RDF-Query-1.041
http://search.cpan.org/~gwilliams/RDF-Query-1.041/
An RDF query implementation of SPARQL/RDQL in Perl for use with RDF::Redland and RDF::Core.
----
SOAP-Amazon-S3-0.023
http://search.cpan.org/~karjala/SOAP-Amazon-S3-0.023/
A module for interfacing with Amazon S3 through SOAP
----
Schedule-Cron-0.97
http://search.cpan.org/~roland/Schedule-Cron-0.97/
cron-like scheduler for Perl subroutines
----
Test-CheckManifest-0.9
http://search.cpan.org/~reneeb/Test-CheckManifest-0.9/
Check if your Manifest matches your distro
----
Test-TestCoverage-0.05
http://search.cpan.org/~reneeb/Test-TestCoverage-0.05/
Test if your test covers all 'public' subroutines of the package
----
Text-CSV-DetectSeparator-0.03
http://search.cpan.org/~reneeb/Text-CSV-DetectSeparator-0.03/
Helps to find the fieldseparator in a csv-file
----
WWW-Search-PubMed-1.003
http://search.cpan.org/~gwilliams/WWW-Search-PubMed-1.003/
Search the NCBI PubMed abstract database.
----
WebService-MusicBrainz-0.06
http://search.cpan.org/~bfaist/WebService-MusicBrainz-0.06/
----
XML-MyXML-0.061
http://search.cpan.org/~karjala/XML-MyXML-0.061/
A simple XML module
----
dvdrip-0.98.2
http://search.cpan.org/~jred/dvdrip-0.98.2/


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: 27 Nov 2006 21:01:45 -0800
From: quakewang@mail.whut.edu.cn
Subject: run a perl program using actviveperl
Message-Id: <1164690105.033610.50360@45g2000cws.googlegroups.com>

hi,

        I have written a perl program using "TK" and it can work
creactly, but when I using it in windowXP, using active Perl to run it,
every time it run, there always have a "cmd" window open too, and if I
close the cmd windown, the perl program stop too.

      Now I would like to know weather I can just open the wanted perl
program windown  created by TK only?

thanks.



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

Date: 28 Nov 2006 05:11:49 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: run a perl program using actviveperl
Message-Id: <Xns9888EBF9BCE75castleamber@130.133.1.4>

quakewang@mail.whut.edu.cn wrote:

> hi,
> 
>         I have written a perl program using "TK" and it can work
> creactly, but when I using it in windowXP, using active Perl to run it,
> every time it run, there always have a "cmd" window open too, and if I
> close the cmd windown, the perl program stop too.
> 
>       Now I would like to know weather I can just open the wanted perl
> program windown  created by TK only?

run it with wperl instead of perl and maybe set up a association for an 
extension (for example plw) to use wperl.

-- 
John                Experienced Perl programmer: http://castleamber.com/

          Perl help, tutorials, and examples: http://johnbokma.com/perl/


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

Date: Mon, 27 Nov 2006 23:06:53 GMT
From: Bryan <b@bcc.com>
Subject: Simple regex question
Message-Id: <hcKah.18948$Sw1.13107@newssvr13.news.prodigy.com>

Hi,

If I have this:
my $v1 = "9";  #Needs to be "09"
my $v2 = "01"; # Okay
my $v3 = "3"; # Needs to be "03"
my $v4 = "54"; #Okay

I want to make sure that all strings have the same format, which is 2 
digits (or more) but that single digit values are padded with a '0'. 
This is for a database query that happens later.

What is the regex to convert "1" to "01" and leaves "101" alone?


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

Date: Tue, 28 Nov 2006 00:13:50 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Simple regex question
Message-Id: <4t19pfF12042lU1@mid.individual.net>

Bryan wrote:
> If I have this:
> my $v1 = "9";  #Needs to be "09"
> my $v2 = "01"; # Okay
> my $v3 = "3"; # Needs to be "03"
> my $v4 = "54"; #Okay
> 
> I want to make sure that all strings have the same format, which is 2 
> digits (or more) but that single digit values are padded with a '0'. 
> This is for a database query that happens later.
> 
> What is the regex to convert "1" to "01" and leaves "101" alone?

You'd better use sprintf() for that.

     perldoc -f sprintf

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


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

Date: 27 Nov 2006 23:25:55 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Simple regex question
Message-Id: <Xns9888B15491A46castleamber@130.133.1.4>

Bryan <b@bcc.com> wrote:

> Hi,
> 
> If I have this:
> my $v1 = "9";  #Needs to be "09"
> my $v2 = "01"; # Okay
> my $v3 = "3"; # Needs to be "03"
> my $v4 = "54"; #Okay
> 
> I want to make sure that all strings have the same format, which is 2 
> digits (or more) but that single digit values are padded with a '0'. 
> This is for a database query that happens later.
> 
> What is the regex to convert "1" to "01" and leaves "101" alone?

perldoc -f printf

-- 
John                Experienced Perl programmer: http://castleamber.com/

          Perl help, tutorials, and examples: http://johnbokma.com/perl/


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

Date: 27 Nov 2006 21:31:31 -0800
From: "zzzhc" <zzzhc.starfire@gmail.com>
Subject: Re: Simple regex question
Message-Id: <1164691891.618954.152660@h54g2000cwb.googlegroups.com>

s/^(\d)$/0$1/;

"Bryan =D0=B4=B5=C0=A3=BA
"
> Hi,
>
> If I have this:
> my $v1 =3D "9";  #Needs to be "09"
> my $v2 =3D "01"; # Okay
> my $v3 =3D "3"; # Needs to be "03"
> my $v4 =3D "54"; #Okay
>
> I want to make sure that all strings have the same format, which is 2
> digits (or more) but that single digit values are padded with a '0'.
> This is for a database query that happens later.
>=20
> What is the regex to convert "1" to "01" and leaves "101" alone?



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

Date: 27 Nov 2006 18:12:01 -0800
From: huntingseasonson@gmail.com
Subject: Validation with XSD using XML::LibXML::Schema, and XML::Validator::Schema
Message-Id: <1164679921.301937.107820@j44g2000cwa.googlegroups.com>

Both XML::LibXML::Schema and  XML::Validator::Schema error when I
attempt to validate, yet the XML and XSD files appear to be perfectly
fine.

XML::LibXML::Schema errors with:
Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref':
References from this schema to components in the namespace '' are not
allowed, since not indicated by an import statement.

Code:

my $parser = XML::LibXML->new();
my $doc = $parser->parse_file("TV.xml");
my $v = XML::LibXML::Schema->new(location=>"TV.xsd");
eval { $v->validate($doc); };
die $@ if $@;

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

XML::Validator::Schema errors with:
Found <simpleType> illegally combined with <complexType>.
 at
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/XML/LibXML/SAX.pm
line 64
 at ./transform.pl line 234

<simpleType> is allowed to be nested withen a <complexType> correct? As
the examples I have seen on the w3c's schema tutorial nest them.
LibXML's error, well I thought a "ref" to a element withen the same
namespace (none) is perfectly ok.

Code:

my $v = XML::Validator::Schema->new(file=>"TV.xsd");
my $p = XML::SAX::ParserFactory->parser(handler=>$v);
eval { $p->parse_uri("TV.xml") };
die $@ if $@;

Both fXML and XSD files are quite long, but I will post if necessary.
Im not sure these errors are do to a problem with Perl's
implementation, in javax.xml.validation.Validator they validated ok;
maybe Java's implementation is more relaxed....? 

 Thanks in advance



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

Date: 28 Nov 2006 01:21:18 GMT
From: wombat@fancier.net
Subject: where are wombats?
Message-Id: <m06102802155629@4ax.com>

Can someone tell me whether Wombats live only in Australia,
or also on other continents?

Apart from zoos, of course.

We all know that Wombats are to be found in Zoos.

436


-- 
Posted via a free Usenet account from http://www.teranews.com



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

Date: Tue, 28 Nov 2006 00:44:32 GMT
From: Ala Qumsieh <noreply@invalid.net>
Subject: Re: Windows CE, Windows Mobile
Message-Id: <QDLah.6892$yf7.3322@newssvr21.news.prodigy.net>

John Bokma wrote:

> sgbailey@iee.org wrote:
> 
>> Is there a working version of Perl that can be installed on a handheld
>> PDA or smartphone (eg Ipaq Hw6915).
>> 
>> I am planning to get a new device and would like to install perl on it
>> - if I can't I'll probably end up installing Basic!
> 
> I am curious as well :-)
> 
> From the top of my head, there is a Python for it.
> For C#, see:
> <http://johnbokma.com/mexit/2006/11/23/net-cf-without-visual-studio.html>
> 
> Perl with Tk would be nice though.

Slaven Rezic has already done that, for the iPaq platform at least. Check
this for details:

  http://tk-appmaster.sourceforge.net/

--Ala



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

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


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