[9676] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3270 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 27 20:03:36 1998

Date: Mon, 27 Jul 98 17:00:18 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 27 Jul 1998     Volume: 8 Number: 3270

Today's topics:
    Re: Mongers, Pumpkinholders, Porters (Chris Nandor)
    Re: Nead a Redir Script, Please (Eric Harley)
    Re: Nead a Redir Script, Please (Bob Trieger)
    Re: Nead a Redir Script, Please (Kelly Hirano)
    Re: NT Sysadmin scripts <petergrp@lbl.gov>
        Perl use in html documents <eskeye01@homer.louisville.edu>
    Re: Reacting to 1 of 10 or so possible values.... Need  (Larry Rosler)
    Re: sending mail from within perl (-)
    Re: Submit only Once (-)
        Win32::OLE trouble (Constantine J Tombras)
    Re: Y2K problem in PERL with localtime() (Erdem Ozsaruhan)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 27 Jul 1998 23:39:59 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Mongers, Pumpkinholders, Porters
Message-Id: <pudge-2707981939240001@192.168.0.3>

In article <6pimq7$c9k$1@nnrp1.dejanews.com>, birgitt@my-dejanews.com wrote:

# I am just wondering where these names came from, if they are used
# only in the Perl community and what and who the Perl Mongers,
# Pumkinholders and Porters really are.

Mongers: tried to find a name that began with an M, so it would go with
".pm".  Mongers are whoever show up at the meetings (Boston.pm has one
this Saturday, see http://boston.pm.org/ for details) or join the mailing
lists.

Pumpkings (pumpkin holders): won't get into the history, but these are
designated by Larry to lead development.  See perlhist.pod in perl5.005
for who has been the pumpking for each release.

Porters: whoever is in the Changes document, and, more generally, whoever
participates on the perl5-porters mailing list.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


------------------------------

Date: Mon, 27 Jul 1998 16:29:57 -0700
From: eharley@pacbell.net (Eric Harley)
Subject: Re: Nead a Redir Script, Please
Message-Id: <eharley-2707981629580001@ppp-207-214-149-155.snrf01.pacbell.net>

You willing to pay 10 dollars for such a script?

-Eric Harley
eharley@pacbell.net


------------------------------

Date: Mon, 27 Jul 1998 23:34:58 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Nead a Redir Script, Please
Message-Id: <6pj300$djo$1@strato.ultra.net>

[ posted and mailed ]

eharley@pacbell.net (Eric Harley) wrote:
-> You willing to pay 10 dollars for such a script?

$10?

Did it take you 6 minutes to write the script and all the documentation that 
goes with it?
How much support are you going to give for that $10?

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972 
  Ext: 1949 and let the jerk that answers know 
  that his toll free number was sent as spam. "


------------------------------

Date: 27 Jul 1998 16:45:11 -0700
From: hirano@Xenon.Stanford.EDU (Kelly Hirano)
Subject: Re: Nead a Redir Script, Please
Message-Id: <6pj3e7$daf@Xenon.Stanford.EDU>

well, first of all, this isn't a perl question. yes, it can be handled with
perl, but it is more of a web server/cgi question.

aside from that, i don't think a redirect is what you want, though, because
afaik, you have to redirect to a url. that url would have to contain the file
path that you are trying to hide. instead, you would want the script to read
in the config file, and upon request, spew out the text of that file. if this
is a high-traffic site, this is a bad idea because unless you're running
mod_perl or fastcgi (the latter would be excellent for this application), it
will be pretty slow.

In article <35bdb5a4.13570833@194.65.22.19>,
Ghost  <Just@CrazySexyCool.Com> wrote:
>Hi
>
>I don4t know to program in Perl, so if someone could help me I will
>apreciate.
>I nead a perl script ( cgi ) to organize my web page.
>I would like something that works li this :
>
>I've got a txt file were I can put  this information :
>
>struture.txt
>
>-------------------------------------------------
>home=http://myserver.com/
>links=http://myserver.com/links/
>files=http://myserver.com/files/
>-------------------------------------------------
>
>and then a script that will work with this tag:
>
><a href="http://myserver/cgi-bin/redir.cgi?id=home">Home Page</a>
><a href="http://myserver/cgi-bin/redir.cgi?id=links">Links Page</a>
><a href="http://myserver/cgi-bin/redir.cgi=id=files">Files Page</a>
>
>the script will read the txt file and redirect the browser to the
>respective page.
>If someone put http://myserver/cgi-bin/redir.cgi in the browser, this
>will redirect automaticaly to the Home Page ( http://myserver ).
>I nead this script to organize the files and for easy link others
>pages.
>This script is for hide the forlder were I4m going to put some files
>too, so I don4t want the real address to apear in the browser when
>someone links to the files folder.
>
>I would like, if possible, when someone links to a file, they only see
>something like this :
>
>http://myserver/cgi-bin/redir.cgi?id=filename
>
>Can anyone help me ??
>
>Thanks in advance
>
>Ghost


-- 
Kelly William Hirano	                    Stanford Athletics:
hirano@cs.stanford.edu	                 http://www.gostanford.com/
hirano@alumni.stanford.org      (WE) BEAT CAL (AGAIN)! 100th BIG GAME: 21-20


------------------------------

Date: Mon, 27 Jul 1998 16:32:19 -0700
From: "Dan Peterson" <petergrp@lbl.gov>
Subject: Re: NT Sysadmin scripts
Message-Id: <6pj3jk$hh9$1@excalibur.flash.net>

Dave,
I have made a similar script , However with this script the username is the
full name in the UMD. Have you a work around for that?

-Dan


Dave Stephens <stepherd@gusun.georgetown.edu> wrote in message
35BCB8CC.95B667ED@gusun.georgetown.edu...
>Well, I'm just starting at the whole NT admin Perl automation thing, but
>here's
>a handy little script I wrote for creating users via a CGI webform.
>It's actually much faster than using the UMD (far less mouse clicks)
>and it would be easy to modify it to reference a text file that held
>constants so you didn't have to enter in the same data (i.e. group,
>etc.) over and over.  Anyway, here's the source.  Feel free to modify it
and
>use it.
>
>Note that I was unable to make this work w/ IIS and ActiveState perl.
>I've been using it on Enterprise w/ Perl v5 build 110 w/ no problem.
>
>Also, the part of the script that sends an e-mail to the newly created
>user assumes that you have Jgaa's wsendmail on the server.  Go to
>http://www.jgaa.com/cgi-bin.htm if you don't have it.
>
>I won't include the html source for the form since you can probably figure
>that out yourself, but if you need it drop me a line at
>stepherd@gusun.georgetown.edu.
>
>
>Hope this helps a bit.
>
>--Dave Stephens
>
>
>#generate header
> print "Content-type: text/html\n\n";
>
># Get Form Information
> &parse_form;
> &get_date;
>
>chdir ("e:/docs/ntadmin/");
>
> $from = "UAA_Tech_Services";
> $server = $in{'server'};
> $username = $in{'username'};
> $name = $in{'name'};
>
>#assign appropriate drive letter
>
>   {
>      $driveletter = "f:";
>           }
>
> if ($server eq "vishnu")
>    {
>      $driveletter = "g:";
>           }
>
>
>#make home directory
> mkdir ("$driveletter/users\$/$username", 0777);
>
>
>#make profiles directory
> mkdir ("$driveletter/profiles\$/$username", 0777);
>
>
>#create user
>
>use Win32::NetAdmin;
>       # set info for the user.
>       $userName = $in{'username'};
>       $password = $username;
>       $passwordAge = 180;
>       $privilege = USER_PRIV_USER;
>       $homeDir = "$driveletter/users\$/$username";
>       $comment = $in{'comment'};
>       $flags = UF_SCRIPT;
>       $scriptpath = 'C:\\';
>       Win32::NetAdmin::UserCreate('', $userName,
>                              $password,
>                              $passwordAge,
>                              $privilege,
>                              $homeDir,
>                              $comment,
>                              $flags,
>                              $scriptpath) || print "Uh, oh.  That username
>may already exist. ";
>
>
>#add the user to the appropriate group
>
>$users = $username;
>$groupName = $in{'group'};
>use Win32::NetAdmin;
>Win32::NetAdmin::LocalGroupAddUsers('',
>         $groupName,
>                              $users,
>                              ) || print "Uh, oh.  Can't assign group.
Check
>to make sure group exists. ";
>
>$email = $in{'email'};
>
>
>#if no @ sign is present append rest of address
>
>if ($email =~ /\@/)
>   { }
>else
>   {
>     @joiner[0] = $email;
>     @joiner[1] = "\@uaa.alaska.edu";
>     $email = join("", @joiner);
>   }
>
>#if no e-mail address is entered then skip sending the message
>
>if ($email ne "")
>{
>
>open(NEWFILE,">email.txt");
>
> #print out e-mail message to send
>
>print NEWFILE "New Account Created";
>print NEWFILE "\n\n";
>print NEWFILE "To: $name\n";
>print NEWFILE "From: $from\n";
>print NEWFILE "Subject: New Account\n";
>print NEWFILE "Date: ";
>print NEWFILE ($date);
>print NEWFILE "\n\n";
>print NEWFILE
"------------------------------------------------------------";
>print NEWFILE "\n";
>
>print NEWFILE "Dear $name,\n\n";
>print NEWFILE "The account you requested has been created.  Please note
>carefully\n";
>print NEWFILE "the following information:\n";
>print NEWFILE "     Username: $username\n";
>print NEWFILE "     Password: $username\n\n";
>print NEWFILE "Your password is initially set you your username.  You will
be
>prompted\n";
>print NEWFILE "to change it the first time you log on to the system.
>Passwords expire\n";
>print NEWFILE "and must be changed every 180 days.\n\n";
>print NEWFILE "Thanks for your request.\n\n";
>print NEWFILE "UAA Tech Services";
>
> #close the file
>
>close (NEWFILE);
>
> #send mail through the mail program
>
>open(MAIL,"|wsendmail.exe -CGI -f($from) -s(Account) $email email.txt");
>
>
>close (MAIL);
>
>}
>
>
>#print something on the screen so you don't get the document contains to
data
>error
>
>print "<HTML>
><HEAD><TITLE>User Created</TITLE>
></HEAD>
><BODY BACKGROUND=\"creampaper.jpg\" BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"
>LINK=\"#0000FF\"
> VLINK=\"#0000FF\" ALINK=\"#FFFF00\">
>
>
><center>
><font size = \"+2\">
>
>User Created</font>
>
><br><br>
>Click <a href = \"index.html\"> HERE </a> to add another
>
></body></html>";
>
>
>#un-webify the form data
>
>sub parse_form {
>
>   # Get the input
>   read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>
>   @pairs = split(/&/, $buffer);
>
>   foreach $pair (@pairs) {
>      ($name, $value) = split(/=/, $pair);
>
>      $value =~ tr/+/ /;
>      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>      $value =~ s/<!--(.|\n)*-->//g;
>
>      if ($allow_html != 1) {
>         $value =~ s/<([^>]|\n)*>//g;
>      }
>      else {
>         unless ($name eq 'body') {
>     $value =~ s/<([^>]|\n)*>//g;
>         }
>      }
>
>      $in{$name} = $value;
>   }
>
>}
>
>
>#Get Date & Format
>
>sub get_date {
>
>   @days =
>('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
>   @months = ('January','February','March','April','May','June','July',
>       'August','September','October','November','December');
>
>   ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
>   if ($hour < 10) { $hour = "0$hour"; }
>   if ($min < 10) { $min = "0$min"; }
>   if ($sec < 10) { $sec = "0$sec"; }
>
>   $date = "$days[$wday], $months[$mon] $mday, 19$year at
$hour\:$min\:$sec";
>
>}
>
>
>
>
>keydet89@yahoo.com wrote:
>
>> Does anyone know were I can find Perl on Win32 sysadmin
>> scripts for maintaining a NT/win95 network?
>>
>> I have checked ActiveState, but I haven't been able to access
>> their forums.
>>
>> I am particularly interested in controlling services, accessing
>> the registry and the EventLog; using NetAdmin, AdminMisc, and
NetResource.
>>
>> Basically, I am looking for examples that I can modify for my own
>> sysadmin uses...
>>
>> Thanks
>>
>> Carv
>>
>> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
>> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum
>
>
>




------------------------------

Date: Mon, 27 Jul 1998 19:03:43 -0400
From: Eric S Keyes <eskeye01@homer.louisville.edu>
Subject: Perl use in html documents
Message-Id: <Pine.HPP.3.95.980727185539.5074A-100000@homer.louisville.edu>

I somewhat can use perl and the book I am learnign from does not help with
this.

My problem in an example:

<html>
<body 'bla bla bla'>
Welcome to my page.

<* Run a perl script to insert data here*>

Thank you and please read my guestbook.
</body>
</html>

To clarify I would like to load a script into the html doc, right now
all I know is how to to is make the perl script create a new html doc and
I do not want to do this.

Please help.

Eric S. Keyes
@}-,-}- BlkRose @}-,-}-

Mail: erickeyes@louisville.edu
Web : http://www.louisville.edu/~eskeye01

"You can push the meek around but those with a strong will, never budge."



------------------------------

Date: Mon, 27 Jul 1998 16:01:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Reacting to 1 of 10 or so possible values.... Need some streamlining help.
Message-Id: <MPG.1026a6c1d061f7e2989749@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <35BCEAE6.1E84@min.net> on Mon, 27 Jul 1998 20:56:15 GMT, John 
Porter <jdporter@min.net> says...
> Randal Schwartz wrote:
> > 
> > >>>>> "John" == John Porter <jdporter@min.net> writes:
> > John> for ( $reqType ) {
> > John>     /^typeOne$/  and  &handle_typeOne    or
> > John>     /^typeTwo$/  and  &handle_typeTwo    or
> > John>                       &do_default_thing
> > John> }
> > 
> > And broken if &handle_typeOne returns false.
> 
> Oof.  Too true.  How's this:
> 
>     for ( $reqType ) {
>         s/^typeOne$/ &handle_typeOne; $& /e    or
>         s/^typeTwo$/ &handle_typeTwo; $& /e    or
>                      &handle_default;
>     }
> 
> 

That seems like a lot of flailing around.

Maybe Randal meant for you simply to change it to this:

for ( $reqType ) {
    /^typeOne$/  ?  &handle_typeOne    :
    /^typeTwo$/  ?  &handle_typeTwo    :
                      &do_default_thing
}


-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Mon, 27 Jul 1998 22:51:01 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: sending mail from within perl
Message-Id: <35bd0420.144761518@news2.cais.com>

>> > Hi:
>> >
>> > I'm running Perl under windows 95.  I want to send mail from a script but do
>> > not have a mail server running.  I am connected 24/7 and wonder if I can use
>> > my mail host (smtp.gte.net) to send the mail for me?
>> >

Yes... you need to understand how to talk to an smtp server, and once
you do, you just need to be able to construct a telnet session with
the mail server, on port 25, to do so....




------------------------------

Date: Mon, 27 Jul 1998 22:49:13 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Submit only Once
Message-Id: <35bd02a0.144377552@news2.cais.com>

"Jim Woodgate" <jdw@dev.tivoli.com> Said this:

>You could generate a random number, store it in a hidden field (which
>would need to be recalculated on a form reset), then store that
>hidden/random number in a database when they submit a *good* form.

Why would it need to be "recalculated" on a form reset?  You do mean a
"clear all fields" or "reset" button created like this, 

<input type=reset>

right?

Because hitting that button will not clear the values of hidden
fields, or fields coded with value="whatever".  Those values remain
after hitting reset.

>
>The first thing you'd check on a form is whether or not the hidden
>field matches anything in the database, if it does, you send them a
>message saying the need to hit "reset" if they want to submit a new
>form.

But hitting reset wouldn't work.  The page you produce from CGI output
should probably have a link back into whatever script generates the
form in the first place, so it can regenerate the unique ID.  Of
course, that may just make it easy for the idiots who were causing the
initial problems anyway.

>
>You might also want to save the random number initially, so the user
>can't modify the form and put in his/her own random numbers, but that
>seems a bit excessive

<input type="hidden" name="session-id" value="xyz23450zxcer">

There, that's simple enough.  Anybody who doesn't use frontpage to
create web pages should be skilled enough to save the page and alter
the code, but so what.





------------------------------

Date: 27 Jul 1998 23:17:32 GMT
From: ctombras@mason2.gmu.edu (Constantine J Tombras)
Subject: Win32::OLE trouble
Message-Id: <6pj1qc$dnt@portal.gmu.edu>

I read Jan Dubois' TPJ article on OLE automation, but I'm still puzzled
why certain things don't work with a simple Word script that I'm working
with.

First, I have installed Office97 twice and still am unable to open an Excel
(or PowerPoint) application from perl, but word works.

So with Word, I would expect:

my $doc = $word_app->Documents->Open(FileName => "c:\\tmp\\doc.txt");

to open doc.txt and assign $doc a Document object.  Yet, $doc seems to
be undefined.

Any ideas on what I am doing wrong? (full script below)

Kosta
ctombras@gmu.edu

Here is what I was trying to do:

# word_ole_test.pl
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Word';

my $infile = "E:\\tmp\\doc.txt";
my $outfile = "E:\\tmp\\summary.txt";
my $summary_length = 15;    # Percentage of original document length.


$word_app = Win32::OLE->new('Word.Application', 'Quit')
    or die "Couldn't create new instance of Word App!";

# Watch what happens while debugging .
$word_app->{Visible} = 1;

# Open a document, extract its key points and save to a new document.
my $doc = $word_app->Documents->Open(FileName => $infile);
$doc->AutoSummarize(Length => $summary_length,
                                  Mode   => wdSummaryModeCreateNew);
$word_app->ActiveDocument->SaveAs(FileName => $outfile,
                                 FileFormat => wdFormatTextLineBreaks);
$word_app->ActiveDocument->Close();
$doc->Close();
$word_app->Quit();

#end of word_ole_test.pl



------------------------------

Date: Mon, 27 Jul 1998 19:26:06 UNDEFINED
From: EOZSARUH@nsf.gov (Erdem Ozsaruhan)
Subject: Re: Y2K problem in PERL with localtime()
Message-Id: <EOZSARUH.131.2981B123@nsf.gov>


Thanks for enlightening me!

>># date +"%m-%d-%y"
>>02-29-00

>  Looks like you have a year 2000 problem _there_ though.

>  Is that 1800?  1900?  2000?  2100? ...

02-29-100  looks like a year  2000 problem, too.
Is that 2100? 3100? or ????

I didn't do my homework and learned that localtime() returns 
the current year - 1900

That's how PERL handles it.

And below is how UNIX handles it as you yourself pointed out!!!

There is no right or wrong!

>DATE(1L)                                                 DATE(1L)

>NAME
>       date - print or set the system date and time

> ...

>       %y     last two digits of year (00..99)
>-------------

>  Hmmm. That "last two digits" part sounds just like the classic
>  year 2000 problem.

>  Good thing there are no problems like that with the way perl
>  handles years, huh?

Neither solution looks right without looking at their manual. However, since 
SUN, IBM and possibly HP chooses to show the year 2000 as 00 (I already 
applied their year 2000 patches), perl could have done the same to be 
compatibable with the OS it runs on. 
 

Note:  date +"%C"    on AIX will give you the century. So it's Ok to have 
00 for the year!


>--
>    Tad McClellan                          SGML Consulting
>    tadmc@metronet.com                     Perl programming
>    Fort Worth, Texas

Erdem Ozsaruhan
NSF Postmaster


------------------------------

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 3270
**************************************

home help back first fref pref prev next nref lref last post