[19235] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1430 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 2 18:05:51 2001

Date: Thu, 2 Aug 2001 15:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <996789910-v10-i1430@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 2 Aug 2001     Volume: 10 Number: 1430

Today's topics:
        Creating small image of web page (Grod)
    Re: Creating small image of web page <tsee@gmx.net>
    Re: Creating small image of web page (Randal L. Schwartz)
    Re: FAQ: How can I expand variables in text strings? nobull@mail.com
        FAQ: How do I handle circular lists? <faq@denver.pm.org>
    Re: FAQ: What is the difference between $array[1] and @ nobull@mail.com
        Finding files matching a pattern? chiry@csua.Berkeley.EDU
    Re: Finding files matching a pattern? <jurgenex@hotmail.com>
    Re: Finding files matching a pattern? <acid-spam@acid06.cjb.net>
    Re: Finding files matching a pattern? (Tad McClellan)
    Re: Finding files matching a pattern? chiry@csua.Berkeley.EDU
    Re: Finding files matching a pattern? <bart.lateur@skynet.be>
    Re: Having some trouble with map (John Kramer)
    Re: Matt Wrights formmail alert <dbe@wgn.net>
    Re: newbie question about file concatenation (Craig Berry)
        PERL system function and variables (Scott)
    Re: PERL system function and variables <ilya@martynov.org>
    Re: PERL system function and variables <jurgenex@hotmail.com>
    Re: PERL system function and variables (Tad McClellan)
        perl/odbc and good old ms access (bigbinc)
    Re: process id on vms (Gary E. Ansok)
    Re: process id on vms <dan@tuatha.sidhe.org>
    Re: Setting DOS Variables (Was: Matt Wrights formmail a <godzilla@stomp.stomp.tokyo>
    Re: simple IO::Select problem on Win32 <clarke__@__hyperformix.com>
        special characters/unicode <superstu@stanford.edu>
    Re: substring matching and assigning to variable <krahnj@acm.org>
    Re: The perlish way to write this? <dbe@wgn.net>
    Re: The perlish way to write this? <uri@sysarch.com>
        Unusual 'use vars' question <bryan@ayesha.phys.Virginia.EDU>
    Re: Unusual 'use vars' question <ilya@martynov.org>
    Re: Unusual 'use vars' question (Gary E. Ansok)
    Re: Unusual 'use vars' question <bart.lateur@skynet.be>
        win32::registry help <boogiemonster@usa.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 2 Aug 2001 14:11:45 -0700
From: ggrothendieck@volcanomail.com (Grod)
Subject: Creating small image of web page
Message-Id: <ffd662ea.0108021311.543fa075@posting.google.com>

I would like to create a web page that contains
small images of other web pages along with some
text.   The html file that I produce would look
like this (if viewed in a browser):


XXXXXXXXXX    blah blah blah
XXXXXXXXXX    blah blah blah
XXXXXXXXXX
XXXXXXXXXX

where the area denoted by X's is a small picture
of the other web page and blah blah blah is text.

In looking around there seems to be solutions
for creating thumbnails of images but what if
one wants to create a thumbnail of an entire 
web page?  Can Perl do that?


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

Date: Thu, 2 Aug 2001 23:45:56 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: Creating small image of web page
Message-Id: <9kche6$59e$04$1@news.t-online.com>

"Grod" <ggrothendieck@volcanomail.com> schrieb im Newsbeitrag
news:ffd662ea.0108021311.543fa075@posting.google.com...
> I would like to create a web page that contains
> small images of other web pages along with some
> text.   The html file that I produce would look
> like this (if viewed in a browser):
>
>
> XXXXXXXXXX    blah blah blah
> XXXXXXXXXX    blah blah blah
> XXXXXXXXXX
> XXXXXXXXXX
>
> where the area denoted by X's is a small picture
> of the other web page and blah blah blah is text.
>
> In looking around there seems to be solutions
> for creating thumbnails of images but what if
> one wants to create a thumbnail of an entire
> web page?  Can Perl do that?

Perl can do pretty much anything another language can. If you plan to do
this on the fly, I daresay this is *very* complicated if possible at all.
You don't even want to try if you don't know whether Perl can do that.
(Get the irony that I wouldn't even try?)

Regards,
Steffen Müller





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

Date: 02 Aug 2001 14:59:57 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Creating small image of web page
Message-Id: <m14rrqceci.fsf@halfdome.holdit.com>

>>>>> "Steffen" == Steffen Müller <tsee@gmx.net> writes:

Steffen> Perl can do pretty much anything another language can. If you
Steffen> plan to do this on the fly, I daresay this is *very*
Steffen> complicated if possible at all.  You don't even want to try
Steffen> if you don't know whether Perl can do that.  (Get the irony
Steffen> that I wouldn't even try?)

ImageMagick and therefore PerlMagick can take .html input and generate
PNG output if you have all the right helper programs.  Scaling is
trivial.  I was thinking of doing that for one of my columns soon.

print "Just another Perl hacker,"

-- 
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: 02 Aug 2001 19:08:48 +0100
From: nobull@mail.com
Subject: Re: FAQ: How can I expand variables in text strings?
Message-Id: <u9lml272rz.fsf@wcl-l.bham.ac.uk>

PerlFAQ Server <faq@denver.pm.org> writes:

>   How can I expand variables in text strings?
> 
>     Let's assume that you have a string like:
> 
>         $text = 'this has a $foo in it and a $bar';
> 
>     If those were both global variables, then this would suffice:
> 
>         $text =~ s/\$(\w+)/${$1}/g;  # no /e needed
> 
>     But since they are probably lexicals, or at least, they could be, you'd
>     have to do this:
> 
>         $text =~ s/(\$\w+)/$1/eeg;
>         die if $@;                  # needed /ee, not /e

The FAQ really should mention:

   If you want not only to expand simple variables but want the full
   power of Perl's double-qouted interpolation then:

         # Assume $text does not contain "\n__EOD__\n"
         chop( $text = eval "<<__EOD__\n$text\n__EOD__" );
         die if $@; 

   This allows $text to contain arbintrary Perl code (for example
   $text = "@{[ system 'rm -rf /' ]}") so before you use this method
   you must be absolutely sure that $text can only come from sources
   who you would trust to have a shell accounts on your box.

Even if you think that this method should be discouraged it should
still be mentioned if only to explain the dangers before people
discover out for themselves.  

"You might injure yourself" is not a reason not to tell people about
the existance of powertools.  It is a reason to explain the dangers.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 02 Aug 2001 18:20:33 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I handle circular lists?
Message-Id: <RRga7.76$l_m.170718720@news.frii.net>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.

+
  How do I handle circular lists?

    Circular lists could be handled in the traditional fashion with linked
    lists, or you could just do something like this with an array:

        unshift(@array, pop(@array));  # the last shall be first
        push(@array, shift(@array));   # and vice versa

- 

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to

    news:news.answers

or to the many thousands of other useful Usenet news groups.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-1999 Tom Christiansen and Nathan
    Torkington.  All rights reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.

                                                           04.45
-- 
    This space intentionally left blank


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

Date: 02 Aug 2001 18:52:19 +0100
From: nobull@mail.com
Subject: Re: FAQ: What is the difference between $array[1] and @array[1]?
Message-Id: <u9ofpy73jg.fsf@wcl-l.bham.ac.uk>

tadmc@augustmail.com (Tad McClellan) writes:

> nobull@mail.com <nobull@mail.com> wrote:
> >Chris Stith <mischief@velma.motion.net> writes:
> >
> >> PerlFAQ Server <faq@denver.pm.org> wrote:
> >
> >> >   What is the difference between $array[1] and @array[1]?
> >> 
> >> Could this FAQ snippet ________PLEASE________ be removed from
> >> the autopost rotation? If not now, at least when Perl 6 is
> >> closer to release?
> 
> >For those of us who've not been following Perl6 developments could you
> >please say (in a couple of lines) how this changes in Perl6.
> 
> So "@array[1]" is how you access the second element of the @array
> in Perl 6, and "$array[1]" is short for "$array.[1]", where $array
> is a reference to an array, and dot is the dereferencing operator.
> 
> ( $array.[1] in perl6 ===  $array->[1] in perl5 )

Perl6 is so different from Perl5 that I suspect we'll need a
completely new FAQ.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 2 Aug 2001 19:41:47 +0000 (UTC)
From: chiry@csua.Berkeley.EDU
Subject: Finding files matching a pattern?
Message-Id: <9kcadr$1sg5$1@agate.berkeley.edu>


Hi, I am writing a perl script on Windows, where the shell does not do
wildchar substitution.

Lets say my script is passed in dsc*.jpg, how do I find all the files
that matches this pattern?

Right now I am doing a opendir(), readdir(), and parse through all the
files, and for each files see if it matches the pattern.

But it's cumbersome. Is there a better way? If the user passed in
\somedir\somepattern*.jpg, thenI need to CD to it first...

Thanks.

-- 
Raymond Chi
chiry@csua.Berkeley.EDU


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

Date: Thu, 2 Aug 2001 12:51:45 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Finding files matching a pattern?
Message-Id: <3b69af51$1@news.microsoft.com>


<chiry@csua.Berkeley.EDU> wrote in message
news:9kcadr$1sg5$1@agate.berkeley.edu...
>
> Hi, I am writing a perl script on Windows, where the shell does not do
> wildchar substitution.
>
> Lets say my script is passed in dsc*.jpg, how do I find all the files
> that matches this pattern?

You are looking for "glob".
Details see man page.

jue




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

Date: Thu, 2 Aug 2001 17:00:45 -0000
From: "Acid" <acid-spam@acid06.cjb.net>
Subject: Re: Finding files matching a pattern?
Message-Id: <tmjc425k4ps73@corp.supernews.com>

This should work:

foreach (<dsc*.jpg>) {
    # do whatever you wanna do with that file
}

-Acid

<chiry@csua.Berkeley.EDU> escreveu na mensagem
news:9kcadr$1sg5$1@agate.berkeley.edu...
>
> Hi, I am writing a perl script on Windows, where the shell does not do
> wildchar substitution.
>
> Lets say my script is passed in dsc*.jpg, how do I find all the files
> that matches this pattern?
>
> Right now I am doing a opendir(), readdir(), and parse through all the
> files, and for each files see if it matches the pattern.
>
> But it's cumbersome. Is there a better way? If the user passed in
> \somedir\somepattern*.jpg, thenI need to CD to it first...
>
> Thanks.
>
> --
> Raymond Chi
> chiry@csua.Berkeley.EDU




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

Date: Thu, 2 Aug 2001 15:06:44 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Finding files matching a pattern?
Message-Id: <slrn9mj964.skr.tadmc@tadmc26.august.net>

chiry@csua.Berkeley.EDU <chiry@csua.Berkeley.EDU> wrote:
>
>
>Lets say my script is passed in dsc*.jpg, how do I find all the files
>that matches this pattern?


   perldoc -f glob


>Right now I am doing a opendir(), readdir(), and parse through all the
>files, and for each files see if it matches the pattern.
>
>But it's cumbersome. Is there a better way? 


I think readdir/grep _is_ a better way than globbing, but you
can choose for yourself  :-)


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 2 Aug 2001 21:23:25 +0000 (UTC)
From: chiry@csua.Berkeley.EDU
Subject: Re: Finding files matching a pattern?
Message-Id: <9kcgcd$1thm$1@agate.berkeley.edu>

Tad McClellan <tadmc@augustmail.com> wrote:

>>Lets say my script is passed in dsc*.jpg, how do I find all the files
>>that matches this pattern?


>   perldoc -f glob


>>Right now I am doing a opendir(), readdir(), and parse through all the
>>files, and for each files see if it matches the pattern.
>>
>>But it's cumbersome. Is there a better way? 


> I think readdir/grep _is_ a better way than globbing, but you
> can choose for yourself  :-)

Thanks. I am new to this newsgroup, you guys are great, great help
everytime! :)

-- 
Raymond Chi
chiry@csua.Berkeley.EDU


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

Date: Thu, 02 Aug 2001 21:59:22 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Finding files matching a pattern?
Message-Id: <1cjjmtgiqsri7a6i60uh0eo8sa849d4lpu@4ax.com>

chiry@csua.Berkeley.EDU wrote:

>Hi, I am writing a perl script on Windows, where the shell does not do
>wildchar substitution.
>
>Lets say my script is passed in dsc*.jpg, how do I find all the files
>that matches this pattern?

An explicit glob. That DOES work on Windows.

	@files = glob("dsc*.jpg");

-- 
	Bart.


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

Date: 2 Aug 2001 13:38:07 -0700
From: kramer@email.arizona.edu (John Kramer)
Subject: Re: Having some trouble with map
Message-Id: <96db72f6.0108021238.4980095c@posting.google.com>

I have resolved the problem. It was more a problem of a misleading
error than with the code itself. (other than bad form that is)  The
@port in the instance in question had no value for $port[10] because
of a hole in the input.  Changing the code to check for a defined
status before the conditional operator fixed things nicely.

I was using map rather than for because there are 10 instances of this
check running in a row and quite frankly I don't want to type out that
many for loops.

John Kramer
Senior Systems Programmer
University of Arizona


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

Date: Thu, 02 Aug 2001 13:31:47 -0700
From: "$Bill Luebkert" <dbe@wgn.net>
Subject: Re: Matt Wrights formmail alert
Message-Id: <3B69B8B3.613E5EF2@wgn.net>

"Godzilla!" wrote:
> 
> Randal L. Schwartz wrote:
> 
> > >>>>> Godzilla! wrote:
> 
> > Godzilla! > Why does this only apply to Matt Wright's mailer?
> 
> > It doesn't.  It applies to any remailer where the address is specified
> > by user form data.  However, Matt Wright's is the most famous of
> > those, and is more likely to be installed on sites than all the others
> > combined.
> 
> > But you knew that.  Why the funny question? :)
> 
> I suspect this Mark fellow is starting up another one
> of these troll initiated "I hate Matt Wright" spam
> argument series. Chances are good at least a dozen
> people will jump on this bandwagon and spam this
> group with fifty reasons to leave Matt Wright.
> 
> Last I scanned the net for mailers, I developed a list
> of over one-hundred remailers, some written in Perl,
> some in C and, others in Java. If I were to scan the
> net for installed and working mailers, I wouldn't
> limit myself to just Matt's script nor would I be
> interested in spamming. My interest would be in those
> scripts vulnerable to commands which will mail me
> superuser / user password files.
> 
> **
> 
> Randal, feel free to ignore or not respond to this; I will
> not be offended as this is not important at all.
> 
> My interest is perked by an article about setting environmental
> variables in DOS via Perl. An example,
> 
> SET test=successful
> 
> Usual DOS command line stuff.
> 
> I been playing with a script and carefully reading my old
> MS-DOS 6.2 book published by QUE along with searching through
> O'Reilly's complete bookshelf and O'Reilly's Perl bookshelf
> for any clues on how to imaginatively set DOS variables via Perl.
> 
> So far, I have partial success using a rogue method. This
> method creates a .bat file, then tries to execute it, all
> within a Perl script. Obviously, I can write the file and,
> I can execute the file, but I cannot get it to work quite
> right; an "out of environment space" message is returned.
> 
> Kinda suspect I need a Control C or similar closing command.
> I have added echo off but this initiates two separate
> commands, as if I am running two bat files.
> 
> Here is what I have so far in my play:
> 
> #!perl
> 
> open (BAT, ">special.bat");
> print BAT "SET test=successful";
> close (BAT);
> system ("special.bat");
> print $ENV{test};
> 
> This returns:
> 
> C:\APACHE\USERS\TEST>SET test=successful
> Out of environment space

1) Try increasing your env space (in config.sys on 9X systems - not 
sure how in 2000/NT), eg:

	SHELL=C:\COMMAND.COM C:\ /E:4096 /L:1024 /U:255 /P

2) Why not just set the vrbl in %ENV before the system call ?

	$ENV{test} = 'successful';
	system ...

> open (BAT, ">special.bat");
> print BAT open (BAT, ">special.bat");
> print BAT "\@ECHO OFF
> SET test=successful";
> close (BAT);
> system ("special.bat");
> print $ENV{test};
> 
> This returns:
> 
> C:\APACHE\USERS\TEST>1@ECHO OFF
> Bad command or file name
> 
> C:\APACHE\USERS\TEST>SET test=successful
> Out of environment space
> 
> Care to enjoin any comments which will point me
> in the right direction? Feel free to pass on this
> one; it is only play. I won't be offended, truly.


-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
 (_/   /  )    // //       DBE Collectibles   Mailto:dbe@todbe.com 
  / ) /--<  o // //      http://dbecoll.webjump.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/


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

Date: Thu, 02 Aug 2001 19:42:56 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: newbie question about file concatenation
Message-Id: <tmjba0639stcc4@corp.supernews.com>

Donnacha Daly (donnacha@ee.ucd.ie) wrote:
: I have three files which together make a html file. I want to
: concatenate them. How do I do this, while making sure there is a space
: between the last word of one file and the first word of the next?

If they are well-formed text files, there will already be a newline there;
is that not enough?

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Brute force done fast enough looks slick."
   |             - William Purves


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

Date: 2 Aug 2001 12:26:32 -0700
From: swcmeng@yahoo.com (Scott)
Subject: PERL system function and variables
Message-Id: <169bb2e3.0108021126.69d7725@posting.google.com>

Greetings,

I am trying to assign the output of the below system function-based
command to a variable.

system "ls -d /etc/lp/interface/* | grep $lprinter";

I have tried:

$var = system "ls -d /etc/lp/interface/* | grep $lprinter";

but it only returns the status byte: 0

Does anyone know how to accomplish this?  Any assistance would be
greatly appreciated.


Thanks,

Scott


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

Date: 02 Aug 2001 23:30:52 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: PERL system function and variables
Message-Id: <87wv4mmf83.fsf@abra.ru>


S> Greetings,
S> I am trying to assign the output of the below system function-based
S> command to a variable.

S> system "ls -d /etc/lp/interface/* | grep $lprinter";

S> I have tried:

S> $var = system "ls -d /etc/lp/interface/* | grep $lprinter";

S> but it only returns the status byte: 0

S> Does anyone know how to accomplish this?  Any assistance would be
S> greatly appreciated.

$var = `ls -d /etc/lp/interface/* | grep $lprinter`


-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Thu, 2 Aug 2001 12:53:41 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: PERL system function and variables
Message-Id: <3b69afd6@news.microsoft.com>

"Scott" <swcmeng@yahoo.com> wrote in message
news:169bb2e3.0108021126.69d7725@posting.google.com...
> I am trying to assign the output of the below system function-based
> command to a variable.
>
> system "ls -d /etc/lp/interface/* | grep $lprinter";

See answer to PerlFAQ8: "Why can't I get the output of a command with
system()?"

jue




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

Date: Thu, 2 Aug 2001 15:09:22 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: PERL system function and variables
Message-Id: <slrn9mj9b2.skr.tadmc@tadmc26.august.net>

Scott <swcmeng@yahoo.com> wrote:
>
>I am trying to assign the output of the below system function-based
>command to a variable.
>
>system "ls -d /etc/lp/interface/* | grep $lprinter";

>Does anyone know how to accomplish this?  


Anybody who could be troubled to read the documentation for the
functions they are using would know how to accomplish that.

I suggest that you start reading the documentation for the
functions that you are using:

   perldoc -f system


>Any assistance would be
>greatly appreciated.


The description of the function that you are using tells you how
to accomplish what you want to accomplish. Just do it that way.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 2 Aug 2001 14:05:39 -0700
From: bigbinc@hotmail.com (bigbinc)
Subject: perl/odbc and good old ms access
Message-Id: <d1b33313.0108021305.4e6e4259@posting.google.com>

I have been trying to do some database work over a web page using perl
and access, so far the journey has been a tough one.  But I had some
things work.  The code below will add entries to a database but this
only works on the command line prompt and I need it to work on the web
page.  I get a 911 error , with no error message using a error dump
call,
on the web page while it works using the command line prompt.  I am
running this project on iis on windows2000 but I also get the same
error on winnt.
For those of you who get 911 errors a lot, I noticed that adding a
description on the database and in your code helps.  See here is the
code, and I have tried
every known configuration for the database, i.e. system/user/adding
pwds/uid etc./read/write/full control access/IUSR_<computer_name>. 
Anybody got any ideas.

Berlin Brown


#!C:/perl/bin/
print "HTTP/1.0 200 ok\n";
print "Content-Type: text/html\n\n";
use Cwd;
use Win32::ODBC;

# Define the driver type for this database
$DriverType = "Microsoft Access Driver (*.mdb)";

# Define the Data Source Name
$DSN = "Email Contacts";

# Describe the Data Source Name
$Description = "Description=Email List and Contact Information";

# The filename of the Database
$DataBase = "EMailContacts.mdb";

# Set the directory to the current directory
$dir = cwd();

print	"<br>$DriverType<br>\n";
print	"<br>DBQ=$dir\\$DataBase\n";
print	"<br>DEFAULTDIR=$dir\n";

# Configure the DSN
#if (Win32::ODBC::ConfigDSN(ODBC_ADD_DSN,
#				$DriverType,
#				("DSN=$DSN",
#				$Description,
#				"DBQ=$dir\\$DataBase",
#				"DEFAULTDIR=$dir",
#				"UID=", "PWD="))) {
#	print "Successful configuration of $DSN!\n";
#}
#else {
#	print	"Error Creating $DSN\n";
#	
#	print	"<PRE>";
#	Win32::ODBC::DumpError();
#	print	"</PRE><br>\n";
#	die;
#}

# Create a Win32::ODBC Object
my $myDb = Win32::ODBC->new($DSN);

my $connection;

# Verify the connection is valid
if (! $myDb) {
	print "Failed to Connect $DSN\n";
	
	print	"<PRE>";
	Win32::ODBC::DumpError();
	print	"</PRE>";
	die;
}
else {
	$connection = $myDb->Connection();
	print "Successful Connection $connection, $DSN\n";
}


$SQL = qq | Insert Into emailContacts (firstname, lastname)
		Values('New Webpage', 'Brown')|;

if ($myDb->Sql($SQL)) {
	print "Error Inserting into Guest table<br>\n";
	print	"<PRE>";
	$myDb->DumpError();
	print	"</PRE>";
}

# Always close the database connection
$myDb->Close;

print "</BODY>";
print "</HTML>";


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

Date: 2 Aug 2001 19:44:38 GMT
From: ansok@alumni.caltech.edu (Gary E. Ansok)
Subject: Re: process id on vms
Message-Id: <9kcaj6$2uf@gap.cco.caltech.edu>

In article <14ce1c21.0108011434.7df0431@posting.google.com>,
Nick Paszty <paszty@xoma.com> wrote:
>hello.
>
>we're running vms 7.1 on an alphaserver 800 5/333 and perl 5.005_03
>built for VMS_AXP.  i am running the following test code from a telnet
>session and also from an xwindows decterm using eXcursions.  here is
>the code.
>
 [ code snipped ]
>
>the problem that i see is that the $$ process id variable value does
>not change from one run to the next.  on unix, every time i run a
>perscript, it has a unique process number.

It's been a while since I worked on VMS, but that's correct -- all
programs run by one CLI (e.g., DCL) session will be run within the 
same process and will see the same process ID.  If you have another 
CLI in a different window or terminal, that script run should see
a different process ID.

Even on Unix, process numbers are only guaranteed to be unique
while the process lives.  They only range up to a certain number 
(30000 is common), and on a busy server it might not take too long 
before a process number is re-used.  I think VMS process IDs work
similarly -- in fact, if I remember correctly, VMS preferentially
re-uses the low numbered IDs (but I could be wrong on this).

>any thoughts on how to find a unique process number for the script? i
>am eventually heading towards running this as a cgi script and with
>multiple users, i need to maintain 'state' using the process id.

I don't know how CGI works on VMS -- whether the server runs multiple 
processes (in which case $$ will be different), or just multiple
threads within one process (in which case $$ will probably be the same
for each CGI call).  You'll need to investigate the server you plan
to run this under.

Still, I'm not sure what kind of 'state' you can usefully maintain
using $$ under either model.  If there are multiple server processes
running, you cannot know whether two requests by the same user will
be served by the same server process; nor will you know whether two
requests to the same server process are connected.

-- Gary Ansok, who used VMS versions 1.5 through 5.7 or so.


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

Date: Thu, 02 Aug 2001 20:09:54 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: process id on vms
Message-Id: <msia7.206487$v5.20850036@news1.rdc1.ct.home.com>

Nick Paszty <paszty@xoma.com> wrote:
> the problem that i see is that the $$ process id variable value does
> not change from one run to the next.  on unix, every time i run a
> perscript, it has a unique process number.

Right, that's because VMS and unix create processes and fire off
programs differently. On unix, the shell forks itself off and
the child then execs the command to be run, so you get a new
PID when you run a perl program. On VMS, we just drop from supervisor
to user mode to execute the program. That's also why %ENV changes on VMS
persist after a perl program exits.

Note that on Unix there isn't any guarantee that you won't reuse the same
pid over and over again when child processes are spwaned, though it isn't
hugely likely. Definitely possible, though.

> any thoughts on how to find a unique process number for the script? i
> am eventually heading towards running this as a cgi script and with
> multiple users, i need to maintain 'state' using the process id.

This isn't the right way to maintain state in CGI regardless. Best find
a better way. (Sequence numbers in files or databases are probably
a much better one, since mod_perl might mess up your PID scheme 
on any platform...)

					Dan


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

Date: Thu, 02 Aug 2001 14:38:46 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Setting DOS Variables (Was: Matt Wrights formmail alert)
Message-Id: <3B69C866.2B7F62C@stomp.stomp.tokyo>

$Bill Luebkert wrote:
 
> Godzilla! wrote:
> > Randal L. Schwartz wrote:
> > > >>>>> Godzilla! wrote:


> > My interest is perked by an article about setting environmental
> > variables in DOS via Perl. An example,

> > SET test=successful

> > Usual DOS command line stuff.

> > Here is what I have so far in my play:

> > #!perl

> > open (BAT, ">special.bat");
> > print BAT "SET test=successful";
> > close (BAT);
> > system ("special.bat");
> > print $ENV{test};

> > This returns:

> > C:\APACHE\USERS\TEST>SET test=successful
> > Out of environment space
 
> 1) Try increasing your env space (in config.sys on 9X systems - not
> sure how in 2000/NT), eg:
 
>         SHELL=C:\COMMAND.COM C:\ /E:4096 /L:1024 /U:255 /P
> 
> 2) Why not just set the vrbl in %ENV before the system call ?
 
>         $ENV{test} = 'successful';
>         system ...


The concept here, inspired by an article, is to set
a DOS environmental variable and have it "stick" even
after a Perl script closes. Otherwords, you could start
another script and access this variable; behavior just
like a proper .bat DOS file.

I did find a reference in my MS DOS 6.2 book on what
you mention:

/E:aaaaa

This switch enables you to adjust the number of bytes of memory
the command processor reserves for its environment.

Based on my research, the minimum is 160 bytes and the maximum
is 32768 bytes. Default setting is 256 bytes. For Windows, a
minimum of 512 bytes is suggested. My book clearly states:

  "If you see the message  Out Of Environment Space  enlarge
   the environment."

So, thanks to your direction, I will try my method again and
variations, but with an /E switch first. Just might work. If
so, I have developed a method to set "sticky" DOS variables
using a Perl script. Challenge will be getting around running
command.com again. I am unsure what overall effect this might
have on what is currently loaded into DOS memory. This could
lead to a rather humorous system crash.

There is a stickler; this /E switch is solely related to
running command.com in junction. This will be interesting.

* suspects it will be safer to reboot into more environment space *


Godzilla!  Queen Of DOS.
--

   COMMAND c:path\ /P /MSG /E:aaaaa /C string

  "If you load another copy of command.com, but omit the 
   c:path\ parameter, the second command processor inherits
   the contents of the first command processor's environment."


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

Date: Thu, 2 Aug 2001 15:23:05 -0500
From: "Allan" <clarke__@__hyperformix.com>
Subject: Re: simple IO::Select problem on Win32
Message-Id: <uBia7.268$cz4.125452@news.uswest.net>

Thanks. I posted another question on non-blocking IO that is more
general.

<nobull@mail.com> wrote in message news:u9zo9k8dsy.fsf@wcl-l.bham.ac.uk...
> "Allan" <clarke_nospam@hyperformix.com> writes:
>
> > I am looking for a way around the fileevent problem on Win32, by using
> > IO::Select to poll for data.
>
> I think you are out of luck, the underlying select() system call on
> Win32 is only implemented for sockets.
>
> --
>      \\   ( )
>   .  _\\__[oo
>  .__/  \\ /\@
>  .  l___\\
>   # ll  l\\
>  ###LL  LL\\




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

Date: Thu, 2 Aug 2001 14:36:05 -0700
From: Stuart Aaron White <superstu@stanford.edu>
Subject: special characters/unicode
Message-Id: <Pine.GSO.4.31.0108021428150.25464-100000@epic19.Stanford.EDU>


Hi there.  I've got a few questions about reading and writing foreign
language characters in perl.  When I say foreign language characters, I
specifically mean letters in the roman alphabet with some sort of
mark like, tildes, umlauts, accents(up and to the left and up and
to the right, those little s thingies under c's in french, and so on.  I
don't mean japanese, chinese, or russian characters.

Can perl read foreign language characters from a file, hash or array?
How would I type them in a file, hash or array so that they could be read?
Can I type them just as they appear, or do I need to use some sort of
numbered code that represents them?
Does perl write foreign language characters?

That's it i think.  Thanks in advance for any help.
-stu











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

Date: Thu, 02 Aug 2001 21:33:25 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: substring matching and assigning to variable
Message-Id: <3B69C7BF.43836DE9@acm.org>

joeri wrote:
> 
> I need to assign a substring to a variable. The problem is that the
> string contains non-alphanumeric characters. This is what I want to
> do:
> 
> $spelling = substr(/alpha\(\'.*/, 7, -3)

Your regular expression (/alpha\(\'.*/) returns either true if it
matched $_ or false if it didn't. The second argument (7) is fine but
the third argument should be the length of the sub string to return and
a string can't have a length of -3.

if ( /alpha\('(.*)/ ) {
    $spelling = $1;
    }



John
-- 
use Perl;
program
fulfillment


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

Date: Thu, 02 Aug 2001 12:49:24 -0700
From: "$Bill Luebkert" <dbe@wgn.net>
Subject: Re: The perlish way to write this?
Message-Id: <3B69AEC4.F628834B@wgn.net>

BCC wrote:
> 
> Notice the HTML end must have no leading whitespace... visually very
> distracting (for me anyaway).  I know you can do $str =<<"    HTML", but
> then in my rapidly changing development environment (read correcting my
> mistakes :) everytime an indent changes I have to go and recount spaces
> so my here doc works again.  Maybe some neat little regex works?

You could always use the same obscure word to end your here docs and 
then yes, a RE would be able to solve it:

	s/^\s+(oBsCuRe)\s*$/$1/;

Where oBsCuRe is whatever word you choose. :)  Maybe a vi macro. :)

-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
 (_/   /  )    // //       DBE Collectibles   Mailto:dbe@todbe.com 
  / ) /--<  o // //      http://dbecoll.webjump.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/


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

Date: Thu, 02 Aug 2001 20:45:17 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: The perlish way to write this?
Message-Id: <x7k80myyw3.fsf@home.sysarch.com>

>>>>> "YO" == Yves Orton <demerphq@hotmail.com> writes:

  YO> Uri Guttman <uri@sysarch.com> wrote in message news:<x7r8uvz4qx.fsf@home.sysarch.com>...

  >> $border ||= '0' ;
  >> $align ||= 'abscenter ;

  YO> Just curious, Uri, as to why you prefer the above to the shift ||
  YO> syntax. (I added the mandatory stuff on my own volition) Is it a speed
  YO> issue or just personal preference?

  YO> sub imageButton {
  YO>     my $href  =shift || die "Missing mandatory parameter \$href\n";
  YO>     my $image =shift || die "Missing mandatory parameter \$image\n";
  YO>     my $alt   =shift || "";
  YO>     my $border=shift || "0";
  YO>     my $align =shift || "abscenter";

well, what if you were passing in key/value pairs in a hash? someone
else posted a common trick for that with a new hash being initialed with
defaults and overwritten with the args. also i like the @_ assignment
style for sub args and not to shift for each one. also not all params
need a default so doing what you have is slightly overkillish. but your
style is ok. put some whitespace between the = and shift. :)

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


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

Date: 2 Aug 2001 18:24:52 GMT
From: "Bryan K. Wright" <bryan@ayesha.phys.Virginia.EDU>
Subject: Unusual 'use vars' question
Message-Id: <9kc5tk$fp3$1@murdoch.acc.Virginia.EDU>

Hi folks,

	For reasons I won't go into, I'd like to use a variable to
define the list of variables I give to 'use vars'.  For example:
	
	$vars = "\'\$this\',\'\$that\'";
	use vars $vars;

I've also tried:

	eval "use vars $vars";

The first version give me the error:

	''$this','$that'' is not a valid variable name...

the second version doesn't complain, but "use strict" acts as if
I'd never called "use vars".

	Is there a way to do this?

						Thanks
						Bryan

-- 
===============================================================================
Bryan Wright                |"If you take cranberries and stew them like 
Physics Department          | applesauce, they taste much more like prunes 
University of Virginia      | than rhubarb does."  --  Groucho 
Charlottesville, VA  22901  |			
(434) 924-7218              |         bryan@virginia.edu
===============================================================================


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

Date: 02 Aug 2001 23:19:40 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Unusual 'use vars' question
Message-Id: <871ymunub7.fsf@abra.ru>


BKW> Hi folks,
BKW> 	For reasons I won't go into, I'd like to use a variable to
BKW> define the list of variables I give to 'use vars'.  For example:
	
BKW> 	$vars = "\'\$this\',\'\$that\'";
BKW> 	use vars $vars;

BKW> I've also tried:

BKW> 	eval "use vars $vars";

BKW> The first version give me the error:

BKW> 	''$this','$that'' is not a valid variable name...

BKW> the second version doesn't complain, but "use strict" acts as if
BKW> I'd never called "use vars".

BKW> 	Is there a way to do this?

Not tested:

BEGIN {
    @vars = qw($this $that);
}
use vars @vars;

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: 2 Aug 2001 19:24:21 GMT
From: ansok@alumni.caltech.edu (Gary E. Ansok)
Subject: Re: Unusual 'use vars' question
Message-Id: <9kc9d5$20r@gap.cco.caltech.edu>

In article <9kc5tk$fp3$1@murdoch.acc.Virginia.EDU>,
Bryan K. Wright <bryan@ayesha.phys.Virginia.EDU> wrote:
>Hi folks,
>
>	For reasons I won't go into, I'd like to use a variable to
>define the list of variables I give to 'use vars'.  For example:
>	
>	$vars = "\'\$this\',\'\$that\'";
>	use vars $vars;
>

    BEGIN {
        use vars qw(@vars);
        @vars = qw($this $that);
    }

    use vars @vars;

-- Gary Ansok


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

Date: Thu, 02 Aug 2001 22:01:14 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Unusual 'use vars' question
Message-Id: <pejjmtk0rq7tl3jsgha8lso19g7qhi4gmd@4ax.com>

Bryan K. Wright wrote:

>	$vars = "\'\$this\',\'\$that\'";
>	use vars $vars;

Try

	my @vars;
	BEGIN {
	    @vars = ('$this', '$that');
	}
	use vars @vars;

-- 
	Bart.


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

Date: Thu, 2 Aug 2001 14:55:37 -0400
From: "Joseph" <boogiemonster@usa.net>
Subject: win32::registry help
Message-Id: <9kc7m0$d90$1@usenet01.srv.cis.pitt.edu>

I'm trying to connect to a remote machine using Win32::Registry.  I want to
delete key and all its sub key.  Is there way to do this without expanding
each individual trees and delete one at a time then finally to the root?  is
there a easier method?  following is my code....any help would be
appreciated...

use Win32::Registry;

%KeyName =

     SoftwareRoot => 'Software\Microsoft',
     LaunchPath  => 'Windows\CurrentVersion\Run',
);

$Root = $HKEY_LOCAL_MACHINE;

if ($Machine = $ARGV[0])
{
     $HKEY_LOCAL_MACHINE->Connect ($Machine, $Root ) || die "Could not
connect to the Registry on '$Machine'\n;"
}

if ( $Root->Open ($KeyName{SoftwareRoot}, $Links))
{

          $Links->DeleteKey("test1"); #there are sub keys in both of these
keys....
          $Links->DeleteKey("test");

     if ($Links->Open ($KeyName{LaunchPath}, $Links2))
     {
          $Links2->DeleteValue("SMS Application Launcher");
     }
     $Links2->Close;
}
$Links->Close;




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 1430
***************************************


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