[29402] in Perl-Users-Digest
Perl-Users Digest, Issue: 646 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 12 09:10:01 2007
Date: Thu, 12 Jul 2007 06:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 12 Jul 2007 Volume: 11 Number: 646
Today's topics:
Re: Capturing a Repeated Group <noreply@gunnar.cc>
Re: Capturing a Repeated Group anno4000@radom.zrz.tu-berlin.de
Re: Capturing a Repeated Group <perrog@gmail.com>
Re: How to undo a bless on a GLOB anno4000@radom.zrz.tu-berlin.de
Re: How to undo a bless on a GLOB <Peter@PSDT.com>
Re: How to undo a bless on a GLOB anno4000@radom.zrz.tu-berlin.de
new CPAN modules on Thu Jul 12 2007 (Randal Schwartz)
no strict 'refs' need help <bpatton@ti.com>
Re: no strict 'refs' need help <nobull67@gmail.com>
Re: Perl 5.6 vs 5.8 <sigzero@gmail.com>
Re: Portable general timestamp format, not 2038-limited <nospam-abuse@ilyaz.org>
Re: Portable general timestamp format, not 2038-limited <bignose+hates-spam@benfinney.id.au>
Re: Remove a specific element from an Array anno4000@radom.zrz.tu-berlin.de
Using MsAccess with Perl on a UNIX system <erpelkapper@gmail.com>
Re: Using xargs perl to join lines <joe@inwap.com>
Validation of user provided regex <noreply@gunnar.cc>
Re: Validation of user provided regex anno4000@radom.zrz.tu-berlin.de
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 12 Jul 2007 06:48:27 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Capturing a Repeated Group
Message-Id: <5flqasF3ba9jtU1@mid.individual.net>
Xicheng Jia wrote:
> Gunnar Hjalmarsson wrote:
>>
>> C:\home>type test.pl
>> use warnings;
>> $_ = '1,234,567,890';
>> @parts = /(\d{1,3})(?=(?:,\d{3}|$))/g;
>> print @parts, "\n";
>> C:\home>test.pl
>> 1234567890
>>
>> That's better. :)
>
> I havenot used (?=...) with '*' by myself, and did not notice that
> before, but I think (?=....)? should be fine, like:
>
> @parts = /(\d{1,3})(?=,\d\d\d)?/g;
Even if that doesn't trigger a warning, I believe it's in fact the same as
@parts = /\d{1,3}/g;
Please consider:
C:\home>perl -e "print q/1,234 and 56,789/ =~ /(\d{1,3})(?=,\d\d\d)?/g"
123456789
C:\home>
> you don't need the extra parentheses inside the (?= ...), right. :-)
Yes, in my variant above, which also does some validation, the purpose
of the inner parentheses is to group the alternations.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 12 Jul 2007 08:32:09 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Capturing a Repeated Group
Message-Id: <5fm789F3cjfstU1@mid.dfncis.de>
attn.steven.kuo@gmail.com <attn.steven.kuo@gmail.com> wrote in comp.lang.perl.misc:
[...]
> print "$n\n";
>
> tr/,//d;
>
> if ($n == $_)
> {
> print "A string of numbers is converted to a number automagically
> \n";
> }
s/numbers/digits/;
Anno
------------------------------
Date: Thu, 12 Jul 2007 05:59:38 -0700
From: "perrog@gmail.com" <perrog@gmail.com>
Subject: Re: Capturing a Repeated Group
Message-Id: <1184245178.592245.161790@22g2000hsm.googlegroups.com>
Thanks for the hint!
On 11 Juli, 21:08, Paul Lalli <mri...@gmail.com> wrote:
> On Jul 11, 3:56 pm, "per...@gmail.com" <per...@gmail.com> wrote:
>
> > I'm new to perl/regular expressions but experience programmer. I'm
> > trying to match a formatted number 123,456,789 and convert it into an
> > integer.
>
> I have a dumb question. Why aren't you just doing:
>
> $_ = "1,234,567,890";
> s/,//g;
>
> or
> $_ = "1,234,567,890";
> tr/,//d;
>
The short answer is that I'm "inchworming" my way through the string.
The text may contain senteces with commas, and is not a single number
string. And after the number is matches, I continue with other
matches.
Correct me if I'm wrong, but for my scenario I think substitutions
requires two matches, first a hit, then a substitution, like so:
$_ = "1,234,456,789";
/\d{1,3}(?:,\d\d\d)*/g && do {
my $number= $&;
$number =~ s/,//g;
print "$number\n";
}
But if the number parts could be eaten up in one regexp, it is
unnecessarily to use two. :-)
------------------------------
Date: 12 Jul 2007 07:36:50 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How to undo a bless on a GLOB
Message-Id: <5fm40iF3dg8a9U2@mid.dfncis.de>
Yuri Shtil <yshtil@cisco.com> wrote in comp.lang.perl.misc:
> The scenario is like this:
> A GLOB was created via Symbol::gensym:
>
> use Symbol
> my $foo = gensym();
>
> The reference was blessed to something:
>
> bless $foo, 'Something';
>
> I need to be able to revert $foo back to the glob.
>
> How do I do it?
You can't. Once an object is blessed, it can only be re-blessed
into another class, not unblessed. Can you bless the glob before
POE gets hold of it?
> Detail:
>
> The reason for all this trouble is that a module with a garbage
> collector (POE) keeps track of $foo in a hash keyed by $foo itself,
> which is a stringified reference. When I bless it, the garbage collector
> cannot find the reference.
That could be a bug in POE. It should key the hash with the refaddr
of objects, not with the stringified object itself. It would also
fail if the object overloaded stringification.
Anno
------------------------------
Date: Thu, 12 Jul 2007 10:02:07 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: How to undo a bless on a GLOB
Message-Id: <pan.2007.07.12.10.02.07.56241@PSDT.com>
On Thu, 12 Jul 2007 07:36:50 +0000, anno4000 wrote:
> Yuri Shtil <yshtil@cisco.com> wrote in comp.lang.perl.misc:
>> The scenario is like this:
>> A GLOB was created via Symbol::gensym:
>>
>> use Symbol
>> my $foo = gensym();
>>
>> The reference was blessed to something:
>>
>> bless $foo, 'Something';
>>
>> I need to be able to revert $foo back to the glob.
>>
>> How do I do it?
>
> You can't. Once an object is blessed, it can only be re-blessed
> into another class, not unblessed. Can you bless the glob before
> POE gets hold of it?
http://search.cpan.org/~ibb/Acme-Damn-0.02/Damn.pm
Acme::Damn provides a single routine, damn(), which takes a blessed
reference (a Perl object), and unblesses it, to return the original
reference. I can't think of any reason why you might want to do this,
but just because it's of no use doesn't mean that you shouldn't be able
to do it.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: 12 Jul 2007 10:15:49 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How to undo a bless on a GLOB
Message-Id: <5fmdalF3c9b99U2@mid.dfncis.de>
Peter Scott <Peter@PSDT.com> wrote in comp.lang.perl.misc:
> On Thu, 12 Jul 2007 07:36:50 +0000, anno4000 wrote:
> > Yuri Shtil <yshtil@cisco.com> wrote in comp.lang.perl.misc:
> >> The scenario is like this:
> >> A GLOB was created via Symbol::gensym:
> >>
> >> use Symbol
> >> my $foo = gensym();
> >>
> >> The reference was blessed to something:
> >>
> >> bless $foo, 'Something';
> >>
> >> I need to be able to revert $foo back to the glob.
> >>
> >> How do I do it?
> >
> > You can't. Once an object is blessed, it can only be re-blessed
> > into another class, not unblessed. Can you bless the glob before
> > POE gets hold of it?
>
> http://search.cpan.org/~ibb/Acme-Damn-0.02/Damn.pm
>
> Acme::Damn provides a single routine, damn(), which takes a blessed
> reference (a Perl object), and unblesses it, to return the original
> reference. I can't think of any reason why you might want to do this,
> but just because it's of no use doesn't mean that you shouldn't be able
> to do it.
Well, I was referring to native Perl. You can do everything with
a little XS [1].
Anno
[1] ... and if it turns out Acme::Damn isn't an XS module, I'll be
damned.
------------------------------
Date: Thu, 12 Jul 2007 04:42:12 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Jul 12 2007
Message-Id: <JL1uEC.1L0I@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.
Bio-NEXUS-Import-v0.0.1
http://search.cpan.org/~limaone/Bio-NEXUS-Import-v0.0.1/
Extends Bio::NEXUS with parsers for file formats of popular phylogeny programs
----
Bio-Phylo-0.17_RC1
http://search.cpan.org/~rvosa/Bio-Phylo-0.17_RC1/
Phylogenetic analysis using perl.
----
Boost-Graph-1.4
http://search.cpan.org/~dburdick/Boost-Graph-1.4/
Perl interface to the Boost-Graph C++ libraries.
----
Bundle-Dependencies-Catalyst-0.09
http://search.cpan.org/~ski/Bundle-Dependencies-Catalyst-0.09/
installs non-Catalyst prereqs
----
Bundle-Parrot-0.4.13.2
http://search.cpan.org/~particle/Bundle-Parrot-0.4.13.2/
Bundle of modules required for developing and testing Parrot
----
Business-OnlinePayment-AuthorizeNet-3.17
http://search.cpan.org/~ivan/Business-OnlinePayment-AuthorizeNet-3.17/
AuthorizeNet backend for Business::OnlinePayment
----
Business-OnlinePayment-LinkPoint-0.09
http://search.cpan.org/~ivan/Business-OnlinePayment-LinkPoint-0.09/
LinkPoint (Cardservice) backend for Business::OnlinePayment
----
CGI-Application-Plugin-RequireSSL-0.04
http://search.cpan.org/~dhorne/CGI-Application-Plugin-RequireSSL-0.04/
Force SSL in specified pages or modules
----
Catalyst-Plugin-Authentication-0.10000
http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication-0.10000/
Infrastructure plugin for the Catalyst authentication framework.
----
Class-Accessor-0.31
http://search.cpan.org/~kasei/Class-Accessor-0.31/
Automated accessor generation
----
Convert-Age-0.03
http://search.cpan.org/~cfedde/Convert-Age-0.03/
convert integer seconds into a "compact" form and back.
----
DBIx-Perlish-0.27
http://search.cpan.org/~gruber/DBIx-Perlish-0.27/
a perlish interface to SQL databases
----
Finance-Math-IRR-0.09
http://search.cpan.org/~erwan/Finance-Math-IRR-0.09/
Calculate the internal rate of return of a cash flow
----
Google-Checkout-1.0.9
http://search.cpan.org/~dzhuo/Google-Checkout-1.0.9/
----
GraphViz-Data-Structure-0.16
http://search.cpan.org/~mcmahon/GraphViz-Data-Structure-0.16/
Visualise data structures
----
Incunabulum-0.03
http://search.cpan.org/~apeiron/Incunabulum-0.03/
Extensible, plugin-based MVC framework
----
Log-Report-0.08
http://search.cpan.org/~markov/Log-Report-0.08/
report a problem, pluggable handlers and language support
----
Mail-Foundry-0.08
http://search.cpan.org/~scottw/Mail-Foundry-0.08/
Perl extension for talking to a MailFoundry appliance
----
Math-Polynom-0.13
http://search.cpan.org/~erwan/Math-Polynom-0.13/
Operations on polynomials
----
Module-MultiConf-0.0100_02
http://search.cpan.org/~oliver/Module-MultiConf-0.0100_02/
Configure and validate your app modules in one go
----
Net-SFTP-Foreign-1.28
http://search.cpan.org/~salva/Net-SFTP-Foreign-1.28/
Secure File Transfer Protocol client
----
Net-Telnet-Wrapper-0.1
http://search.cpan.org/~mwallraf/Net-Telnet-Wrapper-0.1/
wrapper or extension for Net::Telnet and Net::Telnet::Cisco
----
Net-XMPP2-0.02
http://search.cpan.org/~elmex/Net-XMPP2-0.02/
An implementation of the XMPP Protocol
----
PDF-FDF-Simple-0.11
http://search.cpan.org/~schwigon/PDF-FDF-Simple-0.11/
Read and write (Acrobat) FDF files.
----
RPC-Serialized-0.0599_05
http://search.cpan.org/~oliver/RPC-Serialized-0.0599_05/
Subroutine calls over the network using common serialization
----
RT-SimpleGPGVerify-0.05
http://search.cpan.org/~jesse/RT-SimpleGPGVerify-0.05/
----
Tk-HyperText-0.05
http://search.cpan.org/~kirsle/Tk-HyperText-0.05/
Create and manipulate ROText widgets which render HTML code.
----
WWW-Facebook-API-v0.4.1
http://search.cpan.org/~unobe/WWW-Facebook-API-v0.4.1/
Facebook API implementation
----
WebService-CRUST-0.4
http://search.cpan.org/~heschong/WebService-CRUST-0.4/
A lightweight Client for making REST calls
----
Win32-InstallShield-0.4
http://search.cpan.org/~kbaucom/Win32-InstallShield-0.4/
InstallShield data file interface
----
Win32-SqlServer-2.003
http://search.cpan.org/~sommar/Win32-SqlServer-2.003/
Access SQL Server from Perl via OLE DB
----
XHTML-Instrumented-0.00
http://search.cpan.org/~gam/XHTML-Instrumented-0.00/
packages to control XHTML
----
XHTML-Instrumented-0.01
http://search.cpan.org/~gam/XHTML-Instrumented-0.01/
packages to control XHTML
----
Yahoo-Photos-0.0.2
http://search.cpan.org/~daxim/Yahoo-Photos-0.0.2/
Manage Yahoo Photos
----
re-engine-PCRE-0.12
http://search.cpan.org/~avar/re-engine-PCRE-0.12/
Perl-compatible regular expression engine
----
re-engine-POSIX-0.03
http://search.cpan.org/~avar/re-engine-POSIX-0.03/
POSIX (IEEE Std 1003.1-2001) regular expressions
----
re-engine-Plan9-0.11
http://search.cpan.org/~avar/re-engine-Plan9-0.11/
Plan 9 regular expression engine
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: Thu, 12 Jul 2007 04:46:42 -0700
From: bpatton <bpatton@ti.com>
Subject: no strict 'refs' need help
Message-Id: <1184240802.479892.303580@r34g2000hsd.googlegroups.com>
I'm trying to get this function to work. It's a snippett of my
original code, but functional. I'm at home and don't have my perl
book with me to look it up.
Here's the code.
package foo;
use strict;
use warnings;
use Data::Dumper;
use vars qw ( $BY $INTO $VALUE );
my %input = ( by => 'by' ,
into => 'into' ,
value => 'value',
);
setKnownVariables(\%input);
print "by = $::BY\n";
print "into = $::INTO\n";
print "value = $::VALUE\n";
sub setKnownVariables($) {
my ($input) = @_;
my ($var,$uvar);
foreach $var (
'allow45',
'by',
'coincidenceOK',
'comment',
'filter',
'into' ,
'layer',
'lineEnd',
'lpad',
'lpadRedundant',
'metalSys' ,
'overlap',
'overlapOK',
'process' ,
'ruleGroupNumber' ,
'ruleName',
'sideLength',
'sideSpace',
'square',
'technology' ,
'touching',
'value',
'width',
) {
no strict 'refs';
$uvar = $var;
$uvar =~ tr/[a-z]/[A-Z]/;
if (exists $input->{$var}) {
$::${$uvar} = $input->{$var};
delete $input->{$var};
} else {
$::{$var} = undef;
}
}
}
------------------------------
Date: Thu, 12 Jul 2007 12:03:34 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: no strict 'refs' need help
Message-Id: <1184241814.554129.267200@k79g2000hse.googlegroups.com>
On Jul 12, 12:46 pm, bpatton <bpat...@ti.com> wrote:
> I'm trying to get this function to work.
In what way does it fail?
> I'm at home and don't have my perl
> book with me to look it up.
Do you have a computer with Perl on it? If so you could use the
standard reference manuals that are installed as part of Perl.
> {
> no strict 'refs';
> $uvar = $var;
> $uvar =~ tr/[a-z]/[A-Z]/;
> if (exists $input->{$var}) {
> $::${$uvar} = $input->{$var};
> delete $input->{$var};
> } else {
> $::{$var} = undef;
> }
> }
A non-existent element of a hash is undef anyhow.
Did you really mean to create the upper case variable if the element
in %input was there and the lower case one if not? I'm guessing not.
There's a built-in uppercase function.
$::${$uvar} is not valid syntax.
{
no strict 'refs';
${"::\U$var"} = delete $input->{$var};
}
BTW: You need to have a damn good reason to be playing with symrefs in
the main:: namespace. I'd guess it's ~90% probable that you don't.
------------------------------
Date: Thu, 12 Jul 2007 05:36:36 -0700
From: Robert Hicks <sigzero@gmail.com>
Subject: Re: Perl 5.6 vs 5.8
Message-Id: <1184243796.869130.319510@w3g2000hsg.googlegroups.com>
#!/opt/perl5/bin/perl
# ampd - Start a daemon and process connections using i/o
# multiplexing and call the deliver program on the recieved
# connections.
use strict;
use warnings;
use Carp;
use POSIX;
use POSIX ":sys_wait_h";
use IO::Socket;
use IO::Select;
use Socket;
use Fcntl;
use AMP::Configure;
use AMP::Log;
## main block
my $cfg_params = AMP::Configure->get_ampd;
my $debug = AMP::Configure->get_debug;
my $logfile = AMP::Configure->get_debug_log_filename;
my $cmd = "/users/amvermsg/bin/deliver";
my $arg; # command argument given to deliver
my $sname = "/tmp/ampd.sock";
my $outname = "/tmp/ampd.msg"; # temporary message text
file used for deliver
my $deliver_pid; # pid assigned to deliver
process upon fork
my $timeout = $cfg_params->{'timeout'}; # seconds to wait for
deliver to complete before killing
# alarm sentinel
my $alarmset;
my $alarmring;
# text for dropping
my @msg_txt;
unlink $outname;
unlink $sname;
# Listen to port.
my $server = IO::Socket::UNIX->new(
Local => $sname,
Type => SOCK_STREAM,
Listen => SOMAXCONN,
) or croak "ampd - Can't make server socket: $!";
# begin with empty buffers
my %inbuffer = ();
my @ready = ();
# set alarm signal to catch hanging process
$SIG{ALRM} = sub {
$alarmring = 1;
};
# autoreap zombies
$SIG{CHLD} = 'IGNORE';
# put server in non-blocking mode
nonblock($server);
# multiplex connection
my $select = IO::Select->new($server);
# fork and detatch
daemonize();
# Main loop: check reads/accepts, check writes, check ready to process
while (1) {
my $rv;
my $data;
# check for new information on the connections we have
# anything to read or accept?
foreach my $client ( $select->can_read(1) ) {
if ( $client == $server ) {
# accept a new connection
$client = $server->accept();
$select->add($client);
$inbuffer{$client} = "";
nonblock($client);
}
else {
# read data
$data = '';
$rv = $client->recv( $data, POSIX::BUFSIZ, 0 );
# check client is finished sending data
unless ( defined($rv) && length $data ) {
print "ampd - END OF DATA READ\n";
push @ready, $client;
$select->remove($client);
close $client;
next;
}
$inbuffer{$client} .= $data;
}
}
# process a message if client is ready and no deliver processes
are running
if (@ready) {
if ( waitpid( -1, &WNOHANG ) < 0 ) {
alarm 0;
$alarmset = 0;
$alarmring = 0;
print "ampd - GOING TO PROCESS\n";
process( shift @ready );
}
elsif ( not $alarmset ) {
print "ampd - SETTING ALARM, WILL DIE IN $timeout SECONDS
IF MESSAGE DOES NOT PROCESS\n";
$alarmset = 1;
alarm $timeout;
}
elsif ( $alarmring ) {
alarm 0;
$alarmring = 0;
$alarmset = 0;
log_it( "ampd - DELIVER PROCESS TIME EXPIRED, GOING TO
KILL PID $deliver_pid\n" );
eval {
require AMP::Deliver;
my $path =
AMP::Deliver::create_amvermsg_pathname( $cfg_params->{'drop_dir'} );
open my $fh, '>', $path or croak "ampd - Could not
open '$path' for writing: $!\n";
for ( @msg_txt ) { print $fh $_; }
close $fh;
log_it( "ampd - Dropped message is in $path\n" );
};
log_it( $@ if $@ );
kill 9, $deliver_pid;
}
else {
# do nothing
}
}
}
## end main block
# process($client) run a complete message
sub process {
my $client = shift;
# split by newlines
my @outtext;
push @outtext, split( /\n/, $inbuffer{$client} );
# reappend newline
for (@outtext) {
$_ .= "\n" unless /\n$/;
push @msg_txt, $_;
}
# get the argument (subject line from amp-client)
my $arg = shift @outtext;
chomp $arg;
# write the data to a temporary file
open my $fh, '>', $outname;
print $fh @outtext;
close $fh;
# call the program
$deliver_pid = fork;
if ( $deliver_pid == 0 ) {
print "ampd - CHILD PROCESSING\n";
system("$cmd $arg $outname");
unlink $outname;
exit;
}
# clean up
delete $inbuffer{$client};
}
# nonblock($socket) puts socket into nonblocking mode
sub nonblock {
my $socket = shift;
my $flags;
$flags = fcntl( $socket, F_GETFL, 0 )
or croak "ampd - Can't get flags for socket: $!\n";
fcntl( $socket, F_SETFL, $flags | O_NONBLOCK )
or croak "ampd - Can't make socket nonblocking: $!\n";
}
# wrapper routine for fork
sub Fork {
my ($pid);
FORK:
{
if ( defined( $pid = fork ) ) {
return $pid;
# retry fork if no process descriptors are currently
available
}
elsif ( $! =~ /No more process/ ) {
sleep 5;
redo FORK;
}
else {
croak "ampd - Can't fork: $!";
}
}
}
# put program in daemon mode
sub daemonize {
my ( $pid, $sess_id, $i );
# Fork and exit parent
if ( $pid = Fork ) { exit 0; }
# Detach ourselves from the terminal
croak "Cannot detach from controlling terminal"
unless $sess_id = POSIX::setsid();
# Prevent possibility of acquiring a controlling terminal
$SIG{'HUP'} = 'IGNORE';
# Change working directory to root so umount won't hang
chdir "/";
# Clear file creation mask
umask 0;
# Reopen stderr, stdout, stdin to /dev/null
my $nullpath = '/dev/null';
# Make variables for STD(IN|OUT|ERR)
my ($ifh, $ofh, $efh) = ( *STDIN, *STDOUT, *STDERR );
open $ifh, "+>", $nullpath;
if ( $debug eq '1' ) {
open $ofh, ">>", $logfile;
open $efh, ">>", $logfile;
}
elsif ( $debug eq '0' ) {
open $ofh, "+>", $nullpath;
open $efh, "+>", $nullpath;
}
}
------------------------------
Date: Thu, 12 Jul 2007 04:15:26 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <f749su$v12$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Martin Gregorie
<martin@see.sig.for.address>], who wrote in article <qj4gm4-9d5.ln1@zoogz.gregorie.org>:
> Ilya Zakharevich wrote:
> > My point is that attributing something to SH due to it appearing in
> > ABHoT is like attributing it to you since it was mentioned in your
> > post...
> OK, so who should it be attributed to?
*This* was my question; and with kitchentop book, one cannot expect to
find such an answer. If interested, Wiki looks like a good place to
look it up.
Given how obsolete this conjecture is (it contradicts the now known
data about uniformity of background radiation), I have no interest in
looking it up. :-(
Sorry,
Ilya
------------------------------
Date: Thu, 12 Jul 2007 21:53:57 +1000
From: Ben Finney <bignose+hates-spam@benfinney.id.au>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <873aztltwq.fsf@benfinney.id.au>
Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:
> *This* was my question; and with kitchentop book, one cannot expect
> to find such an answer. If interested, Wiki looks like a good place
> to look it up.
I don't know what Wiki[0] has to do with it, but just to check:
<URL:http://c2.com/cgi/wiki?WhatIsNorthOfTheNorthPole>
Nope, can't find any existing page about it.
[0] Left unqualified, referring to a site named "Wiki" refers to *the*
Wiki, at <URL:http://c2.com/cgi/wiki>. If you mean some other
subsequent Wiki site, you'll need to be more specific.
--
\ "Consider the daffodil. And while you're doing that, I'll be |
`\ over here, looking through your stuff." -- Jack Handey |
_o__) |
Ben Finney
------------------------------
Date: 12 Jul 2007 07:30:11 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Remove a specific element from an Array
Message-Id: <5fm3k3F3dg8a9U1@mid.dfncis.de>
Dr.Ruud <rvtol+news@isolution.nl> wrote in comp.lang.perl.misc:
> Petr Vileta schreef:
>
> > foreach $item (0..$#updateNames)
> > {
> > foreach $item2 (@tempArr)
> > {
> > if (@updateNames[$item] eq $item2)
> > {
> > splice @updateNames, $item, 1;
>
> I think it is better to undef the array element here,
> and then remove the undefined elements by a grep, after the loop.
>
> > }
> > }
> > }
Right. The code above may *seem* to work in some cases but won't
in others. On the other hand, using undef as a marker only works
if the original array elements are all defined. Collecting the
indices and deleting the elements in reverse order after the loop
is a solution, but we have seen better ones in this thread.
Anno
------------------------------
Date: Thu, 12 Jul 2007 03:06:50 -0700
From: "linux@colsen.org" <erpelkapper@gmail.com>
Subject: Using MsAccess with Perl on a UNIX system
Message-Id: <1184234810.375580.192140@n2g2000hse.googlegroups.com>
Hello,
I am trying to build a script that creates and fills an MsAccess
database (.mdb) in the right format on a UNIX-system (solaris).
The script needs to retrieve information from an existing MySQL
database and put it in an MsAccess database on the UNIX-platform, so
no connection can be made to a Windows machine. Later the will be FTP-
ed to a windows machine, which can only load the data. ODBC is not
possible.
The script is a perl script, but the solution to this prolbem, doesn't
necessarily need to be with Perl.
Does anyone have experience in how to solve this problem?
Best regards,
Gilian
------------------------------
Date: Thu, 12 Jul 2007 01:46:51 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Using xargs perl to join lines
Message-Id: <2IKdnYAVDOLjdwjbnZ2dnUVZ_gGdnZ2d@comcast.com>
charissaf@gmail.com wrote:
> # sed -e :a -e '$!N;s/\n=/ /;ta' -e 'P;D'
>
> The error I receive is: N: Event not found.
Are you aware that some shells require ! to be quoted as \! even inside ''?
-Joe
linux% date
Thu Jul 12 01:43:44 PDT 2007
linux% echo "a!N."
N.: Event not found.
linux% echo !da
echo date
date
linux% echo $version
tcsh 6.14.00 (Astron) 2005-03-25 (i386-intel-linux) ...
linux% echo "a\!N."
a!N.
------------------------------
Date: Thu, 12 Jul 2007 10:29:23 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Validation of user provided regex
Message-Id: <5fm795F3dcrmnU1@mid.individual.net>
In an app where a user may provide a Perl regular expression I want to
validate the regex before it's applied. Currently I'm doing something like:
{
local $SIG{__WARN__} = sub { die $_[0] };
eval { $regex = qr($regex) };
die $@ if $@;
}
In other words I rely on Perl's ability to catch errors, where also
warnings are treated as errors.
Are there other appropriate checks that could be done?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 12 Jul 2007 09:56:09 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Validation of user provided regex
Message-Id: <5fmc5pF3c9b99U1@mid.dfncis.de>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in comp.lang.perl.misc:
> In an app where a user may provide a Perl regular expression I want to
> validate the regex before it's applied. Currently I'm doing something like:
>
> {
> local $SIG{__WARN__} = sub { die $_[0] };
> eval { $regex = qr($regex) };
> die $@ if $@;
> }
>
> In other words I rely on Perl's ability to catch errors, where also
> warnings are treated as errors.
>
> Are there other appropriate checks that could be done?
If code interpolations are a possibility, you may want to "use re
'eval';" in the block. Or not, depending...
Anno
------------------------------
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 646
**************************************