[22035] in Perl-Users-Digest
Perl-Users Digest, Issue: 4257 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 13 03:05:42 2002
Date: Fri, 13 Dec 2002 00:05:12 -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 Fri, 13 Dec 2002 Volume: 10 Number: 4257
Today's topics:
5.6/5.8 clashing? (Chester Langin)
Re: 5.6/5.8 clashing? <tassilo.parseval@post.rwth-aachen.de>
Re: A formating problem (Jan Fure)
Re: Banner Ad Rotation Program (Tad McClellan)
Re: Banner Ad Rotation Program (Stas Neuberger)
Re: can I ship perl interpreter & do I need to send imp (qanda)
Re: chained maps and greps <foobear@nospam.doom.net>
Re: chained maps and greps <foobear@nospam.doom.net>
Re: Creating COM Objects in Perl (Jay Tilton)
Delete series of bit sequences 1A1A from end of file. <Patrick_member@newsguy.com>
Re: Determining file sizes (TracyTererll)
Re: Determining file sizes (TracyTererll)
Re: Discerning an Open and Closed Socket... <goldbb2@earthlink.net>
Eject CD with Perl (Mike)
Re: Eject CD with Perl <palladium@spinn.net>
Hebrew to web from Access 2000 (bpaluch)
Re: Max fork'd proc limit...? <goldbb2@earthlink.net>
Re: Module for MS SQL Server Access <pkent77tea@yahoo.com.tea>
Re: perl bad interpreter: No such file or directory (Stas Neuberger)
Re: Perl IDE suggestion for Win32 environment <sspatz@kcnet.com>
Re: Perl IDE suggestion for Win32 environment <palladium@spinn.net>
Re: Question about Subroutines <jurgenex@hotmail.com>
Re: Question about Subroutines (Tad McClellan)
Re: regexp help (Tad McClellan)
Re: Spawn a new process in Perl? <tim@vegeta.ath.cx>
Re: unix2dos newbie question (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Dec 2002 20:52:40 -0800
From: langin@cs.siu.edu (Chester Langin)
Subject: 5.6/5.8 clashing?
Message-Id: <926d3d76.0212122052.1b77a84d@posting.google.com>
I've been using SuSE 7.1 apparently with Perl 5.6 installed at
/usr/bin and the modules installed at /usr/lib/perl5. I installed 5.8
from CPAN which apparently put 5.8 in /usr/local/bin and the modules
in /usr/local/lib/perl5. I was getting many errors installing
modules. So I uninstalled and erased everything Perl (I thought). I
reinstalled from SuSE 7.1 including a lot of modules. However, when I
run "perl -Mwhatever -e 1" it says the modules are not there.
"/usr/bin/perl -v" gives me 5.6. However, "whereis perl" gives me
/usr/local/bin/perl. "/usr/local/bin/perl -v" gives me 5.8. (I
obviously didn't remove /usr/local/bin/perl, not realizing that it was
there.) So I move /usr/local/bin/perl to /usr/local/bin/perl.old and
enter "perl -v" and bash tells me that /usr/local/bin/perl is not
there, even though /usr/bin/perl is in the path.
When I try "perl -Mwhatever -e 1" sometimes it displays my @INC list,
which points at places in /usr/local/lib/perl5 and not /usr/lib/perl5.
The Camel book says that @INC is in the PERL5LIB environment
variable, but when I echo this, it is empty.
So somewhere is a configuration file that tells bash to look in
/usr/local/bin even though /usr/bin is in the path and which also sets
@INC to the wrong paths. Does anybody know where this configuration
file is at?
------------------------------
Date: 13 Dec 2002 07:52:34 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: 5.6/5.8 clashing?
Message-Id: <atc3k2$1p$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Chester Langin:
> I've been using SuSE 7.1 apparently with Perl 5.6 installed at
> /usr/bin and the modules installed at /usr/lib/perl5. I installed 5.8
> from CPAN which apparently put 5.8 in /usr/local/bin and the modules
> in /usr/local/lib/perl5. I was getting many errors installing
> modules. So I uninstalled and erased everything Perl (I thought). I
> reinstalled from SuSE 7.1 including a lot of modules. However, when I
> run "perl -Mwhatever -e 1" it says the modules are not there.
>
> "/usr/bin/perl -v" gives me 5.6. However, "whereis perl" gives me
> /usr/local/bin/perl. "/usr/local/bin/perl -v" gives me 5.8. (I
> obviously didn't remove /usr/local/bin/perl, not realizing that it was
> there.) So I move /usr/local/bin/perl to /usr/local/bin/perl.old and
> enter "perl -v" and bash tells me that /usr/local/bin/perl is not
> there, even though /usr/bin/perl is in the path.
This is all quite odd and I can only utter some assumptions. May it be a
problem with symbolic links? There might still be a link pointing to
/usr/local/bin/perl which you previously renamed.
Also, the order of the elements in $PATH might matter. Usually,
/usr/local/bin comes before /usr/bin which comes before /bin. They are
searched left-to-right. Best would be to make a histogramm of where all
of your perls are installed and check that against search-order of
$PATH.
> When I try "perl -Mwhatever -e 1" sometimes it displays my @INC list,
> which points at places in /usr/local/lib/perl5 and not /usr/lib/perl5.
> The Camel book says that @INC is in the PERL5LIB environment
> variable, but when I echo this, it is empty.
No, @INC is hard-compiled into the Perl-executable. PERL5LIB can be set
to add other more to @INC (that are searched before the regular paths in
@INC). This also means that each perl has its own correct @INC no matter
how it is called.
> So somewhere is a configuration file that tells bash to look in
> /usr/local/bin even though /usr/bin is in the path and which also sets
> @INC to the wrong paths. Does anybody know where this configuration
> file is at?
Bash certainly has a number of configuration files. Perhaps there is an
alias defined somewhere. Check this with the 'alias' bash-builtin that
returns all aliases when called without arguments.
Tassilo
--
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;
------------------------------
Date: 12 Dec 2002 23:21:40 -0800
From: jan_may2002_fure@attbi.com (Jan Fure)
Subject: Re: A formating problem
Message-Id: <e47a84bf.0212122321.2361db03@posting.google.com>
Thanks for the explanation, the code works fine after I removed the <>
operator.
Is it correct to state that when processing data,
while ( <FILEHANDLE> ) {
EXPR;
}
and
foreach ( @ARRAY ) {
EXPR;
}
will be transparent to the code reprecented by EXPR if the file and
the array contains the same information?
Anyway, I am much more happy with the code below than my brute force
way.
Jan Fure
foreach(@data1){
my ($field, $val) = split ;
push @{ $data{$field} }, $val;
}
foreach ( sort keys %data ) {
@{$data{$_}} = sort { $a <=> $b } @{$data{$_}};
push @{$points[0]}, $_;
push @{$points[1]}, $data{$_};
}
------------------------------
Date: Thu, 12 Dec 2002 17:10:07 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Banner Ad Rotation Program
Message-Id: <slrnavi5qf.48l.tadmc@magna.augustmail.com>
Regular Joe <Regular_Joe@hotmail.com> wrote:
> "Jeff Zucker" <jeff@vpservices.com> wrote in message
> news:3DF8EA41.70407@vpservices.com...
>> Regular Joe wrote:
>>
>> > Does anyone know of a good FREE Banner Ad Rotation Program?
>> >
>> > I've seen many but I want to know which one is the best.
>>
>>
>> The best one is the one that dosn't display anything.
>>
> Thank you for your helpful and resourceful response.
Hope you never need help with something that really is a Perl question...
*plonk*
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Dec 2002 17:11:06 -0800
From: stas@epost.de (Stas Neuberger)
Subject: Re: Banner Ad Rotation Program
Message-Id: <bea0b7d7.0212121711.541dbf22@posting.google.com>
Jeff Zucker <jeff@vpservices.com> wrote in message news:<3DF8EA41.70407@vpservices.com>...
> Regular Joe wrote:
>
> > Does anyone know of a good FREE Banner Ad Rotation Program?
> >
> > I've seen many but I want to know which one is the best.
>
>
> The best one is the one that dosn't display anything.
try adcycle
------------------------------
Date: 12 Dec 2002 23:37:33 -0800
From: fumail@freeuk.com (qanda)
Subject: Re: can I ship perl interpreter & do I need to send imported modules
Message-Id: <62b4710f.0212122337.517f5e3c@posting.google.com>
Andras Malatinszky <nobody@dev.null> wrote in message news:<3DF8BF39.5070604@dev.null>...
> qanda wrote:
>
> > Hi all
> >
> > I've been slowly learning perl over the last few weeks and need to
> > know about deployment - I've tried a few searches and docs but can't
> > get a definate answer - I'm still learning where to find information!
> >
> > If I want to send perl scripts as part of my companys product, can I
> > also send the perl interpreter (for any particular platform) and do I
> > need to ship anything else such as imported modules. I still don't
> > understand the implementation details of perl and its modules, are
> > some built into the perl interpreter itself, where do they live, etc?
> >
> > Thanks in advance
> >
> Check out Perl2Exe at http://www.indigostar.com/perl2exe.htm.
Thanks, this looks very good; however you would you mind answering the
following (I mentioned in the past I've just started learning, I have
the Camel book but it will take time to digest and I've spend several
hours on this subject without success)
Assuming I wanted to deliver perl script(s) to a customer:-
1) what should I do legally - from the perspective of perl not my
company
2) what files (assuming the customer does not have and cannot obtain
perl and is also on the same platform) do I need to package to use
a)standard modules and b)extra modules, eg CPAN
I will gladly look for the details if I am told where the information
is, however as I said I have spend several hours now searching
newgroups, web-sites and books without a clear explanation.
thanks.
------------------------------
Date: Fri, 13 Dec 2002 05:02:16 GMT
From: <foobear@nospam.doom.net>
Subject: Re: chained maps and greps
Message-Id: <sRdK9.326$0I3.38247@petpeeve.ziplink.net>
Dick Penny <penny1482@attbi.com> wrote:
> I spent a LOT of time trying to understand and do exactly the same around
> 10/2/02 thru 10/7 and got some good ideas from this group. Seach google for
> the word "chain" or "iterator", or maybe my name (never tried that before).
>> <foobear@nospam.doom.net> wrote in message
>> Somewhat of a perl golf question, I'm not trying to obfuscate my code,
>> just want to understand chained maps or greps.
Hello Dick,
Yes, when I first searched google to try and find some hints, yours was the
first post I ran across. Unfortunately only Benjamin answered, with some good
information as always, (thanks Ben), but I'm not certain it answered my question
This is the post I ran across BTW, if anyone is interested:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=3D9E5CF8.35D2C43A%40earthlink.net&rnum=1&prev=/groups%3Fq%3Dchained%2Bmaps%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D3D9E5CF8.35D2C43A%2540earthlink.net%26rnum%3D1
This is the post I ran across BTW, if anyone is interested:
Thanks
------------------------------
Date: Fri, 13 Dec 2002 05:04:42 GMT
From: <foobear@nospam.doom.net>
Subject: Re: chained maps and greps
Message-Id: <KTdK9.327$0I3.38247@petpeeve.ziplink.net>
foobear@nospam.doom.net wrote:
> I was thinking along the lines of a chained map or grep. The problem
> I see is that only one iterator exists for a map/grep, so the innermost map/grep
> will lose access to the outer iterator, maybe saving the iterator of the outermost
> map would work?
> #one liner attempt, doesn't work, but shows what I have in mind
> return map { my $s = $_; grep { $s->id eq $_ } @ids } $self->sessions if @ids;
Hmm, now that I think about it, maybe 'chained' is not the proper term, and
'nested' is what I was looking for?
------------------------------
Date: Thu, 12 Dec 2002 23:37:22 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Creating COM Objects in Perl
Message-Id: <3df91c77.10105245@news.erols.com>
snazystyl@hotmail.com (KP) wrote:
: I have created COM Objects in VBScript/Windows Host Scripting.
:
: Set FSO = CreateObject("Scripting.FileSystemObject")
:
: ... My question is: How does one Create COM Objects in Perl?
use Win32::OLE;
my $fso = Win32::OLE->new('Scripting.FileSystemObject');
------------------------------
Date: 12 Dec 2002 21:46:04 -0800
From: Patrick Flaherty <Patrick_member@newsguy.com>
Subject: Delete series of bit sequences 1A1A from end of file.
Message-Id: <atbs6s02fcb@drn.newsguy.com>
Hi,
As an artifact of the software that we use to span our old and new systems
(software = PATHworks old system = VMS new system = Windows), we get an artifact
at the end of VMS text files (at some point opened and then saved from Windows)
where there are word-aligned series of the sequence 1A1A at the end of the file
(my ASCII table tells me that 1A is SUB whatever that means).
So it seems to reasonable to:
1) open the file
2) spin backwards
while 3) recognizing 1A1A and deleting them (does this require having a
separate output stream?)
4) close the file (with the garbage sequences deleted).
Was never a big Perl guy but do have some old code that I'll take a look at
again. Still any pointers or instruction would be useful. In particular how to
identify (pattern match?) a 32-bit hex sequence (probably a simple thing to do)?
thanx.
pat
------------------------------
Date: 12 Dec 2002 15:35:44 -0800
From: tracyterrell@hotmail.com (TracyTererll)
Subject: Re: Determining file sizes
Message-Id: <8b5ee672.0212121535.6e21ac69@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnavelmv.66h.tadmc@magna.augustmail.com>...
> henrik nilsson <md0nilhe@mdstud.DIESPAMchalmers.se> wrote:
>
> > How do I determine the file sizes, owner etc of the files in a dir?
>
>
> perldoc -f -X
>
> perldoc -f stat
Warning: I am writing perl for WinXP, activestate, perl v5.6.1
I am using stat to get a file size, but I have problems because the
file is over 1GB. The returned byte size is accurate only to 953 MB
(999999999 bytes). Over that size, I get negative numers..... any
thoughts?
------------------------------
Date: 12 Dec 2002 15:55:16 -0800
From: tracyterrell@hotmail.com (TracyTererll)
Subject: Re: Determining file sizes
Message-Id: <8b5ee672.0212121555.35c234ef@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnavelmv.66h.tadmc@magna.augustmail.com>...
> henrik nilsson <md0nilhe@mdstud.DIESPAMchalmers.se> wrote:
>
> > How do I determine the file sizes, owner etc of the files in a dir?
>
>
> perldoc -f -X
>
> perldoc -f stat
I posted a question earlier on large file sizes on XP - I found the
answer in another post (credit Chris Eustace).
my $filesize = sprintf("%u", $size);
It is worth noting that I had the same problem with the -s file test,
but he result is still not accurate, even after being unsigned.
stat() gave the accurate result. For the record the file is 3.65 GB
(3,920,429,056 bytes).
------------------------------
Date: Fri, 13 Dec 2002 01:22:35 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Discerning an Open and Closed Socket...
Message-Id: <3DF97CAB.B73D7FAD@earthlink.net>
Brad W. Galiette wrote:
> I am attempting to create a server application in Perl that offers a
> simpleeyword-based data access system to be used by a separate,
> Windows-GUI
[snip]
When you said, "Windows/GUI", did you meant a GUI in a window, or a GUI
on the Windows Operating System?
Your code uses a number of outdated and/or unportable programming
constructs.
All of your socket stuff should be replaced with IO::Socket. Direct use
of the functions in Socket.pm is very outdated.
A loop of the form 'for (my $i = 0; $i < @arg_ele; $i++)' would be
better written as 'for my $line (@arg_ele)', unless $i is especially
important.
You cannot use the alarm() function on the Windows OS -- it doesn't work
there. Also, on Windows, fork() is emulated using threads and thus has
a fairly high overhead -- much more overhead than there would be if you
multiplexed your sockets using IO::Select.
Even if you're not on windows, it's a good idea to learn to multiplex
with IO::Select.
Consider the following [untested] code:
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket qw(CRLF);
use IO::Select;
# These are the only global variables.
my ($r, $w) = map IO::Select->new, 1, 2;
my %callbacks;
{
my $listener = IO::Socket::INET->new(
LocalPort => 2323,
Reuse => 1,
Listen => SOMAXCONN,
) or die "Couldn't create listening socket: $@";
$r->add($listener);
$callbacks{$listener}{read_callback} = \&do_accept;
}
while( 1 ) {
my $timeout;
if( !$w->count ) {
my $expire;
foreach my $info (values %callbacks) {
my $e = $info->{expire_at} or next;
$expire = $e if !$expire or $e < $expire;
}
$timeout = $expire ? time() - $expire : undef;
$timeout = 0 if defined($timeout) and $timeout < 0;
}
for my $rr (@{
# Yes, $w is passed in, and the corresponding
# arrayref is indeed ignored. This is on purpose;
# it has an effect on how long select() blocks.
(IO::Select->select($r, $w, undef, $timeout))[0]
or die "Error in select: $!";
}) {
$callbacks{$r}{read_callback}->($rrr);
}
for my $ww ($w->can_write(0)) {
$callbacks{$ww}{write_callback}->($ww);
}
my $now = time;
while( my ($sock_stringified, $info) = each %callbacks) ) {
next unless $info->{expire_callback};
$info->{expire_cb}->($sock_stringified);
}
}
# end of main loop.
sub do_accept {
my $listener = shift;
my $newsock = $listener->accept or die "Error in accept: $!\n";
$r->add($newsock);
$callbacks{$newsock} = {
fd => fileno($newsock),
read_callback = \&read_command,
input_buffer = "",
write_callback = \&do_write,
output_buffer = "",
data_id => "",
expire_at => (time() + 10),
expire_callback => \&do_expire,
};
# but don't add $newsock to $w.
}
sub closeit {
my ($client, $action, $e) = @_;
warn "Error $action socket: $!\n" if $e;
$_->remove($client) for $r, $w;
delete $callbacks{$client};
}
# ok, here's one more global variable.
my %commands = map { no strict 'refs'; \&{"do_$_"} }
qw(ANNC TIME STATUS QUIT LOGOFF);
sub read_command {
my $client = shift;
my $buffer = \ $callbacks{$client}{input_buffer};
my $n = sysread( $client, $$buffer, 8192, length $$buffer );
$n or return closeit( $client, "reading from", defined $n );
while( $$buffer =~ s/^((?s).*?)$CRLF// ) {
my ($command, $data) = $1 =~ /^(\w*)(.*)/s;
if( my $f = $commands{ uc $command } ) {
$f->($client, $data);
return if $f == \&do_QUIT or $f == \&do_LOGOFF;
} else {
my_print($client, "501 Command not recognized" . CRLF);
}
}
$callbacks{$client}{expire_at} = time() + 10;
}
sub my_print {
my ($client, $message) = @_;
$callbacks{$client}{outgoing_buffer} .= $message;
$w->add($client};
}
sub do_write {
my $client = shift;
my $buffer = \ $callbacks{$client}{outgoing_buffer};
local $SIG{PIPE} = 'IGNORE';
my $n = syswrite( $client, $$buffer )
or return closeit($client, "writing to", 1);
substr( $$buffer, 0, $n ) = "";
$w->remove($client) unless length $$buffer;
delete $callbacks{$client} unless $r->exists($client);
}
sub do_ANCC {
my ($client, $args) = @_;
my $data_id = \ $callbacks{$client}{data_id};
$args = "" unless defined $args;
if( length($args) and $$data_id eq $args ) {
my_print( $client, "230 $data_id" . CRLF );
return;
}
$$data_id = $args;
my_print( $client, "231 $$data_id" . CRLF );
for my $line ( @data_lines ) {
my @stuff = (split /\|/, $line)[3, 1, 2, 4];
my_print( $client, join( "|", @stuff ) . CRLF );
}
my_print( $client, "." . CRLF );
}
sub do_TIME {
my ($client, $arg) = @_;
my_print($client, join("|", (localtime)[2,1,0,4,3,5] ) . CRLF );
}
sub do_STATUS {
my ($client, $arg) = @_;
my_print($client, "220 1|HELLO" . CRLF );
}
sub do_QUIT { closeit( shift(), "", 0 ) }
BEGIN { *do_LOGOFF = \&do_quit }
sub do_expire {
my $callback_key = shift;
warn "Socket timed out\n";
my $fd = $callbacks{$callback_key}{$fd};
$_->remove($fd) for $r, $w;
delete $callbacks{$callback_key};
}
__END__
This is typed off the top of my head, and quite untested. But I think
that you get the idea, and perhaps more important, I think that this
*type* of program should be more understandable than that stuff you'd
had.
For a serious implementation, I would use a min-heap to keep track of
the timeouts. In addition, each warn()ing that I output would include
some info such as the results of gethostbyaddr or inet_aton upon
$client->peeraddr... maybe include $client->peerport, too.
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: 12 Dec 2002 20:28:44 -0800
From: miketaylorsf@yahoo.com (Mike)
Subject: Eject CD with Perl
Message-Id: <411fc73f.0212122028.415def6a@posting.google.com>
I need to create a perl script to eject a CD.
Can anybody help with providing the code to do that?
Thanks,
Mike
------------------------------
Date: Thu, 12 Dec 2002 21:32:44 -0700
From: "Rod" <palladium@spinn.net>
Subject: Re: Eject CD with Perl
Message-Id: <uvios0pvjaod70@corp.supernews.com>
"Mike" <miketaylorsf@yahoo.com> wrote in message
news:411fc73f.0212122028.415def6a@posting.google.com...
> I need to create a perl script to eject a CD.
>
> Can anybody help with providing the code to do that?
>
> Thanks,
>
> Mike
Depends on the OS Mike.
What OS you using?
On some versions of unix a system call to "eject cdrom" will work?
------------------------------
Date: 12 Dec 2002 20:20:15 -0800
From: beilyp@hotmail.com (bpaluch)
Subject: Hebrew to web from Access 2000
Message-Id: <1ee72a94.0212122020.2c926dd0@posting.google.com>
I am using Perl to display data from an Access 2000 database on the
web. I would like to enter Hebrew into the database, and then display
that on the web, as well. However, since Access stores in Unicode, it
seems to be causing trouble and cannot show on the web. All I get is
?????.
What charset should I specify, if any?
Do I need to use Unicode::String to help me with this?
I think in ASP this can be done with a codepage. Is there something
comparable in Perl?
Thank you.
------------------------------
Date: Thu, 12 Dec 2002 23:39:29 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Max fork'd proc limit...?
Message-Id: <3DF96481.DBFF5F64@earthlink.net>
Ron Ruble wrote:
>
> "Walter Roberson" <roberson@ibd.nrc.ca> wrote in message
> news:at3m6e$oje$1@canopus.cc.umanitoba.ca...
> <snip>
> > I believe I've read in this newsgroup
> > that Windows does not have
> > a unix-style fork that produces a
> > new process, and that on Windows
> > fork is implimented using threads.
> > 64 sounds like a plausible
> > "magic number" as to how many
> > threads might be allowed by Windows.
>
> Yes and no. Windows can start quite a large
> number of threads; but there is a per-process
> limit in pre-Win2K versions of Windows on
> thread-local-storage (TLS) entries.
>
> It isn't necessary to allocate a TLS-entry
> per thread, but VC and a few other C
> compilers do so by default, resulting in
> an artificial 64-thread limit.
>
> If this is the case, the code that performs
> the fork() for the Perl interpreter would
> need to be recompiled (and possibly
> modified to use TLS entries more
> sparingly).
Doesn't perl use thread-specific storage to store a copy of the pointer
to the perl interpreter in, so that one can write code which merely does
'dTHX;' near the top of the function, rather than needing to pass the
interpreter around as a parameter all the time?
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: Fri, 13 Dec 2002 00:31:01 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Module for MS SQL Server Access
Message-Id: <pkent77tea-0AAE71.00310113122002@news-text.blueyonder.co.uk>
In article <1039718698.353143@news.liwest.at>,
"Daniel Fabian" <strap@fabiand.net> wrote:
> > What is the best module to access an SQL Server Database? I only found
> > MSSQL::DBlib, but I always get an error when I try to compile it.
>
> I forgot to mention: From Linux. So I don't have ODBC to connect to it.
At work we use DBD::Proxy to connect from solaris to a windows machine
which _does_ have DBD::ODBC on it. It all worked straight out of the box
for us.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: 12 Dec 2002 17:23:20 -0800
From: stas@epost.de (Stas Neuberger)
Subject: Re: perl bad interpreter: No such file or directory
Message-Id: <bea0b7d7.0212121723.69baaa0a@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnaveq8k.1ja.tadmc@magna.augustmail.com>...
> Stas Neuberger <stas@epost.de> wrote:
>
> > the line feeds are unix style.
>
>
> Despite your assertions to the contrary, I persist in not believing them.
>
> Try this (on Unix):
>
> perl -pe 'tr/\r//d' myprog >myprog.out
>
> ls -l myprog myprog.out
>
>
> If the filesizes are the same, then you're right and we're wrong.
That did it. YOU are right. I'm wrong. actually, i don't know where
the \n\r came from, but thank you very much, and sorry for the stupid
question.
------------------------------
Date: Thu, 12 Dec 2002 18:07:48 -0600
From: Saul Spatz <sspatz@kcnet.com>
Subject: Re: Perl IDE suggestion for Win32 environment
Message-Id: <3DF924D4.2030200@kcnet.com>
http://open-perl-ide.sourceforge.net/
Kasp wrote:
> Hi,
> I would like your suggestion for a good IDE for developing and debugging
> Perl for windows environment.
> I heard about Komodo from ActiveState, but they have a 21 day trial version.
> I am a student and can not spend $s for software. So a freeware would be
> great.
> Thanks.
>
>
>
------------------------------
Date: Thu, 12 Dec 2002 21:17:48 -0700
From: "Rod" <palladium@spinn.net>
Subject: Re: Perl IDE suggestion for Win32 environment
Message-Id: <uvioa73m21ttf2@corp.supernews.com>
"Saul Spatz" <sspatz@kcnet.com> wrote in message
news:3DF924D4.2030200@kcnet.com...
> http://open-perl-ide.sourceforge.net/
>
> Kasp wrote:
> > Hi,
> > I would like your suggestion for a good IDE for developing and debugging
> > Perl for windows environment.
> > I heard about Komodo from ActiveState, but they have a 21 day trial
version.
> > I am a student and can not spend $s for software. So a freeware would be
> > great.
> > Thanks.
My personal free favorite is SciTE editor downloadable from
http://www.scintilla.org/wscite149.zip
at only (390K) download, not to bad for a windblows editor.
It supports 15 Languages with code highlighting output in the same window,
and full customization of colors, languages, etc.
and best of all..FREE.
(I do not work with the guys that write this) I am just an avid fan of the
editor.
Rodney
------------------------------
Date: Thu, 12 Dec 2002 23:26:11 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Question about Subroutines
Message-Id: <nW8K9.6433$dP.1884@nwrddc02.gnilink.net>
Extended Partition wrote:
> Hello Everyone,
>
> I am having a bit of trouble with subroutines. Here is a sample of
> code that mimics what I am doing in my real program:
> No my problem is that the value of $port_name is never returned. My
> output ends up being "PORT 21 is " and that's it. What am I doing
> wrong here?
You are not using strictures and warnings. If you would have asked perl to
help you it would have told several mistakes. I addition let me point out
some more inconsistencies:
> $this_port = "21";
Why do you stringify the number?
> &id_port($this_port);
Why are you using the & form of a function call?
You are never using the return value form id_port(). Did you mean
$port_name = id_port($this_port);
> print "PORT 21 is $port_name\n";
>
>
> sub id_port{
> $port_name = shift;
> if($port == 21){
$port is undefined at this moment.
Did you mean $port_name here?
> $port_name = "FTP";
> }
> else {
> $port_name = "Unknown";
> }
> return $port_name;
> }
'return'ing a global variable doesn't make sense.
I strongly suggest you rethink your use of global versus local variables.
And then use warnings and strict. It is not nice to ask people to do the job
a computer can do better and faster.
jue
------------------------------
Date: Thu, 12 Dec 2002 17:38:22 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Question about Subroutines
Message-Id: <slrnavi7fe.48l.tadmc@magna.augustmail.com>
Extended Partition <extendedpartition@NOSPAM.yahoo.com> wrote:
> Here is a sample of code that
> mimics what I am doing in my real program:
I sure hope not...
> $this_port = "21";
> &id_port($this_port);
^
^
I doubt that you really want that ampersand there.
See perlsub.pod for what the difference is.
> print "PORT 21 is $port_name\n";
You should not use global variables to communicate with
your subroutine, use the return value instead:
my $name = id_port($this_port);
print "PORT 21 is $name\n";
or
print 'PORT 21 is ', id_port($this_port), "\n";
> sub id_port{
> $port_name = shift;
> if($port == 21){
You have never given $port a value, so the else{} clause
will be evaluated every time you run the code.
> $port_name = "FTP";
> }
> else {
> $port_name = "Unknown";
> }
> return $port_name;
> }
>
>
> No my problem is that the value of $port_name is never returned.
That can't be your problem, as your code never makes use of the
return value from your subroutine.
> My output
> ends up being "PORT 21 is " and that's it. What am I doing wrong here?
I dunno.
When I run your code, I get:
PORT 21 is Unknown
just as I would have expected.
> Your
> help is greatly appreciated.
Can't duplicate the problem, can't help.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 12 Dec 2002 18:56:05 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: regexp help
Message-Id: <slrnavic15.48l.tadmc@magna.augustmail.com>
Lance Hoffmeyer <lance@augustmail.com> wrote:
> Given a file that looks like:
>
> TABLE 106
>
> Base - Rewards -* -* - -** 10 50 100 999 150 200 10 10
^^^^
> and a regexp:
>
> $file =~ /TABLE\s$_[0].*?BASE \- [^\-].*?(?:(\d{1,4}|\-)[\*]+?\s+){$colnum}/s;
^^^^
You should never have a "bare" m// operator like that, it should
always be in a conditional so that you can check whether it
succeeded or failed.
It can never match the string you've shown, you need a m//i option.
> where $_[0] = 106
> and $colnum = 8
>
> I am trying to grab the number 999.
What is it that identifies the thing that you want to get?
Looks like you want to get the 8th column, but that just leads
to another question:
How do you identify the start of the first column, so that
we can start counting columns?
> Usually there are no "-","-*","-**"
> but in this particular file there are.
Can the columns contain spaces?
> Also, the part that states "Base -
> Rewards" could say almost anything but it always starts with "Base -". This
> file is a set of tables where there is some text followed by a group of
> columns with numbers in them.
>
>
> The
> old syntax and table looked like:
>
> Base - Total Per 9 100 50 50 10 50 100 999 150 200 300 10 10
> 1) Line always starts with Base -
> 2) There is some amount of text after the "Base -" and perhaps a space
> between words
> 3) There is some amount of space
Where?
> 4) There are some columns with "\d+","\-","\-\*+?"
>
>
> How can I modify the above regexp to account for these items?
I dunno. Won't you accept a solution that does not use the above regex?
I will assume that there are 2 or more space characters before
the first column.
I will assume that there are no space characters in the
columns themselves.
I will assume that there are other "Table \d+" lines in the
string, else you could just start the match with /^Base/m.
That's an awful lot of assumptions. If any of them are wrong,
I've wasted your time and mine.
If it hadn't been for your fortunate choice of ISP, I would
have just skipped trying to answer your question. :-)
-------------------------
#!/usr/bin/perl
use strict;
use warnings;
my $file = 'TABLE 106
Base - Rewards -* -* - -** 10 50 100 999 150 200 10 10
TABLE 1060
Base - Not Me -* -* - -** 100 500 1000 9990 1500 2000 100 100
';
$_[0] = 106;
my $colnum = 8;
my $colval;
if ( $file =~ /TABLE $_[0]\n.*?\nBase.*? +(.*)/s ) {
$colval = (split( ' ', $1))[$colnum-1]
}
print "column #$colnum contains '$colval'\n";
-------------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Dec 2002 16:47:48 -0800
From: Tim Hammerquist <tim@vegeta.ath.cx>
Subject: Re: Spawn a new process in Perl?
Message-Id: <slrnaviatv.bb0.tim@vegeta.ath.cx>
Kasp graced us by uttering:
> I have another question.
> In Unix, we have fork() to spawn a process & Exec().
> Is there something in Perl like that? I want to run multiple
> instances of my program and I must ensure that it runs on both
> - Unix or Windows.
The perl functions fork() and exec() would be what you're looking
for.
The Win32 platform does not natively support the fork()
procedure, but Perl version 5.6 and above emulates fork() for
Win32 systems.
perldoc -f fork
perldoc -f exec
perldoc perlport
HTH
Tim Hammerquist
--
"The number of Unix installations has grown to 10, with more expected."
-- The Unix Programmer's Manual, 2nd Edition, June, 1972
------------------------------
Date: Thu, 12 Dec 2002 17:30:43 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: unix2dos newbie question
Message-Id: <slrnavi713.48l.tadmc@magna.augustmail.com>
Edward Quick <vervoom@hotmail.com> wrote:
> I need to perform a unix2dos function on $ftpbuf,
> but I'm not too sure how to do this in Perl.
If your Perl program is running on Unix:
$ftpbuf =~ s/\n/\r\n/g;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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.
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 4257
***************************************