[10632] in Perl-Users-Digest
Perl-Users Digest, Issue: 4224 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 15 16:07:13 1998
Date: Sun, 15 Nov 98 13:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 15 Nov 1998 Volume: 8 Number: 4224
Today's topics:
Re: A Newbie That Needs Some Quick Help <r28629@email.sps.mot.com>
Re: A Newbie That Needs Some Quick Help <r28629@email.sps.mot.com>
Re: A Newbie That Needs Some Quick Help <r28629@email.sps.mot.com>
Activestate perl and whois <donsimon@bellsouth.net>
Re: Activestate perl and whois <erikd@zip.com.au>
Re: allowed index variables in foreach loops <ghira@mistral.co.uk>
Re: changing formvalues <soccer@all-soccer.com>
Re: How do I check for a valid URL (brian d foy)
Re: Is this a regex bug? miles33@ix.netcom.com
Re: Just a quick debugging problem..... <stevenjm@olywa.net>
Newbie: File creation problem. <chrknudsen@hotmail.com>
Re: Newbie: File creation problem. (Larry Rosler)
Re: Not deleting correctly... (Ronald J Kimball)
Patter matching in a variable problem <ilya@foothill.net>
Re: Patter matching in a variable problem <dgris@moiraine.dimensional.com>
Perl for web programming <freddy@attrition.com>
Re: Perl for web programming (brian d foy)
Re: Perl script for changing page every day <soccer@all-soccer.com>
Problems with SysV IPC, Semaphore use... <mickm@ix.netcom.com>
Re: Regular expression for "B, except after A"? <garethr@cre.canon.co.uk>
Win32::AdminMisc::UserSetMiscAttributes (Was Re: Win32 odinjon@my-dejanews.com
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 15 Nov 1998 11:49:05 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: Larry Rosler <lr@hpl.hp.com>
Subject: Re: A Newbie That Needs Some Quick Help
Message-Id: <364F05FF.E7E32C9A@email.sps.mot.com>
[posted to c.l.p.m and copy emailed]
Larry Rosler wrote:
>
> [Posted to comp.lang.perl.misc and copy mailed.]
>
> In article <364EED18.14124985@email.sps.mot.com> on Sun, 15 Nov 1998
> 10:02:48 -0500, Tk Soh <r28629@email.sps.mot.com> says...
> > Lee wrote:
> > >
> > > Hi, i'm a total newbie to Perl, i've read a "Perl By Example" Book,
> > > but i'm not so hot with the lang. yet. Anyways, I'm currently
> >
> > We are only a bunch of very-hot-with-this-lang people trying to help the same
> > kind of people here. if you are not-so-hot about this lang, than I suggest you
> > leave this ng alone.
>
> Totally wrong-headed attitude! We are all here to learn, with varying
> temperatures.
>
> Don't drive away newcomers who have legitimate questions. Too bad
> that the post you tried to blow off was too vague to allow us to be more
> helpful.
I whole-heartedly agreed with what you said. I guessed I was a little upset
with what the original author said - it almost sounded to me like "I don't
like you, but I want you to help." I hope, but don't expect, you understand that.
In any case, I am grateful about how much I have gained in this ng.
-tk
------------------------------
Date: Sun, 15 Nov 1998 12:00:02 -0500
From: Tk Soh <r28629@email.sps.mot.com>
To: Tad McClellan <tadmc@flash.net>, just_the_man@hotmail.com
Subject: Re: A Newbie That Needs Some Quick Help
Message-Id: <364F088F.F0AE69B8@email.sps.mot.com>
Tad McClellan wrote:
>
> Tk Soh (r28629@email.sps.mot.com) wrote:
> : Lee wrote:
> : >
> : > Hi, i'm a total newbie to Perl, i've read a "Perl By Example" Book,
> : > but i'm not so hot with the lang. yet. Anyways, I'm currently
>
> : We are only a bunch of very-hot-with-this-lang people trying to help the same
> : kind of people here. if you are not-so-hot about this lang, than I suggest you
> : leave this ng alone.
>
> That is simply not true.
>
> This newsgroup if for discussion of Perl programming.
>
> There is no "I'm hot with Perl" requirement.
perhaps I am.
> There is, however, a "I tried my best to find the answer on my
> own before posting" requirement.
>
> I have seen Tk posting here often, and am very surprised to
> hear that this is the perception of a clueful individual.
>
> It is usually the newbies that get it wrong like that.
Actually, from many angles, I am still a newbie.
> Do not follow his/her suggestion to leave this ng alone.
This is he ;)
>
> If you tried (word search the standard docs, and search the ng
> at www.dejanews.com) to find the answer yourself, and came up
> short, please feel free to ask here.
>
> Lee did not give enough information to allow us to help him/her.
>
> Include a _small_ sample of what the input data looks like,
> and a sample of what you want the output data to look like.
>
> Then we might have enough to work with.
My apology with the rather harsh wording in my earlier reply to Lee. I did
_not_ mean to discourage people from learning Perl. No the contrary I have
done quite the opposite alot, as least in my own community.
I will leave it to Lee to decide if Perl is best for him/her.
-tk
------------------------------
Date: Sun, 15 Nov 1998 12:13:22 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: A Newbie That Needs Some Quick Help
Message-Id: <364F0BB1.F1F883CD@email.sps.mot.com>
Tk Soh wrote:
>
> [posted to c.l.p.m and copy emailed]
>
> Larry Rosler wrote:
> >
> > [Posted to comp.lang.perl.misc and copy mailed.]
> >
> > In article <364EED18.14124985@email.sps.mot.com> on Sun, 15 Nov 1998
> > 10:02:48 -0500, Tk Soh <r28629@email.sps.mot.com> says...
> > > Lee wrote:
> > > >
> > > > Hi, i'm a total newbie to Perl, i've read a "Perl By Example" Book,
> > > > but i'm not so hot with the lang. yet. Anyways, I'm currently
> > >
> > > We are only a bunch of very-hot-with-this-lang people trying to help the same
> > > kind of people here. if you are not-so-hot about this lang, than I suggest you
> > > leave this ng alone.
> >
> > Totally wrong-headed attitude! We are all here to learn, with varying
> > temperatures.
> >
> > Don't drive away newcomers who have legitimate questions. Too bad
> > that the post you tried to blow off was too vague to allow us to be more
> > helpful.
>
> I whole-heartedly agreed with what you said. I guessed I was a little upset
> with what the original author said - it almost sounded to me like "I don't
> like you, but I want you to help." I hope, but don't expect, you understand that.
>
> In any case, I am grateful about how much I have gained in this ng.
>
> -tk
Also, perhaps I shouldn't read any newsgroups in my moving day - it makes me
thing less logically.
-tk
------------------------------
Date: Sun, 15 Nov 1998 19:07:38 GMT
From: "DONALD SIMONTON" <donsimon@bellsouth.net>
Subject: Activestate perl and whois
Message-Id: <_DF32.3333$RM6.3681980@news2.mia.bellsouth.net>
Question question. I just recently installed activestate perl for win32 on
a Windows 98 machine. And I'm trying to write a little script to check
whois for a domain name. The problem that I'm having is that it all seems
to work, but it never actually goes to internic to access the information.
I can get the script to work on unix without any problem. But I'd like to
get this to work on 98. Any suggestions?
Below is just some of the info that I use, please help!
#!c:/perl/perl.exe
$WHOISPROC = "C:/perl/site/lib/uri/url/whois";
open (WHOIS, "$WHOISPROC ${currword}.com 2>&1 |");
------------------------------
Date: Mon, 16 Nov 1998 07:41:34 +1100
From: Erik de Castro Lopo <erikd@zip.com.au>
Subject: Re: Activestate perl and whois
Message-Id: <364F3C7E.1EC2456D@zip.com.au>
DONALD SIMONTON wrote:
>
> Question question. I just recently installed activestate perl for win32 on
> a Windows 98 machine. And I'm trying to write a little script to check
> whois for a domain name. The problem that I'm having is that it all seems
> to work, but it never actually goes to internic to access the information.
> I can get the script to work on unix without any problem. But I'd like to
> get this to work on 98. Any suggestions?
>
> Below is just some of the info that I use, please help!
>
> #!c:/perl/perl.exe
> $WHOISPROC = "C:/perl/site/lib/uri/url/whois";
> open (WHOIS, "$WHOISPROC ${currword}.com 2>&1 |");
I've written a whois in Perl. I've included it below
my .sig.
Erik
--
+-------------------------------------------------+
Erik de Castro Lopo erikd@zip.com.au
+-------------------------------------------------+
Windows 2000 : The Tyranosaurus Rex of the software
world. Large, ferocious and soon to be extinct.
______________________________________________________________________
#!/usr/bin/perl -w
#
# whois.pl - the whois (man whois) program written in Perl.
# by erikd@zip.com.au
# Copyright 1998 Erik de Castro Lopo
# version 1.00 Sun Nov 1 19:56:50 EST 1998
#=====================================================================
# This program takes a single argument as either host.name
# of host.name@whois.server.
#
# If the argument is of the former type it will look up
# host.name on whois.internic.net.
#
# If the argument is of the second type it will look up host.name
# on the given server.
#
# If hostname is like a dotted quad but with the last one or two
# numbers missing, it will search whois.arin.net for the owner
# of the class C or class B network.
#=====================================================================
use strict ;
sub lookup_whois_server ($$) ;
sub is_valid_ip_address ($) ;
if (@ARGV != 1)
{ print 'usage: whois user[@<whois.server>]', "\n" ;
exit 0 ;
} ;
my ($DEFAULTSERVER, $commandline, $server, $hostname) ;
# Here is our default whois server.
$DEFAULTSERVER = "whois.internic.net" ;
$commandline = shift (@ARGV) ;
if ($commandline =~ /\@/)
{ ($hostname, $server) = split (/\@/, $commandline) ;
}
else
{ $hostname = $commandline ;
$server = $DEFAULTSERVER ;
if (is_valid_ip_address ($hostname))
{ $server = "whois.arin.net" ;
} ;
}
print lookup_whois_server ($commandline, $server), "\n" ;
exit 0 ;
#================================================================
# Here are the subroutines.
sub lookup_whois_server ($$)
{ my ($session, $hostname, $server, $ref) ;
$hostname = shift ;
$server = shift ;
use Net::Telnet ;
$session = Net::Telnet-> new() ;
# On error, return rather than die!
$session->errmode ("return") ;
$session->open (Host => $server, Port => 43, Timeout => 20) ;
if ($session->error)
{ return "Error : could not connect to server ($server)." ;
} ;
$session->cmd (String => "$hostname\n") ;
# This barfs when connecting to whois.internic.net because it gets
# an EOF at the end. Fortunately we've told the the Telnet object
# to return when it gets an error so we can just pull our data
# out of the Telnet object's buffer and return it.
$ref = $session->buffer ;
return "\[$server\]\n" . $$ref ;
} ; # sub lookup_whois_server
sub is_valid_ip_address ($)
{ my $name = shift ;
if (($name =~ tr/[0-9\.]//) != length ($name))
{ return 0 ;
} ;
my @numbers = split (/\./, $name) ;
if (@numbers < 1)
{ return 0 ;
} ;
my $num ;
foreach $num (@numbers)
{ if ($num < 1 || $num > 254)
{ return 0 ;
} ;
} ; # foreach
return 1 ;
} ; # sub is_valid_ip_address
------------------------------
Date: 15 Nov 98 18:43:00 +0000
From: "Adam Atkinson" <ghira@mistral.co.uk>
Subject: Re: allowed index variables in foreach loops
Message-Id: <976.623T36T11232901@mistral.co.uk>
On 15-Nov-98 17:50:13, Larry Rosler said:
>> I was curious, though. Why is this not permitted?
>`perldoc perlsyn`:
>Note that VAR must be a 'variable' that can be declared (and if not
>declared, is implicitly declared local to the loop). $a[0] is a scalar,
>but cannot be declared. (@a can be declared, but is not a scalar.)
aha...
>I don't have the Llama at home to check, but it intends to be tutorial
>rather than precise in any case.
of course. I shall try to do better in future.
>The quote above from 'perlsyn' isn't
>all that clear either, but the answer can be parsed out of it.
Indeed. Thank you for your assistance.
--
Adam Atkinson (ghira@mistral.co.uk)
Ordinary decent people in this country are sick and tired of being told
that ordinary decent people in this country are fed up with being sick
and tired. I am certainly not, and I'm sick and tired of being told that
I am. (M. Python)
------------------------------
Date: Sun, 15 Nov 1998 13:34:16 -0500
From: Geoffrey Hebert <soccer@all-soccer.com>
Subject: Re: changing formvalues
Message-Id: <364F1EA7.DFF0C0DC@all-soccer.com>
No.
Casema wrote:
> Can man dynamically change values from <INPUT TYPE="TEXT"> from a Perl
> script?
> Like pressing a button would search my database and pass the found content
> into a textbox, so I do not have to push a new form to the browser?
>
> Michel
------------------------------
Date: Sun, 15 Nov 1998 15:04:55 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: How do I check for a valid URL
Message-Id: <comdog-ya02408000R1511981504550001@news.panix.com>
In article <vxD32.32756$%X2.4805635@news3.voicenet.com>, hex@voicenet.com (Matt Knecht) posted:
> Rafely@xxiname.com <Rafely@xxiname.com> wrote:
> >
> >My question is, does anyone have a method for checking for a valid
> >URL? Maybe you're using one in a script or you've seen one in a script
> >somewhere!
>
> Abigail posted a pretty exaustive regex that deals with validating an
> URL. Check dejanews with with a search string of
> "~g comp.lang.perl.misc ~a Abigail ~s Counting URLs".
that will just check the form of an address - not that it actually
exists. this is basically the same problem as email address or
credit card number verification. it might look valid, but eventually
you have to see what happens when you try to use it.
in this case, just pass the url to LWP and see if you can fetch
it. there are examples of this sort of thing in the LWP docs.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Sun, 15 Nov 1998 18:32:51 GMT
From: miles33@ix.netcom.com
Subject: Re: Is this a regex bug?
Message-Id: <72n6oj$mij$1@nnrp1.dejanews.com>
In article <8cg1bnqsrx.fsf@gadget.cscaper.com>,
Randal Schwartz <merlyn@stonehenge.com> wrote:
> >>>>> "miles33" == miles33 <miles33@ix.netcom.com> writes:
>
> miles33> Hi
> miles33> The code included below generates:
>
> miles33> *tag1
> miles33> *tag2
> miles33> **tag3
> miles33> **tag4
>
> As I expected.
>
> miles33> I expected:
>
> miles33> *tag1
> miles33> *tag2
> miles33> **tag1
> miles33> **tag2
> miles33> **tag3
> miles33> **tag4
>
> No. :)
>
> miles33> Changing the hashref to a scalar gives me the results I expect.
>
> Hmm. I doubt this, unless you are making a copy at the same time.
>
Yep, you're right, I wasn't passing a reference to the scalar, I was copying
it.
> If you copy the data to a new scalar var, then you'll get a new pos().
> If that's what you want, you need to do it yourself.
>
For some reason I thought that the pos() was only valid within the enclosing
block.
Thanks for the clarification.
Chris H.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 15 Nov 1998 11:07:55 -0800
From: Steven May <stevenjm@olywa.net>
Subject: Re: Just a quick debugging problem.....
Message-Id: <364F268B.9B8FB7B9@olywa.net>
Tyler Hutcheon wrote:
>
> Hi.
>
> I'm no beginner to programming perl, but I've found one problem that I can't
> find the answer to.
> Here is what perl is reporting the problem to be.
>
> Use of uninitialized value at index.cgi line 52.
> Use of uninitialized value at index.cgi line 70.
>
> If anyone knows what this is, pleez tell me.
>
Larry and Tad pretty much nailed this, but I wonder if the real issue
here is you aren't certain what uninitialized means?
It simply means that you've tried to use a variable that has not been
initialized.
Example:
line 1: my($x);
line 2: my($value);
line 3: my($y) = 2;
line 4:
line 5: $x = $y + $value;
line 6: print "This is x: $x\n";
You're attempting to add $y to an uninitialized $value and perl (using
-w) will tell you:
Use of uninitialized value at script.cgi line 5.
If there aren't a whole lot of values in the line(s) involved, you can
sometimes substitute strings for the values one at a time till you find
the culprit, then look back through your code to find where you made
your mistake. (Using the debugger may be more efficient for many
cases.) In the case above, change line four :
line 1: my($x);
line 2: my($value);
line 3: my($y) = 2;
line 4: $value = 4;
line 5: $x = $y + $value;
line 6: print "This is x: $x\n";
Perl will then be happy, and print:
This is x: 6
It is usually good to test values that might be suspect before using
them:
if($value){
$x = $y + $value;
print "This is x: $x\n";
}
else{ &do_something_else}
This will also save you some grief in dealing with code that doesn't
work as expected.
HTH,
Steve
------------------------------
Date: Sun, 15 Nov 1998 18:38:52 GMT
From: "Christian H. Knudsen" <chrknudsen@hotmail.com>
Subject: Newbie: File creation problem.
Message-Id: <364F2084.365E0562@hotmail.com>
I've made a short routine to check if a file exists, then
create it if not. Doesn't work. I don't get an error, it
just doesn't create the file.
Here's the code:
### CODE START ###
$ip = $ENV{'REMOTE_ADDR'};
$cart = "/data1/hypermart.net/bluegalaxy/carts/$ip";
if (! -e $cart) {
open (CART, ">$cart");
print (CART "");
close (CART);
}
### CODE END ###
I've also tried sysopen with O_CREATE (or something like that),
but that didn't work either. So, now I need help!
By the way, the /carts directory is chmod to 766, in case you
wondered...
/Christian H. Knudsen
------------------------------
Date: Sun, 15 Nov 1998 11:41:16 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie: File creation problem.
Message-Id: <MPG.10b8ce39221d357398990d@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <364F2084.365E0562@hotmail.com> on Sun, 15 Nov 1998 18:38:52
GMT, Christian H. Knudsen <chrknudsen@hotmail.com> says...
...
> if (! -e $cart) {
> open (CART, ">$cart");
...
> I've also tried sysopen with O_CREATE (or something like that),
> but that didn't work either. So, now I need help!
Let Perl help you.
if (! -e $cart) {
open (CART, ">$cart") or die "Couldn't create $cart. $!\n";
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 15 Nov 1998 13:18:19 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Not deleting correctly...
Message-Id: <1dijd79.l1ct62x102z4N@bay1-465.quincy.ziplink.net>
Julian Gilbey <J.D.Gilbey@qmw.ac.uk> wrote:
> > my($date) = split(/\|/,$_);
>
> So $date is set to 6, the number of fields. Did you use
> the -w flag when executing Perl? It should have said
> something like "Implicit split to @_ is deprecated".
That is not correct. This is not an implicit split to @_. This is a
split to the list ($date). $_ will be split into two strings. The
first will be assigned to $date, and the second will be discarded.
Perhaps you had this confused with:
my $date = split(/\|/,$_);
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 15 Nov 1998 19:34:13 GMT
From: Ilya <ilya@foothill.net>
Subject: Patter matching in a variable problem
Message-Id: <72nabm$jk4$1@ns2.foothill.net>
I have a variable that I want to find a pattern in. If that variable has
the string I am looking for, I want to out put that entire line to another
variable.
I scanned several books and could not find the exact example. All examples
are: If this variable has the string, then <do something>, or put the
results back in the variable. But I want to preserve the original variable
for more searches.
@new_values = $old_values =~ /string/;
does not work.
Thanks a lot.
------------------------------
Date: 15 Nov 1998 12:47:37 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Patter matching in a variable problem
Message-Id: <m3vhkgzqjq.fsf@moiraine.dimensional.com>
Ilya <ilya@foothill.net> writes:
> I have a variable that I want to find a pattern in. If that variable has
> the string I am looking for, I want to out put that entire line to another
> variable.
> @new_values = $old_values =~ /string/;
>
> does not work.
push @new_values, $old_values if $old_values =~ /string/;
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
Supporter of grumpiness where grumpiness is due on clpm.
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Sun, 15 Nov 1998 13:34:09 -0600
From: "Alfredo LopezJr." <freddy@attrition.com>
Subject: Perl for web programming
Message-Id: <364F2CB0.F9E4805D@attrition.com>
Is there some kind of comp.lang.perl.misc FAQ so we know what kind of perl
questions can be asked or are there any other newsgroups someone can suggest for
perl-cgi questions? I've been monitoring these and other perl newsgroups for a
while and whenever someone asks a cgi question, they all seem to say the same
thing... and often not as nicely as this one.
Just curious because the sole reason I and a lot of the people I work with even
became interested in perl was for web programming (which as far as I can tell is
a main reason for its current popularity) and it would be nice to find a place to
be able to comfortably ask questions in.
Thanks for any suggestions,
-Alfredo
Tk Soh wrote:
<snip>
> Using Perl for web-programming doesn't quite make them suitable for this
> ng. (Make not mistake, I use perl for my CGI programming too)
>
> -tk
AlfredoLopez
Express-News New Media Design
------------------------------
Date: Sun, 15 Nov 1998 15:02:46 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl for web programming
Message-Id: <comdog-ya02408000R1511981502460001@news.panix.com>
In article <364F2CB0.F9E4805D@attrition.com>, "Alfredo LopezJr." <freddy@attrition.com> posted:
> Is there some kind of comp.lang.perl.misc FAQ so we know what kind of perl
> questions can be asked or are there any other newsgroups someone can suggest for
> perl-cgi questions?
in general, newsgroups are devoted to the topic of their name. if there
is another newsgroup with a more focused topic, then questions belong
in that newsgroup rather than in the more general one. in this case,
the group that you want is comp.infosystems.www.authoring.cgi.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Sun, 15 Nov 1998 13:29:17 -0500
From: Geoffrey Hebert <soccer@all-soccer.com>
To: Terje Hansen <tehan@online.no>
Subject: Re: Perl script for changing page every day
Message-Id: <364F1D7C.9CB71E10@all-soccer.com>
There are many ways of doing what you want.
What do you mean change content?
Who will change it?
How will it be changed?
Let's say you had a paragraph in a page that would change every day.
Who would create it? How would it be created?
Let's say you were adding the paragraph. You could write a perl script to
process a form with your new paragraph. It would merge old information with new
information.
Let's say you wanted to go to a different URL every day. You would create a
page DAY01.01.98, DAY01.02.98, etc. Your perscript would redirect to the
correct page.
You need to be more specific about the functionality of the perl script.
Terje Hansen wrote:
> Is there a Perl script which automates the task of changing the content of a
> certain url every day?
> For example www.mydomain.com/page.htm and I want to change the content of
> page.htm once a day
> Cheers, Terje
------------------------------
Date: Sun, 15 Nov 1998 10:50:56 -0800
From: Mickey Mestel <mickm@ix.netcom.com>
Subject: Problems with SysV IPC, Semaphore use...
Message-Id: <364F2290.96F25142@ix.netcom.com>
hi all,
i'm on an SS5, running solaris 2.6, perl5.00502. when i run the
following code, it always dies with Permission denied on the second call
to semctl, second time through the loop. i originally had another call
to semctl in there, and it was dieing on that one, so i took it out to
see what was up, it always seems to die on the second call.
anyone know what is up with this?
thanks,
mickm
-------------------------------cut here---------------------------------
#!/usr/local/bin/perl
use IPC::SysV qw(IPC_CREAT);
$IPC_KEY = 1234;
$key = semget($IPC_KEY, 10, 0666 | IPC_CREAT ) || die "$!";
print "sem key $key\n";
while(TRUE)
{
print "change the semaphore? ";
chop($c = <STDIN>);
exit if ($c eq 'e');
if ($c eq 'y')
{
$semval = semctl($key, 0, GETVAL, $x);
die "$! on semctl" if (!defined($semval));
print "semval is $semval\n";
$semval = ($semval == 1) ? -1 : 1;
$semop = pack("s*", 0, $semval, 0);
$rv = semop($key, $semop);
die "$! on semop" if (!defined($rv));
}
}
---------------------------------done-----------------------------------
--
-----------------------------------------------------------------------
This is a signature file. This is only a signature file. Had this
been an actual piece of useful information, you would have been
instructed on what to do with it.
-----------------------------------------------------------------------
------------------------------
Date: Sun, 15 Nov 1998 18:20:38 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Regular expression for "B, except after A"?
Message-Id: <sisofkx1ft.fsf@cre.canon.co.uk>
Ian Underwood <science@home.com> wrote:
> Is there some way, in a single expression, to match something except
> when it's immediately preceded by something else?
Perl 5.005's regular expression engine has "zero-width lookbehind
assertions". Look in "perldoc perlre" for details.
If you're running an earlier version, look at what "perldoc perlre" (see
also "Programming Perl", pages 68-69) has to say about this:
lookahead and lookbehind are NOT the same thing. You cannot use
this for lookbehind: /(?!foo)bar/ will not find an occurrence of
"bar" that is preceded by something which is not "foo". That's
because the (?!foo) is just saying that the next thing cannot be
"foo"--and it's not, it's a "bar", so "foobar" will match. You
would have to do something like /(?!foo)...bar/ for that. We say
"like" because there's the case of your "bar" not having three
characters before it. You could cover that this way:
/(?:(?!foo)...|^..?)bar/. Sometimes it's still easier just to say:
if (/foo/ && $` =~ /bar$/)
--
Gareth Rees
------------------------------
Date: Sun, 15 Nov 1998 20:38:53 GMT
From: odinjon@my-dejanews.com
To: david.richards@alderley.zeneca.com
Subject: Win32::AdminMisc::UserSetMiscAttributes (Was Re: Win32 UserCreate )
Message-Id: <72ne4t$s4p$1@nnrp1.dejanews.com>
I was just scanning some of the perl module archives, and came accross this
old post.
I'm also having trouble using the UserSetMiscAttributes function in the
AdminMisc module. I was unable to find any list of issues that may be related
to this function.
I can't seem to get the UserSetMiscAttributes function to set certain
attribute values. Can you please let me know if you've had success or
problems with this function?
Source:
use Win32::AdminMisc;
Win32::AdminMisc::UserSetMiscAttributes('', 'OdinTest789',
USER_HOME_DIR_DRIVE, "i:",)||print "No Set!!!\n";
Win32::AdminMisc::UserGetMiscAttributes('', 'OdinTest789', \%hash) || die;
foreach $i (sort keys(%hash)){
print "$i = ". $hash{$i} ."\n";
}
Output:
No Set!!!
USER_ACCT_EXPIRES = 4294967295
USER_AUTH_FLAGS = 0
USER_BAD_PW_COUNT = 0
USER_CODE_PAGE = 0
USER_COMMENT = User Account: (dev4000)
USER_COUNTRY_CODE = 0
USER_FLAGS = 513
USER_FULL_NAME = Anderson, Odin Test 789
USER_HOME_DIR = \\dev4000\odintest789
USER_HOME_DIR_DRIVE =
USER_LAST_LOGOFF = 0
USER_LAST_LOGON = 0
USER_LOGON_HOURS = 255
USER_LOGON_SERVER = \\*
USER_MAX_STORAGE = 4294967295
USER_NAME = odintest789
USER_NUM_LOGONS = 0
USER_PARMS =
USER_PASSWORD =
USER_PASSWORD_AGE = 146040
USER_PASSWORD_EXPIRED = 0
USER_PRIMARY_GROUP_ID = 513
USER_PRIV = 1
USER_PROFILE = \\dev4000\odintest789\profile\odintest789
USER_SCRIPT_PATH = login.scr
USER_UNITS_PER_WEEK = 168
USER_USER_ID = 1228
USER_USR_COMMENT = Added by OdinAdmin, 11-4-1998
USER_WORKSTATIONS =
Perl Version:
This is perl, version 5.005_02 built for MSWin32-x86-object
Binary build 504 provided by ActiveState Tool Corp. http://www.ActiveState.com
Built 14:58:28 Oct 9 1998
AdminMisc Version:
ftp://ftp.roth.net/pub/ntperl/adminmisc/980511/bin/
75994 Oct 8 15:06 File AdminMisc_Build_5_005.zip
Other Background Stuff:
NT 4.0 SP4 Workstation
NT 4.0 SP3 Server
Single Domain Model
Script run from a Domain Admin account on an NT Workstation
Any input you can provide is greatly appreciated!!!
Odin
--
Odin.Anderson@TDSTelecom.Com
(608) 664-4627
>In article <01bda511$b6e61140$55a0479c@UKMCPHISFW051.ukmcph.zeneca.com>,
> "David Richards" <david.richards@alderley.zeneca.com> wrote:
>>
>> WedgeX@my-dejanews.com wrote in article
>> <6ndc9i$uv8$1@nnrp1.dejanews.com>...
>> > I've managed to get UserCreate to work in NT, but one thing I haven't
>> found a
>> > setting for is to tell NT what drive letter to assign the home directory
>> I
>> > specify in the UserCreate statement.
>>
>> In Dave Roth's Win32::AdminMisc there is a UserSetMiscAttributes with an
>> attribute USER_HOME_DIR_DRIVE.
>>
>> David
>Hmm, it wasn't in the README but I see it in there now. There is one strange
>thing I've seen with AdminMisc's UserSetMiscAttributes though. I used it to
>set the USER_FULL_NAME field. It worked wonderfully for 2-3 test runs, but
>then just stopped working. Win32::GetLastError just spits out a generic
>message about not being able to get some environment option. I just assumed
>that might be that AdminMisc doesn't set up the errors for GetLastError the
>same as the stock Win32 modules.
>
>This exact problem occurred on two different computers on two different
>domains. I use the ActiveState perl build 316, and AdminMisc 980511 (the
>latest one on it's web page). Any clues?
--
Odin
--
Odin@POBox.Com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 4224
**************************************