[24087] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6281 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 19 18:05:42 2004

Date: Fri, 19 Mar 2004 15:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 19 Mar 2004     Volume: 10 Number: 6281

Today's topics:
        0XC0000005 ( Access Violation ) in LocalTime ? <emmanud@wanadoo.fr>
    Re: Accessing a SQL Server Database from a Perl Script  (v796)
    Re: Accessing a SQL Server Database from a Perl Script  <sommar@algonet.se>
        DBI selectall_hashref problem <jcanfield@tshmail.com>
    Re: DBI selectall_hashref problem <xx087@freenet.carleton.ca>
    Re: DBI selectall_hashref problem <jcanfield@tshmail.com>
    Re: DBI selectall_hashref problem <ittyspam@yahoo.com>
    Re: DBI selectall_hashref problem <jcanfield@tshmail.com>
    Re: DBI selectall_hashref problem <szinger@lanl.gov>
    Re: DBI selectall_hashref problem <jcanfield@tshmail.com>
    Re: dollar sign and spaces from a string ctcgag@hotmail.com
    Re: dollar sign and spaces from a string <mr@sandman.net>
    Re: dollar sign and spaces from a string <mr@sandman.net>
        installing CPAN module <nowhere@somewhere.com>
    Re: need help with if then statement <dannywork5@hotmail.com>
    Re: need help with if then statement <roel-perl@st2x.net>
    Re: need help with if then statement <roel-perl@st2x.net>
    Re: Problem installing Net::DNS (John Oliver)
    Re: problem with pack and output to binary files (Jay Tilton)
    Re: problem with pack and output to binary files <roel-perl@st2x.net>
    Re: problem with pack and output to binary files <remorse@partners.org>
    Re: Reading ASCII-Hex file, and saving it as a binary f (Ben Nguyen)
        Test (Grant)
    Re: Test (Malcolm Dew-Jones)
        Using a backslash as a delimiter with the SPLIT functio (Martin L.)
    Re: Using a backslash as a delimiter with the SPLIT fun <roel-perl@st2x.net>
    Re: Using a backslash as a delimiter with the SPLIT fun <noreply@gunnar.cc>
        working example File::Taill <Jimroos@uunet.be>
    Re: working example File::Taill <dskloet@cs.vu.nl>
    Re: working example File::Taill <remorse@partners.org>
    Re: working example File::Taill <remorse@partners.org>
    Re: working example File::Taill <ittyspam@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 19 Mar 2004 21:46:52 +0100
From: "wanadoo user" <emmanud@wanadoo.fr>
Subject: 0XC0000005 ( Access Violation ) in LocalTime ?
Message-Id: <c3fm7t$gqj$1@news-reader1.wanadoo.fr>

Hello,
I'm not a perl developer but I'm trying to assist one of my customer who
gets a drwatson when executing his program under a specific account. ( Note
: it an exe file, not a .pl. )

My assumption is a manipulation of a date (
kernel32!DosDateTimeToFileTime ), but the symbols do not look correct, do
you know where to find them? ( active perl 5.6).
Also it could be a memory allocation problem ( low memory condition ?) but
it works with another user and always crashes with this specific user ( at
least this is what my customer reports).

What can be the function at address 77E787F5  that returns the access vio
( C0000005 !<nosymbols>  ) ?

From these info, do you have an idea of the problem?
Thanks.

Here is the stacktrace :
*----> Parcours arrière de la pile <----*
FramePtr ReturnAd Param#1  Param#2  Param#3  Param#4  Function Name
0012FE1C 2801CFC7 0059A174 00000BF8 00000000 0059A170 !<nosymbols>
0012FE38 28076EC0 0059A174 0059A190 0059A1AC 0059A1C8 !perl_alloc_using
0012FEFC 00404117 0012FF28 00000000 00000000 00000000 !perl_alloc
0012FF2C 00401078 00000000 00000000 00000000 00000002 !<nosymbols>
0012FFC0 77E787F5 FFFFFFFF 006EF348 7FFDF000 C0000005 !<nosymbols>
0012FFF0 00000000 00405524 00000000 000000C8 00000100
kernel32!DosDateTimeToFileTime

here is the perl function that is called :
sub temps
{
 # quelques variables pour la date:
 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
 @semaine=qw(Lundi Mardi Mercredi Jeudi Vendredi Samedi Dimanche);
 @annee=qw(Janvier Fevrier Mars Avril Mai Juin Juillet Aout Septembre
Octobre Novembre Decembre);
 $ann=(localtime(time()))[5]+1900;
}




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

Date: 19 Mar 2004 14:00:35 -0800
From: vicky7909@rediffmail.com (v796)
Subject: Re: Accessing a SQL Server Database from a Perl Script on Linux
Message-Id: <49f90fb9.0403191400.427fce3@posting.google.com>

Thanks for your help. I still have a few queries. I need the
DRIVERNAME.

Consider.
use DBI; 
my $SQLSERVER =  "1SS.VV.XX.TTR"; #hostname
my $MYSQLUSER =  "username";      #username to connect to DB
my $MYSQLPASS =  "pwd";           # password 
# connection string,vads - database name
# 33064 is port number.
my $DBIDSN =     "dbi:DRIVERNAME:vads:$MYSQLSERVER:33064"; 

# die is in case of error.
my $dbh = DBI->connect( $DBIDSN,$MYSQLUSER,$MYSQLPASS) || die
("Database connection not made: $DBI::errstr");
  
  my $sql = "select * from employee;";                  #SQL
statement/query
  my $query = $dbh->prepare($sql); # prepared statement
  $query -> execute(); # Execute it!

# iterate thru query.
  while (my @val = $query->fetchrow_array()) {
    # do whatever here with data                    # @val is an array
of
                                         # the cols returned for this
row
  }

Also, when I execute @driver_names = DBI->available_drivers
and print out each element of the array @driver_names, I do get the
names of all the installed drivers. (None of them work however.) Now
as I understand these are the names of the drivers on the Linux box
and not the Windows machine which has the SQL server on it.

For a Perl program running on a Linux box to query a SQL Server
Database on a Windows machine must drivers be installed on --both--
machines?
And if so which are they? I can probably get Admin rights to the Linus
machine somehow but no way to install dirvers on the Windows machine.
In the connection string above the DRIVERNAME refers to the driver on
the windows machine.

Is there a way to know which drivers are installed on the SQL server
database machine.

Any help is appreciated. If you know any website where I can post
these questions please let me know.

If this can't be done do let me know. One colleague told me that he
thought this was impossible to do. This was the only
configuration(Linux to MS SQL Server) that was impossible to do. I
find it hard to believe.

Sincerely,
V796




Bob Walton <invalid-email@rochester.rr.com> wrote in message news:<405A715C.1010106@rochester.rr.com>...
> v796 wrote:
> 
> ...
> > My Perl script (running as a Cron on Linux) is parsing a text file and
> > now it must access a SQL Server database on a Windows machine. I need
> > the code for that. Can anybody help? Any book or website has that?
> ...
> 
> > v796.
>  
> 
> Actually, your hard drive has that.  You will want to:
> 
> 
>     use DBI;
> 
> 
> Check out:
> 
>     perldoc DBI
> 
> at your command prompt for documentation.  You will need to know details 
> about the particular database package you are using and how to connect 
> to it remotely.  You will need to get that from your database's 
> documentation.


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

Date: Fri, 19 Mar 2004 22:51:31 +0000 (UTC)
From: Erland Sommarskog <sommar@algonet.se>
Subject: Re: Accessing a SQL Server Database from a Perl Script on Linux
Message-Id: <Xns94B1F2714FBECYazorman@127.0.0.1>

[posted and mailed, please reply in news]

v796 (vicky7909@rediffmail.com) writes:
> Also, when I execute @driver_names = DBI->available_drivers
> and print out each element of the array @driver_names, I do get the
> names of all the installed drivers. (None of them work however.) Now
> as I understand these are the names of the drivers on the Linux box
> and not the Windows machine which has the SQL server on it.
> 
> For a Perl program running on a Linux box to query a SQL Server
> Database on a Windows machine must drivers be installed on --both--
> machines?

It depends. I have the impression that many ODBC solutions for Unix are
in fact ODBC-ODBC bridges. That is what looks like an ODBC driver to
you, actually talks with a clientapp in the Windows side which in its
turn talks with SQL Server through an ODBC driver on the Windows side.

> Is there a way to know which drivers are installed on the SQL server
> database machine.

That would be Data Sources in the Control Panel. But since the ODBC
driver for SQL Server comes with the MDAC that comes with the operating
system, it is always there. Anyway, you only have to bother about that
if you go for an ODBC-ODBC bridge.
 
Anyway, I have an article on my web site that discusess the various ways to 
connect from Unix to SQL Server that I know of. Look at
http://www.sommarskog.se/mssqlperl/unix.html. 

-- 
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp


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

Date: Fri, 19 Mar 2004 13:49:14 -0600
From: "Jim Canfield" <jcanfield@tshmail.com>
Subject: DBI selectall_hashref problem
Message-Id: <105mjlrcngjo932@corp.supernews.com>

What is wrong with this code?
my $address = "3ACA50000000";
my $max = $dbh->selectall_hashref("SELECT address,temp_high FROM settings",
"address");
print $max->{$address}[1]; #Print the max temp

This is almost identical to Perl cookbook 14.9 example, but it doesn't seem
to work. I know the sql is good because I can fetch a row a view it.  I'm
new to perl, so be nice!




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

Date: 19 Mar 2004 19:56:15 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: DBI selectall_hashref problem
Message-Id: <slrnc5mk2v.pbj.xx087@smeagol.ncf.ca>

Jim Canfield <jcanfield@tshmail.com> wrote:
>  What is wrong with this code?
>  my $address = "3ACA50000000";
>  my $max = $dbh->selectall_hashref("SELECT address,temp_high FROM settings",
>  "address");
>  print $max->{$address}[1]; #Print the max temp
>  
>  This is almost identical to Perl cookbook 14.9 example, but it doesn't seem
>  to work. I know the sql is good because I can fetch a row a view it.  I'm
>  new to perl, so be nice!

Exactly how does it not work?

Try this, to see what the database gave you:
    use Data::Dumper;
    print Dumper($max);


-- 
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca


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

Date: Fri, 19 Mar 2004 14:09:31 -0600
From: "Jim Canfield" <jcanfield@tshmail.com>
Subject: Re: DBI selectall_hashref problem
Message-Id: <105mks1r5tdj392@corp.supernews.com>


> >  What is wrong with this code?
> >  my $address = "3ACA50000000";
> >  my $max = $dbh->selectall_hashref("SELECT address,temp_high FROM
settings",
> >  "address");
> >  print $max->{$address}[1]; #Print the max temp
> >
> >  This is almost identical to Perl cookbook 14.9 example, but it doesn't
seem
> >  to work. I know the sql is good because I can fetch a row a view it.
I'm
> >  new to perl, so be nice!
>
> Exactly how does it not work?

I get "Not an ARRAY reference" error on the last line.

>
> Try this, to see what the database gave you:
>     use Data::Dumper;
>     print Dumper($max);

Here is the output of Data::Dumper ....really cool by BTW!

$VAR1 = {
'7F4B15000000' => {
'temp_high' => '60',
'address' => '7F4B15000000'
},
'3ACA50000000' => {
'temp_high' => '85',
'address' => '3ACA50000000'
}
};


>
>
> -- 
> Glenn Jackman
> NCF Sysadmin
> glennj@ncf.ca




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

Date: Fri, 19 Mar 2004 15:18:04 -0500
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: DBI selectall_hashref problem
Message-Id: <20040319151601.E21521@dishwasher.cs.rpi.edu>

On Fri, 19 Mar 2004, Jim Canfield wrote:

> > >  What is wrong with this code?
> > >  my $address = "3ACA50000000";
> > >  my $max = $dbh->selectall_hashref("SELECT address,temp_high FROM
> settings",
> > >  "address");
> > >  print $max->{$address}[1]; #Print the max temp
> > >
> > >  This is almost identical to Perl cookbook 14.9 example, but it doesn't
> seem
> > >  to work. I know the sql is good because I can fetch a row a view it.
> I'm
> > >  new to perl, so be nice!
> >
> > Exactly how does it not work?
>
> I get "Not an ARRAY reference" error on the last line.
>
> >
> > Try this, to see what the database gave you:
> >     use Data::Dumper;
> >     print Dumper($max);
>
> Here is the output of Data::Dumper ....really cool by BTW!
>
> $VAR1 = {
> '7F4B15000000' => {
> 'temp_high' => '60',
> 'address' => '7F4B15000000'
> },
> '3ACA50000000' => {
> 'temp_high' => '85',
> 'address' => '3ACA50000000'
> }
> };
>
Okay, and what have you learned from this output?  Do you see that the
$max variable is a hashref of hashrefs?  This is exactly as what you
should expect by calling the method "selectall_hashref".  And yet you're
trying to access a hashref of arrays.  Obviously, this will not work.

print $max->{$address}{'temp_high'}; #Print the max temp

Paul Lalli


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

Date: Fri, 19 Mar 2004 14:38:19 -0600
From: "Jim Canfield" <jcanfield@tshmail.com>
Subject: Re: DBI selectall_hashref problem
Message-Id: <105mmi3b2j43v0f@corp.supernews.com>


"Paul Lalli" <ittyspam@yahoo.com> wrote in message
news:20040319151601.E21521@dishwasher.cs.rpi.edu...
> On Fri, 19 Mar 2004, Jim Canfield wrote:
>
> > > >  What is wrong with this code?
> > > >  my $address = "3ACA50000000";
> > > >  my $max = $dbh->selectall_hashref("SELECT address,temp_high FROM
> > settings",
> > > >  "address");
> > > >  print $max->{$address}[1]; #Print the max temp
> > > >
> > > >  This is almost identical to Perl cookbook 14.9 example, but it
doesn't
> > seem
> > > >  to work. I know the sql is good because I can fetch a row a view
it.
> > I'm
> > > >  new to perl, so be nice!
> > >
> > > Exactly how does it not work?
> >
> > I get "Not an ARRAY reference" error on the last line.
> >
> > >
> > > Try this, to see what the database gave you:
> > >     use Data::Dumper;
> > >     print Dumper($max);
> >
> > Here is the output of Data::Dumper ....really cool by BTW!
> >
> > $VAR1 = {
> > '7F4B15000000' => {
> > 'temp_high' => '60',
> > 'address' => '7F4B15000000'
> > },
> > '3ACA50000000' => {
> > 'temp_high' => '85',
> > 'address' => '3ACA50000000'
> > }
> > };
> >
> Okay, and what have you learned from this output?  Do you see that the
> $max variable is a hashref of hashrefs?  This is exactly as what you
> should expect by calling the method "selectall_hashref".  And yet you're
> trying to access a hashref of arrays.  Obviously, this will not work.
>
> print $max->{$address}{'temp_high'}; #Print the max temp
>
> Paul Lalli

So, what should I use other than "selectall_hashref" to bring things up a
level? Also, just out of curiosity, does this mean the example in the "Perl
Cookbook" is wrong?




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

Date: Fri, 19 Mar 2004 13:56:15 -0700
From: James Szinger <szinger@lanl.gov>
Subject: Re: DBI selectall_hashref problem
Message-Id: <giptb8imj4.fsf@cytotoxic.lanl.gov>

"Jim Canfield" <jcanfield@tshmail.com> writes:

>> >  What is wrong with this code?
>> >  my $address = "3ACA50000000";
>> >  my $max = $dbh->selectall_hashref("SELECT address,temp_high FROM
> settings",
>> >  "address");
>> >  print $max->{$address}[1]; #Print the max temp
>> >
>> >  This is almost identical to Perl cookbook 14.9 example, but it doesn't
> seem
>> >  to work. I know the sql is good because I can fetch a row a view it.
> I'm
>> >  new to perl, so be nice!
>>
>> Exactly how does it not work?
>
> I get "Not an ARRAY reference" error on the last line.

That's because $max->{$address} is a hash ref, not an array ref.  Try
using $max->{$address}{temp_high} instead.

I know it's just an example, but I don't like the hash of hashes here
--- I'd want at least two non-key columns to justify the second hash.
Depending on what else your program does, the following may be
simpler.

    # scalar: retrieve temp_high for $address
    my $sql = 'SELECT temp_high FROM settings WHERE address=?';
    my $sth = $dbh->prepare($sql);
    $sth->execute( $address);
    my $temp_high = $sth->fetchrow_array();
    $sth->finish();

or

    # simple hash: key=address, value=temp_high
    my $sql = 'SELECT address, temp_high FROM settings';
    my $sth = $dbh->prepare($sql);
    $sth->execute();
    my %temp_high = map { $_->[0] => $_->[1] } @{ $sth->fetchall_arrayref()};



-- 
James J. Szinger		Los Alamos National Laboratory
szinger@lanl.gov		Theoretical Biology & Biophysics (T-10)
Disclaimer: The views expessed are my own and are not necessarrily
            shared by LANL, UC or DoE.


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

Date: Fri, 19 Mar 2004 15:33:45 -0600
From: "Jim Canfield" <jcanfield@tshmail.com>
Subject: Re: DBI selectall_hashref problem
Message-Id: <105mpq54vhv7853@corp.supernews.com>


"James Szinger" <szinger@lanl.gov> wrote in message
news:giptb8imj4.fsf@cytotoxic.lanl.gov...
> "Jim Canfield" <jcanfield@tshmail.com> writes:
>
> >> >  What is wrong with this code?
> >> >  my $address = "3ACA50000000";
> >> >  my $max = $dbh->selectall_hashref("SELECT address,temp_high FROM
> > settings",
> >> >  "address");
> >> >  print $max->{$address}[1]; #Print the max temp
> >> >
> >> >  This is almost identical to Perl cookbook 14.9 example, but it
doesn't
> > seem
> >> >  to work. I know the sql is good because I can fetch a row a view it.
> > I'm
> >> >  new to perl, so be nice!
> >>
> >> Exactly how does it not work?
> >
> > I get "Not an ARRAY reference" error on the last line.
>
> That's because $max->{$address} is a hash ref, not an array ref.  Try
> using $max->{$address}{temp_high} instead.
>
> I know it's just an example, but I don't like the hash of hashes here
> --- I'd want at least two non-key columns to justify the second hash.
> Depending on what else your program does, the following may be
> simpler.
>
>     # scalar: retrieve temp_high for $address
>     my $sql = 'SELECT temp_high FROM settings WHERE address=?';
>     my $sth = $dbh->prepare($sql);
>     $sth->execute( $address);
>     my $temp_high = $sth->fetchrow_array();
>     $sth->finish();
>
> or
>
>     # simple hash: key=address, value=temp_high
>     my $sql = 'SELECT address, temp_high FROM settings';
>     my $sth = $dbh->prepare($sql);
>     $sth->execute();
>     my %temp_high = map { $_->[0] => $_->[1] } @{
$sth->fetchall_arrayref()};
>
Thanks to everyone for the suggestions.  I learned a lot today and I'm happy
to say I've used a little bit of everyone's input to get things working.

Thanks Again!





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

Date: 19 Mar 2004 19:35:43 GMT
From: ctcgag@hotmail.com
Subject: Re: dollar sign and spaces from a string
Message-Id: <20040319143543.731$aW@newsreader.com>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> ctcgag@hotmail.com wrote:
> > Gunnar Hjalmarsson wrote:
> >> If somebody is working on a CGI script, such a small program will
> >> typically include the printing of a content-type header.
> >>
> >> Anything wrong with that?
> >
> > Yes.  It implies they couldn't be bothered to try debugging it on
> > the command line before coming here for help.  That's just
> > insulting.
>
> You make the printing of a content-type header a symbol for all kinds
> of questions that are posted without having been preceded by
> reasonable efforts by the poster to solve the problem. Doing so is not
> fair. It rather indicates a negative attitude to people who use Perl
> for CGI apps.

*I* use Perl for CGI apps, extensively.  But I practise what I preach.
I make non-CGI versions for debugging purposes long before I think of
posting here for help.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
And you all should be grateful that I do.


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

Date: Fri, 19 Mar 2004 22:21:30 +0100
From: Sandman <mr@sandman.net>
Subject: Re: dollar sign and spaces from a string
Message-Id: <mr-A7E6CB.22213019032004@news.fu-berlin.de>

In article <c3f8kk$4uo$2@mamenchi.zrz.TU-Berlin.DE>,
 anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:

> > Newbies just can't win -  ...
> 
> Right.  You're new, you make mistakes, you're criticized.  You leave
> or you learn.  Anything wrong with that?

Well, of course. Problem is that too many would rather make fun of and insult 
the newbies than directing them to the appropriate documentation - even though 
the latter is so much easier! I suppose the former is more fun, but a lot of 
newbies are scared off due to the elitist attitude.

-- 
Sandman[.net]


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

Date: Fri, 19 Mar 2004 22:26:30 +0100
From: Sandman <mr@sandman.net>
Subject: Re: dollar sign and spaces from a string
Message-Id: <mr-8C30F7.22263019032004@news.fu-berlin.de>

In article <20040319123741.569$Ge@newsreader.com>, ctcgag@hotmail.com wrote:

> > > Nothing wrong with that at all.
> > > But printing this line doesn't contribute anything to explain what the
> > > problem is or to find a solution for the problem. It is just noise and
> > > thus useless at best, and confusing and irritating at worst.
> >
> > Newbies just can't win - if they post a part of their code they will be
> > slammed for not submitting the entire script, and if they do they will be
> > slammed for submitting parts of the script not relevant to the problem
> > they are having. :)
> 
> There is something to be said for the fact that those unable to identify
> the problem will often also be unable to identify which part of the code
> contains the problem.

Absolutely!

> However, mostly this just indicates a lack of serious effort to solve the
> problem oneself before posting here.

Of course. Well, that could be said for ANY post here, though. I mean, it's not 
like there ar eproblems that can only be solved by posting here. If I post 
here, it means I haven't devoted enough resources in perl documentation to try 
to solve the problem myself.

And that's what this group is about, to share your knowledge with others. 
Perfectly natural.

Reading the guidelines will help you do that - but not knowing about them and 
nto having read them does not in any way warrant the usual kind of attitude 
that is generaqlly displayed here when that happens. It warrants the poster to 
be INGORED by those not wanting to help him or her, it does NOT warrant insults 
and mockery.

:)

-- 
Sandman[.net]


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

Date: Fri, 19 Mar 2004 21:14:49 GMT
From: foobardude <nowhere@somewhere.com>
Subject: installing CPAN module
Message-Id: <dpJ6c.71$o76.54@nwrdny02.gnilink.net>

Hi everybody, 

I'm trying to install the Math-Pari module from CPAN after having
followed the instructions at 

http://www.phys.ufl.edu/~prescott/perl_modules_normal_user.html

for configuring my cpan settings to install locally. I keep
getting the error messages below, the relevant part of which (I think)
I've reproduced between the dotted lines. (I'm doing this on a stock
Fedora Core 1 install + critical updates). 

Furthermore, attempts to clean out the Math-Pari installation to 
start from scratch seem to have failed: 

cpan> clean Math::Pari
Running clean for module Math::Pari
Running make clean
make: *** No rule to make target `clean'.  Stop.
  /usr/bin/make clean -- NOT OK
make clean did not succeed, marking directory as unusable for further work.


I'm totally lost at this point; how do I even fetch GP/PARI manually?
Is that another module? The part where it asks "Fetch?" does not wait
around for an answer either, so I don't know how to intervene, if that's
required...

Any help greatly appreciated, 

C. 

---------------------------------------------------------------------------
Did not find GP/PARI build directory around.
Do you want to me to fetch GP/PARI automatically?
  (If you do not, you will need to fetch it manually, and/or direct me to
   the directory with GP/PARI source via the command-line option
paridir=/dir)
Make sure you have a large scrollback buffer to see the messages.
Fetch? (y/n, press Enter) Can't open PREFIX=~/perl5lib/: No such file or
directory at utils/Math/PariBuild.pm line 148.
Can't open LIB=~/perl5lib/lib: No such file or directory at
utils/Math/PariBuild.pm line 148.
Can't open INSTALLMAN1DIR=~/perl5lib/man1: No such file or directory at
utils/Math/PariBuild.pm line 148.
Can't open INSTALLMAN3DIR=~/perl5lib/man3: No such file or directory at
utils/Math/PariBuild.pm line 148.
Well, as you wish...
Rerun Makefile.PL when you fetched GP/PARI manually.
Could not find GP/PARI build directory, please run Makefile.PL
with paridir=/directory option.
Running make test
  Make had some problems, maybe interrupted? Won't test
Running make install
  Make had some problems, maybe interrupted? Won't install
---------------------------------------------------------------------------


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

Date: Fri, 19 Mar 2004 19:11:05 GMT
From: "Danny" <dannywork5@hotmail.com>
Subject: Re: need help with if then statement
Message-Id: <dBH6c.31886$E8.7336054@news4.srv.hcvlny.cv.net>


"James Willmore" <jwillmore@remove.adelphia.net> wrote in message
news:pan.2004.03.19.18.10.49.354076@remove.adelphia.net...
> On Fri, 19 Mar 2004 17:31:32 +0000, Danny wrote:
>
> > Can this be done?
> > I am trying to generate dynamic pages using cgi.  How can I store the
html
> > code portions into a string
> > like around the single or double qoutes.  It doesnt seem to like it but
this
> > below
> >
> > $html1 = '<DIV ALIGN="center">
> >   <CENTER>
> >   <TABLE BORDER="0" cellpadding="0" CELLSPACING="0" WIDTH="750">
> > '
>  [ ... ]
>
> Try a heredoc :-)
>
> my $html1 =<<END;
> <DIV ALIGN="center">
>     <CENTER>
>        <TABLE BORDER="0" cellpadding="0" CELLSPACING="0" WIDTH="750">
> END
>
> HTH
>
> -- 
> Jim
>
> Copyright notice: all code written by the author in this post is
>  released under the GPL. http://www.gnu.org/licenses/gpl.txt
> for more information.
>
> a fortune quote ...
> The IQ of the group is the lowest IQ of a member of the group
> divided by the number of people in the group.
>

I tried out the above << END  END statment and that worked.
Is it ok if my PERL script is very long now due to the assignement to
variables of some very long htm portions?

Thanks a bunch





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

Date: 19 Mar 2004 19:15:35 GMT
From: Roel van der Steen <roel-perl@st2x.net>
Subject: Re: need help with if then statement
Message-Id: <slrnc5mhmg.2df.roel-perl@localhost.localdomain>

On Fri, 19 Mar 2004 at 18:54 GMT, Danny <dannywork5@hotmail.com> wrote:
> 
> "Danny" <dannywork5@hotmail.com> wrote in message
> news:U7G6c.31068$E8.7078476@news4.srv.hcvlny.cv.net...
>> Can this be done?
<snipped the ugly code again. Sigh.>
>
> But how can I do it?
> can I store a variable like this
> table 1 =  '
><table width="75%" border="1" cellpadding="1">
>  <tr>
>     <td>table 1</td>
>  </tr>
></table>
><p>&nbsp;</p>
> '
> 
> it doenst seem to work if I store this variable to this string.
> Thanks for any help.
> 

  perldoc perlintro

  http://learn.perl.org/

And then: the Camelbook, the other online documentation, 
maybe the Cookbook, etc. etc.


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

Date: 19 Mar 2004 19:20:40 GMT
From: Roel van der Steen <roel-perl@st2x.net>
Subject: Re: need help with if then statement
Message-Id: <slrnc5mi02.2df.roel-perl@localhost.localdomain>

On Fri, 19 Mar 2004 at 19:11 GMT, Danny <dannywork5@hotmail.com> wrote:
> 
> "James Willmore" <jwillmore@remove.adelphia.net> wrote in message
> news:pan.2004.03.19.18.10.49.354076@remove.adelphia.net...
>> On Fri, 19 Mar 2004 17:31:32 +0000, Danny wrote:
>
> Is it ok if my PERL script is very long now due to the assignement to
> variables of some very long htm portions?
> 

Does it run without errors? Then it should be OK.
(For you I mean. Please promise to never show me
the code.)


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

Date: 19 Mar 2004 22:28:32 GMT
From: joliver@john-oliver.net (John Oliver)
Subject: Re: Problem installing Net::DNS
Message-Id: <slrnc5mt04.ev3.joliver@ns.sdsitehosting.net>

On 19 Mar 2004 18:38:11 GMT, Roel van der Steen wrote:
> On Fri, 19 Mar 2004 at 18:11 GMT, John Oliver <joliver@john-oliver.net> wrote:
><lots of dumped screen data snipped>
>>
>> There is a resolv.conf file, and it does work.  This host is not behind
>> a firewall.  I've asked the admin at that location to double-check the
>> router for ACLs, but I really doubt that's the case.
>> 
> 
> Just installed Net::DNS on my system without problems. Maybe you can
> add the line
> 
>   $res->debug(1);
> 
> to t/10-recurse.t, just after the object creator, and run this
> particular test again from the build dir. (Your source tree is 
> probably in ~/.cpan/build/Net-DNS-0.46 .)

"just after the object creator"???  I know naught of that of which you
speak...

In t/10-recurse I see:

BEGIN { use_ok('Net::DNS::Resolver::Recurse'); }


my $res = Net::DNS::Resolver::Recurse->new;

# new() worked okay?
ok($res, 'new() works');
#$res->debug(1);

$res->udp_timeout(60);



I uncommented $res->debug(1); but still had the same problem.  Was there
somewhere else in that file that I should add that line?

-- 
* John Oliver                              http://www.john-oliver.net/ *
* California gun owners - protect your rights and join the CRPA today! *
* http://www.crpa.org/         Free 3 month trial membership available *
* San Diego shooters come to http://groups.yahoo.com/group/sdshooting/ *


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

Date: Fri, 19 Mar 2004 19:08:40 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: problem with pack and output to binary files
Message-Id: <405b42e4.661767688@news.erols.com>

Richard Morse <remorse@partners.org> wrote:

: In article <slrnc5mae6.284.roel-perl@localhost.localdomain>,
:  Roel van der Steen <roel-perl@st2x.net> wrote:
: 
: > On Fri, 19 Mar 2004 at 16:31 GMT, Mark Flynn <triflynn@earthlink.net> wrote:
: > 
: > > binmode FILE, ":raw" ;
: >                 ^^^^^^
: >                 (not needed)
: 
: Ummmm.... I disagree.  He does need the binmode, 
 ...

He meant that the underscored ":raw" is not needed.

But is the binmode really needed?

I've grown to appreciate the ability to specify the IO layer when using the
three-argument open, instead of choosing it in a separate binmode()
statement.

    open FILE, '>:raw', $file or die $!;



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

Date: 19 Mar 2004 19:23:52 GMT
From: Roel van der Steen <roel-perl@st2x.net>
Subject: Re: problem with pack and output to binary files
Message-Id: <slrnc5mi61.2df.roel-perl@localhost.localdomain>

On Fri, 19 Mar 2004 at 19:08 GMT, Jay Tilton <tiltonj@erols.com> wrote:
> Richard Morse <remorse@partners.org> wrote:
> 
>: In article Roel van der Steen <roel-perl@st2x.net> wrote:
>
> I've grown to appreciate the ability to specify the IO layer when using the
> three-argument open, instead of choosing it in a separate binmode()
> statement.
> 
>     open FILE, '>:raw', $file or die $!;
> 

Yes, that's equivalent to

  open FILE, ">$file" or die $!;
  binmode FILE;

but to me the three-argument form is also clearer. Agreed.


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

Date: Fri, 19 Mar 2004 15:15:49 -0500
From: Richard Morse <remorse@partners.org>
Subject: Re: problem with pack and output to binary files
Message-Id: <remorse-A2D3DC.15154919032004@plato.harvard.edu>

In article <405b42e4.661767688@news.erols.com>,
 tiltonj@erols.com (Jay Tilton) wrote:

> Richard Morse <remorse@partners.org> wrote:
> 
> : In article <slrnc5mae6.284.roel-perl@localhost.localdomain>,
> :  Roel van der Steen <roel-perl@st2x.net> wrote:
> : 
> : > On Fri, 19 Mar 2004 at 16:31 GMT, Mark Flynn <triflynn@earthlink.net> 
> : > wrote:
> : > 
> : > > binmode FILE, ":raw" ;
> : >                 ^^^^^^
> : >                 (not needed)
> : 
> : Ummmm.... I disagree.  He does need the binmode, 
> ...
> 
> He meant that the underscored ":raw" is not needed.

Ah.  OK, that is correct, it isn't needed.  However, does it hurt?  I 
usually put it in there anyway, as it makes it (to me) clearer.

> But is the binmode really needed?
> 
> I've grown to appreciate the ability to specify the IO layer when using the
> three-argument open, instead of choosing it in a separate binmode()
> statement.
> 
>     open FILE, '>:raw', $file or die $!;

I'm running Perl 5.6.1 (because up until recently, I couldn't get 
DBD::Oracle off of PPM).  I think this shortcut was introduced in 5.8.0, 
although I could be wrong.

Ricky


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

Date: 19 Mar 2004 11:43:21 -0800
From: benn686@hotmail.com (Ben Nguyen)
Subject: Re: Reading ASCII-Hex file, and saving it as a binary file
Message-Id: <e604be8.0403191143.1f2a1680@posting.google.com>

Doesnt 'split' just separate/deliminate or does it also
convert ascii?

Ben

> perldoc -f split
> 
> perldoc -f pack


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

Date: 19 Mar 2004 12:43:27 -0800
From: emailgrant123@yahoo.com (Grant)
Subject: Test
Message-Id: <1c9d8b45.0403191243.619c809@posting.google.com>

Last message didn't seem to work.


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

Date: 19 Mar 2004 12:52:56 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Test
Message-Id: <405b5da8@news.victoria.tc.ca>

Grant (emailgrant123@yahoo.com) wrote:
: Last message didn't seem to work.

Neither did this one!


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

Date: 19 Mar 2004 14:06:02 -0800
From: mjpliv@eastlink.ca (Martin L.)
Subject: Using a backslash as a delimiter with the SPLIT function
Message-Id: <36fd063b.0403191406.3a613757@posting.google.com>

I am trying to break down the uploaded file path and truncate just the
filename and MIME type portion. In a perfect world this snippet of
code would work but it seems I cannot use the backslash as a
delimiter. I did some searching around for a solution but come up
empty handed. I had a look through PERLFUNC and nothing stood out. I
am sure someone has run into this . Please keep it simple if you can -
just learning!

#read uploaded file info

$image=param("img1");

#split uploaded file path

@path = split (/\/ , $image);

#find the length of new array

$path_length=@path;

#extract the last string in the array - should be the filename and
MIME

$filename=@path[$path_length - 1];


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

Date: 19 Mar 2004 22:17:42 GMT
From: Roel van der Steen <roel-perl@st2x.net>
Subject: Re: Using a backslash as a delimiter with the SPLIT function
Message-Id: <slrnc5msbu.2is.roel-perl@195-86-124-242.dsl.easynet.nl>

On Fri, 19 Mar 2004 at 22:06 GMT, Martin L. <mjpliv@eastlink.ca> wrote:
> In a perfect world this snippet of
> code would work but it seems I cannot use the backslash as a
> delimiter.
> 
> @path = split (/\/ , $image);
> 
The line above doesn't compile: 'Search pattern not terminated'.
This should have make you think that the backslash is special,
which it turns out to be. Just double the backslash and you'll be
fine.


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

Date: Fri, 19 Mar 2004 23:27:06 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Using a backslash as a delimiter with the SPLIT function
Message-Id: <c3fsmt$28ej4i$1@ID-184292.news.uni-berlin.de>

Martin L. wrote:
> I am trying to break down the uploaded file path and truncate just
> the filename and MIME type portion. In a perfect world this snippet
> of code would work but it seems I cannot use the backslash as a 
> delimiter.

Correct. Backslashes are used to escape characters, so to tell Perl
that you actually mean a backslash, you need to enter \\.

> #read uploaded file info
> 
> $image=param("img1");
> 
> #split uploaded file path
> 
> @path = split (/\/ , $image);

Try

     @path = split /\\/ , $image;

> #find the length of new array
> 
> $path_length=@path;
> 
> #extract the last string in the array - should be the filename and 
> MIME
> 
> $filename=@path[$path_length - 1];

You should have Perl help you detect errors by including:

     use strict;
     use warnings;

at the beginning of the program. If warnings had been enabled, for
instance, Perl would have suggested a less ambigous expression:

     $filename = $path[$path_length - 1];
----------------^

Now, there are easier ways to do what you want. This is one way:

     my ($filename) = $image =~ /.*\\(.*)/;

If you want to write portable code, that works also on other platforms
but Windows, you'd better use a Perl module:

     use File::Basename;
     my $filename = basename $image;

HTH

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Fri, 19 Mar 2004 19:56:46 GMT
From: "Jim roos" <Jimroos@uunet.be>
Subject: working example File::Taill
Message-Id: <2gI6c.41274$HQ6.2880664@phobos.telenet-ops.be>

Hi there,

As a newbie to perl i have problems to get the following script to run
properly.
I get the message
Global symbol "$file" requires explicit package name at test.pl line 09
Global symbol "$line" requires explicit package name at test.pl line 10
Can someone help me out please...

Thank You.


#!/usr/bin/perl

use MIME::Parser;
use strict;
use File::Tail;



  $file=File::Tail->new("/home/noc/procmail");
  while (defined($line=$file->read)) {
      print "$line";
  }






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

Date: Fri, 19 Mar 2004 21:11:51 +0100
From: David de Kloet <dskloet@cs.vu.nl>
Subject: Re: working example File::Taill
Message-Id: <Pine.GSO.4.58.0403192105350.19242@keg.cs.vu.nl>

Jim roos:

> Hi there,
>
> As a newbie to perl i have problems to get the following script to run
> properly.
> I get the message
> Global symbol "$file" requires explicit package name at test.pl line 09
> Global symbol "$line" requires explicit package name at test.pl line 10
> Can someone help me out please...

I'm fairly new to perl but I believe you should add the line:
my($file, $line);
to declare your variables (since you use strict).

David

>
> Thank You.
>
>
> #!/usr/bin/perl
>
> use MIME::Parser;
> use strict;
> use File::Tail;
>
>
>
>   $file=File::Tail->new("/home/noc/procmail");
>   while (defined($line=$file->read)) {
>       print "$line";
>   }


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

Date: Fri, 19 Mar 2004 15:22:14 -0500
From: Richard Morse <remorse@partners.org>
Subject: Re: working example File::Taill
Message-Id: <remorse-961B07.15221419032004@plato.harvard.edu>

In article <2gI6c.41274$HQ6.2880664@phobos.telenet-ops.be>,
 "Jim roos" <Jimroos@uunet.be> wrote:

> Hi there,
> 
> As a newbie to perl i have problems to get the following script to run
> properly.
> I get the message
> Global symbol "$file" requires explicit package name at test.pl line 09
> Global symbol "$line" requires explicit package name at test.pl line 10
> Can someone help me out please...
> 
> 
> #!/usr/bin/perl
> 
> use MIME::Parser;
> use strict;
> use File::Tail;
> 
> 
> 
>   $file=File::Tail->new("/home/noc/procmail");
>   while (defined($line=$file->read)) {
>       print "$line";
>   }

Thank you for using strict!

Try this:

#!/usr/bin/perl
use warnings;
use strict;
use MIME::Parser;
use File::Tail;

my $file = File::Tail->new("/home/noc/procmail");
while(my $line = $file->read) {
   print "$line";
}


The error messages are because you need to explicitly tell Perl what the 
scoping of your variables is: I've shown you how to create a lexically 
scoped variable, using the 'my' in front of the variable declaration.  
You could also use 'local', or 'our', although they have different 
meanings, which you should look up in your reference.

Also, the 'defined()' test is superfluous (I think?) -- the '=' operator 
returns the value assigned, and undef is false...

HTH,
Ricky


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

Date: Fri, 19 Mar 2004 15:23:26 -0500
From: Richard Morse <remorse@partners.org>
Subject: Re: working example File::Taill
Message-Id: <remorse-D994B9.15232619032004@plato.harvard.edu>

In article <Pine.GSO.4.58.0403192105350.19242@keg.cs.vu.nl>,
 David de Kloet <dskloet@cs.vu.nl> wrote:

> Jim roos:
> 
> > Hi there,
> >
> > As a newbie to perl i have problems to get the following script to run
> > properly.
> > I get the message
> > Global symbol "$file" requires explicit package name at test.pl line 09
> > Global symbol "$line" requires explicit package name at test.pl line 10
> > Can someone help me out please...
> 
> I'm fairly new to perl but I believe you should add the line:
> my($file, $line);
> to declare your variables (since you use strict).

It's better not to pre-declare your variables -- declare them just where 
you'd need them...

Ricky


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

Date: Fri, 19 Mar 2004 15:30:36 -0500
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: working example File::Taill
Message-Id: <20040319152900.T21521@dishwasher.cs.rpi.edu>

On Fri, 19 Mar 2004, Richard Morse wrote:

> Thank you for using strict!
>
> Try this:
>
> #!/usr/bin/perl
> use warnings;
> use strict;
> use MIME::Parser;
> use File::Tail;
>
> my $file = File::Tail->new("/home/noc/procmail");
> while(my $line = $file->read) {
>    print "$line";
> }
>
>
> The error messages are because you need to explicitly tell Perl what the
> scoping of your variables is: I've shown you how to create a lexically
> scoped variable, using the 'my' in front of the variable declaration.
> You could also use 'local', or 'our', although they have different
> meanings, which you should look up in your reference.
>
> Also, the 'defined()' test is superfluous (I think?) -- the '=' operator
> returns the value assigned, and undef is false...
>

The only time the defined() would return a different response than the
simple boolean test is if the last line of the file contained just the
string "0" (without a newline).  In this case, the boolean test would
return false, but a defined() test would return true.

If you're confident this situation will never arrise, there shouldn't be a
problem not using defined()

Paul Lalli


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

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


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