[22020] in Perl-Users-Digest
Perl-Users Digest, Issue: 4242 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 10 14:06:03 2002
Date: Tue, 10 Dec 2002 11:05:13 -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, 10 Dec 2002 Volume: 10 Number: 4242
Today's topics:
@INC error in in unix <sunil_franklin@hotmail.com>
Re: @INC error in in unix <nobull@mail.com>
Re: @INC error in in unix <nobull@mail.com>
can somebody explain this statement? <hamunaptra@pandora.be.NOSPAM>
Re: can somebody explain this statement? <nobull@mail.com>
Can't find MakeRegex.pm (RonaldWS)
Re: cgi and perl on windows 98 ? <os7man@attbi.com>
Re: cgi and perl on windows 98 ? <kent@erix.ericsson.se>
Re: convert a date-time to an absolute value (in second <no@email.com>
Re: convert a date-time to an absolute value (in second <nobull@mail.com>
Re: convert a date-time to an absolute value (in second <a@b.c>
gtk-perl <stijn.gunst@pandora.be>
hidden eval variables <risto.vaarandi@eyp.ee>
Re: hidden eval variables (Walter Roberson)
Re: hidden eval variables <tassilo.parseval@post.rwth-aachen.de>
mtrace / Devel::Peek (TD)
Re: open (Walter Roberson)
Re: perl speed comparisom on windows and linux (eddie wang)
Re: Problem - Array as Member of Object <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Re: Problem - Array as Member of Object (Tad McClellan)
Re: Problem with range operator: for ($1 .. $2) (Tad McClellan)
Re: Problem with range operator: for ($1 .. $2) (Tad McClellan)
Re: RegEx question? <kurzhalsflasche@netscape.net>
Re: RegEx question? <usenet@dwall.fastmail.fm>
Re: RegEx question? (Tad McClellan)
Sending Email? <bob@bobber.com>
Time::HiRes question <spikey-wan@bigfoot.com>
Re: Time::HiRes question (Walter Roberson)
Re: Time::HiRes question <spikey-wan@bigfoot.com>
Re: Two pppd's one after the other... (Vittorio)
Re: Two pppd's one after the other... <nobull@mail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 10 Dec 2002 23:54:41 +0530
From: "Sunil" <sunil_franklin@hotmail.com>
Subject: @INC error in in unix
Message-Id: <vmqJ9.10$jV1.140@news.oracle.com>
I have a script which worked perfectly fine in win2000 Perl v5.6.1
I am using English, warnings, strict and diagnostics;
I moved the script to unix and it started giving errors like
Can't locate English.pm in @INC
(@INC contains:
'some directory I don't even have'
.....
'some other directory I don't even have' .
) at myprg.pl line 53.
The default perl in my path is of an older version and I was running my
program by using
/full/path/to/561/perl/bin/perl myprg.pl -Idir
/full/path/to/561/perl/lib/5.6.1
This does not help.
Any pointers on how to to deploy on unix? Any docs on it?
Thanks,
Sunil.
------------------------------
Date: 10 Dec 2002 18:38:37 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: @INC error in in unix
Message-Id: <u9znrdsor6.fsf@wcl-l.bham.ac.uk>
"Sunil" <sunil_franklin@hotmail.com> writes:
> (@INC contains:
> 'some directory I don't even have'
> .....
> 'some other directory I don't even have' .
> ) at myprg.pl line 53.
>
>
> The default perl in my path is of an older version and I was running my
> program by using
> /full/path/to/561/perl/bin/perl myprg.pl -Idir
> /full/path/to/561/perl/lib/5.6.1
You have made two careless mistakes in reading the perlrun manpage.
The 'dir' bit in '-Idir' is supposed to be read as a variable.
Switches to perl come before the script file. Any switches after the
script file are arguments to the script not arguments to perl.
/full/path/to/561/perl/bin/perl -I/full/path/to/561/perl/lib/5.6.1 myprg.pl
> Any pointers on how to to deploy on unix? Any docs on it?
Unix is the default OS.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 10 Dec 2002 18:43:27 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: @INC error in in unix
Message-Id: <u9vg21soj4.fsf@wcl-l.bham.ac.uk>
Brian McCauley <nobull@mail.com> writes:
> /full/path/to/561/perl/bin/perl -I/full/path/to/561/perl/lib/5.6.1 myprg.pl
I forgot to mention you probably need multiple -I switches, one for
each directory you want to prepend to @INC (you probably want to
include the architecture specfic and ones site-specific too).
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 10 Dec 2002 18:22:22 GMT
From: "HamuNaptra" <hamunaptra@pandora.be.NOSPAM>
Subject: can somebody explain this statement?
Message-Id: <yhqJ9.44738$Ti2.6978@afrodite.telenet-ops.be>
can somebody explain this statement?
grep /^[^\.]/
foreach (grep /^[^\.]/, readdir D){
$_="$_[0]\\$_";
-f $_ ?():()
}
------------------------------
Date: 10 Dec 2002 18:31:35 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: can somebody explain this statement?
Message-Id: <u94r9lu3nc.fsf@wcl-l.bham.ac.uk>
"HamuNaptra" <hamunaptra@pandora.be.NOSPAM> writes:
> can somebody explain this statement?
> grep /^[^\.]/
No, that is not a complete statement - it does not compile: "Not
enough arguments for grep"
For a description of the Perl grep function:
perldoc -f grep
The pattern /^[^\.]/ matches any string that starts with a character
other than a period. Or to put it another way, any non-empty string
that doesn't start with a period.
For an explaination of Perl regular expressions:
perldoc perlre
------------------------------
Date: 10 Dec 2002 17:12:57 GMT
From: ronaldws@aol.com (RonaldWS)
Subject: Can't find MakeRegex.pm
Message-Id: <20021210121257.22587.00006831@mb-me.aol.com>
MakeRegex.pm seems to be needed to extend the list of names for
Lingua::En::Nickname.. The only plausible link to this module I have found is
http://www.netch.se/~hakank/makeregex/ and that link no longer seems to be
functioning. Does anyone know where I can get the module?
Thanks in advance,
Ron Schmidt
------------------------------
Date: Tue, 10 Dec 2002 16:46:56 GMT
From: Eric Osman <os7man@attbi.com>
Subject: Re: cgi and perl on windows 98 ?
Message-Id: <3DF61AEA.B70BECCC@attbi.com>
Sheila, what are you really cautioning me against ?
> Alan is cautioning you against inadvertently setting something up on a
> website, that would allow anyone to send any email through the script. Try
> searching on "formmail exploit" on Google.
>
> Here's the link for you:
> http://www.google.com/search?q=%22formmail+exploit
>
Are you cautioning me against using some specific
formmail.pl (by the way, what does p.l. stand for here?)
?
Or are you cautioning me against sending *any* email
from my CGI perl script in response to user clicking
SUBMIT on a form ?
If you're cautioning me against using some specific
formmail.pl then you're way ahead of me here, because
I was going to probably write my own script that
used whatever sendmail black box is supplied with
indigostar (which I've installed, thanks to previous
posters, it looks really useful thanks !) .
I wasn't planning on using formmail.pl because I didn't
even know it existed !
But if you're cautioning me against sending email
*at all* in response to a SUBMIT button, then please
explain to me what the situation is that I need
to avoid in my design for the spam danger.
Here's my envisioned design:
o Form gets displayed
o User fills in fields
o User clicks SUBMIT
o My CGI perl script packages the form into an
email and sends it to os7man@attbi.com (that's
MY email address ).
Is this inherently a bad idea ? Or is it only
a bad idea if I use some pre-packaged formmail.pl
that's been shown to have a security hole ?
Thanks. /Eric
--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.
HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html
------------------------------
Date: Tue, 10 Dec 2002 17:43:26 GMT
From: Kent Boortz <kent@erix.ericsson.se>
Subject: Re: cgi and perl on windows 98 ?
Message-Id: <d265u1kbxd.fsf@erix.ericsson.se>
Eric Osman <os7man@attbi.com> writes:
> But if you're cautioning me against sending email
> *at all* in response to a SUBMIT button, then please
> explain to me what the situation is that I need
> to avoid in my design for the spam danger.
>
> Here's my envisioned design:
>
> o Form gets displayed
> o User fills in fields
> o User clicks SUBMIT
> o My CGI perl script packages the form into an
> email and sends it to os7man@attbi.com (that's
> MY email address ).
>
> Is this inherently a bad idea ? Or is it only
> a bad idea if I use some pre-packaged formmail.pl
> that's been shown to have a security hole ?
If you don't pass on destination email addresses from the form and
check the user input carefully before passing data from the form on to
the mail sending "black box" then everything is fine. Problem is that
you can't trust the caller of your script to use your form. So if for
example the Unix sendmail is used to send the mail and your script
looks like
use CGI qw(:cgi);
use CGI::Carp qw(fatalsToBrowser);
use strict;
use diagnostics;
my $sendmail = "/sbin/sendmail";
# I know that more flags should be added to sendmail, don't remeber which one
open(MAIL,"$sendmail -t |") or die "Can't run $sendmail: $!";
print MAIL "To: os7man@attbi.com\n";
print MAIL "From: ", param('from'), "\n";
print MAIL "Subject: Form submission\n";
print MAIL "\n"; # extra newline terminates header
print MAIL param('content');
close MAIL;
This is not a safe way to call sendmail. The user may insert text into
the form 'from' field with a newline and insert new mail headers, like
additional "To: persontospam1, persontospam2....". Using a HTML tag
that don't allow a newline doesn't help, your script may be called
from another FORM created by the evil cracker.
If you are 100% sure the "black box" mail sending program will check
the input careful enough, fine. Else you need to add input data checking
(a good thing anyway) so that you know that the input is what you
expected.
As a general rule, don't expect your CGI to be called the way you
indended. Check the syntax of all user input. You can add the "taint"
-T switch to Perl to get warnings about data that is passed from
outside Perl that is used in an unsafe way. You "untaint" by matching
out what you want, for example (code not tested)
my $category_input = param('category'); # Get the user input
$category_input =~ /^(\w+)$/; # We only allow alphanumeric word
my $category = $1;
open(ITEMS,"$base/$category.txt") or die "Can't open....";
while (my $row = <ITEMS>) {
my ($no,$link,$name) = split(' ',$row,3);
print qq($no <a href="$link">$name</a><br>\n);
}
close ITEMS;
Without this matching a cracker could view the server password file on
some machines or do other nasty things.
If you want to use the script to be used in different forms with
different destinations you could use a short nickname in the form and
have a name mapping in your script, like
my %valid_destinations =
(
knatte => "gordon@mynet.com",
fnatte => "ken@mynet.com",
tjatte => "susan@mynet.com",
);
my $to = $valid_destinations{param('to')};
$to or die "Not a valid destination user";
kent
--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.
HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html
------------------------------
Date: Tue, 10 Dec 2002 17:45:19 -0000
From: "Brian Wakem" <no@email.com>
Subject: Re: convert a date-time to an absolute value (in seconds or so)
Message-Id: <at597g$vn6vs$1@ID-112158.news.dfncis.de>
"ZZT" <a@b.c> wrote in message news:at4rpv$k3e$1@news1.wdf.sap-ag.de...
> Hello,
>
> I have the following time-format from a source:
>
> Mon, 9 Dec 2002 14:14:57
>
> and would like to convert it in a format like time() returns.
> Is there a way?
>
> thanks
>
$_ = "Mon, 9 Dec 2002 14:14:57";
use Time::Local;
my $time;
my @month = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my %month = map { $month[$_] => $_ } 0 .. $#month;
if(/^\w+,\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+)$/) {
$time = timelocal($6, $5, $4, $1, $month{$2}, $3);
}
print $time;
--
Brian Wakem
------------------------------
Date: 10 Dec 2002 17:46:01 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: convert a date-time to an absolute value (in seconds or so)
Message-Id: <u9k7ihu5ra.fsf@wcl-l.bham.ac.uk>
ZZT <a@b.c> writes:
> I have the following time-format from a source:
>
> Mon, 9 Dec 2002 14:14:57
>
> and would like to convert it in a format like time() returns.
> Is there a way?
Please see FAQ: "How can I take a string and turn it into epoch seconds?"
It is not considered polite behaviour to post a question to a Usenet
group without looking to see if it is in the FAQ first.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 10 Dec 2002 19:59:32 +0100
From: ZZT <a@b.c>
Subject: Re: convert a date-time to an absolute value (in seconds or so)
Message-Id: <at5dil$3bm$1@news1.wdf.sap-ag.de>
Brian Wakem wrote:
> $_ = "Mon, 9 Dec 2002 14:14:57";
> use Time::Local;
> my $time;
> my @month = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
> my %month = map { $month[$_] => $_ } 0 .. $#month;
> if(/^\w+,\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+)$/) {
> $time = timelocal($6, $5, $4, $1, $month{$2}, $3);
> }
>
> print $time;
thanks a lot - works fine :)
bye
------------------------------
Date: Tue, 10 Dec 2002 17:37:21 GMT
From: Leo <stijn.gunst@pandora.be>
Subject: gtk-perl
Message-Id: <lDpJ9.44668$Ti2.7039@afrodite.telenet-ops.be>
hi,
i have trouble getting gtk-perl installed
this is what the error-output looks like (piece of output of make, see
bottom)
the linker tries to link the object-files, but i noticed the object file
aren't in dir xs/ but one dir higher up
i don't find people with same problem on Google, which is strange, as i'm
only doing a standard install (perl Makefile.PL, make, make install)
how can i have this module compiled and installed??
rm -f ../blib/arch/auto/Gtk/Gtk.so
LD_RUN_PATH="/usr/lib:/usr/X11R6/lib" gcc -shared -L/usr/local/lib
xs/GtkMenuBar.o xs/GtkCheckMenuItem.o xs/Gtk-1.2.o xs/GtkMenuItem.o
xs/GtkCombo.o xs/GtkToggleButton.o xs/GtkCTree.o xs/GtkRange.o
xs/GtkAlignment.o xs/GtkRadioButton.o xs/GtkLabel.o xs/GtkPreview.o
xs/GtkMenuShell.o xs/GtkAspectFrame.o xs/GtkObject.o xs/GtkVScrollbar.o
xs/GtkFileSelection.o xs/GtkHRuler.o xs/GtkArrow.o xs/GtkSocket.o
xs/GtkViewport.o xs/GtkBox.o xs/GtkEntry.o xs/GtkTree.o xs/GtkList.o
xs/GtkBin.o xs/GtkVRuler.o xs/GtkScrollbar.o xs/GtkFontSelection.o
xs/GtkSelection.o xs/GtkItem.o xs/GtkItemFactory.o xs/GtkOptionMenu.o
xs/GtkDrawingArea.o xs/GtkAccelGroup.o xs/GtkWindow.o xs/GtkTooltips.o
xs/GtkStatusbar.o xs/GtkEventBox.o xs/GtkTreeItem.o xs/GtkCalendar.o
xs/GtkImage.o xs/GtkPaned.o xs/GtkFrame.o xs/GtkPlug.o xs/GtkHScale.o
xs/GtkVPaned.o xs/GtkSeparator.o xs/GtkScale.o xs/GtkAccelLabel.o
xs/GtkProgressBar-1.1.o xs/GtkToolbar-1.1.6.o xs/GtkCList-1.2.o
xs/GtkContainer.o xs/GtkMenu.o xs/GtkNotebook.o xs/GtkHBox.o
xs/GtkToolbar.o xs/GtkCList.o xs/GtkTipsQuery.o xs/GtkCurve.o
xs/GtkHScrollbar.o xs/GtkVButtonBox.o xs/Gtk-1.1.o xs/GtkCheckButton.o
xs/GtkHPaned.o xs/Gtk.o xs/GtkVScale.o xs/GtkTable.o xs/GtkProgressBar.o
xs/GtkDialog.o xs/GtkData.o xs/GtkPacker.o xs/GtkVBox.o xs/GtkText.o
xs/GtkHandleBox.o xs/GtkHButtonBox.o xs/GtkInputDialog.o xs/GtkRuler.o
xs/GtkColorSelectionDialog.o xs/GtkFixed.o xs/GtkTearoffMenuItem.o
xs/GtkFontSelectionDialog.o xs/GtkLayout.o xs/GtkAdjustment.o
xs/GtkPixmap.o xs/GtkColorSelection.o xs/GtkButtonBox.o xs/GtkVSeparator.o
xs/GtkScrolledWindow.o xs/GtkGammaCurve.o xs/GtkProgress.o xs/GtkListItem.o
xs/GtkButton.o xs/GtkMisc.o xs/GtkSpinButton.o xs/GtkHSeparator.o
xs/GtkRadioMenuItem.o xs/GtkEditable.o xs/GtkInvisible.o xs/GtkWidget.o
GdkTypes.o build/PerlGtkExt.o MiscTypes.o Derived.o GtkTypes.o
build/GtkDefs.o -o ../blib/arch/auto/Gtk/Gtk.so -L/usr/X11R6/lib
-L/usr/lib -lgtk -lgdk -lgmodule -lgthread -lglib -lpthread -ldl -lXi
-lXext -lX11 -lm
gcc: xs/GtkMenuBar.o: No such file or directory
gcc: xs/GtkCheckMenuItem.o: No such file or directory
gcc: xs/Gtk-1.2.o: No such file or directory
gcc: xs/GtkMenuItem.o: No such file or directory
gcc: xs/GtkCombo.o: No such file or directory
gcc: xs/GtkToggleButton.o: No such file or directory
gcc: xs/GtkCTree.o: No such file or directory
gcc: xs/GtkRange.o: No such file or directory
gcc: xs/GtkAlignment.o: No such file or directory
gcc: xs/GtkRadioButton.o: No such file or directory
gcc: xs/GtkLabel.o: No such file or directory
gcc: xs/GtkPreview.o: No such file or directory
gcc: xs/GtkMenuShell.o: No such file or directory
gcc: xs/GtkAspectFrame.o: No such file or directory
gcc: xs/GtkObject.o: No such file or directory
gcc: xs/GtkVScrollbar.o: No such file or directory
gcc: xs/GtkFileSelection.o: No such file or directory
gcc: xs/GtkHRuler.o: No such file or directory
gcc: xs/GtkArrow.o: No such file or directory
------------------------------
Date: Tue, 10 Dec 2002 19:31:44 +0200
From: Risto Vaarandi <risto.vaarandi@eyp.ee>
Subject: hidden eval variables
Message-Id: <3DF62500.B4EE12B2@eyp.ee>
hi,
I would like to build an expression calculator that would read user
input from stdin and rely on perl's eval() to calculate the expression
the user entered.
However, with eval() the user can actually set variables inside the
program if he/she wants to. E.g., if user enters $a = 1 and there is a
variable called $a in the main perl program, the value of that variable
will be changed.
Is there any way to avoid that? (with eval() or some other way?)
br,
risto
------------------------------
Date: 10 Dec 2002 17:44:01 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: hidden eval variables
Message-Id: <at5951$i09$1@canopus.cc.umanitoba.ca>
In article <3DF62500.B4EE12B2@eyp.ee>,
Risto Vaarandi <risto.vaarandi@eyp.ee> wrote:
:I would like to build an expression calculator that would read user
:input from stdin and rely on perl's eval() to calculate the expression
:the user entered.
:However, with eval() the user can actually set variables inside the
:program if he/she wants to. E.g., if user enters $a = 1 and there is a
:variable called $a in the main perl program, the value of that variable
:will be changed.
:Is there any way to avoid that? (with eval() or some other way?)
You could use the Safe module, but you would be better advised
to sanitize the input to only allow the kinds of operations that you
want. Watch out for ++ and watch out for functions that have
side-effects, and watch out for die() and for many other things...
--
Ceci, ce n'est pas une idée.
------------------------------
Date: 10 Dec 2002 18:56:43 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: hidden eval variables
Message-Id: <at5ddb$hl7$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Risto Vaarandi:
> I would like to build an expression calculator that would read user
> input from stdin and rely on perl's eval() to calculate the expression
> the user entered.
> However, with eval() the user can actually set variables inside the
> program if he/she wants to. E.g., if user enters $a = 1 and there is a
> variable called $a in the main perl program, the value of that variable
> will be changed.
> Is there any way to avoid that? (with eval() or some other way?)
First make sure that the script that eval()s the code runs under
strictures (use strict). After that, separate your script from the stuff
that gets dynamically executed through a block:
use strict;
{
# ordinary script
...
call_eval();
}
sub call_eval {
eval <STDIN>;
}
Thus you can protect all lexical variables from the upper block. They
will be invisible within call_eval() as long as they are declared with
my().
As for global variable, they need to be fully qualified under strictures
(instead of $var, it would need to be $main::var). This should also catch a
few of these cases.
However, this is still not a catch-all mechanism. If you just want to
prevent accidental side-effects on other variables it is certainly
better than nothing. But if you are going to do more serious stuff, it
is not. Also, when input can come from potentially any user, take into
account that the string could also be:
system "rm -rf /";
or something similarily malicious.
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: 10 Dec 2002 10:03:32 -0800
From: tushar08@yahoo.com (TD)
Subject: mtrace / Devel::Peek
Message-Id: <584a8362.0212101003.44d0652d@posting.google.com>
Hello all,
I have some problem with memory leak in my perl programs. Is there any
url where I can get a binary distribution of perl that is compiled
with mtrace built in it. I went thru perlguts/perldebug/perldebguts it
says you need to have perl version that can do memory footprint
debugging. I tried Devel::Peek and tried to use mstat() it did not
worked.
Can anyone please advise. Thanks in advance
PERL version
Summary of my perl5 (revision 5 version 6 subversion 1) configuration:
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
usethreads=undef use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='cl', ccflags ='-nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE
-DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX',
optimize='-O1 -MD -DNDEBUG',
cppflags='-DWIN32'
ccversion='', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -release
-libpath:"C:/Perl\lib\CORE" -machine:x86'
libpth="D:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\Lib\" "C:\Perl\lib\CORE"
libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib
odbc32.lib odbccp32.lib msvcrt.lib
perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib
version.lib odbc32.lib odbccp32.lib msvcrt.lib
libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
-libpath:"C:/Perl\lib\CORE" -machine:x86'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS
PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
Locally applied patches:
ActivePerl Build 633
Built under MSWin32
Compiled at Jun 17 2002 21:33:05
%ENV:
PERL5LIB="c:\dev_apps\lib;c:\dev_apps\mapper\lib2;c:\dev_apps\ezemail\src;c:\dev_apps\mapper\app\DU\src;c:\dev_apps\ezspam\src;."
PERLDB_OPTS="RemotePort=127.0.0.1:2000"
@INC:
c:\dev_apps\lib
c:\dev_apps\mapper\lib2
c:\dev_apps\ezemail\src
c:\dev_apps\mapper\app\DU\src
c:\dev_apps\ezspam\src
.
C:/Perl/lib
C:/Perl/site/lib
.
------------------------------
Date: 10 Dec 2002 17:54:24 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: open
Message-Id: <at59og$i9i$1@canopus.cc.umanitoba.ca>
In article <at533t$hvd$1@discovery.ens-cachan.fr>,
David Nowak <David.Nowak_NS@libertysurf.fr> wrote:
:In perl 5.6.1,
: open (STDOUT, ">/tmp/xxx");
: close(STDOUT);
: open (STDOUT, ">-");
: print "B";
: exit 0;
:never prints the B. If I replace ">-" with ">/tmp/yyy" then the B is correctly
:printed in the file /tmp/yyy.
:What's wrong?
Opening ">-" opens the descriptor to the current location of STDOUT,
but you closed STDOUT in the line above, so the current location
is effectively /dev/null .
You should not expect STDOUT to still be pointed at the file,
because you explicitly closed that connection. open() and
kin have no memory: there is no way to specify that you want
to open to "the last place that STDOUT was open to before I
closed it"
--
Ceci, ce n'est pas une idée.
------------------------------
Date: 10 Dec 2002 10:00:34 -0800
From: eddiekwang@hotmail.com (eddie wang)
Subject: Re: perl speed comparisom on windows and linux
Message-Id: <879e0e64.0212101000.3d93e41b@posting.google.com>
Thank you everyone!
SendNoSpam <SendNoSpam> wrote in message news:<31havuctq24qrtbab7uleljds678hqfuid@4ax.com>...
> On 9 Dec 2002 16:14:53 -0800, eddiekwang@hotmail.com (eddie wang)
> wrote:
>
> >hello, does anyone know if perl would run faster on linux than on
> >windows, given the same computer? If so, is the difference very
> >dramatic?
> >
> >Thank you in advance.
> >edy
>
> I regularly extract data from several hundred .html files at a crack.
> Bascially open the file, parse, extract wanted data with a set of
> regexes, and write results into an output file, one file per input
> file processed. I have run jobs on either a desktop 866MHz Dell
> running Win2k (ActiveState perl 5.6.1) OR a server on a 550MHz Dell
> running RedHat 7.1 (perl 5.6.0) . I haven't done formal measurements,
> but I do observe that RH is faster. The Linux file system is much
> faster than Win2k.
>
> Mark
------------------------------
Date: Tue, 10 Dec 2002 17:08:30 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Problem - Array as Member of Object
Message-Id: <newscache$6ivw6h$2lh$1@news.emea.compuware.com>
Tad McClellan wrote (Tuesday 10 December 2002 15:59):
> Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com> wrote:
>> You just stuffed a list in a scalar.
> No, he just stuffed an _array_ in a scalar.
>> Evaluating a list in a scalar context
> A list cannot exist is scalar context.
> An array can though.
> "there's no such thing as a list in scalar context"
> Quoted from this Perl FAQ:
[Per FAQ read, understood and snipped]
>> yields the number of elements in that list.
> s/list/array/;
With all due respect Ted, isn't this an academic discussion without
real-life implications? I do agree that advice should always be to the
point, technically and theoretically correct (with which I am not always
successful). But is there anyone making a difference between the two? I am
not.
--
KP
------------------------------
Date: Tue, 10 Dec 2002 11:25:10 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Problem - Array as Member of Object
Message-Id: <slrnavc8rm.2u1.tadmc@magna.augustmail.com>
Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com> wrote:
[snip "What is the difference between a list and an array?"]
> With all due respect Ted,
^
^
s/e/a/;
> isn't this an academic discussion without
> real-life implications?
I doubt it would be included in the FAQ if it never made a difference :-)
One important difference is that you can take a reference to an
array, you cannot take a reference to a list.
Another is that subroutines can return lists, but not arrays.
> But is there anyone making a difference between the two?
In list context, there is no important difference, because perl
will DWIM an array into the list that is contained in the array.
So the below discussion is concerned with scalar context.
There are 2 ways of getting a list: a literal list or a
list operator (function).
If you (try to) use a literal list, you get the comma operator instead.
If a list operator, then there are myriad possible results,
you'll have to check the docs for the operator to know
what to expect when the operator is used in scalar context.
eg:
--------------------------------------
#!/usr/bin/perl
use warnings;
use strict;
print scalar(array()), "\n";
print scalar(list()), "\n";
print scalar(list_grep()), "\n";
print scalar(list_reverse()), "\n";
sub array {
my @ra = (0, 1, 2);
return @ra;
}
sub list {
return 0, 1, 2;
}
sub list_grep {
return grep $_ >= 0, 0, 1, 2;
}
sub list_reverse {
return reverse 0, 1, 2;
}
--------------------------------------
output:
3
2
3
210
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 10 Dec 2002 09:58:27 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Problem with range operator: for ($1 .. $2)
Message-Id: <slrnavc3p3.2hc.tadmc@magna.augustmail.com>
Robert Szczygiel <RobTM@fake.addr.ess> wrote:
> Pasi Ryhanen wrote:
>> for ($1 .. $2) {
>> Could somebody enlighten me on what is happening here?
>> (The documentation (perlop) talks about "magical auto-increment
>> algorithm", but I don't quite see how it could explain this.)
The range operator (in list context) makes use of the magical
auto-increment algorithm if the operands are strings.
^^^^^^^^^^^^^^^^^^^^^^^^^^^
> I will not enlighten you as I do not know why it works like that,
> but using:
> for ($1 .. $2+0)
> seems to help. :-))
>
> Somebody could explain?
You've forced the right operand to be a number rather than a string,
so you get "regular" (numeric) incrementing.
But that does not explain why there is no output without the '+0' ...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 10 Dec 2002 11:34:18 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Problem with range operator: for ($1 .. $2)
Message-Id: <slrnavc9cq.2u1.tadmc@magna.augustmail.com>
Peter Scott <peter@PSDT.com> wrote:
> What I find curious is that after being in existence for nearly three years this
> bug was reported to p5p, discovered on the Perl Quiz of the Week, and reported
> here, all within the space of two months.
And when I learn a new word that I'd never seen before,
I'll see it used several times in the following few weeks. :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 10 Dec 2002 17:12:42 +0100
From: Dominik Seelow <kurzhalsflasche@netscape.net>
Subject: Re: RegEx question?
Message-Id: <at53sv$10e2v1$2@fu-berlin.de>
Recently, Mike told us:
> hello,
>
> i am trying to write a regular expression to match this line:
>
> 11449971_770_jig
>
> the numbers can be anything.
>
> i have this simple program:
>
> $name = "11449971_770_jig";
> if ($name =~ /\d_\d_jig$/) { print "yes"; } else { print "no"; }
>
> but it doesn't seem to match the line, i think the problem has to do
> with the underscore before the \d. i can match up to "\d_jig$", but
> as soon as i add an underscore before the \d like this: "_\d_jig$" the
> regex doesn't match.
>
> any help would be appreciated.
>
> thanks,
>
> -Mike
Hello Mike,
you simply forgot the quantifier.
\d will match *only* one digit.
So it should be
if ($name =~ /\d+_\d+_jig$/) { print "yes"; } else { print "no"; }
However, IMO it is better to write this as
if ($name =~ /\d+_\d+_jig$/) {
print "yes";
}
else {
print "no";
}
or, if you're fond of brevity, as
($name =~ /\d+_\d+_jig$/) ? print "yes" : print "no";
HTH,
Dominik
------------------------------
Date: Tue, 10 Dec 2002 17:51:49 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: RegEx question?
Message-Id: <Xns92E082DB0801Adkwwashere@216.168.3.30>
Dominik Seelow <kurzhalsflasche@netscape.net> wrote on 10 Dec 2002:
> or, if you're fond of brevity, as
> ($name =~ /\d+_\d+_jig$/) ? print "yes" : print "no";
That's using the ?: operator in void context. It's valid Perl, but why
bother evaluating an expression if you're just going to throw the value
away?
How about this instead:
print ($name =~ /\d+_\d+_jig$/) ? "yes" : "no";
That makes it clearer that the idea is to print something. It's
shorter, too.
--
David K. Wall
"Oook."
------------------------------
Date: Tue, 10 Dec 2002 11:30:49 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: RegEx question?
Message-Id: <slrnavc969.2u1.tadmc@magna.augustmail.com>
Dominik Seelow <kurzhalsflasche@netscape.net> wrote:
> ($name =~ /\d+_\d+_jig$/) ? print "yes" : print "no";
I'd call that an abuse of the ?: operator, since it has side-effects.
I'd write it in a side-effect free manner instead:
print $name =~ /\d+_\d+_jig$/ ? "yes" : "no";
(Not really. I'd really use your if{}else{} that I snipped :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 10 Dec 2002 18:26:05 GMT
From: Bob <bob@bobber.com>
Subject: Sending Email?
Message-Id: <3DF631BD.80803@bobber.com>
Hi,
I need to send an email to several users from my perlscript (running on
linux). Searching CPAN and google show a LOAD of different modules as
well as non-modular methods ( piping to sendmail, ..? ).
Is there any one that is better or should I just take my pick?
Thanks
B
------------------------------
Date: Tue, 10 Dec 2002 17:20:17 -0000
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Time::HiRes question
Message-Id: <at57ps$p3k$1@newshost.mot.com>
Hello World!
If I do this...
$start = [gettimeofday()];
#do a command that I want to time
$end = [gettimeofday()];
$interval = tv_interval ($start, $end);
What units will $interval be in? Seconds, ms, or us?
Thanks.
R.
------------------------------
Date: 10 Dec 2002 17:39:30 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: Time::HiRes question
Message-Id: <at58si$hps$1@canopus.cc.umanitoba.ca>
In article <at57ps$p3k$1@newshost.mot.com>,
Richard S Beckett <spikey-wan@bigfoot.com> wrote:
:If I do this...
:$interval = tv_interval ($start, $end);
:What units will $interval be in? Seconds, ms, or us?
perldoc -m Time::HiRes
[...]
Returns the floating seconds between the two times, which should have
been returned by gettimeofday()
--
Would you buy a used bit from this man??
------------------------------
Date: Tue, 10 Dec 2002 18:18:10 -0000
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Re: Time::HiRes question
Message-Id: <at5b6d$ps2$1@newshost.mot.com>
"Walter Roberson" <roberson@ibd.nrc.ca> wrote in message
news:at58si$hps$1@canopus.cc.umanitoba.ca...
> In article <at57ps$p3k$1@newshost.mot.com>,
> Richard S Beckett <spikey-wan@bigfoot.com> wrote:
> :If I do this...
>
> :$interval = tv_interval ($start, $end);
>
> :What units will $interval be in? Seconds, ms, or us?
>
> perldoc -m Time::HiRes
>
> [...]
> Returns the floating seconds between the two times, which should have
> been returned by gettimeofday()
> --
> Would you buy a used bit from this man??
Hehehe! Thanks Walter. I did read the docs, but got confused by the part
about an array, and getting the results in ms and seconds.
Get your lurvely bits 'ere. Nice 'n cheep! ;-)
R.
------------------------------
Date: 10 Dec 2002 10:33:40 -0800
From: vic50@email.it (Vittorio)
Subject: Re: Two pppd's one after the other...
Message-Id: <c942feb2.0212101033.447e9ef1@posting.google.com>
"perlsage" <eldar@iki.fi> wrote in message news:<XEiJ9.22158$ZE1.468328@news1.nokia.com>...
> Not always, you can also use BEGIN block, it is
> executed when the program loads, like:
>
> sub BEGIN {
> system ("/usr/sbin/pppd call callbacku");
> system ("/usr/sbin/pppd call secondcall");
> }
>
> "Vittorio" <vic50@email.it> wrote in message
> news:c942feb2.0212090503.1d7916fc@posting.google.com...
> > Bart Lateur <bart.lateur@pandora.be> wrote in message
> news:<b7h7uu03k0b5g7opqom42bknttv32apok3@4ax.com>...
> >
> > > system()? That will wait until the launched program exits.
> >
> >
> > Well I did it the following:
> > -----------------------------------------------------------
> > #!/usr/bin perl -w
> > #
> > print "Begin firstcall\n";
> > system ("/usr/sbin/pppd call callbacku");
> > print"End callback\n";
> >
> > print "Begin answering\n";
> > system ("/usr/sbin/pppd call secondcall");
> > #system "ls ppp*";
> > print "End answer\n";
> >
> > exit;
> > --------------------------------------------------
>
Perhaps I forgot to highlight with the right enphasis that I'am an
absolute beginner with perl.
Could you please be more straightforward and a bit less synthetic?
In a nutshell, what should I do step by step?
Ciao
Vittorio
------------------------------
Date: 10 Dec 2002 18:49:18 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Two pppd's one after the other...
Message-Id: <u9r8cpso9d.fsf@wcl-l.bham.ac.uk>
vic50@email.it (Vittorio) writes:
> Bart Lateur <bart.lateur@pandora.be> wrote in message news:<b7h7uu03k0b5g7opqom42bknttv32apok3@4ax.com>...
>
> > system()? That will wait until the launched program exits.
> print "Begin answering\n";
> system ("/usr/sbin/pppd call secondcall");
> #system "ls ppp*";
> print "End answer\n";
>
> exit;
> --------------------------------------------------
>
> Without success. As a matter of fact - keeping an eye on
> /var/log/messages - I see starting and completing the first call pppd
> process only (not the second), whilst the perl program is executed to
> the end (It prints "End answer").
>
> PLEASE HELP
As Bart correctly points out system() wait until the launched program
exits.
I suspect your problem is that /usr/sbin/pppd does a fork-off-and-die.
You probably want to prevent it from doing this.
IIRC there's an argument for pppd do this, but this has nothing to do
with Perl.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
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 4242
***************************************