[18583] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 751 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 24 06:06:02 2001

Date: Tue, 24 Apr 2001 03:05:09 -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: <988106708-v10-i751@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 24 Apr 2001     Volume: 10 Number: 751

Today's topics:
        @INC array <gwilson@ocs1.ocs.mq.edu.au>
    Re: @INC array <ronald.fischer@deadspam.com>
    Re: avoid having to hit the enter key ( )
    Re: Can I include local perl snipits? <r1ckey@home.com>
    Re: Can I include local perl snipits? <xris@dont.send.spam>
    Re: Compression (to .zip/.gz) using system/backticks nobull@mail.com
    Re: Daemon: should the parent exit or _exit after the f <pne-news-20010424@newton.digitalspace.net>
        Execute script at certain times? <pric3596@cs.uidaho.edu>
    Re: Execute script at certain times? <mk@ticklets.com>
    Re: Execute script at certain times? (Bernard El-Hagin)
    Re: Execute script at certain times? <johnm@aiamail.com>
        expressions <zakaria1@hotmail.com>
    Re: expressions (Bernard El-Hagin)
    Re: expressions <xris@dont.send.spam>
    Re: expressions (Logan Shaw)
    Re: Getting a list of modules currently installed <pne-news-20010424@newton.digitalspace.net>
    Re: Good editor for perl (Rafael Garcia-Suarez)
    Re: Good editor for perl <zakaria1@hotmail.com>
        locale <dean@housefloors.co.uk>
    Re: locale (Rafael Garcia-Suarez)
    Re: LWP::UserAgent? (Rafael Garcia-Suarez)
    Re: Newbie question: reading variables with CGI (Si Ballenger)
    Re: Please help <krahnj@acm.org>
        problem understanding stat function output <johnm@aiamail.com>
        Problems with ADO and Oracle <jb@catalog-international.com>
    Re: regexp matching with optional part <ronald.fischer@deadspam.com>
    Re: removing the \n from the data obtained from a text  <hafner-usenet@ze.tu-muenchen.de>
    Re: web log parsing (Rafael Garcia-Suarez)
    Re: Where is my script ( )
    Re: Windows Perl for Windows 95 -- Internet Explorer 5  <bart.lateur@skynet.be>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 24 Apr 2001 14:46:56 +1000
From: greg wilson <gwilson@ocs1.ocs.mq.edu.au>
Subject: @INC array
Message-Id: <3AE50540.28F6C262@ocs1.ocs.mq.edu.au>

Hi,
    I work on WINNT platform - my @INC array seems to change when I
    move scripts to different directories.

    It now points to c:\recycler!!

    Short of downloading a new perl distribution, how do I change @INC
    back to original settings? I have read all I can but don't
understand - can't make
    anything work.

    Does anyone know why @INC keeps changing?




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

Date: 24 Apr 2001 08:47:02 +0200
From: Ronald Fischer <ronald.fischer@deadspam.com>
Subject: Re: @INC array
Message-Id: <7qfd7a2rdzt.fsf@icn.siemens.de>

greg wilson <gwilson@ocs1.ocs.mq.edu.au> writes:

>     I work on WINNT platform - my @INC array seems to change when I
>     move scripts to different directories.

Could it be that you are invoking by accident a different copy of Perl
(maybe one which is local to the respective directory)? What is when you
hop from directory to directory and do a

        perl -e 'print @INC'

Do you get a different value everytime?

>     Short of downloading a new perl distribution, how do I change @INC
>     back to original settings? 

Provided that you know what the settings should look like, you could
invoke perl with the -I switch and supply the directories manually.

Ronald
-- 
Do NOT reply to the address given in the From: header. If you want to
reply by mail, use the following address (after deleting the XXX):
Ronald Otto Valentin Fischer <rovfXXX@earthling.net>
http://profiles.yahoo.com/ronny_fischer/


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

Date: Tue, 24 Apr 2001 06:23:16 GMT
From: "( ) | 3 ]" <obiwan@mahood.com.eatme_spammers>
Subject: Re: avoid having to hit the enter key
Message-Id: <3AE51BEC.DA85EE82@mahood.com.eatme_spammers>

What are you having this system command do?  Whatever it's executing is
waiting for your keystroke.

Phil Treen wrote:

> I have written a perl script that uses the system command, the script
> stalls until the enter key is hit. Is there any way to avoid this
>
>             Thanks in Advance
>                     Phil



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

Date: Tue, 24 Apr 2001 04:41:49 GMT
From: r1ckey <r1ckey@home.com>
Subject: Re: Can I include local perl snipits?
Message-Id: <3AE50448.B5CDC78C@home.com>

God_Of_Pain wrote:
> 
> On my web site I have a cgi-bin and I am using a few functions over and
> over again. I don't have access to the perl modules directory.
> 
> Is there some way to put my functions into a command file in my cgi-bin and
> just include them like #include "my_file" in C?
> 
> Should I write a local perl module? Can I have a module in my cgi-bin?
> 
> What is the best way?

Perl packages is what you're looking for...For instance, 

--Package file, name=MyPackage--

#!/usr/bin/perl

package MyPackage;

# function contained within the package
sub print_it($) 
{
	my $to_print = shift;
	print "$to_print\n";
}
# this is required
return 1; 

--Script file using the package--
#!/usr/bin/perl

# mind the single qoutes
require 'MyPackage'; 

# call the function contained in the package
MyPackage::print_it("Hello World!");

P.S. God, please don't cross post.


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

Date: Tue, 24 Apr 2001 00:09:56 -0500
From: xris <xris@dont.send.spam>
Subject: Re: Can I include local perl snipits?
Message-Id: <xris-56AB63.00095624042001@news.evergo.net>

In article <3AE50448.B5CDC78C@home.com>, r1ckey <r1ckey@home.com> 
wrote:

> Perl packages is what you're looking for...For instance, 

not necessarily.  If he just wants to include a few functions, there's 
no need to create the overhead of a package...

I do this in my own work, with what I've called .lib files - basically 
just libraries of functions that I "require" in when I need them.  Most 
of them are too random to bother grouping together within an 
object/package.

Plus, that way, you don't need to specify the package name every time 
you want to call the subroutines.



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

Date: 24 Apr 2001 10:36:34 +0100
From: nobull@mail.com
Subject: Re: Compression (to .zip/.gz) using system/backticks
Message-Id: <u9lmoqmyfx.fsf@wcl-l.bham.ac.uk>

"Scott R. Godin" <webmaster@webdragon.unmunge.net> writes:

> I have two text files (one .html, and one plain .txt) generated by a 
> Perl CGI script I'm working on. I was considering having the script 
> e-mail the files to the end-user, but two things occured to me. 
> 
>     1> there is a (slight to moderate) possibility of it being used for 
> abuse, in that the user could enter an incorrect (i.e. someone else's) 
> mail address 
> 
>     2> I'd most likely want to use Mail::Mailer or MIME::Lite to send 
> the files as attachments, and in either case, it would require the host 
> to install those perl modules.

Why?  AFAIK these are flagged on CPAN as pure Perl except MIME::Base64
which is 'h' meaning the non-Perl bit is optional.

> Since in 5 months, I haven't even been 
> able to get them to update some stock modules that I *know* have bugs in 
> them, and really *require* newer versions... this doesn't seem likely.
> 
> SO, I'm considering calling out to the shell via system or backticks to 
> have it compress the two files into a .zip archive. 

I don't see how shelling out to a compression program is an
alternative to the Mail modules.
 
> Two things have me pausing.. one, I'm not 100% certain of the syntax 
> needed to .zip (which I use more of between Mac and Windoze) a file

This has nothing to do with Perl.  The syntax of the external command
is well the syntax of the external command - read the manual of that
command.
 
> instead of gzip (which I use more of between my Mac and my shell). I'm 
> quite familiar with gzip from the shell but I've never used anything 
> that created plain .zip files from unix, so I'm unsure which way to go. 

So your question is "Where can I get a program to make .zip files on
Unix?". What possessed you to imagine this had anything even remotely
to do with Perl?

http://www.info-zip.org/pub/infozip/

> Since I'm of certainty approaching 100% that the people using this 
> script to generate the templates will be on Windows systems, (and some 
> may be complete newbies) I'd rather give them a file that I'm confident 
> can be "unzipped" with something like WinZip[1]. 
> 
> so it boils down to two questions
> A. (non-perl) does anyone offhand know whether WinZip can uncopress a 
> unix .gz file?

Yes.

> B. (perl ! and thus saving my bacon :) would the proper command look 
> something like
> 
>     `cat $file1 $file2 | gzip > ${fileprefix}.gz` 
>         or die "$!";

See FAQ: "What's wrong with using backticks in a void context?"

> .. or would it be $@ and not $! ? 

You probably should be checking both $! and $?

See: "perldoc -f system" for details.

> Obviously I know the unix part -- cat filea fileb |gzip >foo.gz -- 
> that's not what I'm asking in B, above. *cough* :-)

No it is not obvious you know the Unix part.  Do you realise that when
the user unpacks the .gz file they'll get a single file with no way to
know where to split it to get the two component files?

> Or would you do it a different way? 

I would use, and indeed have used, Info-Zip for implementing
multi-file download from a CGI.

> [2] If you'd rather not answer because you think the whole thing is too 
> much unix and not enough perl[3], would you be so kind as to provide a 
> helpful suggestion as to which comp.unix.* group would be most receptive 
> and responsive to my questions above? I looked, but there's enough of 
> 'em that I'm not sure. I *will* be sure to keep any answer to [2] in 
> mind in the future however, with many thanks for the tip. 

I suspect "Where can I get a program to make .zip files on Unix?"
would be best asked in comp.unix.misc.  Although I'd recommend a you
try a web search first for things like this first.

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


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

Date: Tue, 24 Apr 2001 10:19:35 +0200
From: Philip Newton <pne-news-20010424@newton.digitalspace.net>
Subject: Re: Daemon: should the parent exit or _exit after the fork?
Message-Id: <lmdaetofgfch7plkvp6etgtqj6m82mbofu@4ax.com>

On 23 Apr 2001 17:13:54 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

> What makes the final flush special?  Parent and kid will have flushed
> in an un-coordinated way all along.

There is no "all along"; the first thing the parent does after forking
is to exit. It doesn't write to file handles any more. But it
shouldn't clean up structure that will continue to be used by the
child.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Tue, 24 Apr 2001 00:52:34 -0700
From: "Preston Price" <pric3596@cs.uidaho.edu>
Subject: Execute script at certain times?
Message-Id: <9c3b4m$ecp$1@kestrel.csrv.uidaho.edu>

I was wondering if anyone knew of a way to have a program run at a certain
time everyday. I want something that will run at midnight every night. Does
anyone know of a way to do this?
Thanks in advance.






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

Date: Tue, 24 Apr 2001 09:58:20 +0200
From: "Paul Kersey" <mk@ticklets.com>
Subject: Re: Execute script at certain times?
Message-Id: <9c3bqp$6gj$1@news1.xs4all.nl>

on windows nt, use the 'at' command.
On another operating system: use another scheduling command :-)
Since you didn't provide any details: so can't I......

> I was wondering if anyone knew of a way to have a program run at a certain
> time everyday




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

Date: Tue, 24 Apr 2001 08:08:17 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Execute script at certain times?
Message-Id: <slrn9eacp6.bfu.bernard.el-hagin@gdndev25.lido-tech>

On Tue, 24 Apr 2001 00:52:34 -0700, Preston Price <pric3596@cs.uidaho.edu>
wrote:
>I was wondering if anyone knew of a way to have a program run at a certain
>time everyday. I want something that will run at midnight every night. Does
>anyone know of a way to do this?
>Thanks in advance.

If you can prove that this is a Perl question I'll give you the answer.

Cheers,
Bernard
--
perl -e's;;s,,Just another CRON hacker,;and$\="\r"and
$$=q!print${"\x27"}!;$;=qq.$0..q.v..qq!al $$!;$;=~s-\---;
/^....*(?{$|=eval$;;select($Just,$another,$Perlhacker,0.1)}).{25}/x;'


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

Date: 24 Apr 2001 09:52:40 GMT
From: "John Michael" <johnm@aiamail.com>
Subject: Re: Execute script at certain times?
Message-Id: <9c3id8$mqp@dispatch.concentric.net>

On unix see:
http://realtimescripts.com/docs/tutorials.htm#Crontab
Cya
John Michael

Preston Price <pric3596@cs.uidaho.edu> wrote in message
news:9c3b4m$ecp$1@kestrel.csrv.uidaho.edu...
> I was wondering if anyone knew of a way to have a program run at a certain
> time everyday. I want something that will run at midnight every night.
Does
> anyone know of a way to do this?
> Thanks in advance.
>
>
>
>




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

Date: Mon, 23 Apr 2001 10:45:12 -0400
From: zak <zakaria1@hotmail.com>
Subject: expressions
Message-Id: <3AE43FF8.57C0457B@hotmail.com>

Hi,
here is an example of what i want to do:

$variable= " name is $name";
$name="joe";
print "$variable";

The output is : name is
 I am expecting : name is joe

is it possible at all? Am i missing something? Thanks.



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

Date: Tue, 24 Apr 2001 07:06:16 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: expressions
Message-Id: <slrn9ea94s.bfu.bernard.el-hagin@gdndev25.lido-tech>

On Mon, 23 Apr 2001 10:45:12 -0400, zak <zakaria1@hotmail.com> wrote:
>Hi,
>here is an example of what i want to do:
>
>$variable= " name is $name";
>$name="joe";
>print "$variable";
>
>The output is : name is
> I am expecting : name is joe
>
>is it possible at all? Am i missing something? Thanks.

Enable warnings and run the above code again. You'll learn two things that way:

1. why the code doesn't work the way you expect it to,
2. why you should always use strictures and warnings even in silly
   little programs like the one above.

Cheers,
Bernard
--
perl -e's;;s,,Just another Perl hacker,;and$\="\r"and
$$=q!print${"\x27"}!;$;=qq.$0..q.v..qq!al $$!;$;=~s-\---;
/^....*(?{$|=eval$;;select($Just,$another,$Perlhacker,0.1)}).{25}/x;'


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

Date: Tue, 24 Apr 2001 02:08:35 -0500
From: xris <xris@dont.send.spam>
Subject: Re: expressions
Message-Id: <xris-45D3EA.02083424042001@news.evergo.net>

In article <3AE43FF8.57C0457B@hotmail.com>, zak <zakaria1@hotmail.com> 
wrote:

> $variable= " name is $name";
> $name="joe";
> print "$variable";
> is it possible at all? Am i missing something? Thanks.

try declaring $name *before* using it in the expression (your expression 
is interpreted before declaring the name, not every time $variable is 
accessed).



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

Date: 24 Apr 2001 03:15:32 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: expressions
Message-Id: <9c3cn4$4li$1@charity.cs.utexas.edu>

In article <3AE43FF8.57C0457B@hotmail.com>, zak  <zakaria1@hotmail.com> wrote:
>$variable= " name is $name";
>$name="joe";
>print "$variable";
>
>The output is : name is
> I am expecting : name is joe

Let's look at the problem a different way.  If you had this code:

	$x = $y + 1;
	$y = 72;
	print $x;

then would you expect the value that's printed to be 73?  Probably not,
because $y is set to 72 after $x is set to $y + 1.

What you are doing is very similar.  Don't let the quotes fool you.
The expression '" name is $name "' is evaluated just like any other
expression, which means that the values its composed of must already be
defined.

  - Logan
-- 
my  your   his  her   our   their   _its_
I'm you're he's she's we're they're _it's_


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

Date: Tue, 24 Apr 2001 10:34:01 +0200
From: Philip Newton <pne-news-20010424@newton.digitalspace.net>
Subject: Re: Getting a list of modules currently installed
Message-Id: <0ieaet8t338bb4vk5602gt1hqf7o2eqsll@4ax.com>

On Mon, 23 Apr 2001 17:35:39 +0100, "Stuart Moore" <stumo@bigfoot.com>
wrote:

> Is there a way to get a list of all currently available modules from within a
> Perl script? I haven't had any luck searching for one, but it may just be me
> being more massive per unit volume.

I recommend Tom Phoenix's "Inside" application. It's meant to be used
as a CGI script, but works fine from the command line as well. Get it
from CPAN/authors/id/P/PH/PHOENIX/Inside-1.01.tar.gz .

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 24 Apr 2001 06:31:26 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Good editor for perl
Message-Id: <slrn9ea7fe.eek.rgarciasuarez@rafael.kazibao.net>

Anno Siegel wrote in comp.lang.perl.misc:
} 
} In any case, they do not really highlight syntax.  Well, perhaps
} in lisp, but not in Perl.  A syntax highlighter should be able to tell
} whether a particular "{" opens a block of code, a hash subscript, or
} an anonymous hash.  I don't expect one anytime soon.

Perltidy can generate a colored HTML version of some Perl code. Look at
an impressive example : http://perltidy.sourceforge.net/node008.html

However, it's too slow to be embedded in an editor as a syntax
highlighting module.

Editors use (sometimes sophisticated) heuristics to color code. This is
intended to work for only the most common cases. When the heuristics
fails, this produces annoying results. The same problem arises for
editors that helps to indent code being typed.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/vim/


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

Date: Mon, 23 Apr 2001 10:48:37 -0400
From: zak <zakaria1@hotmail.com>
Subject: Re: Good editor for perl
Message-Id: <3AE440C5.E4A985C0@hotmail.com>

TextPAd is free, Editplus is maybe better but its only a shareware...

textpad.com
editplus.com

If you find better please let me know.

Super-Simon wrote:

> Hi all,
>
> I'm searching for a good, fast editor with syntax highlighting for perl
> (CGI) for use under Windows 2000 / Windows 98 (I use windowz only for
> editing scripts, scripts runs on Linux-server). It has to be free (I'm a
> poor student ;-)
>
> Grtz,
>
> Super-Simon



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

Date: Tue, 24 Apr 2001 09:49:15 +0100
From: "Dean Wakerley" <dean@housefloors.co.uk>
Subject: locale
Message-Id: <9c3eg4$jm6$1@news7.svr.pol.co.uk>

I've install glibc 2.2.2 recently and now perl, when executed prints out
crap about checking locale and reverting to default c locale. Although the
settings it prints out appear correct.

How do I stop this and make it use the correct locale?

Dean




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

Date: 24 Apr 2001 08:59:14 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: locale
Message-Id: <slrn9eag4i.f02.rgarciasuarez@rafael.kazibao.net>

Dean Wakerley wrote in comp.lang.perl.misc:
} I've install glibc 2.2.2 recently and now perl, when executed prints out
} crap about checking locale and reverting to default c locale. Although the
} settings it prints out appear correct.
} 
} How do I stop this and make it use the correct locale?

Perhaps should you recompile Perl. For another way of fixing your
problem, look at the perllocale manpage, section on "Locale problems".

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: 24 Apr 2001 06:40:41 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: LWP::UserAgent?
Message-Id: <slrn9ea80o.eek.rgarciasuarez@rafael.kazibao.net>

smilepak wrote in comp.lang.perl.misc:
} 
} HERE IS THE SCRIPT THAT DOESN'T WORK:
} 
} foreach $line(@list) {
}     chomp($line);
}     &sub_https($line);
} }
} 
} sub sub_https {
} $filename = shift;

Apparently you don't use strict and -w. You should.

} $ua = new LWP::UserAgent;

You don't need to create another LWP::UserAgent object every time you
call this function.

} my $req = new HTTP:Request 'GET', 'https://mydomain.com/$filename';

Variables are not interpolated in single-quoted strings. That's your
problem.

} $res = $ua -> request($req, "$filename");

And here you should look at the HTTP::Response object to know whether
the request succeeded:

  if ($res->is_success) {
    print "Request OK for $filename\n";
  } else {
    print "Request failed for $filename: ",$response->status_line(),"\n";
  }

Careful error reporting helps you to debug!

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Tue, 24 Apr 2001 04:14:57 GMT
From: shb@vnet.net (Si Ballenger)
Subject: Re: Newbie question: reading variables with CGI
Message-Id: <3ae4fd06.181206737@166.82.1.9>

On 23 Apr 2001 18:09:03 +0100, nobull@mail.com wrote:

>Unless it is your intension to be insulting then you should quote _in_
>_context_ only _relevant_ bits of the message to which you are
>replying.
>
>Is it your intension to be insulting?
>
>"Super-Simon" <simon@super-simon.com> writes:
>
>> "brian d foy" <comdog@panix.com> wrote in message
>> news:comdog-CFCF7A.11442523042001@news.panix.com...
>> > use CGI.pm.  it comes with Perl and is documented.
>> >
>> I know, but I can't find an example of how to use it...
>
>The manuals for Perl modules can be displayed using the "perldoc"
>command.
>
>Actually GCI.pm is (pointlessly) an execption to this rule but this
>doesn't matter.
>
>> Please help me,
>> 
>> Newbie
>
>If you'd lurked for a while before posting In this group the term
>Newbie when applied to someone by themselves is usually correctly
>interpreted as "person too lazy to read the manual".
>
>This is not the correct use of the term but is apparently what it
>means to people who use it of themselves.

Hmmm..., another charter member of the cplm catfish club? ;-)


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

Date: Tue, 24 Apr 2001 05:12:29 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Please help
Message-Id: <3AE50B3C.CDFD559B@acm.org>

Joe Schaefer wrote:
> 
> % perl -MMorse a1-q3.pl
> 101, 102, 103, 104, 105, 106, 107, 108, 109, tenth
> 111, 112, 113, 114, 115, 116, 117, 118, 119, tenth
> 121, 122, 123, 124, 125, 126, 127, 128, 129, tenth
> 131, 132, 133, 134, 135, 136, 137, 138, 139, tenth
> 141, 142, 143, 144, 145, 146, 147, 148, 149, tenth

You should have used the Bleach module. :-)


John
-- 
use Perl;
program
fulfillment


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

Date: 24 Apr 2001 09:50:28 GMT
From: "John Michael" <johnm@aiamail.com>
Subject: problem understanding stat function output
Message-Id: <9c3i94$qi0@dispatch.concentric.net>

Hi
I ran this in a perl script.
($file_mode) = (stat($ENV{'PATH_TRANSLATED'}))[2];

The output was 33188
According to my books this is the mode & file type.

I need just the mode so that I can check it against a value like so.

if ($file_mode eq "0777"}){
    do something
}


How do I get the mode out of this?


Thanks in advance.
John Michael





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

Date: Tue, 24 Apr 2001 10:26:27 +0200
From: Jens Bang <jb@catalog-international.com>
Subject: Problems with ADO and Oracle
Message-Id: <f8daet86lfmc6tm5jo2n94tlmoc267fd8g@4ax.com>

I'm writing a script, where I need to call a stored procedure in
Oracle, which takes 2 parameters: one integer parameter and one string
parameter. Since the string can contain linebreaks I had problems
using ODBC and so I switched to ADO. But when I call the function
below, I get this error message when I call $Cmd->Execute()


OLE exception from "Microsoft OLE DB Provider for ODBC Drivers":

[Oracle][ODBC][Ora]ORA-24334: no descriptor for this position

Win32::OLE(0.1101) error 0x80004005: "Unspecified error"
    in METHOD/PROPERTYGET "Execute"


What am I doing wrong?

Here is the function I call. $Conn is initialized like this:


# creates a connection object
my $Conn = Win32::OLE->new('ADODB.Connection'); 
# opens the database connection
$Conn->Open($connectstring);                    

sub dbCallProc {
  # creates a stored procedure object
  my $Cmd = Win32::OLE->new("ADODB.Command");     
  $Cmd->{ActiveConnection} = $Conn;
  $Cmd->{CommandText} = "APPEND_TEXTBODY";
  $Cmd->{CommandType} = 4;   # adCmdStoredProc
  $Cmd->Parameters->Append($Cmd->CreateParameter("PARID", 3, 4));
  $Cmd->Parameters->Item(0)->{value} = $parid;
  $Cmd->Parameters->Append($Cmd->CreateParameter("BUFFER", 200, 4,
     length($_[0])));
  $Cmd->Parameters->Item(1)->{value} = $_[0];
  $RetVal = $Cmd->Execute();
  $Cmd->Close;
	return $RetVal;
}

---
Venlig hilsen / Kind regards

Jens Bang (jb@catalog-international.com)
Software Engineer

Catalog-International A/S
Toldbodgade 55
1253 Copenhagen K
Denmark

Phone       : +45 - 8233 - 2200
Direct dial : +45 - 8233 - 2220
Fax         : +45 - 8233 - 2201
Homepage    : www.catalog-international.com


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

Date: 24 Apr 2001 07:48:21 +0200
From: Ronald Fischer <ronald.fischer@deadspam.com>
Subject: Re: regexp matching with optional part
Message-Id: <7qfg0eyrgpm.fsf@icn.siemens.de>

Uri Guttman <uri@sysarch.com> writes:

> >>>>> "RF" == Ronald Fischer <ronald.fischer.gp@icn.siemens.de> writes:
> 
>   >> "Ronald Fischer" <ronald.fischer.gp@icn.siemens.de> wrote in message
>   >> news:7qfwv8gq6pk.fsf@icn.siemens.de...
>   >> > x-abc-x  -> return abc
>   >> > x-foo    -> return foo
>   >> > bar-x    -> return bar
>   >> > baz      -> return baz
>   >> > x--x     -> fail
> 
>   RF> Probably this really can't be done in a single regexp...
> 
> what is your failure test? this strips the strings and you can test for
> failure afterwards:
> 
> assume the input is in $_
> 
> 	s/^x-|-x$//g && $_

That's it! I never thought about the s/// function here, but of course,
the solution is simple:

(s/^x-|-x$//g, length($_) > 0)

Thanks a lot.

Ronald
-- 
Do NOT reply to the address given in the From: header. If you want to
reply by mail, use the following address (after deleting the XXX):
Ronald Otto Valentin Fischer <rovfXXX@earthling.net>
http://profiles.yahoo.com/ronny_fischer/


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

Date: 24 Apr 2001 09:44:33 +0200
From: Walter Hafner <hafner-usenet@ze.tu-muenchen.de>
Subject: Re: removing the \n from the data obtained from a text area in a form
Message-Id: <srj66fubv32.fsf@w3proj1.ze.tu-muenchen.de>

"Scott R. Godin" <webmaster@webdragon.unmunge.net> writes:

> In article <3AE31093.983E4FD4@cornell.edu>,
>  Young Chi-Yeung Fan <yf32@cornell.edu> wrote:
> 
>  | Is the script running on Windows, or Unix, or Mac? I think Windows 
>  | uses "\r\n" for the end-of-line, so you'd have to replace \r\n with 
>  | <P>. I think Mac uses "\r", and Unix uses "\n".
> 
> on the Mac, under MacPerl, I use \n, but it effectively translates to 
> \015 (IIRC) and unix uses \012, while Whinedows uses \012\015..
> 
> so while my scripts still use \n, and unix scripts can/may also use \n, 
> the mapping internally is different to what character Perl actually 
> generates. (something to bear in mind, anyway.)

Hmmm ... on a related topic:

Occasionaly I have to process files of unknown origin. I.e., the files
were written by my coworkers, some under Windows, some under Unix - no
Macs. My scripts have to work on all of them. Since I can't tell the
format, I use constructs like

while (<>) {
	s/\r//;
	chomp;
	# process one line after the other
}

to remove all the line delimiters. Is this the most effective way or
should I use constructs like

while (<>) {
	$/ = '\r\n' if /\r\n/;
	chomp;
	# process one line after the other
}

Very messy, because of the comparison in every single line. But if I
pull the $/ line out of the loop, i loose the first line.

Any suggestions?

-Walter


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

Date: 24 Apr 2001 06:51:47 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: web log parsing
Message-Id: <slrn9ea8lj.eek.rgarciasuarez@rafael.kazibao.net>

igor' spivak wrote in comp.lang.perl.misc:
} hey, anyone know of a good script to parse apache or combined logs? i mainly
} need the reg.exps, the rest is easy,

Have you tried to search the CPAN ? <http://search.cpan.org/> Look
for... hmm... something like Apache::ParseLog...

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Tue, 24 Apr 2001 06:39:31 GMT
From: "( ) | 3 ]" <obiwan@mahood.com.eatme_spammers>
Subject: Re: Where is my script
Message-Id: <3AE51FBB.19C8F32E@mahood.com.eatme_spammers>

Your own location is called your present (or current) working directory.  In
unix, this is reffered to as pwd or cwd.  There is a unix command, cwd,
which tells you this when you're in a shell.  There is also an environment
variable for most shells (PWD) which contains this information.

A process has an environment, as you do as a user, and a corresponding set
of environment variables.  To see your environment variables (in most
shells), type: env.

In perl, environment variables are stored in the %ENV hash.  Hopefully you
can learn from the following:

#! /usr/local/bin/perl

foreach $x ( sort keys %ENV ) {
        print "$x: $ENV{$x}\n";
}

print "Here is my PWD: $ENV{'PWD'}\n";


- ( ) | 3 ][


Martin Djernaes wrote:

> Hi,
>
> What's the way to find the location of a script (from within the
> script)?
>
> I have a CGI script in /home/someuser/public_html/adir/ called
> ascript.pl. When ever it's called by Apache I can use '.' for the
> current dir, which is also the dir of the script, but if I'm in
> /home/someuser and call /usr/bin/perl public_html/adir/ascript.pl I look
> that information - how do I find "my own" location?
>
> Martin



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

Date: Tue, 24 Apr 2001 09:22:07 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Windows Perl for Windows 95 -- Internet Explorer 5 required?
Message-Id: <jdhaet0rm5cshcmnvueruq1n4sgudkhi94@4ax.com>

Charles M. Kozierok wrote:

>Thanks Bart. I'll give Indigo a try. If you have any tips or pitfalls
>to help a newbie avoid, please share them. :)

Avoid spaces in the path to perl's directory. PerlConsole doesn't work
for me. Instead, one can start (and stop) Apache manually with the start
menu items, and point your browser to <http://localhost/html/>. There's
a file missing in the html directory with the name "win32prk.css",
Netscape doesn't like that; you may even put an empty file of that name
there. Create a directory called "local_repository" in your root perl
directory. It's there that the GPM will then put its downloads. The base
URL for Activestate's repository is
<http://www.activestate.com/PPMpackages/5.6>. Heh!

-- 
	Bart.


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

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


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