[26395] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8566 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 25 11:05:48 2005

Date: Tue, 25 Oct 2005 08:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 25 Oct 2005     Volume: 10 Number: 8566

Today's topics:
    Re: Access a c++ module from Perl <bart.lateur@pandora.be>
    Re: Access a c++ module from Perl <temporary@mail.gr>
    Re: Microsoft Hatred FAQ <my_email_is_posted_on_my_website@munged.invalid>
    Re: Perl And Apache. <bart.lateur@pandora.be>
    Re: printf and variable length? <tadmc@augustmail.com>
        varhash question (Jeremy Billones)
    Re: varhash question <no@email.com>
    Re: write to windows share folder from perl/Win32 <thepoet_nospam@arcor.de>
    Re: write to windows share folder from perl/Win32 <syncwa@gmail.com>
    Re: write to windows share folder from perl/Win32 <thepoet_nospam@arcor.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 25 Oct 2005 10:34:39 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Access a c++ module from Perl
Message-Id: <4m1sl1pqph98n8svv2k52s603vtrc9bnea@4ax.com>

bg-greece wrote:

>I am using cygwin and perl and trying to access some function from a C++
>windows dll. After the first attempt produced a segmentation fault, I tried
>to do it step-by-step. I created a dummy function in the dll file:
>
>int TestDLL(int x)
>{
>    return 1;
>}
>
>
>and put the following code in a perl file:
>
>use strict;
>use Win32::API::Prototype;
>
>my $TestDLL = ApiLink("mydll",'I TestDLL(I x)');
> if (not defined $TestDLL) {
> die "Can't import API TestDLL: $! \n";
>}

In my experience, the prototype based stuff is very buggy. I've had
nothing but crashes with it. I would skip it and go the oldfashioned raw
way, which always *did* work. Try.

	use Win32::API;
	my $TestDLL = Win32::API->new('mydll', 'TestDLL', 'I', 'I') 
	  or die "Can't load function";

   HTH,
   Bart.


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

Date: Tue, 25 Oct 2005 15:42:03 +0300
From: "bg-greece" <temporary@mail.gr>
Subject: Re: Access a c++ module from Perl
Message-Id: <djl9aa$16vn$1@ulysses.noc.ntua.gr>

In fact Win32::API was the first try and it also produced segmentation
fault.Other trivial examples however (with kernel32.dll for example) have
worked.

> In my experience, the prototype based stuff is very buggy. I've had
> nothing but crashes with it. I would skip it and go the oldfashioned raw
> way, which always *did* work. Try.
>
> use Win32::API;
> my $TestDLL = Win32::API->new('mydll', 'TestDLL', 'I', 'I')
>   or die "Can't load function";
>
>    HTH,
>    Bart.




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

Date: Tue, 25 Oct 2005 12:04:41 GMT
From: Roedy Green <my_email_is_posted_on_my_website@munged.invalid>
Subject: Re: Microsoft Hatred FAQ
Message-Id: <3c7sl11bhsjfk2nuedev7drhbqm8ci8c9o@4ax.com>

On Tue, 25 Oct 2005 04:21:45 -0700, "David Schwartz"
<davids@webmaster.com> wrote, quoted or indirectly quoted someone who
said :

>    2) There are other realistic competing operating systems. In this case, 
>you were foolish to agree to Microsoft's deal. You lost out on the realistic 
>competing markets. That is, unless Windows only really was a better deal, in 
>which case you were wise to take the deal and have no reason to be upset. 

The actuality at the time was the vast majority of my business was
Windows.  People would ask about OS/2 and when they asked around town
and discovered because of the MS dirty deal it cost way more, they
lost interest.

I could not have made a living selling only OS/2.  It is was a very
difficult business to survive in as it was and I was already at a
disadvantage because of my insistence on not cutting corners the way
my competitors did.  Every once in a while I run into one of my
machines I built back in the early 90s still going without a hitch
over a decade later.

I don't think I could make it clearer.  What MS did was wrong and I
will to my dying day curse them for it.  If I were a Christian, I
would put it this way. The pressured me into selling my soul.

They did not tempt me into it. They threatened to destroy my business
and my livelihood if I did not knuckle under. That is extortion.





-- 
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.


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

Date: Tue, 25 Oct 2005 10:44:37 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Perl And Apache.
Message-Id: <6k2sl1h9rtli8nuoh982j9k0b8g95rlai3@4ax.com>

Morris.C wrote:

>
>After UserID/Password authentication on a web page, does Apache store the 
>UserID in an environment variable that a Perl script could use?

Authentication how? There's a huge difference between the browser
supported authentication with the dialog box, typically based upon
 .htaccess/.htpasswd, and something your people put together on a normal
webform.

>I've used a Perl script called 'test-cgi', but the UserID that it always 
>returns is "apache".

That's not how it works. For the former, browser native authentication,
there is indeed some environment variable set with the user name, but
not with the password. Try printing out the contents of %ENV in a test
page.

For the latter, you're on your own. You'll have to use one of the
typical technologies to create and keep track of a so-called session,
using a session ID -- combined with some associated data on the server.

Typical ways to do this is in a cookie, clean and hasslefree, but the
user has to allow cookies from your site; a hidden form variable you
pass along in every form (troublesome: forget it once and your user
suddenly finds himself logged out), and putting it in the URL (Google
for PATH_INFO), but with the major disadvantage that bookmarks will hold
the session id. 

Check the info on environment variables on this page:

	<http://hoohoo.ncsa.uiuc.edu/cgi/env.html>

   HTH,
   Bart.


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

Date: Tue, 25 Oct 2005 07:31:07 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: printf and variable length?
Message-Id: <slrndls9cb.f8q.tadmc@magna.augustmail.com>

Daemonice <sashimi123@gmail.com> wrote:

> printf DB "%-19s",$value;
> 
> However, now I need to write $fieldlength positions. I cannot find how
> I can combine printf with $fieldlength.


You can disambiguate the name of the variable with curly braces
(so that the "s" is not part of the variable name):

   printf DB "%-${fieldlength}s", $value;


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


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

Date: Tue, 25 Oct 2005 14:47:04 -0000
From: billones@radix.net (Jeremy Billones)
Subject: varhash question
Message-Id: <11lshb8nok7n473@corp.supernews.com>

I know very little about perl.  (Just wanted to get that out of the way :)

I've been handed a script that, at first, does essentially the following:

$tmpldir="(directory with template files)"
$scriptdir="(some directory)"
opendir (DIR,$tmpldir)
while (defined($file=readdir DIR))
  open (FILE, "$tmpldir/$file")
  ($newfile,$ext) = split/\./, $file)
  $newfile = $newfile . "(new ext)"
  open (NEWFILE, "> $varhash{'scriptdir'}/$newfile")

The problem is that whenever the script calls $varhash, it generates
null output.

print "$scriptdir" gives me the expected output
print "$varhash{'scriptdir'}" gives me nothing

I can't go through the entire script and replace all the uses of varhash,
I have to make it work.

What should I look to do?

Thanks in advance.

-- 
Jeremy Billones
"It's a place used the world over where people can come together to bitch about
movies and share pornography together."  This is a much more sophisticated idea
of the Net than we find in high-tech cyberthrillers, where the Net is a place
that makes your computer beep a lot.     - Roger Ebert on "Jay & Silent Bob..."



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

Date: Tue, 25 Oct 2005 15:59:08 +0100
From: Brian Wakem <no@email.com>
Subject: Re: varhash question
Message-Id: <3s6vhsFmjmtoU1@individual.net>

Jeremy Billones wrote:

> I know very little about perl.  (Just wanted to get that out of the way :)
> 
> I've been handed a script that, at first, does essentially the following:
> 
> $tmpldir="(directory with template files)"
> $scriptdir="(some directory)"
> opendir (DIR,$tmpldir)
> while (defined($file=readdir DIR))
>   open (FILE, "$tmpldir/$file")
>   ($newfile,$ext) = split/\./, $file)
>   $newfile = $newfile . "(new ext)"
>   open (NEWFILE, "> $varhash{'scriptdir'}/$newfile")
> 
> The problem is that whenever the script calls $varhash, it generates
> null output.
> 
> print "$scriptdir" gives me the expected output
> print "$varhash{'scriptdir'}" gives me nothing


Well %varhash is never defined or populated, so putting it in a path to a
file is a bit pointless.  Why aren't you just opening
"$scriptdir/$newfile" ?

Why do you expect $varhash{'scriptdir'} to have a value?  Give it a value if
you want it to have one.




-- 
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png


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

Date: Tue, 25 Oct 2005 12:05:24 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: write to windows share folder from perl/Win32
Message-Id: <435e0365$0$12652$9b4e6d93@newsread4.arcor-online.net>

syncwa wrote:
> Can anyone help me to figure out how perl on windows can  write to a
> regular share folder from my active perl script?
> An example will be nice.

Just use the path like you do in the cmd shell or any common
windows app (only to avoid having to escape every backslash,
Perl lets you use a forward slash instead):
open( SHAREFILE, "> //server/share/file.txt" ) or die $!;

HTH
-Chris


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

Date: Tue, 25 Oct 2005 18:22:54 +0800
From: syncwa <syncwa@gmail.com>
Subject: Re: write to windows share folder from perl/Win32
Message-Id: <6p1sl1pqcoh0fqbphet4un7msueh62jvvk@4ax.com>

Thanks, but what if the share need authentication?
What if it's mounted with a drive letter?
I'm using it on a Windows 2003 server accessing a share on NetApp
filer.

On Tue, 25 Oct 2005 12:05:24 +0200, Christian Winter
<thepoet_nospam@arcor.de> wrote:

>syncwa wrote:
>> Can anyone help me to figure out how perl on windows can  write to a
>> regular share folder from my active perl script?
>> An example will be nice.
>
>Just use the path like you do in the cmd shell or any common
>windows app (only to avoid having to escape every backslash,
>Perl lets you use a forward slash instead):
>open( SHAREFILE, "> //server/share/file.txt" ) or die $!;
>
>HTH
>-Chris


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

Date: Tue, 25 Oct 2005 14:55:12 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: write to windows share folder from perl/Win32
Message-Id: <435e2b31$0$12651$9b4e6d93@newsread4.arcor-online.net>

syncwa wrote:
[Quote order fixed]
> On Tue, 25 Oct 2005 12:05:24 +0200, Christian Winter
> <thepoet_nospam@arcor.de> wrote:
>>syncwa wrote:
>>
>>>Can anyone help me to figure out how perl on windows can  write to a
>>>regular share folder from my active perl script?
>>>An example will be nice.
>>
>>Just use the path like you do in the cmd shell or any common
>>windows app (only to avoid having to escape every backslash,
>>Perl lets you use a forward slash instead):
>>open( SHAREFILE, "> //server/share/file.txt" ) or die $!;

> Thanks, but what if the share need authentication?

First of all, please don't top post. This makes the conversation
hardly readable for others. Just imagine you take all pages out
of a book, sort them in reverse order and put them back. Big fun
to read the front of the last (first) page, then turn over and
read the back side, then turn back two pages and read the front,
then turn over and read the back side, then turn back two.....

But back to the topic:
If you need to authenticate as a different user, you will most
probably have to run your script as the intended user. The means
for that of course depend on how the script gets invoked.

> What if it's mounted with a drive letter?

Then you can treat the path like any other local drive path.

-Chris


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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