[17949] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 109 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 21 03:05:38 2001

Date: Sun, 21 Jan 2001 00:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <980064310-v10-i109@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 21 Jan 2001     Volume: 10 Number: 109

Today's topics:
    Re: Can't locate URI/Escape.pm in @INC  (Martin Vorlaender)
    Re: Deleting a line from file <gracenews@optusnet.com.au>
    Re: Directory Last Modified (BUCK NAKED1)
    Re: FAQ 9.2:   How can I get better error messages from <nospam@nospam.com>
        how to install a module metamp@my-deja.com
    Re: how to install a module (Martien Verbruggen)
        Java <jane__millson@hotmail.com>
        JVM for Perl <tcassidy@mediashell.net>
    Re: JVM for Perl (Martien Verbruggen)
    Re: matching "*"? <monty@primenet.com>
        MS Outlook PST reading in PERL? <danielzr@netzero.net>
    Re: Multiprocess or multithreaded??? <davesisk@ipass.net>
    Re: Multiprocess or multithreaded??? (Martien Verbruggen)
    Re: Newbie question - deleting directories (Martien Verbruggen)
    Re: percentages, how? <diab.lito@usa.net>
    Re: Perl  - Bytecode, Compile to C, Perl2EXE  <gracenews@optusnet.com.au>
    Re: Perl  - Bytecode, Compile to C, Perl2EXE (Martien Verbruggen)
    Re: Perl 500502 DBI does not work on V4R5 <brucegray@home.com>
        Posting email from PERL to Outlook (Exchange)??? <danielzr@netzero.net>
    Re: Posting email from PERL to Outlook (Exchange)??? <a565a87@my-deja.com>
    Re: Posting email from PERL to Outlook (Exchange)??? <a565a87@my-deja.com>
        running UNIX shell script from web jay1m_2@my-deja.com
        running UNIX shell script from web jay1m_2@my-deja.com
    Re: running UNIX shell script from web egwong@netcom.com
    Re: running UNIX shell script from web (Martien Verbruggen)
    Re: running UNIX shell script from web <comdog@panix.com>
    Re: Using perl to update an ASP? (Mark W. Schumann)
    Re: Words in Perl - Pulling Hair <smullett@omeninc.com>
    Re: Words in Perl - Pulling Hair <uri@sysarch.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 21 Jan 2001 02:33:50 +0100
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: Can't locate URI/Escape.pm in @INC 
Message-Id: <3a6a3c7e.524144494f47414741@radiogaga.harz.de>

Justin Kuo (jkuo@bellatlantic.net) wrote:
: Can't locate URI/Escape.pm in @INC (@INC contains: ...
:
: What can I do to correct the problem? Is my perl application on my Linux
: machine missing a module?

It is. It's called URI::Escape.

: If so, how do I install the module?

1. Go to CPAN, http://www.CPAN.org/, and find the tarball containing
   URI::Escape, which is URI-#.##.tar.gz (#.## is the version number)
   - or -
   Search for the URI tarball at http://search.CPAN.org/
2. Download & unpack it
3. Read and follow the instructions in README. Normally, it's just
     perl Makefile.PL
     make
     make test
     make install

cu,
  Martin
--
One OS to rule them all       | Martin Vorlaender  |  VMS & WNT programmer
One OS to find them           | work: mv@pdv-systeme.de
One OS to bring them all      |       http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de


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

Date: Sun, 21 Jan 2001 16:48:21 +1000
From: "Jeffrey Grace" <gracenews@optusnet.com.au>
Subject: Re: Deleting a line from file
Message-Id: <3a6a863e$0$15501$7f31c96c@news01.syd.optusnet.com.au>

"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrn96j61l.9cm.tadmc@tadmc26.august.net...
<snip>
> The other process locks the file, reads and removes the first line,
> and unlocks the file.
>
<snip>
> will likely help with the add-a-line and remove-a-line part
> of the solution to your problem.
>
>
>    perldoc -q lock
>    perldoc -f flock
>
> will get you started on the file-locking part.
>

I had a look through the above plus file locking man page and found no
answer to below question:
I wich to delete a line of text from a file, but there is a brief period
where the file will not exist, and an open (FH, > file) will re-create a
blank version.

--------------------------------
<snip>

   open(DATA, $data_file) || die("deleteUser: Unable to open user database:
$data_file:$_");
      flock(DATA, LOCK_SH);
   open(TEMP, ">".$temp_file) || die("deleteUser: Unable to write to temp
file");
      flock(TEMP, LOCK_EX);

   while(<DATA>) {
      ($user, $pass, $level) = split(/:/,$_,3);
      if ($user ne $username) {
         print TEMP $user . ":" . $pass . ":" . $level;
      }
   }

# Problem: There will be a brief period where there is no data file. Between
A and B.

      flock(DATA, LOCK_UN);   # I've others say this line isn't needed as
close will do it,
   close(DATA);   # but this is how it is in the FAQ.
   unlink($data_file);     # A (see above)
   if ($fileLocking eq "Enabled") {
      flock(TEMP, LOCK_UN);
   }
   close(TEMP);
# I've seen this done with two renames but there is still a period where the
data file is missing
   rename($temp_file, $data_file); # B (see above)
}
---------------------------------------

Is there anything I can do to stop a new file from being created, I know the
temp file will replace any created file at the rename, but any access to the
file from another process before the rename will either see a blank file or
no file.  I've just thought about changing the appropriate opens to sysopen
(with write but not create) but the file still won't exist at times.  I can
modify the code to retry on open for readings
eg:
open (FH, file) || open (FH, file), etc || die (message).

Is there a better way?

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

Jeffrey Grace

PS: if this doesn't make sense in places please ask for clarification, I
have to go out, so this was written in a bit of a rush.




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

Date: Sat, 20 Jan 2001 23:51:23 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Directory Last Modified
Message-Id: <10705-3A6A78DB-101@storefull-247.iap.bryant.webtv.net>

Thank You. I really appreciate it.
--Dennis



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

Date: 21 Jan 2001 05:44:59 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: FAQ 9.2:   How can I get better error messages from a CGI program?
Message-Id: <94dt0r$c5i$0@216.155.32.172>

In article <NXaa6.1144$B9.194572800@news.frii.net>, PerlFAQ Server 
<faq@denver.pm.org> wrote:
[copy mailed to the faq server]

 |   How can I get better error messages from a CGI program?
 | 
 |     Use the CGI::Carp module. It replaces `warn' and `die', plus the 
 |     normal Carp modules `carp', `croak', and `confess' functions 
 |     with more verbose and safer versions. It still sends them to the 
 |     normal server error log.
 | 
 |         use CGI::Carp;
 |         warn "This is a complaint";
 |         die "But this one is serious";
 | 
 |     The following use of CGI::Carp also redirects errors to a file 
 |     of your choice, placed in a BEGIN block to catch compile-time 
 |     warnings as well:
 | 
 |         BEGIN {
 |             use CGI::Carp qw(carpout);
 |             open(LOG, ">>/var/local/cgi-logs/mycgi-log")
 |                 or die "Unable to append to mycgi-log: $!\n";
 |             carpout(*LOG);
 |         }
 | 
 |     You can even arrange for fatal errors to go back to the client 
 |     browser, which is nice for your own debugging, but might confuse 
 |     the end user.
 | 
 |         use CGI::Carp qw(fatalsToBrowser);
 |         die "Bad error here";
 | 
 |     Even if the error happens before you get the HTTP header out, 
 |     the module will try to take care of this to avoid the dreaded 
 |     server 500 errors. Normal warnings still go out to the server 
 |     error log (or wherever you've sent them with `carpout') with the 
 |     application name and date stamp prepended.
 | 

I'd like to add one thing here. 

The newer versions of CGI.pm also allow something along the lines of the 
following which will let you replace the server error message with one 
of your own, that will contain *your* e-mail address instead of that of 
the server admin:

  use CGI qw/:standard/;
  use CGI::Carp qw/fatalsToBrowser set_message/;
  BEGIN {
     sub handle_errors {
        my $msg = join( br(), @_);
        print header, 
          start_html( "CGI/Perl Script Error" ),
          h2( "Warning: CGI/Perl Script Error!"),
          p( "I may be currently beta-testing, so E-mail me, ", 
            a({-href=>'mailto:your@address.com'}, "YourName"), 
            ", about this if it persists for any long period of time.",
           ), 
          hr,
          p( "Got an error: $msg" ), 
        end_html;
     }
     set_message(\&handle_errors);
  };

This is much easier than trying to grep through the server logs, 
particularly when you might not have Telnet access to a website, and 
also allows you to warn people with *your* e-mail address so that *you* 
get notified of the bugs and not the site's server admin, who most 
likely neither has nor wants anything to do with your script without a 
'small fee'. ;)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Sun, 21 Jan 2001 04:27:14 GMT
From: metamp@my-deja.com
Subject: how to install a module
Message-Id: <94doet$nov$1@nnrp1.deja.com>




 I want to install a module on my host's server
 of corse I can not do that so is there any way to make the module on my
local machine and
 upload it to CGI-BIN directory on my host and then set the path to the
module in my script

 can anybody help with this?


Sent via Deja.com
http://www.deja.com/


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

Date: Sun, 21 Jan 2001 16:10:58 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: how to install a module
Message-Id: <slrn96krr2.bgr.mgjv@martien.heliotrope.home>

On Sun, 21 Jan 2001 04:27:14 GMT,
	metamp@my-deja.com <metamp@my-deja.com> wrote:
> 
>  I want to install a module on my host's server

You posted this question in clp.modules as well. It has been answered
there. Go to that group, and read the answer.

For the next time you decide that you should post the same quesiton in
multiple groups (and you should NOT make that decisions lightly) please
use your newsreaders crossposting facility. That way there will be only
one message, and followups are easier to keep track of.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia                  | 


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

Date: Sat, 20 Jan 2001 22:02:04 -0500
From: "Jane Millson" <jane__millson@hotmail.com>
Subject: Java
Message-Id: <94djfu$55r$3@slb1.atl.mindspring.net>

Is there a way to embed Java into Perl, and if so does it work seamlessly?




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

Date: Sun, 21 Jan 2001 00:18:05 -0500
From: "Timothy Cassidy" <tcassidy@mediashell.net>
Subject: JVM for Perl
Message-Id: <t6ks3ml84qb802@corp.supernews.com>

I grabbed this JVM for Perl from this address:
http://www.perl.com/CPAN-local/modules/by-authors/id/Y/YE/YEWEI/

I need it, so that I can make calls to Java methods in Perl.

I downloaded and installed it onto my machine - however I ran into some
troubles.

I have JDK 1.3 and Perl 5.6.0, so I don't think it is a problem with what I
have installed on my machine.

I ran the following set of commands:
perl Makefile.PL
make
make test
make install

All of the commands completed successfully except the "make test" command
which returned:
PERL_DL_NONLAZY=1
/usr/bin/perl -Iblib/arch -Iblib/lib-I/usr/lib/perl5/5.6.0/i386-linux -I/usr
/lib/perl5/5.6.0 test.pl
1..1
Can't load 'blib/arch/auto/Jvm/Jvm.so' for module Jvm: libjvm.so: cannot
load shared object file: No such file or directory at
/usr/lib/perl5/5.6.0/i386-linux/D
ynaLoader.pm line 200.
 at test.pl line 20
Compilation failed in require at test.pl line 20.
BEGIN failed--compilation aborted at test.pl line 20.
make: *** [test_dynamic] Error 255

I checked and the file DynaLoader.pm is in the directory
/usr/lib/perl5/5.6.0/i386-linux/
Does this mean I didn't correctly load the JVM module?

Sorry, my expertise in this area is minimal at best, so please feel free to
speak like a layman to me.  I will check this newsgroup regularly, so feel
free to post the answer here instead of e-mailing me.  But whichever is
easiest.

Thanks,
Tim

PS Here is what happened when I tried to run perl on one of the examples
that were provided:

>perl demo.pl

Can't load '/usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/Jvm/Jvm.so' for
modul
e Jvm: libjvm.so: cannot load shared object file: No such file or directory
at /
usr/lib/perl5/5.6.0/i386-linux/DynaLoader.pm line 200.
 at demo.pl line 6
Compilation failed in require at demo.pl line 6.
BEGIN failed--compilation aborted at demo.pl line 6.

In this file demo.pl, line 6 is:
use Jvm;





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

Date: Sun, 21 Jan 2001 17:39:04 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: JVM for Perl
Message-Id: <slrn96l108.bgr.mgjv@martien.heliotrope.home>

On Sun, 21 Jan 2001 00:18:05 -0500,
	Timothy Cassidy <tcassidy@mediashell.net> wrote:
> I grabbed this JVM for Perl from this address:
> http://www.perl.com/CPAN-local/modules/by-authors/id/Y/YE/YEWEI/

I just spent some time answering this exact same question in
clp.modules. Please, if you _must_ post to two groups, at least use the
crossposting facilities of your news reader. That way the two separate
threads won't be separate. Now you end up with two different threads,
discussing the exact same thing, which means people might need to do
work to give you the same answer that someone else has already given
you, but in a different group.

Don't do this, please. usenet is better organised than this.

Martien
-- 
Martien Verbruggen              | Since light travels faster than
Interactive Media Division      | sound, isn't that why some people
Commercial Dynamics Pty. Ltd.   | appear bright until you hear them
NSW, Australia                  | speak?


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

Date: 21 Jan 2001 06:35:21 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: matching "*"?
Message-Id: <94dvv9$9uu$1@nnrp2.phx.gblx.net>

Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Johannes Graumann wrote:
> > I'm trying to match a "*" at the end of a line. 
> > Since * is a multiplier, something like /*^/ won't work.
>
> You will discover either method shown in my test
> script below, to be quicker and more efficient.
>
> TEST SCRIPT:
> ____________
>
> #!/usr/local/bin/perl
>
> print "Content-type: text/plain\n\n";
>
> # Destructive Method:
>
> print "Destructive Chop Method:\n\n";
>
> $line = "test line *";
>
> # remove end of line characters if needed:
>
> chomp ($line);
>
> $test = chop ($line);
>
> if ($test eq "*")
>  { print "  End Of Line Asterisk Found\n\n" }
> else
>  { print "  No End Of Line Asterisk Found" }
>
> # Non-destructive Method:
>
> print "Non-destructive Substring Method:\n\n";
>
> $line = "test line *";
>
> # remove end of line characters if needed:
>
> chomp ($line);
>
> $test = substr ($line, -1, 1);
>
> if ($test eq "*")
>  { print "  End Of Line Asterisk Found\n\n" }
> else
>  { print "  No End Of Line Asterisk Found" }
>
> exit;
>
> [...]

Now demonstrate for our benefit how much "quicker and more efficient"
it is to adapt your script to a simple change of specification. For
example:

    Match an asterisk at the end of a line, possibly with trailing
    whitespace. In other words, match an asterisk when it is the
    last visible character on the line.

        /\*$/ becomes /\*\s*$/

    Match either an asterisk or a period at the end of a line.

		/\*$/ becomes /[*.]$/ or /[*.]\s*$/

These are hardly contrived examples of possible specification
changes. Indeed, the former example is quite likely to occur in
the real world.

Be careful what you "optimize".

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


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

Date: Sun, 21 Jan 2001 03:37:42 GMT
From: "Daniel Rosenzweig" <danielzr@netzero.net>
Subject: MS Outlook PST reading in PERL?
Message-Id: <aQsa6.4031$Mu1.254239@bgtnsc06-news.ops.worldnet.att.net>

Is there a way to read PST files in PERL? I've searched for the file both
CPAN modules and the PST format itself - to no avail. Any ideas?




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

Date: Sun, 21 Jan 2001 03:36:59 GMT
From: "David Sisk" <davesisk@ipass.net>
Subject: Re: Multiprocess or multithreaded???
Message-Id: <vPsa6.16781$YQ.3196355@typhoon.southeast.rr.com>

Thanks for the reply.  Very informative!

Regards,
Dave





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

Date: Sun, 21 Jan 2001 15:39:21 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Multiprocess or multithreaded???
Message-Id: <slrn96kpvp.bgr.mgjv@martien.heliotrope.home>

On Sun, 21 Jan 2001 11:32:38 +1100,
	Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> On Fri, 19 Jan 2001 12:21:43 GMT,
> 	David Sisk <davesisk@ipass.net> wrote:
>> 
>> 1)  Create the part that will be parallelized as a subroutine that will only
>> be run by the forked children.
>> 2)  Create the part that will be parallelized as a seperate Perl script,
>> which will be forked, then exec'd.
>
>                                                             But, on NT
> both 1 and 2 will run as process threads, while on Unices, both 1 and 2
> will run as separate processes. On a single OS there is no difference in
> the process-thread distinction.

This is of course not true. At least, I don't know it for certain. On
Win, 1 will run as a single process, with multiple threads. I think that
2 will actually result in multiple processes on Win. On unices there is
no real difference. Most of what I said later still stands, and maybe
even makes a slightly stronger case for 1.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd.   | make up 3/4 of the population.
NSW, Australia                  | 


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

Date: Sun, 21 Jan 2001 13:23:11 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Newbie question - deleting directories
Message-Id: <slrn96ki0f.bgr.mgjv@martien.heliotrope.home>

On Sun, 21 Jan 2001 01:33:49 GMT,
	bigdawg <ewsr1@home.com> wrote:
> Here is what I'd like to do.  I am using Activestate on a Win32 system.
> I'm also not clear as to which modules may be needed.
> 
> 
> 1. change to a specific directory
> 2. read the directory
> # using readdir()
> 
> 3. delete all directories older than $days_old
> # using unlink()
> 
> 4. write output to an existing  file to track deleted directories
> # using open()

You do not need any modules. chdir(), opendir(), readdir(), closedir(),
unlink() open() and close() are all builtin Perl functions. All of them
are described in the perlfunc documentation. With your activestate
installation of Perl you also got the perl documentation, bot in pod
format, which you can read with the perldoc command, and in HTML format.
You need to read it.

But, since you want to delete directories, presumably with their
content, you probably want to include File::Path. That means you won't
have to fiddle with recursion and unlink yourself:

You do not really need to change directory to there though.

Here's a skeleton that you can use to start:

#!/usr/local/bin/perl -w
use strict;
use File::Path;

my $dir = "/tmp";
my $log_file = "/var/log/grubble";
my $expire_days = 2;

opendir(DIR, $dir) or die "Cannot opendir $dir: $!";
my @dirs =  grep { -d && -M _ > $expire_days } 
            map { "$dir/$_" }
            readdir DIR;
closedir(DIR);

my $num_unlinked = rmtree [@dirs];
open(LOG, ">$log_file") or *LOG = *STDERR;
print LOG "Removed $num_unlinked files in ", 
        scalar @dirs, 
        " directories (@dirs)\n";

Of course, you can loop over the readdir call to report on each
individual file (or the elements of @files), but you should be able to
easily do that once you have read the relevant entries on perlfunc and
perlsyn. The -M and -f operators and the special filehandle _ are
introduced in perlfunc as well, and so are map and grep. 

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd.   | bundled with your Microsoft product.
NSW, Australia                  | 


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

Date: Sun, 21 Jan 2001 07:06:09 GMT
From: Mario <diab.lito@usa.net>
Subject: Re: percentages, how?
Message-Id: <94e1p0$ug7$1@nnrp1.deja.com>


> I've got 3 characters: a, b, c in an array (@x)
> Now I want to get one character randomly
> This is easy. Something like $a[rand 3].
>
> but now i want to add some winning percentages. The change to get b
must
> be 80%.

I would do it in this way.

@a=qw(a b c);
@p=(10,90,100);

$n=int(rand(100)+1);

$i=0;
for (@p) {
   unless ($_>$n) {$i++}
}

$and_the_winner_is=$a[$i];


--
Mario


Sent via Deja.com
http://www.deja.com/


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

Date: Sun, 21 Jan 2001 16:21:58 +1000
From: "Jeffrey Grace" <gracenews@optusnet.com.au>
Subject: Re: Perl  - Bytecode, Compile to C, Perl2EXE 
Message-Id: <3a6a800f$0$15492$7f31c96c@news01.syd.optusnet.com.au>

[Posted and Mailed]
<jgore@home.com> wrote in message news:3a68d192.140770597@24.14.77.6...
> Perl  - Bytecode, Compile to C, Perl2EXE
>
> I'm confused!
> I have a perl (CGI) program which uses many other modules.
> I can run it on my own server just fine.

>
> I have two problems:
> 1)  I would like to distribute the program but not the source.
> 2)  I would like to run it on my ISP 's server (simplehost.com).

From what I gather from this and other postings, you should have added:
3) I would like to distribute my program as one file, so that users are not
required to manually install the modules that I have used.
4) Does not produce an EXE file.  (Is your host running Win NT or something
anyway?)

> I'm just looking for the best way to distribute my program and run it on a
standard ISP site that
> allows perl. Any help appreciated!

What I would suggest is primarily a copyright warning on your work, and
acknowledgement of the work of others (the modules, perl) and an install
script that checks for installed modules and offers to automate the install
of required modules, to make the task easier for the user. (lets face it,
although the person likely to have the security to install modules is an
experienced sysadmin, they typically don't have the time to manually install
all the modules you've used.).

However if you really are desperate to protect the source of your program, I
suggest you search for information on perl obfuscation programs (I had a
quick look and didn't find a link, or I'd give one to you).  Though I'd
strongly suggest you add an acknowledgement to the work of others in a
comment at the start of the program. Also note that you should _not_
obfuscate any code that you didn't write, that would be similar to claiming
that you wrote all of their code as well.

<ASIDE> Is there an official or semi-official site with the rules of this
newsgroup and appropriate links.  That way instead of insulting someone when
they post a first post you can point them to the site (and ask them
_politely_ to repost when they have read the rules).  I don't see what being
nasty or sarcastic achieves besides generating multiple perl un-related
posts as for example this thread does.   (BTW I'm _not_ blaming anyone, just
suggesting a way to cut down on these sorts of threads.)  Hell if an
old-timer (meant fondly of course ;-) ) would like to post or email me the
rules, I'll do up a quick web page on yahoo or similar. </END ASIDE>

--
Jeffrey Grace
~~~~~~~~~~~~~~~~~~~~
Queensland, Australia





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

Date: Sun, 21 Jan 2001 17:56:40 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Perl  - Bytecode, Compile to C, Perl2EXE
Message-Id: <slrn96l218.bgr.mgjv@martien.heliotrope.home>

On Sun, 21 Jan 2001 16:21:58 +1000,
	Jeffrey Grace <gracenews@optusnet.com.au> wrote:
><jgore@home.com> wrote in message news:3a68d192.140770597@24.14.77.6...
>>
>> I have two problems:
>> 1)  I would like to distribute the program but not the source.
>> 2)  I would like to run it on my ISP 's server (simplehost.com).
> 
><ASIDE> Is there an official or semi-official site with the rules of this
> newsgroup and appropriate links.  That way instead of insulting someone when

The rules, as far as there are any, are regularly rehashed here. Tad
McClellan is working on something that can regularly be posted here.
However, this had only partly to do with a violation of rules, and much
more with a violation of common decency. Perl, and all of the modules of
CPAN, are the fruit of many years of hard work, work from people who did
it for no remuneration whatsoever. Not one of these people complains
about the fact that there is no money for them in it. This is what open
source communities do. They give away sources, often for free.

What this person was asking was, paraphrased: "I wrote something, and I
am going to sell it. I want _you_ people to help me make money, and
'protect' my property, and I'm not going to pay you for it."

That's what was offensive. Not that he wants to make money. Not that he
wants to protect his sources. But that he is in fact a commercial
person, who expects free help. It does _not_ work that way. If you're in
commerce, you pay commercial rates. You hire someone if you can't do it
yourself.

Note the followups. This thread as been long enough. It's been explained
a few times now. Anyone who still doesn't get it is a Nazi.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | System Administration is a dirty job,
Commercial Dynamics Pty. Ltd.   | but someone said I had to do it.
NSW, Australia                  | 


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

Date: Sun, 21 Jan 2001 05:31:12 GMT
From: Bruce Gray <brucegray@home.com>
Subject: Re: Perl 500502 DBI does not work on V4R5
Message-Id: <7pfk6tshv8e9jmjf5js86lel5u9vf776gc@4ax.com>

On Fri, 19 Jan 2001 02:39:46 GMT, uzaemon@my-deja.com wrote:
>To AS/400 Perl experts:
>Following perl script doesn't work on V4R5.
>All character fields become blank. It works fine on V4R4...
>Any ideas?
--snip--

Just an idea: 
Run "DSPFFD qgpl/qrpglesrc" on both your V4R4 system and your V4R5 system.
Check the CCSID (Coded Character Set Identifier) for the SRCDTA field,
listed at the bottom of the output.
Are the CCSIDs of the two files identical?
Perhaps one file is CCSID 37, and the other is CCSID 65535.

To offer more help, I will need more info:
Are you running Perl on Win32 or Unix (or maybe on the AS/400 itself)?
If Win32, what happens when you retrieve both files using Client Access or
ODBC?
If you do this:
	...
	$arr = $sth->fetchall_arrayref;
	use Data::Dumper;
	$Data::Dumper::Useqq = 1;
	print Dumper $arr;
	...
do your character fields really show up as blanks, or as garbage?

Hope this helps,
Bruce Gray
(Not an AS/400 Perl expert, but I do have one foot deeply in each world)



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

Date: Sun, 21 Jan 2001 03:41:06 GMT
From: "Daniel Rosenzweig" <danielzr@netzero.net>
Subject: Posting email from PERL to Outlook (Exchange)???
Message-Id: <mTsa6.4034$Mu1.255144@bgtnsc06-news.ops.worldnet.att.net>

I'm running PERL on a PC - WIN NT 4- Also, I'm using Outlook to retrieve MS
Exchange mail (MAPI 1.0).... I want to write a PERL script which can count x
number of email replies and send an email at certain times of day saying how
many YES / NO /MAYBE s have been received.

Is there a way that I can have PERL send an email via Outlook? Any other
ideas on how to get it to an Exchange server?
(A sent another msg ---- how do I read the PST file....)

Thanks...
(Actually at the moment, I'm using Netscape to a Unix server which is much
easier- but will be changing soon....)
Thanks.




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

Date: Sun, 21 Jan 2001 06:13:49 GMT
From: Rob <a565a87@my-deja.com>
Subject: Re: Posting email from PERL to Outlook (Exchange)???
Message-Id: <94dumq$s7b$1@nnrp1.deja.com>

Daniel,

Plan A:
is if you have the Win32::OLE module, you can use Automation to grab a
count of all the opened and unopened mail in the Inbox of Outlook.  You
can download the Win32-OLE-0.1403 source from

     http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?distinfo=2056

The site includes documentation for writing a PL script that happens to
use Excel as an e.g.  I tried the sample script; it works--it even puts
the resulting excel file it creates into the machine's Personal folder.

(If you want to perform an Outlook Inbox count, on the other hand, you
have to take the CDO code that would ordinarily accomplish that goal
and resolve that into Perl in the same fashion as the Excel Automation
example was resolved into a Perl PM as was done in the Win32::OLE
documentation.  Since I'm just learning Perl, I can't yet write exactly
how to do that.)

Plan B:
is get a PM that grants access to a Win API function that would launch
a middle/ancillary app of your own making that, in turn, would use CDO
to grab the count.

-Rob


Sent via Deja.com
http://www.deja.com/


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

Date: Sun, 21 Jan 2001 06:18:48 GMT
From: Rob <a565a87@my-deja.com>
Subject: Re: Posting email from PERL to Outlook (Exchange)???
Message-Id: <94dv05$shb$1@nnrp1.deja.com>

When I said "...resolved into a Perl PM...," what I actually meant to
say was "...PL, or script...."  (The lingo hasn't sunk in yet.)

-Rob


Sent via Deja.com
http://www.deja.com/


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

Date: Sun, 21 Jan 2001 04:44:25 GMT
From: jay1m_2@my-deja.com
Subject: running UNIX shell script from web
Message-Id: <94dpf8$obi$1@nnrp1.deja.com>

I'm trying to run a UNIX shell script from the
web using Perl.  I have tried using the system()
function to do so:

system("scriptname $parameter");

When I tried executing my Perl script from a UNIX
prompt, it seemed to work.  However, when I tried
executing the Perl script from a web browser, it
the Perl script did everything but execute the
UNIX shell script.

Any ideas?

Thanks,
Jay Manalo


Sent via Deja.com
http://www.deja.com/


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

Date: Sun, 21 Jan 2001 04:49:31 GMT
From: jay1m_2@my-deja.com
Subject: running UNIX shell script from web
Message-Id: <94dpoq$om8$1@nnrp1.deja.com>

I'm interested in using Perl to run a UNIX shell script from the web.
I have been trying to do so using the system() function:

print("....");
 ...
system("scriptname $scriptparameter");

When I run my Perl script from a UNIX prompt, the UNIX shell script
gets called correctly.  However, when I try running the Perl script
from a web browser, for some reason the Perl script executes all of the
commands execept for running the UNIX shell script.

Any ideas?


Sent via Deja.com
http://www.deja.com/


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

Date: Sun, 21 Jan 2001 06:06:56 GMT
From: egwong@netcom.com
Subject: Re: running UNIX shell script from web
Message-Id: <40va6.12220$J%.1098456@news.flash.net>

Perhaps your webserver doesn't have the right permissions to do whatever
your script wants to do or perhaps it can't find the script name.
Try putting the fully qualified path in front of the script name.

If you're running a shell script from the web, consider using
  system( '/path/to/scriptname', $scriptparameter );

rather than
  system( "/path/to/scriptname $scriptparameter" );

to avoid calling things through a shell.  Less things to go wrong.



jay1m_2@my-deja.com wrote:
> I'm interested in using Perl to run a UNIX shell script from the web.
> I have been trying to do so using the system() function:

> print("....");
> ...
> system("scriptname $scriptparameter");

> When I run my Perl script from a UNIX prompt, the UNIX shell script
> gets called correctly.  However, when I try running the Perl script
> from a web browser, for some reason the Perl script executes all of the
> commands execept for running the UNIX shell script.

> Any ideas?


> Sent via Deja.com
> http://www.deja.com/


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

Date: Sun, 21 Jan 2001 17:47:41 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: running UNIX shell script from web
Message-Id: <slrn96l1gd.bgr.mgjv@martien.heliotrope.home>

On Sun, 21 Jan 2001 04:44:25 GMT,
	jay1m_2@my-deja.com <jay1m_2@my-deja.com> wrote:
> I'm trying to run a UNIX shell script from the
> web using Perl.  I have tried using the system()
> function to do so:
> 
> system("scriptname $parameter");
> 
> When I tried executing my Perl script from a UNIX
> prompt, it seemed to work.  However, when I tried
> executing the Perl script from a web browser, it
> the Perl script did everything but execute the
> UNIX shell script.
> 
> Any ideas?

Yes, many. It all starts by reading the manual pages, and letting Perl
help you.


Of course, since this is a CGI program, you already have the following
start:

#!/usr/local/bin/perl -wT
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

So you can do something that is suggested in the manual page (perlfunc),
and check the return code from system. The following is copied from the
documentation, and adapted for your program:

@args = ("scriptname", $parameter);
system(@args) == 0
    or die "system @args failed: $?"

The OS and Perl will happily cooperate and tell you _what_ was wrong. We
can only guess at it. Your environment _knows_. Learn to get it to tell
you this.

Oh, and before you continue: You are accepting a parameter from a user,
right? That's what $parameter is, right?

Don't do that. Or at least, read the perlsec documentation, make sure
you use the -T flag, and check what is in that parameter. And don't use
system with a single string like that unless you know what you're doing.
Pass it a list. It's much, much safer. When you pass it a single string,
and anything in that string is a shell metacharacter, the whole thing
gets run by the shell. So... Your' user passes you 

$parameter = "garbage ; rm -rf /";

Do you see what happens next? You will be executing

scriptname garbage; rm -rf /

Dangerous. Just don't do it. Read Perl FAQ part 9, perlsec, and know
what you do. Every single time you write a CGI program, in whatever
language, and you pass user parameters to a shell, be EXTREMELY careful.
EXTREMELY. Ok?

In Perl those cases occur frequently, and that's what the -T flag is
for. To help you find places where you are doing dangerous things.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | Curiouser and curiouser, said Alice.
NSW, Australia                  | 


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

Date: Sun, 21 Jan 2001 02:14:38 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: running UNIX shell script from web
Message-Id: <comdog-46E21C.02143821012001@news.panix.com>

In article <94dpf8$obi$1@nnrp1.deja.com>, jay1m_2@my-deja.com wrote:

> When I tried executing my Perl script from a UNIX
> prompt, it seemed to work.  However, when I tried
> executing the Perl script from a web browser, it
> the Perl script did everything but execute the
> UNIX shell script.

see the CGI Troubleshooting Guides referenced in the CGI
Meta FAQ. 


    http://www.sri.net/public/CGI_MetaFAQ.html

-- 
brian d foy <comdog@panix.com>
no longer for hire ;)


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

Date: 20 Jan 2001 22:52:54 -0500
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Using perl to update an ASP?
Message-Id: <94dmem$28b@junior.apk.net>

In article <948b72$f8c$1@nnrp1.deja.com>,
duckdba  <scorkery@my-deja.com> wrote:
>my $req =  POST 'http://www.some.web.address/clocker/default.asp',
>					[Badge => '0123456',
>					 PinNo => '123',
>					 QB => 'checked',
>					];

That's probably not the URL you want.

I'm going to guess that you need to find what URL _that_ page tries to
load when you would normally "click" on the "submit" button or whatever.

BTW, depending on where you live and work it may be illegal for your
employer to dock your vaction for carp like that.



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

Date: Sun, 21 Jan 2001 07:26:36 GMT
From: Sterling <smullett@omeninc.com>
Subject: Re: Words in Perl - Pulling Hair
Message-Id: <3A6A8F46.281D387E@omeninc.com>

H-


Thanks to all that have written. 
As it turns out this isn't something that I'll be needing to do after
all. 

For curiosities sake though here is the url I was getting this from. 
http://www.perl.com/pub/language/ppt/src/words/words.rjk.html

Later all, 
-Sterling




Martien Verbruggen wrote:
> 
> On Sat, 20 Jan 2001 08:55:10 GMT,
>         Sterling <smullett@omeninc.com> wrote:
> > H-
> >
> > I'm attempting to use the 'words' feature for perl.
> > The documentation says do this.
> > words [-w word-file] [-m min-length] <letters>
> 
> I just grepped through the documentation set for perl 5.6.0, thinking
> that I missed something new, without finding a reference to this
> 'feature' or command or tool. What is this thing, and what is it
> supposed to do?
> 
> As far as I can tell it's something from some module or something?
> 
> > It says that by default words looks for a 'wordlist' in the directory of
> > execution. So I created a ln -s to a word list on the machine under the
> > /usr/share/dict/ directory.
> >
> > Here's the problem. It errors.
> >     $symbol = "RXSN"; # I've changed this to match the error presented
> > below.
> >     $stuff = words $symbol;
> >     print "SYMBOL: $symbol - $stuff \n";
> 
> [snip of too much verbiage]
> 
> > Can't locate object method "words" via package "RXSN" at ./perl_code.pl
> > line 18.
> > SYMBOL: RXSN -
> 
> Is this the error message you were talking about above? In that case:
> The line
> 
> $stuff = words $symbol;
> 
> Will only be interpreted as a subroutine call if the subroutine words
> has been defined earlier during the execution of the program, either by
> a full definition, a predeclaration or an importation. if it's
> going to be declared later on, it's too late. In the absence of a
> seen sub with the name words, perl will interpret that line as an
> indirect reference to the sub words in the package $symbol.
> 
> The solution is to make sure that the sub is declared before you reach
> that line, _or_ to use parentheses:
> 
> $stuff = words($symbol);
> 
> Did you remember to use the module or require the library earlier in
> the program?
> 
> > Now maybe I'm mis-reading the documentation but why won't this work? I'm
> > not setting the word-file because it's in the current directory and I
> > don't set a minium length so it will choose all words and assign to
> > $stuff.
> 
> The perlsub documentation as something to say about this.
> 
> Nothing that I know of has anything to say about the words feature
> though...
> 
> Martien
> --
> Martien Verbruggen              |
> Interactive Media Division      | Useful Statistic: 75% of the people
> Commercial Dynamics Pty. Ltd.   | make up 3/4 of the population.
> NSW, Australia                  |


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

Date: Sun, 21 Jan 2001 07:57:15 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Words in Perl - Pulling Hair
Message-Id: <x78zo5xrqb.fsf@home.sysarch.com>

>>>>> "S" == Sterling  <smullett@omeninc.com> writes:

  S> For curiosities sake though here is the url I was getting this from. 
  S> http://www.perl.com/pub/language/ppt/src/words/words.rjk.html

well, can you tell the difference between a program written in perl (as
the above is) and a function IN perl? 

  >> Sterling <smullett@omeninc.com> wrote:
  >> > H-
  >> >
  >> > I'm attempting to use the 'words' feature for perl.
  >> > The documentation says do this.
  >> > words [-w word-file] [-m min-length] <letters>
  >> 
  >> I just grepped through the documentation set for perl 5.6.0, thinking
  >> that I missed something new, without finding a reference to this
  >> 'feature' or command or tool. What is this thing, and what is it
  >> supposed to do?

did you look in the parent directory? did you download the source for
this program? did you investigate what ppt means?

obviously not.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


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


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