[17549] in Perl-Users-Digest
Perl-Users Digest, Issue: 4969 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 26 18:05:44 2000
Date: Sun, 26 Nov 2000 15:05:15 -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: <975279914-v9-i4969@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 26 Nov 2000 Volume: 9 Number: 4969
Today's topics:
Re: Beginners Blues II (Joe Smith)
Re: Command Line Perl (Joe Smith)
credit card validation script <ayambema@adelphia.net>
Re: desperate pls help me! (Joe Smith)
Forking <jhyde@shreve.net>
Re: Forking (Chris Fedde)
Getting control over Imaging <s.meyer@ds-service.de>
Re: How do i replace the spaces? (Randal L. Schwartz)
Re: How do i replace the spaces? (Ilya Zakharevich)
Re: How do i replace the spaces? <jeff@vpservices.com>
Re: How to send back 2 or more gif, if only one cgi cal (Joe Smith)
Re: how would you call a subrountine using a button in (Joe Smith)
Re: identifying $_ as variable or constant (Tad McClellan)
Re: identifying $_ as variable or constant (Martien Verbruggen)
Re: identifying $_ as variable or constant (Eric Smith)
Re: identifying $_ as variable or constant <uri@sysarch.com>
Imbedding POD in script? <friedman@math.utexas.edu>
Re: Imbedding POD in script? (Garry Williams)
Re: Imbedding POD in script? (Chris Fedde)
Re: Most easy way to get IP from a local NIC by device (Joe Smith)
Re: reading IP and MAC addresses with Win::Registry mod <jensluetzen@yahoo.de>
Re: reading IP and MAC addresses with Win::Registry mod <carvdawg@patriot.net>
Re: Secure vs. unsecure server <godoy@conectiva.com>
Re: setuid/setgid with perl? (Tad McClellan)
Re: setuid/setgid with perl? (Garry Williams)
Re: Test to see if a file exists? <jhyde@shreve.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Nov 2000 12:19:27 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Beginners Blues II
Message-Id: <8vqv4f$g48$1@nntp1.ba.best.com>
In article <Yi8S5.14571$tU2.122530@news-server.bigpond.net.au>,
John Boy Walton <johngros@Spam.bigpond.net.au> wrote:
>I just get a file called 4294967294.txt
>When what I am looking for is johngros@bigpond.net.au.txt
There's a difference between
$name = ~s/old/new/;
and
$name =~ s/old/new/;
FYI: ~1 = 4294967294 on a 32-bit machine.
>Trying your suggestions I have come up with the following.
>#!E:/Millenium Programs/perl/bin/Perl -w
>$path = "C:/Program Files/G6FTP/";
>$datapath = "ftpdatabase/";
>$pwd = time;
>$name= <stdin>;
>$name = ~s/\@/\\\@/;# preparing an email address to be used as a file name.
Get rid of that line and replace it with
chomp $name; # Remove end-of-line character(s)
>$file = $path.$datapath.$name.".txt";
>open BOGUS,"+>>$file" or die "Cannot open file: $!";
>print BOGUS $pwd;
>close BOGUS;
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 26 Nov 2000 11:50:57 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Command Line Perl
Message-Id: <8vqtf1$ftj$1@nntp1.ba.best.com>
In article <slrn91ikb0.fv3.rgarciasuarez@rafael.kazibao.net>,
Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
>These scripts are not very useful: they don't print the file name.
>Here's an attempt (assuming that -M is wanted and the 'ls' program
>exists):
> ls|perl -lne 'print"$_\t",-M'
Doesn't work: you forgot to chomp().
Doesn't work if 'ls' is aliased to 'ls -F' in .cshrc .
Floating point numbers are ugly; use printf.
/bin/ls | perl -ne 'chomp;printf "%6.2f %s\n",-A,$_'
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Sun, 26 Nov 2000 21:19:11 GMT
From: "hokiebear" <ayambema@adelphia.net>
Subject: credit card validation script
Message-Id: <j7fU5.3140$tR2.88044@news1.news.adelphia.net>
Can anyone point me to a free source of cgi/perl script for validation
credit card data? Thank you.
amba
------------------------------
Date: 26 Nov 2000 11:37:44 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: desperate pls help me!
Message-Id: <8vqsm8$fqt$1@nntp1.ba.best.com>
In article <8vc17s$sgt@dispatch.concentric.net>,
M Lambert <mlambert@concentric.net> wrote:
>Im trying to write a cgi that will allow users to run a reporting tool and
>have the report emailed to them... the problem is the reports can take up to
>3 hours to generate. How do I background a process in Perl that will allow
>users to visit a cgi and leave while the pro finoishes up without them...
A better solution is to not start the report generation immediately.
Instead, output the message "Your request has been entered into the
queue. Expect a response in 6 to 10 hours." and let a cron job handle it.
Sequence of events:
1) User fills out an HTML form and submits it.
2) The CGI program validates that the required fields are present,
then appends the request to a file. The CGI program outputs a
message stating approximately how long the request will take.
(This can depend on how many other requests are already in the queue.)
3) A cron job checks the queue once an hour or so, and if there is
anything to do, processes the oldest request in the queue.
4) When the request is done, e-mail is sent to the requestor.
5) Some sort of locking mechanism will need to be used so that a
second cron job will not do anything if the first one hasn't completed.
This separation of functions works very well when you are using one
computer for the web server and a different one to generate reports.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Sun, 26 Nov 2000 14:43:24 -0600
From: "shreve.net" <jhyde@shreve.net>
Subject: Forking
Message-Id: <B646D20C.4484%jhyde@shreve.net>
Hello all!
I need some help with Fork.
My CGI mod_perl (DBI/mySQL) program opens a mySQL database $sth, does a
while loop customizing a email newsletter for each of my tens of thousands
of users. The problem is the browser connection times out before the task is
completed.
What I'd like to do is Fork the emailing and have the program return an HTML
web page and finish the mail-out in the background.
Here's a snip of the code:
# Create the Query
my $query = qq!
SELECT
U_Username,U_Email,U_Password,U_fname,U_lname,U_Status,U_geekcode
FROM w3t_Users
ORDER BY U_Username
!;
my $sth = $dbh -> prepare ($query) or w3t::not_right("Query syntax error:
$DBI::errstr. Query: $query",$Cat);
$sth -> execute() or w3t::not_right("Can't execute query: $query. Reason:
$DBI::errstr",$Cat);
my
($U_Username,$U_Email,$U_Password,$U_fname,$U_lname,$U_Status,$U_geekcode,$f
ooter,$header);
$sth->bind_columns(undef,\$U_Username,\$U_Email,\$U_Password,\$U_fname,\$U_l
name,\$U_Status,\$U_geekcode);
while (my @results = $sth->fetchrow_array) {
#
# -------------------------------------
# Now we need to mail the message
$header = "Dear $U_fname,\n\n";
$header .= "$tbody\n";
if ($U_Status eq 'User') {
$footer = "Log on at http://www.delriolive.com/\n";
$footer .= "===================================================\n";
$footer .= "Forget your password? Go here:\n";
$footer .=
"http://www.delriolive.com/cgi-bin/sqlaccount.cgi?printgetpasswd=1\n";
$footer .= "AOL Users: <a
href=\"http://www.delriolive.com/cgi-bin/sqlaccount.cgi?printgetpasswd=1\">C
lick here to retrieve you password.</a>\n";
} else {
$footer = "YOU SHOULD ACTIVATE YOUR ACCOUNT!\n";
$footer .= "===================================================\n";
$footer .= "We show your account as inactivated. To fix this, point
your web browser here:\n";
$footer .=
"http://www.delriolive.com/cgi-bin/sqlaccount.cgi?geekcode=$U_geekcode\n";
$footer .= "<a
href=\"http://www.delriolive.com/cgi-bin/sqlaccount.cgi?geekcode=$U_geekcode
\">AOL users click here to activate</a>.\n";
}
open (MAIL, "|$config{'sendmail'} -t")
|| die "Cannot start mail program: $!";
print MAIL "To: $U_Email ($U_fname $U_lname)\n";
print MAIL "From: members\@delriolive.com (Del Rio LIVE!)\n";
print MAIL "Subject: $FORM{'Subject'}\n";
print MAIL "Content-Type: multipart/alternative;
boundary=\"JJH_alternativemessage\"\n\n";
print MAIL "--JJH_alternativemessage\nContent-Type: text/html;
charset=ISO-8859-1\nContent-Transfer-Encoding: 8bit\n\n";
print MAIL "$HTML_email\n";
print MAIL "<font face=\"verdana\" size=\"2\">Dear Joe,</font>";
print MAIL "$HTML_email2\n";
if ($U_Status eq 'User') {
print MAIL <<"EOF";
<font size="1" face="verdana"><a
href="http://www.delriolive.com/">Log on Del Rio LIVE! now</a>. <br>
Your Username: $U_Username<br>
Your Password: $U_Password<br> </font>
EOF
} else {
print MAIL <<"EOF";
<font size="1" face="verdana">Our records show you have not
activated your account.<br>
<b>Please <a
href="http://www.delriolive.com/cgi-bin/sqlaccount.cgi?geekcode=$U_geekcode"
>CLICK ON THIS LINK TO ACTIVATE.</a></b>
EOF
}
print MAIL "<p>$HTML_email3\n\n";
print MAIL "--JJH_alternativemessage\nContent-Type: text/plain;
charset=ISO-8859-1\nContent-Transfer-Encoding: 8bit\n\n";
print MAIL "$header\n";
print MAIL "$footer";
close (MAIL);
}
$sth -> finish;
# ------------------------
# Send HTML a confirmation mailout is underway
w3t::send_header("Email sent",$Cat,0,0,0,0);
w3t::table_header("Email sent");
print qq~
<TABLE BORDER=0 WIDTH="$theme{'tablewidth'}" align="$theme{'tablealign'}">
<TR><TD>
Email has been sent to all users.
</P>
</TD></TR></TABLE>
~;
# -------------
# Send a footer
w3t::send_footer();
------------------------------
Date: Sun, 26 Nov 2000 22:08:38 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Forking
Message-Id: <GRfU5.84$QX6.172412416@news.frii.net>
In article <B646D20C.4484%jhyde@shreve.net>,
shreve.net <jhyde@shreve.net> wrote:
>Hello all!
>
>I need some help with Fork.
>
>My CGI mod_perl (DBI/mySQL) program opens a mySQL database $sth, does a
>while loop customizing a email newsletter for each of my tens of thousands
>of users. The problem is the browser connection times out before the task is
>completed.
>
Assuming that the server is unixoid. look into at(1), cron(1) and batch(1).
These are great ways to start things in the background that will need to run
asynch of the webserver process.
--
This space intentionally left blank
------------------------------
Date: Sun, 26 Nov 2000 20:53:23 +0100
From: "Sebastian Meyer" <s.meyer@ds-service.de>
Subject: Getting control over Imaging
Message-Id: <8vrp73$5j1tn$1@ID-26281.news.dfncis.de>
Hi,
perhaps its OT, sorry for that.
does anyone know how to control Imaging under Win32
with the Win32::OLE mod from perl? Or does anyone know
where to find additional information?
thanx for your help
Sebastian
s.meyer@ds-service.de
ICQ: 99091607
------------------------------
Date: 26 Nov 2000 11:01:42 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How do i replace the spaces?
Message-Id: <m1ofz2o8vd.fsf@halfdome.holdit.com>
[comp.lang.perl has been dead for 4 years. Please stop posting to it.]
>>>>> "Poohba" == Poohba <poohba@io.com> writes:
Poohba> I am trying to replace the spaces in a filename with "_". How do I do
Poohba> this? Presently I have
[some code deleted]
Well, this might be closer:
for (<*>) {
next if /cgi/;
$old = $_;
s/\s/_/g;
if ($old ne $_ and not -e) {
print "renaming $old to $_... ";
if (rename $old, $_) {
print "done\n";
} else {
print "error: $!\n";
}
}
}
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 26 Nov 2000 19:39:35 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: How do i replace the spaces?
Message-Id: <8vrotn$q3i$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Jeff Zucker
<jeff@vpservices.com>],
who wrote in article <3A215C93.7457650E@vpservices.com>:
> > @images = grep {/./} readdir MYDIR;
>
> That is a rather strange grep expression since the only files it
> excludes are files that don't have a name.
open \*{"\n"}, '>', "\n";
print {\*{"\n"}} "Really? ;-)\n";
Ilya
------------------------------
Date: Sun, 26 Nov 2000 11:56:31 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How do i replace the spaces?
Message-Id: <3A216AEF.DF990FB0@vpservices.com>
Ilya Zakharevich wrote:
>
> [A complimentary Cc of this posting was sent to Jeff Zucker
> <jeff@vpservices.com>],
> who wrote in article <3A215C93.7457650E@vpservices.com>:
> > > @images = grep {/./} readdir MYDIR;
> >
> > That is a rather strange grep expression since the only files it
> > excludes are files that don't have a name.
>
> open \*{"\n"}, '>', "\n";
> print {\*{"\n"}} "Really? ;-)\n";
Yes, of course you are right, it excludes all of those files also.
Somehow I doubt that fact brings it any closer to what the OP intended,
but one never knows. :-)
--
Jeff
------------------------------
Date: 26 Nov 2000 12:38:43 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: How to send back 2 or more gif, if only one cgi call?
Message-Id: <8vr08j$g9d$1@nntp1.ba.best.com>
In article <B63DE40F.61CC%claudej@videotron.ca>,
claudej <claudej@videotron.ca> wrote:
>In a CGI Perl script
>
>How to send back 2 or more gif, if only one cgi call ?
><IMG SRC="cgi-bin/counter.cgi">
You are only allowed on image per <IMG> tag.
Therefore your program must read the two image files, combine them into
a single rectangle, then return that rectangle as a single image.
Look for "$myImage->copy($srcImage,10,10,0,0,25,25);" in the GD docs.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 26 Nov 2000 11:23:29 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: how would you call a subrountine using a button in a web browser?
Message-Id: <8vqrrh$fll$1@nntp1.ba.best.com>
In article <8vcd2t$8qe$1@nnrp1.deja.com>, <pape_98@my-deja.com> wrote:
>What I really want to do is to be able to call a subroutine using a
>button on the page.
>
>$button1->Button(name=>'Add', value=>'Add A User', OnClick=>"add()");
OnClick is a JavaScript keyword.
It can be used to execute a JavaScript function, not a perl subroutine.
>print start_form(add());
That says to execute the perl function add() immediately, and whatever
it returns, send the result to the browser. It is NOT the same thing
as calling a JavaScript add() function.
You need to make up your mind. Are you writing a JavaScript program
or a perl program? Mixing the two is confusing.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Sun, 26 Nov 2000 13:55:33 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: identifying $_ as variable or constant
Message-Id: <slrn922n55.bcl.tadmc@magna.metronet.com>
Eric Smith <eric@fruitcom.com> wrote:
> if ($filename=~/stdout/i){
> *FH=*STDOUT;
So then, you want to write to standard out if they have:
$filename = 'this_is_not_stdout';
??
Your pattern matches more strings than you want it to, I'm guessing...
You could be silly and fix it this way:
if ( $filename =~ /^stdout$/i ...
But you should only use patterns when you need patterns. There
are other tools for strings. The best fix would be:
if ( uc($filename) eq 'STDOUT' ...
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 26 Nov 2000 22:33:22 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: identifying $_ as variable or constant
Message-Id: <slrn9233q1.850.mgjv@verbruggen.comdyn.com.au>
On Sun, 26 Nov 2000 08:35:08 -0500,
Bernie Cosell <bernie@fantasyfarm.com> wrote:
> mgjv@tradingpost.com.au (Martien Verbruggen) wrote:
>
> } On 26 Nov 2000 01:00:29 GMT,
> } Eric Smith <eric@fruitcom.com> wrote:
> } > say: $var='something';
> } > In a loop, how can I determine whether the value in $_ is $var or the
> } > constant 'something'?
> }
> } What you are asking doesn't make sense. The value stored in $_ is either
> } the string "something" or it isn't. The value stored in $var is either
> } the string "something" or it isn't. The value of the constant expression
> } 'something' is always the string "something".
> }
> } The value in $_ has no memory of where it came from. It either is
> } "something" or it isn't.
>
> I thought that wasn't true -- I thought that Perl preserved lvalue-ness and
> so it *DID* remember where $_ came from, and so these are quite different:
> for (@a)
> { $_ = 4 ; }
> and
> for (1,2,3)
> { $_ = 4 ; }
Ah, yes, in this case there is some magic involved, but it isn't magic
that's tied to the $_, but to the for loop. Perl aliases $_ to the
members of the list passed to it, so you can modify them directly,
which allows things like:
# multiply array members by 2
for (@a) { $_ *= 2 }
But in general, no, variables do not retain any idea about where they
got their value from. Even in this case, the variable doesn't. The
name $_ just becomes a temporary alias for the element of the array.
Martien
--
Martien Verbruggen |
Interactive Media Division | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: 26 Nov 2000 22:33:54 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: Re: identifying $_ as variable or constant
Message-Id: <slrn9233ug.hff.eric@plum.fruitcom.com>
In comp.lang.perl.misc, you wrote:
> ES> and values respectively. This, however, is inappropriate if I
> ES> want to say go: logit('logfiletag','Here is the results
> ES> array',@array);
>
> so pass @array as a ref \@array and deal with it separately.
What is the way to check whether $_ in a loop is a reference or an actual
lvalue?
> or we can ask why? i still don't see any reason for you to know if a
> value was a constant or a variable. all you seem to do is log it but
> there is some very odd code here as well. i will comment on it in general.
Because in the log file I want to distinguish clearly between a label
and an lvalue. viz.
* This is the result *
4535 widgets delivered
* phonumnumber is *
00 31 20 42353244
...
Is that not clear?
> cuddled elses are considered poor style. and 2 char indents are also
> poor style IMO. a quick glance doesn't show me the blocking at all.
mmm, how many do you want?
> while( my( $label, $val ) = splice( @_, 0, 2 ) ) {
>
> print FH "$label\n* \U$val *\n" ;
> print GLOBAL "$label\n* \U$val *\n" ;
> }
>
Oh, how elegant - I will remember that use of splice and the \U is real
nice too.
>
> my $log_text = "$label\n* \U$val *\n" ;
> print FH $log_text ;
> print GLOBAL $log_text ;
This brings me to another burning question that I forgot to mention in my
original post. I did ask this question some time ago but cannot
recall/find the answer.
Is it / how is it possible ...
to open to physical files with a single fiklfilehandle. Without using
`tee' or any unix specific calls.
> ES> print FH qq|$_
> ES> |;
> ES> print GLOBAL qq|$_
> ES> |;
>
> why are you using qq here? it gains you nothing but confusion. all you
> are doing is adding a newline so use quotes normally:
I sometimes prefer to use the qq notation - to me it is clearer than
double quotes. Maybe I am in the minority.
> and nowhere do i see the need to know if a value was a constant string
> or a variable. explain your need for this further in clear english. your
> code doesn't reflect that desire at all.
As per the example at the start, I want to make a clear visual distinction
between the two cases. When I gave the example of passing @array to the
function, I meant to say that the function may be presented with a series
of vars (lvalues) with no alternate constants to label these lvalues. The
funstion needs to know this in order to give the desired visual
distinction.
>
> and jeopardy posting is not cool here. put your reply AFTER the quoted
> post.
ok, I am sure it will dawn on me soon what you mean by `jeopardy'
(apologies I am a bit out of touch). My guess it is after the legal use
of that word.
Thank you for your observations.
Eric Smith
Fruitcom.com Amsterdam
www.fruitcom.com
------------------------------
Date: Sun, 26 Nov 2000 23:03:21 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: identifying $_ as variable or constant
Message-Id: <x7ofz2bakn.fsf@home.sysarch.com>
>>>>> "ES" == Eric Smith <eric@fruitcom.com> writes:
ES> What is the way to check whether $_ in a loop is a reference or
ES> an actual lvalue?
ES> Because in the log file I want to distinguish clearly between a label
ES> and an lvalue. viz.
ES> * This is the result *
ES> 4535 widgets delivered
ES> * phonumnumber is *
ES> 00 31 20 42353244
ES> ...
ES> Is that not clear?
no. you don't show the call which generates those log messages. remember
to show examples of input AND output when you want to show a
transformation. you seem to show one or the other.
>> cuddled elses are considered poor style. and 2 char indents are also
>> poor style IMO. a quick glance doesn't show me the blocking at all.
ES> mmm, how many do you want?
at least 4 spaces. i prefer hard tabs but that is my style. 2 is way too
little to stick out visually.
ES> This brings me to another burning question that I forgot to
ES> mention in my original post. I did ask this question some time
ES> ago but cannot recall/find the answer. Is it / how is it
ES> possible ... to open to physical files with a single
ES> fiklfilehandle. Without using `tee' or any unix specific calls.
tied handles can do it.i think there is a module on cpan for this. if
not, it is easy to create.
ES> I sometimes prefer to use the qq notation - to me it is clearer than
ES> double quotes. Maybe I am in the minority.
for regular quoted strings it obsfucates unnecessarily. use the normal
quotes for normal strings. reserve qq for short strings with " inside
them. use here docs for longer strings with " inside.
ES> between the two cases. When I gave the example of passing @array
ES> to the function, I meant to say that the function may be
ES> presented with a series of vars (lvalues) with no alternate
ES> constants to label these lvalues. The funstion needs to know
ES> this in order to give the desired visual distinction.
a simpler solution is to pass an array as a ref like i said. and then
pass a null label string in front of it. you are working at this
backwards IMO. fix the api, not the code behind it.
the only way i know to check for a constant string is to assign to
it. so if you insist on your strategy, first copy each value to save it,
then in a eval {} try to assign to it. if you succeed, it is an
value. but that will destroy the original lvalue unless you reassign it
the saved value (which you also use for the printing to the log. that is
a very clumsy way to do the job. the api fix is much better.
ES> ok, I am sure it will dawn on me soon what you mean by `jeopardy'
ES> (apologies I am a bit out of touch). My guess it is after the legal use
ES> of that word.
it is not a legal term. it refers to an american quiz show where you
respond to the clue with the answer in the form of a question. in this
group that means putting your comments before the quoted post. answer
BEFORE the question. that is highly frowned upon as it makes following
the thread much more difficult.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 26 Nov 2000 14:54:27 -0600
From: Chas Friedman <friedman@math.utexas.edu>
Subject: Imbedding POD in script?
Message-Id: <3A217882.9145BDC7@math.utexas.edu>
I thought that if I put text in a script (say "test.pl") surrounded by
"=pod" and "=cut", then
"perldoc test.pl" would extract and exhibit this. I've never been able
to get anything like
this to work (usually get a message that no documentation was found;
also the directories searched
don't seem to include the one containing test.pl, and I can't seem to
make this included.)
Any comments/suggestions would be much appreciated! Thanks in advance!
chas friedman
------------------------------
Date: Sun, 26 Nov 2000 21:27:51 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Imbedding POD in script?
Message-Id: <rffU5.1822$xb1.110391@eagle.america.net>
On Sun, 26 Nov 2000 14:54:27 -0600, Chas Friedman
<friedman@math.utexas.edu> wrote:
>I thought that if I put text in a script (say "test.pl") surrounded
>by "=pod" and "=cut", then "perldoc test.pl" would extract and
>exhibit this. I've never been able to get anything like this to work
>(usually get a message that no documentation was found; also the
>directories searched don't seem to include the one containing
>test.pl, and I can't seem to make this included.) Any
>comments/suggestions would be much appreciated! Thanks in advance!
Read the perlpod manual page.
--
Garry Williams
------------------------------
Date: Sun, 26 Nov 2000 22:03:13 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Imbedding POD in script?
Message-Id: <BMfU5.83$QX6.170635264@news.frii.net>
In article <3A217882.9145BDC7@math.utexas.edu>,
Chas Friedman <friedman@math.utexas.edu> wrote:
>I thought that if I put text in a script (say "test.pl") surrounded by
>"=pod" and "=cut", then
>"perldoc test.pl" would extract and exhibit this. I've never been able
>to get anything like
>this to work (usually get a message that no documentation was found;
>also the directories searched
>don't seem to include the one containing test.pl, and I can't seem to
>make this included.)
>Any comments/suggestions would be much appreciated! Thanks in advance!
> chas friedman
>
You need a bit more than just =pod and =cut You also need a header or two.
#!/usr/bin/perl
use strict;
use warnings;
=pod
=head1 STUFF
This is a bit of pod here
=cut
seek(DATA, 0, 0);
while(<DATA>) {
print;
}
__END__
--
This space intentionally left blank
------------------------------
Date: 26 Nov 2000 13:05:11 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Most easy way to get IP from a local NIC by device name (eth0,eth1...)
Message-Id: <8vr1q7$gfs$1@nntp1.ba.best.com>
In article <f55o1tkrf5d4uorh7tksapvqs7bu3ddd3h@4ax.com>,
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.li> wrote:
>On Wed, 22 Nov 2000 01:49:57 GMT, mgjv@tradingpost.com.au (Martien Verbruggen)
>wrote:
>
>> Of course, you have to wrap anything in a sub anyway, and test for the
>> platform you're on. You're free to use ifconfig where appropriate,
>> netstat where that works, and anything else for the others (ipconfig
>> for NT?)
>
>Probably. And, theoretically, winipcfg on Win 9x, though it'll probably be tough
>parsing stuff out of a GUI with Perl.
It's easier to parse the output of `netstat -rn` on Win9x.
C:\>perl -le "for(`netstat -rn`){@a=split; print $a[3] if $a[1] eq '255.255.255.255' and not $seen{$a[3]}++ and $a[1] ne $a[0]}"
127.0.0.1
192.168.1.2
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Sun, 26 Nov 2000 21:24:50 +0100
From: jens <jensluetzen@yahoo.de>
Subject: Re: reading IP and MAC addresses with Win::Registry module regexp?
Message-Id: <3A217192.E69F0192@yahoo.de>
Thanks for your help.. unfortunately, I have to use perl to solve this problem,
thus I will try to find the devicename in some registry key and then use it to
extract the registry value at the respective location..
jens
H C wrote:
> > Your problem isn't really a regex issue; in fact it has nothing to do
> > with Perl. In Perl or any other language, if you need to grab IP
> > addresses and MAC addresses reliably on a Win32 OS, hunting through
> > the Registry won't do it. I would suggest reading up on using SNMP in
> > Microsoft OSes; there's a fair amount of info available on the Net.
>
> Lew is correct...it's not a regex issue. The IP address is kept in one
> (generally) location in
> the Registry...you don't have to search the entire Registry w/ a regex to find
> it:
>
> HKLM\SYSTEM\CurrentControlSet\Services\<devicename>\Parameters\Tcpip\IPAddress
>
> You can get the MAC address by calling the server or workstation transports
> via the Win32::Lanman
> module. Note: This can also be done via a null session.
>
> Using the Win32::Registry (I prefer Win32::TieRegistry) and Win32::Lanman
> modules, you don't have to
> install SNMP on your systems, and the collection mechanism is completely
> agentless...
>
> --
> Q: Why is Batman better than Bill Gates?
> A: Batman was able to beat the Penguin.
------------------------------
Date: Sun, 26 Nov 2000 16:14:27 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: reading IP and MAC addresses with Win::Registry module regexp?
Message-Id: <3A217D33.9F73CE93@patriot.net>
> Thanks for your help.. unfortunately, I have to use perl to solve this problem,
Unfortunately? Dude, I try to solve every NT problem w/ Perl first!
> thus I will try to find the devicename in some registry key and then use it to
> extract the registry value at the respective location..
Why not go to http://www.roth.net/perl/scripts? There's already a script there
that will do it. Also, ForixNT, which is avaible from http://www.forixnt.com, will
also get devices and IPs...
------------------------------
Date: 26 Nov 2000 19:33:10 -0200
From: Jorge Godoy <godoy@conectiva.com>
Subject: Re: Secure vs. unsecure server
Message-Id: <3a218196$1@news.terra.com.br>
On Sun, 26 Nov 2000, ayambema@adelphia.net wrote:
> I have a Perl script that has been debugged (using perl -d myscript)
> and works fine on a non-secure server. However, when it is
> transferred to a secure server, it generates an error. Are there any
> special adjustments that one must make to a code on transferring
> from a non-secure to a secure server? I am relatively new to Perl so
> every possible pointer would help. Thanks a million.
If you don't tell us what the error is, there's nothing we can do.
Try reading 'perldoc perlsec' for some security issues.
If you haven't changed anything in your script, it's probably a
problem in the environment it's running in (server configuration, file
permissions, etc.).
Regards,
--
Godoy. <godoy@conectiva.com>
Departamento de Publicações Conectiva S.A.
Publishing Department Conectiva Inc.
------------------------------
Date: Sun, 26 Nov 2000 14:02:03 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: setuid/setgid with perl?
Message-Id: <slrn922nhb.bcl.tadmc@magna.metronet.com>
Marten Lehmann <lehmann@cnm.de> wrote:
>I'm looking for a solution to use the standard system functions setuid
>and setgid
I'd start with:
perldoc perlsec
and
perldoc -f chmod
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 26 Nov 2000 21:23:27 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: setuid/setgid with perl?
Message-Id: <jbfU5.1819$xb1.110391@eagle.america.net>
On Sun, 26 Nov 2000 19:33:18 +0100, Marten Lehmann <lehmann@cnm.de>
wrote:
>I'm looking for a solution to use the standard system functions setuid
>and setgid as known from C and C++. The functions themselves with the
>same name doesn't exist in perl,
But they do. See the POSIX manual page.
Also, take Tad's advice and read the perlsec manual page (thoroughly).
--
Garry Williams
------------------------------
Date: Sun, 26 Nov 2000 14:57:15 -0600
From: "shreve.net" <jhyde@shreve.net>
Subject: Re: Test to see if a file exists?
Message-Id: <B646D54A.4488%jhyde@shreve.net>
in article QduT5.137906$td5.20530432@news1.rdc2.pa.home.com, Revelation at
rev260@home.com wrote on 11/24/00 7:41 AM:
> If $date_1.jpg exists I want to print out a link to it...how can I check if
> it does?
>
> Revelation
> rev260@home.com
>
>
>
Try this:
my $html_code;
my $web_address_to_images = "http://www.foo.com/media";
my $path_to_images = "/path/to/images;
my $jpg = "the_jpg_image.jpg";
if (-e "$path_to_jpg/$jpg") {
$htmlcode = "<img src="$web_address_to_images/$jpg"\n";
}
Joe
------------------------------
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 4969
**************************************