[17648] in Perl-Users-Digest
Perl-Users Digest, Issue: 5068 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 8 21:05:33 2000
Date: Fri, 8 Dec 2000 18:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976327508-v9-i5068@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 8 Dec 2000 Volume: 9 Number: 5068
Today's topics:
Re: Algorithm::Diff -- why does diff() return LOLOL ins <iltzu@sci.invalid>
Re: Anywhere to put my scripts? <harrisr@bignet.net>
Re: behavior of open "+>>" <iltzu@sci.invalid>
dynamic require & new on variable package <simonmcc@nospam.nortelnetworks.com>
eval() performance <spam@klamath.dyndns.org>
Re: File Operator -A Question <ren.maddox@tivoli.com>
Re: How do I find out my own IP Address? <brondsem@my-deja.com>
Re: How do I find out my own IP Address? <harrisr@bignet.net>
Re: How do I find out my own IP Address? (Michael Fuhr)
Re: How do I find out my own IP Address? <tony_curtis32@yahoo.com>
Re: How do I find out my own IP Address? (Michael Fuhr)
Re: IOT/Abort trap running using setuid wrapper AIX (Martien Verbruggen)
Re: List Values and Arrays (Tad McClellan)
Re: multi keyed hash or array (Chris Fedde)
Re: multi keyed hash or array <jdhunter@nitace.bsd.uchicago.edu>
Re: Newbie File Uploading Problem <nospam@bml.uk-mart.co.uk>
Re: number vs string <dwb1@home.com>
Perl Help with LWP <ng@fnmail.com>
Re: problems with perlcc <someone@compugenx.com>
Re: Sybase heterogeneous copy <mpeppler@peppler.org>
Re: untaint a regular expression <elijah@workspot.net>
Re: Uploading file via CGI <g.soper@soundhouse.co.uk>
Re: Yesterdays Date (Martien Verbruggen)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Dec 2000 23:36:39 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Algorithm::Diff -- why does diff() return LOLOL instead of LOL?
Message-Id: <976317794.25617@itz.pp.sci.fi>
In article <iowa88_song88.remove_eights-0812001312100001@121.salt-lake-city-08-09rs.ut.dial-access.att.net>, Weston Cann wrote:
>I'm looking at the documentation about Algorithm::Diff, and I don't
>quite get why the list returned from diff is a list of lists of lists,
>rather than simply a list of lists. For the example:
Presumably because the original author (MJD) wanted it that way.
There's no reason why you couldn't write your own:
use Algorithm::Diff qw(traverse_sequences);
sub mydiff {
my $seq1 = shift;
my $seq2 = shift;
my @diff;
my $callbacks = {
DISCARD_A => sub { push @diff, ['-', $_[0], $seq1->[$_[0]]] },
DISCARD_B => sub { push @diff, ['+', $_[1], $seq2->[$_[1]]] },
};
traverse_sequences($seq1, $seq2, $callbacks, @_);
return wantarray ? @diff : \@diff;
}
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental." -- nobull in clpm
------------------------------
Date: Fri, 8 Dec 2000 20:20:36 -0500
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: Anywhere to put my scripts?
Message-Id: <t332608bdoqrd9@corp.supernews.com>
Richard Zilavec <rzilavec@tcn.net> wrote in message
news:3a415ebf.372343329@news.tcn.net...
> On Fri, 08 Dec 2000 17:38:26 -0500, H C <carvdawg@patriot.net> wrote:
>
> >yourscripts | /dev/null ?
> >
> Data written on a null or zero special file is discarded.
I think the poster knew that, but it was offered because the original
question was so lame.
>
> ./program.pl > /tmp/gooddata.txt 2> /dev/null
>
> Just don't fill it all the way up!
>
> --
> Richard Zilavec
> rzilavec@tcn.net
------------------------------
Date: 8 Dec 2000 23:15:16 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: behavior of open "+>>"
Message-Id: <976316798.23891@itz.pp.sci.fi>
In article <3a312d1b$1@cs.colorado.edu>, Tom Christiansen wrote:
>In article <90ph6p$p3n@netnews.hinet.net>,
>John Lin <johnlin@chttl.com.tw> wrote:
>>
>> open F,"+>>nonexist" or die $!;
>> seek F,0,0;
>> print my $line = <F>;
>> print F "hello 3\n";
>> print F "hello 4\n";
>> close F;
>
> Reads and writes cannot be arbitrarily intermixed on
> read/write streams. ANSI C requires that a file positioning
> function intervene between output and input, unless an
> input operation encounters end-of-file.
\begin{restatement}
Of course, this should IMHO be considered a bug (or at least a
shortcoming) in perl, since it could and should do the necessary
seek(F,0,1) automagically.
\end{restatement}
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental." -- nobull in clpm
------------------------------
Date: Fri, 8 Dec 2000 23:36:10 -0800
From: "simonmcc" <simonmcc@nospam.nortelnetworks.com>
Subject: dynamic require & new on variable package
Message-Id: <90rr7t$lj9$1@bcrkh13.ca.nortel.com>
So I've tried deja, and camel etc, and I can get answers to parts of my
problem, but not all.
I need to instantiate an object, but I don't know what it is (i.e. it is in
a variable).
for example:
my $o_type="Driver::Type1"; #for example, could be one of many types
eval "require $o_type;"; #works fine, dynamically requires a given package
if ($@)
{
die "ERROR : couldn't load $o_type : $@";
}
my $object;
eval "$object = $o_type->new();";
#etc etc
but object never gets initialised: what am I doing wrong? if it is something
simple, call me stupid, but I cant find the answer anywhere (hope it is
simple ;)
also is this bad practice? (I need to do it because I use a generic piece of
code to instantiate many drivers)
any help is appreciated
simon.
------------------------------
Date: Sat, 09 Dec 2000 00:38:11 GMT
From: Neil Conway <spam@klamath.dyndns.org>
Subject: eval() performance
Message-Id: <3A317EF2.3000509@klamath.dyndns.org>
Hello everyone,
I've been taking a look at some old Perl code, written by someone else.
The main part of the app does the following (it's a CGI script):
1) Read in a certain CGI parameter
2) Based on this parameter, open() a certain Perl script as a text file
and read the contents into a single scalar variable
3) Use the following code to evaluate the loaded code:
eval $code;
if ($@) {
#handle errors
}
My question is: how would you improve this? My first thought was to use
an eval block - i.e.
eval {$code;};
if ($@) {
#handle errors
}
Would this improve performance? I've read the docs on eval(), but it
only takes about how an eval block can improve perforance by running at
compile time -- but in this case, the code must be loaded at runtime anyway.
Suggestions for drastic changes are welcome, but I'm primarily
interested in ways to improve the performance / code quality of this
design without huge changes (since I'm probably going to rewrite this at
some point anyway).
------------------------------
Date: 08 Dec 2000 16:00:26 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: File Operator -A Question
Message-Id: <m3u28epo91.fsf@dhcp11-177.support.tivoli.com>
"spurcell" <skpurcell@hotmail.com> writes:
> I am having trouble understanding the -A operator in regards to a file.
>
> I have a file that was created Nov. 27, 2000. It has not been modified since
> its creation date. But when I run a -A on it, it shows the following:
> my $tmp = (-A "$sessions/views/a-dbm");
> print "$tmp";
> prints '2.17798611111111'
>
> How can that be, if no one has "Modified, or Inserted New Records since Nov.
> 27, 2000"?
-A is for access time, not modification time. A relevant excerpt from
perlfunc(1) is:
-M Age of file in days when script started.
-A Same for access time.
-C Same for inode change time.
> I do read that directory occasionally via a file handle, but would that
> constitute an access?
Yes.
> If anyone has any understanding of the -A, (The camel is very short on this
> topic, and there is nothing about this in the Cookbook), I would appreciate
> hearing from you.
You probably want -M.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Fri, 08 Dec 2000 23:58:19 GMT
From: Dave Brondsema <brondsem@my-deja.com>
Subject: Re: How do I find out my own IP Address?
Message-Id: <90rsip$dt7$1@nnrp1.deja.com>
In article <3A3165FF.A1434D27@gmx.de>,
Christoph <cvh@gmx.de> wrote:
> Hello,
>
> could anybody tell me how to find out the IP-address that my
> internet-provider gives me at dial-up?
> I allready searched CPAN but I couldn't find anything that looks like
a
> solution.
>
print "REMOTE_ADDR: $ENV{REMOTE_ADDR}<br>\n";
%ENV is a has of the cgi environmental variables.
To print all of them:
foreach $key (sort(keys %ENV)) {
print "$key = $ENV{$key}<br>\n";
}
> Thank you,
> Christoph
>
--
Dave Brondsema
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 8 Dec 2000 20:09:13 -0500
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: How do I find out my own IP Address?
Message-Id: <t331gm1l47gq10@corp.supernews.com>
Dave Brondsema <brondsem@my-deja.com> wrote in message
news:90rsip$dt7$1@nnrp1.deja.com...
> In article <3A3165FF.A1434D27@gmx.de>,
> Christoph <cvh@gmx.de> wrote:
> > Hello,
> >
> > could anybody tell me how to find out the IP-address that my
> > internet-provider gives me at dial-up?
> > I allready searched CPAN but I couldn't find anything that looks
like
> a
> > solution.
> >
>
> print "REMOTE_ADDR: $ENV{REMOTE_ADDR}<br>\n";
>
> %ENV is a has of the cgi environmental variables.
>
Dave, that does not work on my NT4 system.
However:
perldoc -q "ip address"
returns this:
use Socket;
use Sys::Hostname;
my $host = hostname();
my $addr = inet_ntoa(scalar gethostbyname($host || 'localhost'));
which works nicely.
Randy Harris
> To print all of them:
>
> foreach $key (sort(keys %ENV)) {
> print "$key = $ENV{$key}<br>\n";
> }
>
>
> > Thank you,
> > Christoph
> >
>
> --
> Dave Brondsema
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 8 Dec 2000 18:15:24 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: How do I find out my own IP Address?
Message-Id: <90s13c$n77@flatland.dimensional.com>
Dave Brondsema <brondsem@my-deja.com> writes:
> In article <3A3165FF.A1434D27@gmx.de>,
> Christoph <cvh@gmx.de> wrote:
> > Hello,
> >
> > could anybody tell me how to find out the IP-address that my
> > internet-provider gives me at dial-up?
> > I allready searched CPAN but I couldn't find anything that looks like
> a
> > solution.
> >
>
> print "REMOTE_ADDR: $ENV{REMOTE_ADDR}<br>\n";
>
> %ENV is a has of the cgi environmental variables.
The poster didn't mention anything about CGI. This answer has nothing
to do with the poster's question.
See the Perl FAQ, specifically perlfaq9, which answers the question "How
do I find out my hostname/domainname/IP address?":
http://www.perl.com/pub/doc/manual/html/pod/perlfaq9.html#How_do_I_find_out_my_hostname_do
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
------------------------------
Date: 08 Dec 2000 19:17:18 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How do I find out my own IP Address?
Message-Id: <87ofym1jhd.fsf@limey.hpcc.uh.edu>
>> On Fri, 8 Dec 2000 20:09:13 -0500,
>> "Randy Harris" <harrisr@bignet.net> said:
> Dave Brondsema <brondsem@my-deja.com> wrote in message
> news:90rsip$dt7$1@nnrp1.deja.com...
>> In article <3A3165FF.A1434D27@gmx.de>, Christoph
>> <cvh@gmx.de> wrote: > Hello, > > could anybody tell me
>> how to find out the IP-address that my >
>> internet-provider gives me at dial-up? > I allready
>> searched CPAN but I couldn't find anything that looks
> like
>> a > solution. >
>>
>> print "REMOTE_ADDR: $ENV{REMOTE_ADDR}<br>\n";
>> %ENV is a has of the cgi environmental variables.
> Dave, that does not work on my NT4 system. However:
That's because Dave's answer addresses finding the client
connecting to a web server, which, however, isn't relevant
here.
> use Socket; use Sys::Hostname; my $host =
> hostname(); my $addr = inet_ntoa(scalar
> gethostbyname($host || 'localhost'));
That will return the address of the _hostname_
That won't necessarily find the address of the ethernet or
ppp (or ...) interface. In some situations you may have
more than 1 such interface.
You might want to search deja for past discussions of this
topic in this newsgroup.
hth
t
------------------------------
Date: 8 Dec 2000 18:56:44 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: How do I find out my own IP Address?
Message-Id: <90s3gs$plu@flatland.dimensional.com>
mfuhr@dimensional.com (Michael Fuhr) writes:
> > In article <3A3165FF.A1434D27@gmx.de>,
> > Christoph <cvh@gmx.de> wrote:
> > > Hello,
> > >
> > > could anybody tell me how to find out the IP-address that my
> > > internet-provider gives me at dial-up?
> > > I allready searched CPAN but I couldn't find anything that looks like
> > a
> > > solution.
[snip]
> See the Perl FAQ, specifically perlfaq9, which answers the question "How
> do I find out my hostname/domainname/IP address?":
>
> http://www.perl.com/pub/doc/manual/html/pod/perlfaq9.html#How_do_I_find_out_my_hostname_do
Whoops -- as another poster pointed out, this probably won't help if
you're trying to find the address assigned to your PPP interface.
Sorry about that.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
------------------------------
Date: Sat, 9 Dec 2000 10:58:36 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: IOT/Abort trap running using setuid wrapper AIX
Message-Id: <slrn932tdc.20m.mgjv@martien.heliotrope.home>
On Thu, 07 Dec 2000 14:31:43 GMT,
Ronald J.H. Rood <ronr@my-deja.com> wrote:
> In article <slrn92v1lq.20m.mgjv@martien.heliotrope.home>,
> mgjv@tradingpost.com.au wrote:
>> On Thu, 07 Dec 2000 12:16:19 GMT,
>> Ronald J.H. Rood <ronr@my-deja.com> wrote:
>> >
>> > Thanks for the reaction Martien,
>> >
>> > In the mean time I fixed part of the problem. The error went away after
>> > removing the -u flag. The icmp ping now works fine but ...
>> > a new problem came in.
>>
>> You mean you were running perl with the -u flag and used undump to
>> create the binary you talked about above? Or were you running perl with
>> -u all the time? If you do, perl will dump core after compiling the
>> program, but before running it. That's the point of the flag.
>>
>> Did I misunderstand what you are saying, or did you misunderstand what
>> -u does? I'm confused.
>>
>> dump/undump, IIRC, isn't always reliable anyway.
>>
>> > I heard of sudo but I am afraid the problem is hidden in my code. It
>> > will have something to do with subroutines, parameters, scoping.
>> > Debugging_mode=ON.
>>
>> yes, but sudo would allow you to write a program the normal way (I'd
>> still use the -T flag), and rely on the sudo binary to do the right
>> setuid things.
>>
>> Did you have a look at perlsec, as I suggested?
>
> Yes, I did. A lot of words there, not much help for me. I got some taint
> error. I think it was because I read the hostname from STDIN. I checked
> the validity of the hostname by resolving it to an ip-address and vv.
There's no need to untaint that.
> I changed the code a little, now I do no longer need ping. Ofcourse it
> give me a little less detail but for most cases it is just enough.
But, Net::Ping should work just fine from a program that runs as root.
Have you tried setting the setuid bit on the script itself?
> Perl is new for me and there is a lot to learn. It's mostlikely that I
> do not understand the -u flag. The binary I made was just a little c
> program that executes the perl script. The binary is setuid root.
The -u flag to perl tells it to dump core after compiling your program.
You can use that core dump to create an executable. It's a bit obsolete.
The perlrun an page talks about it. But you should need it, and should
use it.
You _are_ talking about the -u flag to Perl, right? Not some other -u
flag?
> The goal of the script was to see if a specific service was availlable
> on a given host, passed via STDIN. The original idea was to ping the
> host to see if it was running. If it was, open a telnet connection to
> the port. It that succeeded, the service was there, if not, not.
>
> Most hosts are configured to react on icmp pings only. The missing
> detail now is that I don't know if just all services are down, or that
> the complete host is down...
# cat myping.c
#include <unistd.h>
int
main(int argc, char *argv[])
{
int rc = execv("/tmp/ping.pl", argv);
return rc ? 1 : 0;
}
# gcc -o myping myping.c
# chmod u+s myping
# ls -l myping
-rwsr-xr-x 1 root root 11783 Dec 9 10:46 myping
$ cat /tmp/ping.pl
#!/usr/local/bin/perl -w
use strict;
use Net::Ping;
my $ping = Net::Ping->new("icmp", 2);
my $host = shift;
if (!$host)
{
local $| = 1;
print "Hostname: " if (-t STDIN);
$host = <STDIN>;
chomp $host;
}
print "$host is ", $ping->ping($host) ? "" : "not ", "reachable\n";
And now use it with a hostname on the command line:
$ ./myping www
www is reachable
$ ./myping pram
pram is reachable
$ ./myping non-existing
non-existing is not reachable
$ ./myping "not reachable"
not reachable is not reachable
Or without arguments, interactively
$ ./myping
Hostname: not reachable
not reachable is not reachable
Or non-interactively
$ echo reachable | ./myping
reachable is not reachable
HTH,
Martien
--
Martien Verbruggen |
Interactive Media Division | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd. | enough features yet.
NSW, Australia |
------------------------------
Date: Fri, 8 Dec 2000 17:04:34 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: List Values and Arrays
Message-Id: <slrn932mni.22l.tadmc@magna.metronet.com>
Otto Wyss <otto.wyss@bluewin.ch> wrote:
>> Perl FAQ, part 4:
>>
>> "What is the difference between a list and an array?"
>
>I just tried to read perlfaq4 myself and search for "list and an array"
>but it didn't found anything.
perldoc -q "list and an array"
works for me.
>Doing
>
> perldoc perlfaq4
> /list
>
>revealed that the FAQ was there, but why didn't match this simple search
>the word "list" in the text
>
> "What is the difference between a list and an array?"
>
>What's best way to get to the text in a FAQ?
I use grep(1) to search the *.pod files.
I use vi(1) to read the *.pod files.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 08 Dec 2000 23:05:39 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: multi keyed hash or array
Message-Id: <7PdY5.68$B9.170159104@news.frii.net>
In article <1ru28ebl67.fsf@video.bsd.uchicago.edu>,
John Hunter <jdhunter@nitace.bsd.uchicago.edu> wrote:
>
>I have some data that I want to store by month and year. Currently
>I'm using a hash where each key is a the year, and the value is a hash
>with keys that are months and the values are an array.
>
>When it comes time to print the results, I don't know how to get the
>keys, for a given year. In this case, I can use the months = 1..12
>which works fine, but how does one do it generally?
>
>#generate the report
>foreach my $year (keys %store) {
> foreach my $month (1..12) { ## here I want to use a keys statement
If
$year
is the key, then
$store{$year}
is the hash ref. And
%{$store{$year}}
is the hash. So
keys %{$store{$year}}
Are the keys to the hash stored at $store{$year}.
Did that make sense?
chris
--
This space intentionally left blank
------------------------------
Date: 08 Dec 2000 17:28:54 -0600
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: Re: multi keyed hash or array
Message-Id: <1r66kubih5.fsf@video.bsd.uchicago.edu>
>>>>> "Chris" == Chris Fedde <cfedde@fedde.littleton.co.us> writes:
Chris> $store{$year}
Chris> is the hash ref. And
Chris> %{$store{$year}}
Chris> is the hash. So
Yes, thank you. So I could also write %$store{$year}, right?
Out of curiosity, what happens if you coerce a hash ref into the wrong
type, ie ${$store{$year}}?
John Hunter
------------------------------
Date: Fri, 8 Dec 2000 23:08:34 -0000
From: "Mark Longhurst" <nospam@bml.uk-mart.co.uk>
Subject: Re: Newbie File Uploading Problem
Message-Id: <cTdY5.4603$tR1.79072@news2-win.server.ntlworld.com>
"Randall" <tech-removethis-@rch-usa.com> wrote in message
news:i2v51tsmk2pm2vqkfalkes0as027a2tk7c@4ax.com...
> Haven't programmed for so long couldn't tell ya the diff between a
> post and a parse, BUT....
>
> I'm using the Ranson's Upload script, but can't figure out how to have
> the file names say the same as they are posted on the site.
>
> I have ul'd the script as I assume all have seen/used it. If not, I
> will.
>
> Also is there a way to stuff this into a separate directory for
> different clients so that their files are kept within their
> subdirectories, considering this uses a common <G> cgi-bin?
The following code snipet will upload a file from the clients machine onto
the server:
#Copy File To Server
if ($file){copy ($file, "upload.tmp") or warn "Can't Copy File: ", $!;
#Strip Filename
chomp($file);
$realfile = $file;
if ($realfile =~ /\\/) { ($realfile) = $file =~ /^.*\\([^\/]+)$/g;}
#Rename Copied File Back To Original Name
rename "upload.tmp", $realfile;
Please note that the section which strips the filename (taking out any path
information) is designed on the theory that the users machine is running
Windows of some form. If they are using unix it should start : if
($realfile=~'\/') to search for '/' instead of '\'.
The value in the scalar $file is obtained from a file upload field in the
preceding page as follows:
$file=param('upload');
assuming the upload field is named upload.
In order to make files upload to dofferent directories, replace upload.tmp
with a variable containing the path to the directory you want, and a
temporary filename, and also change the contents of $realfile to match.
These could be set depending on the password entered, or whatever.
Hope this helps
Mark Longhurst
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SEMPER IN FACCIBUS SUM SOLE PROFUNDUM VARIAT
(I'm always in the Shit, only the depth varies)
------------------------------
Date: Sat, 09 Dec 2000 01:11:52 GMT
From: "Daniel W. Burke" <dwb1@home.com>
Subject: Re: number vs string
Message-Id: <Pine.LNX.4.20.0012082011160.29890-100000@ethyl.addictmud.org>
On Fri, 8 Dec 2000, Chris Fedde wrote:
> In article <Pine.LNX.4.20.0012081016490.29457-100000@ethyl.addictmud.org>,
> Daniel W. Burke <dwb1@home.com> wrote:
> >
> >What is the best, most warning-free method of testing if a scalar
> >is a number or a string?
> >
> >if (length($var) == 0 || ($var < 1)
> >
> >Is there a way ahead of time to check that... like,
> >
<abridged version of my original post>
> the FAQ says...
>
> How do I determine whether a scalar is a number/whole/integer/float?
>
> if (/^[+-]?\d+$/) { print "is a +/- integer\n" }
that's kind of emberrasing... I really should have checked the FAQ before
posting... but that's exactly what I'm looking for, thanks much for the
help.
Dan.
------------------------------
Date: Fri, 8 Dec 2000 19:57:33 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: Perl Help with LWP
Message-Id: <90s3ig$8e8$1@newsx.cc.uic.edu>
I wanted to try learning more about LWP and perl.
I found a good site a while ago at webreview.com, but the articles arent
there anymore
does anyone else no of any good sites?
--
Enrico Ng <ng@fnmail.com>
------------------------------
Date: Fri, 8 Dec 2000 18:19:49 -0500
From: "Jimmy" <someone@compugenx.com>
Subject: Re: problems with perlcc
Message-Id: <90rqd3$hng$1@bob.news.rcn.net>
Try perl2exe from indigostar.com
-jimmy
J Landman <landman@mediaone.net> wrote in message
news:4ecY5.3859$Uj7.196599@typhoon.mw.mediaone.net...
> folks:
>
> I am attempting to use perlcc to compile (e.g. make a binary) out of my
> code. Unfortunately, it appears to die in the ld step with an invalid
> reference to the boot_DynaLoader. Is there anything I can do to fix
> this? Is this a known problem? Is there a faq somewhere that I should
> read? All pointers welcome. Thanks!
>
> ------
>
>
perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 -I/usr/lib/per
l5/site_perl/5.6.0/i386-linux -I/usr/lib/perl5/site_perl/5.6.0 -I/usr/lib/pe
rl5/site_perl -I. /tmp/ctblastall.pl.tst
> gcc -fno-strict-aliasing -I/usr/lib/perl5/5.6.0/i386-linux/CORE -o
ctblastall.x
ctblastall.pl.c -L/usr/local/lib -L/usr/lib/perl5/5.6.0/i386-linux/CORE -l
perl -lnsl -ldl -lm -lc -lcrypt
/usr/lib/perl5/5.6.0/i386-linux/auto/Sys/Hostname/Hostname.so
/usr/lib/perl5/5.6.0/i386-linux/auto/IO/IO.so
/usr/lib/perl5/5.6.0/i386-linux/auto/POSIX/POSIX.so
/usr/lib/perl5/5.6.0/i386-linux/auto/Socket/Socket.so
/usr/lib/perl5/5.6.0/i386-linux/auto/Fcntl/Fcntl.so
> /tmp/ccjb6BaM.o: In function `xs_init':
> /tmp/ccjb6BaM.o(.text+0x125851): undefined reference to `boot_DynaLoader'
> collect2: ld returned 1 exit status
> ERROR: In compiling code for ctblastall.pl.c !
------------------------------
Date: Fri, 08 Dec 2000 15:11:48 +0800
From: "Michael Peppler" <mpeppler@peppler.org>
Subject: Re: Sybase heterogeneous copy
Message-Id: <t32qllea8rdmfd@corp.supernews.com>
[ Followups set to comp.databases.sybase ]
In article <90qeet$7aa$1@nnrp1.deja.com>, akluyskens@my-deja.com wrote:
> Hello,
>
> Are there any sybase system admin out here? I have to perform a system
> copy of a large sybase dataserver running on HP_UX to an AIX system.
> Does someone know if there are any (perl)tools availbale to do so or if
> sybase provides a decent method to perform such copies (they don't have
> exports like Oracle). I looked on the internet, posted a msg to the
> sybase newsgroup (still no answer). I know this is not really the place
> to post such messages but some Perl users could also be Sybase
> sysadmins.
Indeed.
As you have discovered Sybase uses binary formats based on the hosts
architecture for database dumps, and these are often not compatible from
one type of system to another.
Your best bet is bcp out to a temp file and then bcp in on the other
side, and writing a script for this should not be very difficult.
You can also investigate sqsh, which can open a connection to both
servers and select from one and bcp in to the other.
If you don't have the source DDL for the database I suggest you take a
look at dbschema.pl at http://www.midsomer.org - this is a script that
completely reverse engineers a Sybase database.
Hope this helps.
Michael
--
Michael Peppler - Data Migrations Inc. - mpeppler@peppler.org
http://www.mbay.net/~mpeppler - mpeppler@mbay.net - AIM MPpplr
International Sybase User Group - http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
------------------------------
Date: 9 Dec 2000 00:58:18 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: untaint a regular expression
Message-Id: <eli$0012081951@qz.little-neck.ny.us>
In comp.lang.perl.misc, Tad McClellan <tadmc@metronet.com> wrote:
> Eli the Bearded <elijah@workspot.net> wrote:
>
> >Suppose you want to let a CGI user enter a 'full' perl regular
> >expression, how would you go about untainting it?
>
> >Here's a first draft of mine:
> >
> >$t_regexp =~ / ^(
> > (?: [^\$\@\\]+ | # things that don't interpolate varibles
> > \\. | # anything backslashed
> > \$ (?: # $ followed by
> > $ | # end-of-string
> > \) # close paren
> > )
> > )+ # close (?:)
> > ) # close () of $1
> ^^^^
> Better stick an end-of-string anchor there too.
Good form, yes.
> It untaints ' @{[ warn "foo" ]}' as it is.
Not really, since the only thing in $1 for that will be ' ',
which is a safe RE. ($t_regexp would still be tainted, and
$unt_regexp is set from $1.)
Elijah
------
it is the (?x:...) that would be cool but is so much harder
------------------------------
Date: Fri, 08 Dec 2000 23:17:42 +0000 (GMT)
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Re: Uploading file via CGI
Message-Id: <4a29e7a2a2g.soper@soundhouse.co.uk>
In article <4a296bcb8dg.soper@soundhouse.co.uk>, Geoff Soper
<g.soper@soundhouse.co.uk> wrote:
> i'm using the following piece of code in my first attempt to upload a
> file using CGI. While the file is created it is of zero length. Could
> somebody point out my error?
To simple things further I have taken the example given in the Docs for
this module and changed only the name and the method uised to call the
upload function giving:
Form:
<INPUT TYPE="file" NAME="upload_1" SIZE=60>
Script:
use CGI qw(:standard upload);
$fh = upload('upload_1');
while (<$fh>) {
print;
}
Which was as below before modification:
$fh = $query->upload('uploaded_file');
while (<$fh>) {
print;
}
I have tried searching for help or tutorials on the web but have found
nothing useful. If somebody could point out my error I'd me most grateful.
Cheers
--
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/
------------------------------
Date: Sat, 9 Dec 2000 11:16:05 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Yesterdays Date
Message-Id: <slrn932ue5.20m.mgjv@martien.heliotrope.home>
On Fri, 08 Dec 2000 10:53:00 GMT,
Bart Lateur <bart.lateur@skynet.be> wrote:
> Martien Verbruggen wrote:
>
>>> (my $day,my $month,my $year) = (localtime(time))[3,4,5];
>>> gives me todays date but what's the most simple way to get yesterdays date
>>> in the same format?
>>
>>my ($day, $month, $year) = (localtime(time - 86400))[3,4,5];
>>
>>And no, this doesn't give anyone any problems around DST changes.
>
> Eh? It doesn't?
>
> Because of DST, there are days with only 23 hours in 'em, aren't there?
> What if you do this test, ooh, 15 minutes into the next day? You'll get
> the day it was 24 hours ago, 45 minutes before midnight then. That is 2
> days ago.
You're right. brain fart on my part. And I forgot that the FAQ already
says this too.
Martien
--
Martien Verbruggen |
Interactive Media Division | Little girls, like butterflies, need
Commercial Dynamics Pty. Ltd. | no excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 5068
**************************************