Re: Getting garbage fast

2010-03-23 Thread Sam

Eric Veith1 wrote:

Hello list,

this is rather unusual: I want a chunk of random garbage, and I want it 
fast. The background is that I have a streaming test, and to run into some 
intelligent read-ahead/write-behind/caching algorithm, I need random 
stuff. /dev/null is fast, but obviously won't do it. /dev/urandom is too 
slow. In C, I once resorted in a similar case to using malloc() to get 
some portion of memory without initializing it and writing that, but Perl 
doesn't let me access malloc(), at least not via POSIX. I already tested 
something like "rand x 100", but that's too slow, too. :-/


Any ideas are greatly appreciated.

Thanks in advance,
Eric

--
Eric MSP Veith 
Hechtsheimer Str. 2
DE-55131 Mainz
Germany

IBM Deutschland GmbH
Vorsitzender des Aufsichtsrats: Erich Clementi
Geschäftsführung: Martin Jetter (Vorsitzender), Reinhard Reschke, 
Christoph Grandpierre, Matthias Hartmann, Michael Diemer, Martina 
Koederitz

Sitz der Gesellschaft: Stuttgart
Registergericht: Amtsgericht Stuttgart, HRB 14562
WEEE-Reg.-Nr. DE 99369940




Could you use a file of random data? You can create one of those really 
easy: dd if=/dev/urandom of=ranfile bs=



Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




'format' puzzle

2005-04-13 Thread Sam
How can I create a perl 'format' string that begins with a comment (#)?

Eg.

  format STDOUT_TOP =
#  Field1   Field2
@<< @||| @|||
.


If I try '\#' then I see the backslash.  I just want the pound char.

TIA,
-Sam






__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: 'format' puzzle

2005-04-14 Thread Sam
Thanks.  Was right there in the manual... -Sam

--- "Moon, John" <[EMAIL PROTECTED]> wrote:
> Subject: 'format' puzzle
> 
> How can I create a perl 'format' string that begins with a comment (#)?
> 
> Eg.
> 
>   format STDOUT_TOP =
> #  Field1   Field2
> @<< @||| @|||
> .
> 
> 
> If I try '\#' then I see the backslash.  I just want the pound char.
> 
> TIA,
> -Sam
> 
> 
> I'm not sure where you want the "#" ... but
> 
> DEV,SUN2>more foo2
> #! /usr/bin/perl
> format STDOUT_TOP =
> @   fld1   fld2
> "#"
> .
> format STDOUT =
> @<< @|||   @|||
> $a,$b,$c
> .
> $a = 1;
> $b = 2;
> $c = 3;
> write;
> DEV,SUN2>./foo2
> #   fld1   fld2
> 12  3
> DEV,SUN2>
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 
> 



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




umask

2007-10-27 Thread sam
Hello everyone! This is my first time posting anywhere about perl, so
be gentle. Let me start off with my script:

#!/usr/local/bin/perl
#Author: Sam Ganim 10/26/07

print "What Lesson are you on? ";
chop($lesson = );

print "How many exercises are there? ";
chop($exercises = );

#print "What is the date today?(MM/DD/YY) ";
#chop($date = );

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
$year += 1900;
$year = sprintf("%02d", $year % 100);

$date = ++$mon ."/" .$mday ."/" .$year;

umask 0022;

while ($exercises > 0)
{
open EXERCISE, ">exercise" .$lesson ."_" .$exercises .".pl";
print EXERCISE "#!/usr/local/bin/perl\n#Author: Sam Ganim " .$date
."\n#perltutor Lesson " ."$lesson " ."Exercise " 
.$exercises ."\n";
$exercises = --$exercises;
}


The problem I'm having is that the permissions on the files being
created are 644 and not 755. I know it has something to do with octals
but I'm not sure what else. Any help either solving the problem or
steering me in the right direction would be greatly appreciated.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: OO perl programming

2014-02-05 Thread Sam

On 02/05/2014 04:30 PM, kavita kulkarni wrote:

Can somebody suggest me good book to learn/practice object oriented Perl
programming.


Regards,
Kavita :-)



Beginning Perl by Curtis Poe is a really good read. Also there are many 
tutorials for perl moose online.



Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: OO perl programming

2014-02-06 Thread Sam

On 02/06/2014 12:00 PM, Frank Landry wrote:

any of the oreilly books


Frank N. Landry


The oreilly "Learning Perl" teaches one to use the ampersand when 
calling subroutines, which most perl'ers will disagree with. I did it 
for years with out even questioning it until it bit me because I had 
read that book.


Sam


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: References

2014-05-14 Thread Sam

On 05/14/2014 12:31 AM, Mike Dunaway wrote:

What's a good use of references? When is it ideal to use them? Why would
you want to use them?




I learned C before I learned perl. I think understanding it in C will 
also help: 
http://how-to.linuxcareer.com/c-development-on-linux-pointers-and-arrays-vi


You could just also google "C pointer tutorial"

For the most part, if you are passing multiple variables into a function 
and one is an array, you will more than likely want to pass the array as 
a reference. This is because an array passed into a function will get 
expanded into list context. So if you pass an integer and a 3 element 
array into a  function, within the function it will look like you passed 
4 variables.


Also another common use is with hashes too. Perhaps you want an array 
and each element is info from a customer account. You could make a hash 
with the keys being "customer_name", "account_id", "city", and then you 
can push a reference to that onto an array. Later on in your program, 
you can pop each element off the array and work on it (or just iterate 
through it)


If you are a beginner, I can recommend picking up the "Beginning Perl" 
book by Curtis Poe :)


--Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Planning to buy Hard Copy Book

2014-06-11 Thread Sam
Depends on your level. I enjoyed "Beginning Perl" by Curtis Poe. It 
covers alot of areas in perl, from the different object frameworks to a 
really nice section on testing.


If you really want to get serious, get a copy of the larger "Programming 
Perl" as well.


--Sam

On 06/11/2014 05:23 AM, Frank Vino wrote:

Hi Team,

   Could you please let me know which publisher and author name are good
in Perl Book, I am planning to buy a hard copy.

Thanks,
Vino



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Perl CGI-html quotation marks

2014-07-04 Thread Sam

On 07/04/2014 12:41 AM, Shaji Kalidasan wrote:

Here's one way to do it

print << "BUTTON";
http://www.example.com')">
BUTTON



or:

print qq{http://www.example.com')">};



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: How to Upgrade Perl to latest Stable Version.

2014-07-08 Thread Sam

On 07/08/2014 07:20 AM, Uday Vernekar wrote:

Hi All,

Currently I am using  perl 5, version 12, subversion 4 (v5.12.4)

Kindly suggest on how to upgrade to latest version of Perl

with regards
Uday V G

--
*
Don't ask them WHY they hurt you,
because all they'll tell you is lies and excuses.
  Just know they were wrong, and try to move on.
**



As root:
wget https://raw.github.com/tokuhirom/Perl-Build/master/perl-build
chmod +x perl-build
mkdir /opt/perl-5.20.0/
./perl-build 5.20.0 /opt/perl-5.20.0/
ln -s /opt/perl-5.20.0/bin/ /opt/perl/current/bin

Now in your .bashrc:
export PATH=/opt/perl/current/bin:${PATH}

Now install needed modules:
wget -O cpanm http://cpanmin.us
chmod +x cpanm
./cpanm 

Installing as a non-root user:
Basically the same except leave off the directory parameters for 
'/opt/perl-5.20.0/'. Everything will default into ~/perl5



--Sam


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Impossible to install Perl modules

2014-07-08 Thread Sam

On 07/08/2014 05:07 AM, Bob Sauvage wrote:

Hi there,

I'm not able to install any perl modules on one of my RedHat 6.5
servers. Hereunder the issue:

[root@xxx jmx4perl-1.10]#cpan Config::General
CPAN: Storable loaded ok (v2.20)
Going to read '/root/.cpan/Metadata'
Database was generated on Tue, 08 Jul 2014 07:29:02 GMT
Running install for module 'Config::General'
CPAN: YAML loaded ok (v0.90)
Running make for T/TL/TLINDEN/Config-General-2.56.tar.gz
CPAN: Digest::SHA loaded ok (v5.47)
CPAN: Compress::Zlib loaded ok (v2.021)
Checksum for
/root/.cpan/sources/authors/id/T/TL/TLINDEN/Config-General-2.56.tar.gz ok
CPAN: Archive::Tar loaded ok (v1.58)
Config-General-2.56/
[...]
CPAN: File::Temp loaded ok (v0.22)

CPAN.pm: Going to build T/TL/TLINDEN/Config-General-2.56.tar.gz

Checking if your kit is complete...
Looks good
*CPAN::Meta::YAML 0.011 is not available
at /usr/local/share/perl5/CPAN/Meta.pm line 613*
Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
TLINDEN/Config-General-2.56.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install

I encounter this error with all perl modules... Even if I try to build
"CPAN::Meta::YAML 0.011" from source:
[root@xxx CPAN-Meta-YAML-0.011]# perl Makefile.PL
Checking if your kit is complete...
Looks good
*CPAN::Meta::YAML 0.011 is not available
  at /usr/local/share/perl5/CPAN/Meta.pm line 613*

Could you help me please ?
Thanks,
Bob !
-- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional
commands, e-mail: beginners-h...@perl.org http://learn.perl.org/



Try cpanminus:
wget -O cpanm http://cpanmin.us
chmod +x cpanm
./cpanm 

Also note on redhat, they did weird stuff with system perl. The "perl" 
package on redhat will give you nothing more than /usr/bin/perl
For the default modules (perhaps YAML?) that are supposed to be 
distributed with perl, install perl-core



--Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Problem installing a module

2014-07-23 Thread Sam

On 07/23/2014 07:53 AM, Chris wrote:

On Thu, 2014-07-24 at 00:28 +1200, Kent Fredric wrote:


On 22 July 2014 06:05, Chris  wrote:
 I'm not a programmer so I apologize if I'm on the wrong list
 but I'm
 looking for some assistance in installing File::Scan::ClamAV.
 I've tried
 multiple ways, CPAN and from source, to install this and I
 constantly
 get the errors shown here http://pastebin.com/drEmcSc5 I need
 to get
 this installed so I can interface SpamAssassin with ClamAV.
 Any help or
 advice would be appreciated. This is being installed on a
 Ubuntu 14.04
 LTS box.


Here, your problem i that the modules fail testing, and that
subsequently don't install due to failing testing.


The reason for it is probable either:


a) Your system ClamAV is no longer compatible with the ClamAV module
b) The ClamAV module is no longer compatible with some dependency

c) The ClamAV module is no longer compatible with perl


Unfortunately, all of these mean the solution to your problem will be
specific to the module, not a general problem with Perl Module
installation.


1. The ClamAV module hasn't seen maintenance since 2009.

2. However, the good news is there are some passes on recent perls
( http://matrix.cpantesters.org/?dist=File-Scan-ClamAV+1.91 ),
indicating its more likely to be a ClamAV/Dependency issue.

3. There are however, 7 open bugs
https://rt.cpan.org/Public/Dist/Display.html?Name=File-Scan-ClamAV

4. This bug suggests indeed, that the ClamAV API has been changed, and
the module has not been updated to adjust
https://rt.cpan.org/Public/Bug/Display.html?id=54205

5.  which suggests you may want to try installing an older version
of ClamAV such as ClamAV-0.93  and see if that helps




--
Kent


KENTNL - https://metacpan.org/author/KENTNL


Thanks Kent, someone on the ClamAV mailing list sent me a list of
changes to be made in the 't' folder to the tests and to the 'mkconf.pl'
file there. After that it installed flawlessly.

Thank you for your reply
Chris



Can you post those changes or a link to the mailing list? It might be 
wise for someone to update the module



--Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: async, non blocking tcp server

2014-08-28 Thread Sam

On 08/28/2014 09:19 AM, Chris Knipe wrote:

Hi All,

I’ve looked at Net::Server (and have my “new” server with some 20K lines
of code written in it that we’re currently finalising), POE, and a few
other things, but I cannot find what I am looking for… I’m hoping for
some assistance / pointers please.  I am looking for the following
simple scenario…

On the server side, read data through the socket (for simplicity, let’s
say “commands” are terminated by \n)

On the client side, send numerous commands to the server, WITHOUT
waiting for a response – that’s simple enough.

Now, let’s say the server sleep($randomtime) between commands to
simulate a work load.  I effectively want the following

C> Do 1

C> Do 2

S> Done 1

C> Do 3

C> Do 4

S> Done 4

S> Done 2

S> Done 3

I know this sounds simple, but can anyone give a rough example of the
server code (even if it’s just an echo with a random sleep).  For the
love of… I cannot seem to stop the synchronous nature of POE, or
Net::Server.  The whole wait for input, deal with input, write output
thing is really blocking my application’s performance, seriously, at
this point in time.  I need to be truly asynchronous.

I need to also preferably need to use PreForks.  The application needs
to deal with some 500Mbps in terms of bandwidth on the sockets, and a
good amount of thousands of concurrent connections.  Again, I’m not sure
whether Net::Server will scale (we’re developing / debugging currently,
whilst in production we currently use xinetd).

Many thanks,

Chris.




Are you saying the normal 'unix' way won't work? (ie. listen on socket, 
fork on an accepted connection, do the work, close)



$server = IO::Socket::INET->new(LocalPort => 8801,
Type => SOCK_STREAM,
Reuse => 1,
Listen => 10)
or die "Server open failed: $!\n";


while(1){
#accept() will block until connection received
$client = $server->accept();
#create new process for client
my $pid = fork();

if($pid == 0){
processClient($client);
}
else{
close($client);
waitpid(-1,WNOHANG);
}


}



--Sam


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Books or links or knowledge base

2014-09-13 Thread Sam

On 09/13/2014 02:54 AM, Santosh Kumar wrote:

Any good pointers or links on learning perl . Also any good pointer on
OOPS concepts.



lots of links:
http://perlmaven.com/perl-sites

moose:
http://www.houseabsolute.com/presentations/intro-moose-class/
(mouse-over bottom right for next slide buttons)

--Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Any project like Ipython/Bpython in Perl.

2014-09-15 Thread Sam

On 09/14/2014 10:15 PM, Santosh Kumar wrote:

I have seen some quick help option in some of the interpreters in python
like Ipython and bpython. Do we have similar kind of projects or
interpreter tools which i can start using in perl.

Note: i am using ubuntu.

Thanks,

--
D. Santosh Kumar
RHCE | SCSA
+91-9703206361


Every task has a unpleasant side .. But you must focus on the end result
you are producing.




If you are just looking for a REPL, look at: 
https://metacpan.org/pod/Devel::REPL


Just install with cpan or cpan-minus


--Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Best way to install perl modules

2014-10-04 Thread Sam
You probably need to give us more info as both cpan and cpanm will auto 
resolve and install needed dependencies.


The dependency installs could be failing because a compiler or something 
similar is missing.


If you are on a redhat based system, trying running:
yum groupinstall "Development Tools"

If you are on a debian based system try running:
aptitude install build-essential


--Sam


On 10/04/2014 11:39 PM, Benjamin Fernandis wrote:

Hi Mike,

Thanks for your kind response. I tried cpanm instead of cpan, but many
times, it does not install require dependencies for module.

For example, when i was trying to install
cpanm XML::SAX  -> it failed and said no Fatal.pm module , then i
manually first installed that module and then i tried to install
XML::SAX and it works.

It happens many times while installing different modules. I mean cpanm
does not automatically fetch require dependencies for module. like yum
in centos to install packages.

Is there any tool or something like yum for perl module installations.
Or Is there , I am missing anything ?

Regards
Ben

On Sun, Oct 5, 2014 at 2:51 PM, Mike mailto:ekimduna...@gmail.com>> wrote:

Use cpanminus.

To install:

sudo curl -L http://cpanmin.us | perl - --sudo App::cpanminus

To use: sudo cpanm 

Here's the official documentation:
http://search.cpan.org/~miyagawa/App-cpanminus-1.7012/lib/App/cpanminus.pm


On 10/4/14, 8:32 PM, Benjamin Fernandis wrote:

Hi,

Many times I face problem with module installation and then have
to go to google and apply trial and error to resolve this
permanently, could u please suggest me best and correct method to
get resolved it?

i mean if i installed centos 7 freshly then what are
pre-requisites from OS side to get perl module installation
successfully. What steps require to follow?

Previously i tried cpanm and cpan console but some times faced
installation faild error.

Is there any specific guideline to resolve this problem? I am
using centos based distro.

Regards
Ben






--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Best way to install perl modules

2014-10-09 Thread Sam
Take note at least on rehl, you have to run 'yum install perl perl-core' 
to get a full working perl (If I remember right).


--Sam

On 10/09/2014 04:11 AM, Benjamin Fernandis wrote:

Hi Shlomi,

Thanks. I also feel that centos/rhel perl seems brokern in terms of
dependencies issues and some others.

Regards


On Thu, Oct 9, 2014 at 9:12 PM, Shlomi Fish mailto:shlo...@shlomifish.org>> wrote:

Hi Benjamin,

On Sun, 5 Oct 2014 17:39:46 +1300
Benjamin Fernandis mailto:benjo11...@gmail.com>> wrote:

> Hi Mike,
>
> Thanks for your kind response. I tried cpanm instead of cpan, but many
> times, it does not install require dependencies for module.
>
> For example, when i was trying to install
> cpanm XML::SAX  -> it failed and said no Fatal.pm module , then i manually
> first installed that module and then i tried to install XML::SAX and it
> works.
>
> It happens many times while installing different modules. I mean cpanm 
does
> not automatically fetch require dependencies for module. like yum in 
centos
> to install packages.
>
> Is there any tool or something like yum for perl module installations. Or
> Is there , I am missing anything ?
>

The equivalents of yum in the Perl-world are cpan/CPAN.pm and
cpanp/CPANPLUS.pm . Also see what I wrote about it here:

* http://perl-begin.org/topics/cpan/

* http://perl-begin.org/topics/cpan/wrappers-for-distributions/

Note that the CentOS/RHEL/Fedora perl is suffering from several
issues and the
general wisdom is that you should install your own perl under a
prefix using
perlbrew - http://perlbrew.pl/ .

Regards,

 Shlomi Fish


--
-
Shlomi Fish http://www.shlomifish.org/
Apple Inc. is Evil - http://www.shlomifish.org/open-source/anti/apple/

You can never truly appreciate The Gilmore Girls until you’ve
watched it in
the original Klingon.

Please reply to list if it's a mailing list post -
http://shlom.in/reply .





--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Yet another first website

2014-11-08 Thread Sam

On 11/08/2014 10:39 AM, Артём Варнайский wrote:

Hi folks!
I want to create a news website. Something like a public blog, where
everyone, who wants be able to add post to the news line. I want to add
new sections later (Job ads, articles on various subjects, photo
gallery, etc). I know perl basics, cgi, js, css, html  and even
developed small dynamical sites on 'vanilla' perl (about 5 pages), but
haven’t written anything complex yet.
I haven’t mastered perl modules and object-oriented programming. I know
everything separately, but when I try to get things together, my
creation turnes into garbage (from the standpoint of support).  There is
a little bit more then 3 months left.
I think to use dancer, but I’m not sure. Is it good choice for beginner?
Also, I have no idea how to design databases. For example, should I
store photos separately from the DB or in it? Prompt me with useful
books / articles, please. How to gather it all together and make it work
with the prospect of growth,  where to start?
In the end, just wish me good luck.
Hope you will understand my runglish. Thank you.



I can recommend the courses at https://geekuni.com/
They might be just what you are looking for.

Dancer would work fine, but for someone that is new, trying to figure 
out how to deploy (plack, cgi, fcgi) might seem confusing. Also there 
really is no design pattern behind Dancer, you are free to set up your 
routes and namespaces as you want. That can be really confusing since 
you are not forced to stay on any one design path and all your choices 
might just feel wrong at first.


There is a nice blog that is in Dancer that I sometimes use as a 
reference: https://github.com/Perl-Evozon/PearlBee


For database design, there is a small section about normalization in 
this book: http://tinyurl.com/pqun7sf that I found really easy to 
follow. Though it is for mysql and I only use postgresql now.


And as an extra secret, a year after you develop all this, you will 
probably want to throw it all away since you will always be continuing 
to learn and you'll start to see all your design mistakes later on. The 
point is, just start somewhere and keep working on it :)



--Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Good books to study perl interpreter

2015-03-31 Thread Sam

On 03/30/2015 11:42 AM, rakesh sharma wrote:

Hi all

Please suggest nice books to know perl interpreter. In depth books is that i am 
looking for.

Thanks
Rakesh




Perl guts can be nice:
http://cpansearch.perl.org/src/RURBAN/illguts-0.49/index.html
http://perldoc.perl.org/perlguts.html

--Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Need Advice on Perl learning

2015-04-12 Thread Sam

On 04/12/2015 07:05 AM, Manpreet Singh wrote:

Hello All,

I am and have been an avid Java programmer. I started learning Perl
about a month ago as I took up a new role in QA automation. I have gone
through the 'Learning Perl' Llama book by OReilly and did quite a few
scripts in office. I love Perl and love the fact how it is totally
different than Java.

The question now is, do I straightaway jump into the 'Intermediate Perl'
book or should I try my hand at a few other scripts before I do that? If
I do need to try more programs, could somebody recommend a website or a
portal where such problem statements might be provided?  Also, is there
any book or website dedicated to any Perl design methodologies?

Any other skill building advice for a beginner related to Perl is welcome.

Thank you.

*Regards*
Manpreet Singh



I enjoyed Beginning Perl by Ovid. It covers a lot of the more modern 
stuff going on in the perl ecosphere.  If you really want to know some 
of the lower level stuff, Programming Perl is a good ( although a little 
long!) read too. Mastering Perl by Brian has a new version out, with a 
few advanced sections, but I have not personally read it (yet).


--Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: perl certification

2015-05-20 Thread Sam

On 05/20/2015 12:45 PM, Chankey Pathak wrote:

Certificates are of no value in my opinion.



But a good github profile is :)

--Sam


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Regarding perl learning

2015-07-02 Thread Sam

On 07/01/2015 01:29 PM, bikram behera wrote:

Hi Team,

My name is Bikram Behera , am new in perl want to learn perl.

Thanks,
Bikram Behera


I'd recommend a good book: http://amzn.com/1118013840

--Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Perl executable problem...

2015-11-13 Thread Sam
I've never used active state, you might try strawberry perl if you are 
on windows.


--Sam

On 11/12/2015 07:53 AM, Rui Fernandes wrote:

/Hi,

I'm having a problem compiling a perl script to run in my windows 7 32
bits environment. It compiles with Perl Dev Kit from active state, but
when I run it (in the command line of dos) it just freezes - no anwer.
The compilation gives no error. Does anyone knows why this might be
happening?

Cheers.

/
/Rui Fernandes
/



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Strange HASH(0x2ced735) values

2017-02-21 Thread Sam

On 02/21/2017 04:12 PM, David Precious wrote:

On Tue, 21 Feb 2017 09:11:10 -0800
SSC_perl  wrote:


On Feb 21, 2017, at 8:34 AM, Uri Guttman 
wrote:

you can't trace it from the value. but you can write code where
that value is stuffed into the db and look for a reference vs 1 or
a blank. then you can dump the call stack (with caller()) or do
other debugging. something is putting a hash reference in there
that shouldn't be doing it.


Thanks Uri, but that’s the problem - so far I haven’t been
able to tell where it’s being generated.  That’s why I was hoping to
decode that value.  Looks like I’ll have to continue searching. :\


As Uri explained, there's nothing to "decode" - it's just a string
representation, where the value is the memory address that hash had at
the time.

Look at all the places you execute queries; (at least) one of them is
accidentally passing a hashref instead of a scalar value.



One can also turn on the DBI trace log as well. It will show the inserts 
with the data. Of course it won't tell you where it is running from 
code-wise. And it won't help if you can't get the bad values to appear 
on demand either...


--Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: use Time::Piece

2018-10-31 Thread Sam

On 10/30/2018 10:24 PM, Martin McCormick wrote:

I can not seem to send Time::Piece any syntax it likes.

The file I am reading sends a time stamp that should
conform to RFC822 date stamps.  An example of a stamp follows:

main::(lwx:204):my @obtime = split( /\,+/, $data->{observation_time_
rfc822} );
   DB<2> print $obtime[1]
  30 Oct 2018 20:53:00 -0500
   DB<2> n
main::(lwx:205):my $t1 = Time::Piece->strptime( '$obtime[1]', '%D %b
  %H:%M:%S %z' );
   DB<2> n
Error parsing time at /usr/lib/i386-linux-gnu/perl/5.24/Time/Piece.pm line 481.
  at /usr/lib/i386-linux-gnu/perl/5.24/Time/Piece.pm line 481.
 Time::Piece::strptime("Time::Piece", "\$obtime[1]", "%D %b %H:%M:%S 
%z")
  called at lwx line 205

The code that caused all that follows:

 my @obtime = split( /\,+/, $data->{observation_time_rfc822} );
 my $t1 = Time::Piece->strptime( '$obtime[1]', '%D %b %H:%M:%S %z' );

Another thing I tried was just
 my $t1 = Time::Piece->strptime( '$obtime[1]', '%z' );

The man page for strptime lists all the possible %flags
one can send and the last one is %z for RFC822

%z An RFC-822/ISO 8601 standard timezone specification.

I was not sure if that meant it would pull in all the fields
shown above.  If it had, I wouldn't be posting this message so I
tried the longer form

 my $t1 = Time::Piece->strptime( '$obtime[1]', '%D %b %H:%M:%S %z' );

There is that -500 offset from utc, soon to become a -600 this
Sunday.

The following code will demonstrate the only outcome I have been
able to get.  Those of you who followed earlier messages in the
thread about time stamps will recognise this code which now has a
few more lines and the data dumper is commented out but it
demonstrates what is happening.

If there is some way to see what Time::Piece thinks I am
trying to tell it to do then one might be able to figure out what
is wrong but a miss is the same as close so I can't tell if I am
getting warm.

Thanks for any ideas.

Martin McCormick



None of your arguments are right. For one, you are using the '%D' flag 
which is the same as saying '%m/%d/%y'


This works fine from a quick command line test:
perl -e 'use Time::Piece; $t = "30 Oct 2018 20:53:00 -0500"; print 
Time::Piece->strptime( $t, "%d %b %Y %H:%M:%S %z" );'


Wed Oct 31 01:53:00 2018

But notice since you specified '%z', that that offset was added to the 
returned time... That might be what you want, or it might not be. And 
also note Time::Piece->strptime returns an object that is set to UTC 
whereas localtime->strptime returns an object not in UTC. If you really 
want to get crazy with parsing times, DateTime is usually recommended: 
https://metacpan.org/pod/DateTime or just 
https://metacpan.org/pod/DateTime::Format::Strptime


--Samuel Smith

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: A Regular Expression Problem in Perl 5.28

2023-03-28 Thread Sam

On 3/28/23 16:07, Uri Guttman wrote:

On 3/28/23 17:01, Martin McCormick wrote:

Uri Guttman  writes:
why are you escaping the {}?? those are meta chars that are needed to 
make

that a 5+ range. just delete the backslashes on them and it will work.

First, thank you but read on, please.
I couldn't agree more.  That should do it but when I
don't escape them, I get:

Nested quantifiers in regex; marked by <-- HERE in m//^\d+{ <-- HERE 
3,}// at ./regex line 10.


you also quoted the whole regex in '' but included the // which are the 
normal regex delimiters. remove the outer quotes.


and use the qr// form for regexes.

and you don't want the + after the \d as the {5,} is the count. you 
can't have both types of repeat counts.


my $re = qr/^\d{5,}/ ;

that should be all you need.

read perlretut to learn more regex basics. you have escaping and quoting 
mistakes in the original.


uri



I would think /^\d{5,6}/ would be what is needed? He wanted 5 or 6 digits.

--Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: [Q] How to eval an EXPR once and make it stick

2004-01-28 Thread Sam

Thanks for all your responses; I learned a bit.

1.  I wasn't clear on $_ in my email; that's being read elsewhere in program so
it's already set by the time print_lines is called.

2.  Will you bet your life on this equivalence: "not /^\s*$/ == /\S/"?  I
believe it's safer to negate an EXPR than to find some other EXPR2 that is
equivalent to 'not EXPR'.

3.  Hadn't thought about xor; good to know.

4.  As for the generalized case, I learned about using refs.  Anonymous subs
also work.  

my $re  = sub { return /^\s*$/; };
my $nre = sub { return not &$re; };
my $expr = $blank ? $re : $nre;
do ... while (&$expr and not eof);

But I'm not sure which is faster though.

Thanks for all your help.

--- Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote:
> On Jan 27, Rob Dixon said:
> 
> >Sam wrote:
> >>
> >> sub print_lines_ok {
> >> my ($output, $blank_lines) = @_;
> >> if ($blank_lines) {
> >> do {
> >> print if $output;
> >> $_ = <>;
> >> } while (/^\s*$/ and not eof);
> >> } else {
> >> do {
> >> print if $output;
> >> $_ = <>;
> >> } while (not /^\s*$/ and not eof);
> >> }
> >> }
> >>
> >>
> >> sub print_lines_ideal {
> >> my ($output, $blank_lines) = @_;
> >> my $expr = $blank_lines ? '/^\s*$/' : 'not /^\s*$/';
> >>
> >> do {
> >> print if $output;
> >> $_ = <>;
> >> } while (eval $expr and not eof);  # works, but not fast.
> >># Can I move eval out of loop?
> >> }
> 
> You could just say
> 
>   do ... while (($blank ? /^\s*$/ : not /^\s*$/) and not eof);
> 
> which could be written with 'xor' as Rob shows below:
> 
>   do ... while ($blank xor not /^\s*$/) and not eof;
> 
> and 'not /^\s*$/' can be written as /\S/, which results in Rob's code.
> 
> >I don't think you want what you've written, as the first call to 'print'
> >is before anything has been read from the file. This should come close:
> >
> >  sub print_lines {
> >my ($output, $blank_lines) = @_;
> >while (<>) {
> >  last if $blank_lines xor /\S/;
> >  print if $output;
> >}
> >  }
> 
> That might work in this specific case, but if you want to be able to
> change the course of events like that without constant re-evaluation, I'd
> suggest using code references:
> 
>   my $code = \&first;
> 
>   sub first {
> # code for the first case
> if (some condition) { $code = \&second }
>   }
> 
>   sub second {
> # code for the second case
>   }
> 
>   $code->();
> 
> -- 
> Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
> RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
>  what does y/// stand for?   why, yansliterate of course.
> [  I'm looking for programming work.  If you like my work, let me know.  ]
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: [Q] How to eval an EXPR once and make it stick

2004-01-28 Thread Sam

--- Rob Dixon <[EMAIL PROTECTED]> wrote:
> Sam wrote:
> >
> > Thanks for all your responses; I learned a bit.
> 
> Good: well done.
> 
> > 1.  I wasn't clear on $_ in my email; that's being read elsewhere in
> program so
> > it's already set by the time print_lines is called.
> 
> You /mustn't/ use $_ like that. It's meant to be an 'it' in places like

What?  You want me to pass the line around in a variable! :-)

> 
>   For each banana, look at it, smell it, and eat it.
> 
> NOT
> 
>   When I say 'it', it means 'banana 3 from crate 5'.
>   For each apple, look at it, smell it, and eat it.
>   Do it to it.
> 
> > 2.  Will you bet your life on this equivalence: "not /^\s*$/ == /\S/"?  I
> > believe it's safer to negate an EXPR than to find some other EXPR2 that is
> > equivalent to 'not EXPR'.
> 
> Yes. (But I can think of more valuable things to bet on.)
> 
> The first says,
> 
>   Does the entire string, from start to end, consist of zero or more 'space'
> characters?
> 
> The second says,
> 
>   Does the string contain a non-'space' character anywhere?
> 
> The only difficulty could be with a zero-length string, which is still fine,
> if
> you think about it.

I hear 'ya, but I like to avoid possible boundary conditions that make me think
'what if.'  Just using 'not' avoids that mess.  In this case the re was simple
enough, but w/more complex ones...

> 
> > 3.  Hadn't thought about xor; good to know.
> 
> Be careful though. 'xor' goes with the other low-precedence operators 'and'
> and 'or', which have the high-precedence equivalents && and ||. 'xor' has
> no equivalent. (The caret, ^, is a bitwise operator, which is completely
> different.)
> 
> > 4.  As for the generalized case, I learned about using refs.  Anonymous
> subs
> > also work.
> >
> > my $re  = sub { return /^\s*$/; };
> > my $nre = sub { return not &$re; };
> 
> Eek. Don't do that. It may work, but it's not at all obvious what $_ is in
> the
> context of a subroutine call. Having $nre dereference $re at each call isn't
> your best bet either.
> 
> > my $expr = $blank ? $re : $nre;
> > do ... while (&$expr and not eof);
> 
> The better syntax for a call to a subroutine reference is
> 
>   $expr->()
> 
> which doesn't assume all sorts of things that could keep you awake at night
> if
> you knew.

Ok, that's good to know.  

> 
> > But I'm not sure which is faster though.
> 
> If you don't know, it doesn't matter.
> 
> If your software is /too/ slow and you would die for a 10% speed increase
> then
> check out
> 
>   use Benchmark;
> 
> If not, don't bother.

No it hums along fine.  But using eval was *really* slow and clearly I was on
the wrong track using it.

Thanks.

> 
> HTH,
> 
> Rob
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: [OT:style]deleting a line with a particular string.

2001-06-29 Thread Sam Lander

>> At a shell prompt / command line, enter:
>> 
>> perl -ne '/string/ or print' file
>> 
>> where string is the string and file is the file.
>
>I prefer 'print unless /string/'. 
>As if it matters. ;o] 

I wanted to do this just today. Although, I want to tidy up the resulting
line a bit by deleting everything before a colon, so I tried this:
   perl -ne "/string/ &&  print s/.*://" file
I was surprised that I got this:
   111 (one '1' for each match)
A bit of playing gave me:
   perl -ne "/Recipient/ &&  s/.*:// && print"
Which gave me what I wanted, but is rather unsatisfying (esp to the sedder
in me). 
What do other people do? Shouldn't DWIM come into play here?

Sam




problem when I sh Configure to setup perl 5.00503.

2001-07-11 Thread Sam Park

I'm having problem when I try to setup the perl5.00503.

When I run sh Configure, it hangs at the system manual is in /usr/man/man1
Here is error..

Congratulations, your kernel has secure setuid scripts!

No need to emulate SUID scripts since they are secure here.

System manual is in /usr/man/man1.

Thanks




How to read RegEx match in to a variable?

2009-06-12 Thread Sam Munzani

Team,

I am a totally newbee to perl scripting. I have learned enough to 
understand somebody's simple scripts and written some basic ones. Below 
is what I am trying to achieve.


I am writing a wrapper script to trigger when a syslog message arrives 
to syslog-ng. It fires up my parser.pl script by passing whole message 
as an argument. The message looks like this.


Jun  2 22:34:30 172.24.100.1 Jun 02 2009 22:34:33 home-pix : 
%PIX-6-302013: Built inbound TCP connection 3933236 for 
outside:172.23.1.1/50229 (172.23.1.1/50229) to 
inside:172.24.100.25/1 (172.24.100.25/1) (smunzani)


What I am trying to do is use RegEx to extract information from this. I 
want to capture IP address to a variable, hostname to another variable 
and anything after PIX-6-302013: as message variable. I was able to hack 
through creating the RegEx to match my requirements. However I don't 
know how to pass RegEx matches strings to value of another variable.


Any hints, examples?

Thanks,
Sam

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




DBD::SQLite and column_info

2008-09-03 Thread sam . paquin
How do you use column_info with DBD::SQLite?  Any set of parameters I
use result in getting back undef. All of the following commands return
undef but $DBI::err remains false:

$info = $dbh->column_info('%', '%', '%', '%');
$info = $dbh->column_info('%', '%', 'mytable', '%');
$info = $dbh->column_info('%', '%', 'mytable', undef);
$info = $dbh->column_info(undef, undef, undef, undef);

All I want is the information about "mytable".  What's the correct
syntax?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




can somebody tell me what this means

2004-03-11 Thread sam lehman
i got his code from a program i found, and i was wondering that the ? and 
the : are for?

$target = (@digits % 2) ? ($digits[int(@digits/2)]) : 
([EMAIL PROTECTED]/2-1]);

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: can somebody tell me what this means

2004-03-12 Thread sam lehman
On Thu, 11 Mar 2004 11:07:24 +0100, Ralf Schaa <[EMAIL PROTECTED]> 
wrote:

sam lehman wrote:

i got his code from a program i found, and i was wondering that the ? 
and the : are for?

$target = (@digits % 2) ? ($digits[int(@digits/2)]) : 
([EMAIL PROTECTED]/2-1]);

conditional statement (with lower priority than an 'if-construct' ?):

if (@digits % 2) {
   $target = ($digits[int(@digits/2)])
}else{
$target = ($digits[int(@digits/2)])
}
ahh, i see
thanks
so would:
something ? dosomething : somethingelse ? dosomethingelse : killyourself
be the same as
if (something){
dosomething
}
elsif (somethingelse){
dosomethingelse
}
else{
killyourself
}
???
--
http://www.backstab.net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Trouble Calling Modules...

2005-01-06 Thread Sam Pinizzotto
Hi,

I'm very new to the Perl Scene...I have an application that was developed
for Perl TK and we are now trying to convert it for use through the web.

I can pass the info from a web form to the script, but when the script runs,
it says it can't find the modules I am calling. How do I tell where it's
looking for the modules? Or how do I tell it to look in a specific place? I
tried declaring the @INC array with the directory locations, but it didn't
work either.

Any help or direction would be appreciated.

Here's the error:

"Can't locate Spreadsheet/ParseExcelSimple/Simple.pm in @INC (@INC contains:
.) at C:\Inetpub\VACWEB\cgi-bin\vac02b.pl line 7.
BEGIN failed--compilation aborted at C:\Inetpub\VACWEB\cgi-bin\vac02b.pl
line 7."

Here's the code snippet:

#!/usr/bin/perl -w
#!/perl/bin -w

###
# main
###
   use Spreadsheet::ParseExcelSimple::Simple;
   use strict;
   our $bad_news;
   our @acctparts;
   our $return_this;
   #our ($call_type,$acct_or_sheetname,$columns) = @_;

   read(STDIN, $data, $ENV{"CONTENT_LENGTH"});

   our $call_type;
   our $acct_or_sheetname;
   our $columns;
   our $submit;

($trash,$call_type,$trash,$acct_or_sheetname,$trash,$columns,$trash,$submit)
= split /=|&/,$data;


   if ($call_type eq "single")   {
  $return_this = &validate_one_code($acct_or_sheetname);
# &validate_one_code($acct_or_sheetname);
   }
   else  {
  $return_this = &validate_spreadsheet ($acct_or_sheetname,$columns);
# &validate_spreadsheet($acct_or_sheetname,$columns);
   }


Thanks,
Sam



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: calling a perl script on windows

2006-07-12 Thread Sam DeForest
> -Original Message-
> From: Mahdi A Sbeih [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 12, 2006 2:41 AM
> To: beginners@perl.org
> Subject: calling a perl script on windows
> 
> Hi all,
> 
> I am working on porting some scripts from unix to windows, and I noticed
> that perl ignores the first line of the script, and it seems I have to
> run the script like this:
> D:\Perl\bin\perl.exe myscript.pl
> 
> if I run it like we do on unix:
> ./myscript.pl
> 
> it will search the path and it uses the perl found in the path env
> variable.
> 
> 
> How can I make it to run exactly like Unix, meaning, just use the first
> line in the script?
> 
> Thanks,
> Mahdi.
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>


For windows make sure you have the path to the perl executable in the path
(environment variable)
For example, if you perl.exe executable resides in c:\perl\bin
Make sure you put c:\perl\bin in the PATH
Also, make sure you associate the .pl extension with the perl.exe
executable.  You can do this within Windows Explorer\Tools\Folder
Options\File Types

Doing that will enable you to run any perl script from the command line
without calling perl firstie. you can just type foo.pl and it will run.
And likewise if you clicked on the file within windows.it will
automatically run the perl interpreter to run the script.

Hope that helps.

Regards,
Sam


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




List OK?

2006-07-31 Thread Sam DeForest
I have not received any list topics lately, is the list broken??  Or am I ?

Trying to stay cool in New England,
Sam


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Help with rotating logs

2006-08-31 Thread binu sam
Hi,
   
  I am trying to write a script that can take log files in /var/log to a 
different directory (/opt/backup) every week.
  Each week it has to deposit the logs on a seperate directory with proper dates
   
  Can anyone has a script for this
   
  Thanks


-
Get your email and more, right on the  new Yahoo.com 

RE: Free Perl Editor

2007-01-02 Thread Sam DeForest

> -Original Message-
> From: Paul Brasseur [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 23, 2006 1:17 PM
> To: beginners@perl.org
> Subject: Free Perl Editor
> 
> 
> Hello:
> 
>  Try PSPad ! It is a Great Perl/PHP Editor. It has many nice
> Features such
> as Permanent and Descriptive Bookmarks, add a Comment to Line(s), Code
> Explorer Window. It easily can be set to run Apache and/or Xitami. It
> is written
> by a Computer Science Instructor in Eastern Europe.
> 
> 
> Regards,
> Paul Brasseur
> (Victoria, B.C.
> Canada )
> 
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>


Try perl-expressi found it has many useful features.
www.perl-express.com

hth
-sam


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Class::Struct comparison & MOP

2011-03-04 Thread Sam Steingold
1 How do I compare Class::Struct instances (objects)
  for equality (or precedence)?

E.g.,

use Class::Struct MyStruct =>
  [foo => '$',
   bar => '$',
   baz => '$'];

my MyStruct $a = MyStruct->new(foo => "a");
my MyStruct $b = MyStruct->new(bar => "b");
my MyStruct $a1 = MyStruct->new(foo => "a");

Both ($a eq $a1) and ($a eq $b) return false which is wrong for the
first expression.
I can write my own comparison, of course:

sub struct_eq ($$) {
  my ($x,$y) = @_;
  List::AllUtils::notall
(sub { $_ }, (List::AllUtils::pairwise
   (sub { $a eq $b }, @$x, @$y)));
}

but this does simple version does not work because some fields are
undefined and I have to check than and it quickly becomes a nightmare.
I could write a tedious function like

sub MyStruct_eq ($$) {
  my ($x,$y) = @_;
  (defined $x->foo and defined $y->foo and $x->foo eq $y->foo)
  or (not defined $x->foo and not defined $y->foo)
  .
}

but there must be a better way.

2. Is there a way to get a list of all fields in a struct?
Class::Fields seems to claim to be able to do it, but I cannot figure
out how to use it.
Class::Fields->show_fields('MyStruct') returns nothing.
MyStruct->show_fields is not defined.
I am lost.

I would also like to be able to access MyStruct instance fields by name.
I know I can do that using hash{} instead of array[] in the definition,
but I would like to preserve the underlying array structure for passing
to Text::CSV functions (I guess I could use "values" for that too).
E.g., I want to be able to write something like

my $mystruct_foo_pos = MyStruct->getpos('foo');

and have $mystruct_foo_pos set to 0.
then I will be able to write

my MyStruct $a = MyStruct->new(...);

$a[$mystruct_foo_pos] = "a";


Thanks!

-- 
Sam Steingold (http://sds.podval.org/) on CentOS release 5.3 (Final) X
http://iris.org.il http://pmw.org.il http://memri.org http://ffii.org
http://dhimmi.com http://palestinefacts.org http://jihadwatch.org
My other CAR is a CDR.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Class::Struct comparison & MOP

2011-03-04 Thread Sam Steingold
1 How do I compare Class::Struct instances (objects)
  for equality (or precedence)?

E.g.,

use Class::Struct MyStruct =>
  [foo => '$',
   bar => '$',
   baz => '$'];

my MyStruct $a = MyStruct->new(foo => "a");
my MyStruct $b = MyStruct->new(bar => "b");
my MyStruct $a1 = MyStruct->new(foo => "a");

Both ($a eq $a1) and ($a eq $b) return false which is wrong for the
first expression.
I can write my own comparison, of course:

sub struct_eq ($$) {
  my ($x,$y) = @_;
  List::AllUtils::notall
(sub { $_ }, (List::AllUtils::pairwise
   (sub { $a eq $b }, @$x, @$y)));
}

but this does simple version does not work because some fields are
undefined and I have to check than and it quickly becomes a nightmare.
I could write a tedious function like

sub MyStruct_eq ($$) {
  my ($x,$y) = @_;
  (defined $x->foo and defined $y->foo and $x->foo eq $y->foo)
  or (not defined $x->foo and not defined $y->foo)
  .
}

but there must be a better way.

2. Is there a way to get a list of all fields in a struct?
Class::Fields seems to claim to be able to do it, but I cannot figure
out how to use it.
Class::Fields->show_fields('MyStruct') returns nothing.
MyStruct->show_fields is not defined.
I am lost.

I would also like to be able to access MyStruct instance fields by name.
I know I can do that using hash{} instead of array[] in the definition,
but I would like to preserve the underlying array structure for passing
to Text::CSV functions (I guess I could use "values" for that too).
E.g., I want to be able to write something like

my $mystruct_foo_pos = MyStruct->getpos('foo');

and have $mystruct_foo_pos set to 0.
then I will be able to write

my MyStruct $a = MyStruct->new(...);

$a[$mystruct_foo_pos] = "a";


Thanks!

-- 
Sam Steingold (http://sds.podval.org/) on CentOS release 5.3 (Final) X
http://iris.org.il http://pmw.org.il http://memri.org http://ffii.org
http://dhimmi.com http://palestinefacts.org http://jihadwatch.org
My other CAR is a CDR.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Class::Struct comparison & MOP

2011-03-04 Thread Sam Steingold
1 How do I compare Class::Struct instances (objects)
  for equality (or precedence)?

E.g.,

use Class::Struct MyStruct =>
  [foo => '$',
   bar => '$',
   baz => '$'];

my MyStruct $a = MyStruct->new(foo => "a");
my MyStruct $b = MyStruct->new(bar => "b");
my MyStruct $a1 = MyStruct->new(foo => "a");

Both ($a eq $a1) and ($a eq $b) return false which is wrong for the
first expression.
I can write my own comparison, of course:

sub struct_eq ($$) {
  my ($x,$y) = @_;
  List::AllUtils::notall
(sub { $_ }, (List::AllUtils::pairwise
   (sub { $a eq $b }, @$x, @$y)));
}

but this does simple version does not work because some fields are
undefined and I have to check than and it quickly becomes a nightmare.
I could write a tedious function like

sub MyStruct_eq ($$) {
  my ($x,$y) = @_;
  (defined $x->foo and defined $y->foo and $x->foo eq $y->foo)
  or (not defined $x->foo and not defined $y->foo)
  .
}

but there must be a better way.

2. Is there a way to get a list of all fields in a struct?
Class::Fields seems to claim to be able to do it, but I cannot figure
out how to use it.
Class::Fields->show_fields('MyStruct') returns nothing.
MyStruct->show_fields is not defined.
I am lost.

I would also like to be able to access MyStruct instance fields by name.
I know I can do that using hash{} instead of array[] in the definition,
but I would like to preserve the underlying array structure for passing
to Text::CSV functions (I guess I could use "values" for that too).
E.g., I want to be able to write something like

my $mystruct_foo_pos = MyStruct->getpos('foo');

and have $mystruct_foo_pos set to 0.
then I will be able to write

my MyStruct $a = MyStruct->new(...);

$a[$mystruct_foo_pos] = "a";


Thanks!

--
Sam Steingold (http://sds.podval.org/) on CentOS release 5.3 (Final) X
http://iris.org.il http://pmw.org.il http://memri.org http://ffii.org
http://dhimmi.com http://palestinefacts.org http://jihadwatch.org
My other CAR is a CDR.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Class::Struct comparison & MOP

2011-03-07 Thread Sam Steingold
Hi Shlomi,
Thanks for your kind reply.

> * Shlomi Fish  [2011-03-04 20:37:51 +0200]:
> On Friday 04 Mar 2011 18:47:40 Sam Steingold wrote:
>> 1 How do I compare Class::Struct instances (objects)
>>   for equality (or precedence)?
>> 
>> E.g.,
>> 
>> use Class::Struct MyStruct =>
>>   [foo => '$',
>>bar => '$',
>>baz => '$'];
>> 
>> my MyStruct $a = MyStruct->new(foo => "a");
>> my MyStruct $b = MyStruct->new(bar => "b");
>> my MyStruct $a1 = MyStruct->new(foo => "a");
>> 
>
> First of all I should note that there are better accessor generators already 
> than Class::Struct. see:
>
> http://www.shlomifish.org/lecture/Perl/Newbies/lecture5/accessors/
>
> where I recommend either Class-Accessor (simple, sane and popular), Class-
> XSAccessor (very fast) or Moose (extremely powerful and versatile, but has a 
> small compile-time overhead). Class::Struct should also be OK.

I cannot figure out how to use Class::Accessor.
what are the specific lines of code equivalent to my code above?

>> Both ($a eq $a1) and ($a eq $b) return false which is wrong for the
>> first expression.
>> I can write my own comparison, of course:
>> 
>> sub struct_eq ($$) {
>>   my ($x,$y) = @_;
>>   List::AllUtils::notall
>> (sub { $_ }, (List::AllUtils::pairwise
>>(sub { $a eq $b }, @$x, @$y)));
>> }
>> 
>> but this does simple version does not work because some fields are
>> undefined and I have to check than and it quickly becomes a nightmare.
>> I could write a tedious function like
>> 
>> sub MyStruct_eq ($$) {
>>   my ($x,$y) = @_;
>>   (defined $x->foo and defined $y->foo and $x->foo eq $y->foo)
>>   or (not defined $x->foo and not defined $y->foo)
>>   .
>> }
>> 
>> but there must be a better way.
>> 
>> 2. Is there a way to get a list of all fields in a struct?
>> Class::Fields seems to claim to be able to do it, but I cannot figure
>> out how to use it.
>> Class::Fields->show_fields('MyStruct') returns nothing.
>> MyStruct->show_fields is not defined.
>> I am lost.
>> 
>> I would also like to be able to access MyStruct instance fields by name.
>> I know I can do that using hash{} instead of array[] in the definition,
>> but I would like to preserve the underlying array structure for passing
>> to Text::CSV functions (I guess I could use "values" for that too).
>> E.g., I want to be able to write something like
>> 
>> my $mystruct_foo_pos = MyStruct->getpos('foo');
>> 
>> and have $mystruct_foo_pos set to 0.
>> then I will be able to write
>> 
>> my MyStruct $a = MyStruct->new(...);
>> 
>> $a[$mystruct_foo_pos] = "a";
>> 
>
> You can do it with Moose or friends ( http://www.iinteractive.com/moose/ ) 
> using intropsection.

Moose is far too heavy-weight for my purposes.

> And you should not use arrays references for structs, but 
> hash references, where it is a bit easier.

As I said, I need to pass it to CSV writer, so it must be an array.

So, the gist of your answer is that my problems have no solution:

- I cannot compare for equality of order objects created with the
  Class::Struct->new constructor

- I cannot get the list of fields of the structure created by
  Class::Struct.

Right?

-- 
Sam Steingold (http://sds.podval.org/) on CentOS release 5.3 (Final) X
http://www.memritv.org http://iris.org.il http://thereligionofpeace.com
http://memri.org http://honestreporting.com http://truepeace.org
Lisp: it's here to save your butt.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




obtaining file properties

2007-07-14 Thread Sam DeForest
Hi folks,  noob here...

Im looking to produce a script that will return to me some file properties in 
windows.  I know for unix I can use 'stat'.  The only thing that comes close 
(as i can find right now) is use of the Win32::File module.  However that would 
just return the attributes.  Im looking to find "size" and "create date/time".  
Could someone point me in a good direction so I can read into further?
I appreciate the help,

Sam

 

for rss 2.0?

2013-01-22 Thread Sam Lee
Hey,

I am trying to add an   with :

item title>
http://example.com/1
   * sam*



Here is perl code:
=8<=
use strict;
use warnings;
use XML::RSS;
my $rss = XML::RSS->new(version => '*2.0*');
$rss->add_module(prefix => 'dc', uri => 'http://purl.org/dc/elements/1.1/');
$rss->channel(title => 'title', link => 'http://exmaple.com', description
=> 'description');
$rss->add_item(title => 'item title', link => 'http://example.com/1',
dc => {creator => 'sam'}
);
print $rss->as_string;
=8<=

It doesn't add  element.

item title
http://example.com/1



When I use the following:
=8<=
use strict;
use warnings;
use XML::RSS;
my $rss = XML::RSS->new(version => '2.0');
$rss->add_module(*prefix => 'ddc'*, uri => '
http://purl.org/dc/elements/1.1/');
$rss->channel(title => 'title', link => 'http://exmaple.com', description
=> 'description');
$rss->add_item(title => 'item title', link => 'http://example.com/1',
*ddc => *{creator => 'sam'}
);
print $rss->as_string;
=8<=


It does give me

item title
http://example.com/1
*sam*




How can I include   in RSS 2.0 document?

Thanks.
Sam


Urgent help in h2xs

2005-10-01 Thread sam joseph

hi

I am new to perl and have got a project of interfacing c/c++ code with perl 
and have downloaded active perl.


But i am stuck at the very basic step of execution.

To interface i have to perform foll step:

run h2xs

run perl makefile.pl

nmake

after this i get an error message saying
types.h not present in sys folder and many other header files missing

Can anyone tell me how can i fix this problem and get teh correct 
C:\Perl\lib\CORE\sys\

which contains all the required header files.


Any help will be appreciated.

Thanks,
Sam

_
Repay your personal loan on your own terms. 
http://www.hsbc.co.in/script/in/common/redirect.asp?redirectto=/in/personal/loans/perloan.htm 
With HSBC's MyTerms Credit



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Urgent help in h2xs

2005-10-02 Thread sam joseph

Hi All

I appreciate your help

I have MSVC++ version 6.0

Can you be more precise in telling how to use VC++ for h2xs as i dont have 
much prior working experience in VC++ except for some basic C++ coding.


Are there any steps required for executing h2xs on MSVC++ editor.

I have made a default dll project which has a default exported method.
After compiling that project

what should be the next steps for interfacing the the exported function from 
the

project using perl h2xs.

Please be as clear as possible
so that i am able to execute the steps.

Its really urgent as i have already some precious time in searching
information in this area.

Thanks,
Sam.


I


From: Xiaofang Zhou <[EMAIL PROTECTED]>
To: sam joseph <[EMAIL PROTECTED]>, beginners@perl.org 


Subject: Re: Urgent help in h2xs
Date: Sun, 2 Oct 2005 11:58:20 +0800

Hi, Sam,

Check what version of VC u're running:
active perl 5.001-> vc++5.0
active perl 5.6->vc++6.0
active perl 5.8->vc.net?

Thanks,
Xiaofang.


ÔÚ 2005-10-01 18:22:00 ÄúдµÀ£º
>hi
>
>I am new to perl and have got a project of interfacing c/c++ code with 
perl

>and have downloaded active perl.
>
>But i am stuck at the very basic step of execution.
>
>To interface i have to perform foll step:
>
>run h2xs
>
>run perl makefile.pl
>
>nmake
>
>after this i get an error message saying
>types.h not present in sys folder and many other header files missing
>
>Can anyone tell me how can i fix this problem and get teh correct
>C:\Perl\lib\CORE\sys\
>which contains all the required header files.
>
>
>Any help will be appreciated.
>
>Thanks,
>Sam
>
>_
>Repay your personal loan on your own terms.
>http://www.hsbc.co.in/script/in/common/redirect.asp?redirectto=/in/personal/loans/perloan.htm
>With HSBC's MyTerms Credit
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
><http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
>.

ÖÂ
Àñ£¡

Xiaofang Zhou
[EMAIL PROTECTED]



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




_
Amitabh fan? Here’s a chance to chat with the Big B himself. 
http://server1.msn.co.in/sp05/DJbk/index.asp Click here now!



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




FW: Re: Urgent help in h2xs

2005-10-02 Thread sam joseph
I have installed activeperl version 5.8.7 for win32 applications on windows 
2000.


I am using MSVC for compiling the programs and after running h2xs.bat when i 
run the makefile.pl command it gives me the following error message :
Could not open 'lib/03_10_05.pm': No such file or directory at 
C:/Perl/lib/ExtUt

ils/MM_Unix.pm line 3079.

and the line 3079 of MM_Unix.pm  looks like this :

open(FH,$parsefile) or die "Could not open '$parsefile': $!";

Anyone knowing why such kind of an error message is coming ???




From: "sam joseph" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED], beginners@perl.org, 
[EMAIL PROTECTED]

Subject: Re: Urgent help in h2xs
Date: Sun, 02 Oct 2005 20:28:07 +0530

Hi All

I appreciate your help

I have MSVC++ version 6.0

Can you be more precise in telling how to use VC++ for h2xs as i dont have 
much prior working experience in VC++ except for some basic C++ coding.


Are there any steps required for executing h2xs on MSVC++ editor.

I have made a default dll project which has a default exported method.
After compiling that project

what should be the next steps for interfacing the the exported function 
from the

project using perl h2xs.

Please be as clear as possible
so that i am able to execute the steps.

Its really urgent as i have already some precious time in searching
information in this area.

Thanks,
Sam.


I


From: Xiaofang Zhou <[EMAIL PROTECTED]>
To: sam joseph <[EMAIL PROTECTED]>, beginners@perl.org 


Subject: Re: Urgent help in h2xs
Date: Sun, 2 Oct 2005 11:58:20 +0800

Hi, Sam,

Check what version of VC u're running:
active perl 5.001-> vc++5.0
active perl 5.6->vc++6.0
active perl 5.8->vc.net?

Thanks,
Xiaofang.


ÔÚ 2005-10-01 18:22:00 ÄúдµÀ£º
>hi
>
>I am new to perl and have got a project of interfacing c/c++ code with 
perl

>and have downloaded active perl.
>
>But i am stuck at the very basic step of execution.
>
>To interface i have to perform foll step:
>
>run h2xs
>
>run perl makefile.pl
>
>nmake
>
>after this i get an error message saying
>types.h not present in sys folder and many other header files missing
>
>Can anyone tell me how can i fix this problem and get teh correct
>C:\Perl\lib\CORE\sys\
>which contains all the required header files.
>
>
>Any help will be appreciated.
>
>Thanks,
>Sam
>
>_
>Repay your personal loan on your own terms.
>http://www.hsbc.co.in/script/in/common/redirect.asp?redirectto=/in/personal/loans/perloan.htm
>With HSBC's MyTerms Credit
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
><http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
>.

ÖÂ
Àñ£¡

Xiaofang Zhou
[EMAIL PROTECTED]



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




_
Amitabh fan? Here’s a chance to chat with the Big B himself. 
http://server1.msn.co.in/sp05/DJbk/index.asp Click here now!



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




_
Stand a chance to Win Half Kg Gold & Lots more! 
http://adfarm.mediaplex.com/ad/ck/4686-26272-10936-631?ck=GoldRush Shop on 
eBay Now!



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




FW: Re: Urgent help in h2xs

2005-10-03 Thread sam joseph

Hi All

1) h2xs -n modulefolder sam.h

2) modifyimg the makefile.pl by adding

PROTOTYPES:ENABLE

int

fnSam(void)

and also modifying the include statement as
#include "sam.h"

3) modify the .xs file by adding the OBJECT mapping and have to also comment
the VERSION_FROM for being able to compile the makefile.pl otherwise it
gives an error saying
Could not open 'lib/trymodule.pm':
No such file or directory at
c:\perl\lib\ExtUtils\MM_Unix.pm line 3079



4) run perl makefile.pl
which creates the makefile

5) run nmake15
this creates the nmake.exe,nmake.err and readme.txt

6) run nmake
which says the makefile is up-to-date

What is to be done next
In the documents i find the "make install" step but there is no makefile
created by the name
install.

And also there is no blilb folder created which gets creted if a ifollow
these steps on cmd.




From: "Sisyphus" <[EMAIL PROTECTED]>
To: "sam joseph" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>,


Subject: Re: Urgent help in h2xs
Date: Mon, 3 Oct 2005 18:11:33 +1000


- Original Message -
From: "sam joseph" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; ;
<[EMAIL PROTECTED]>
Sent: Monday, October 03, 2005 12:58 AM
Subject: Re: Urgent help in h2xs


> Hi All
>
> I appreciate your help
>
> I have MSVC++ version 6.0

Ok - did you get it set up correctly so that you can use it to build perl
modules ? Can you build (eg) Math::FFT from the source tarball on cpan ?

>
> Can you be more precise in telling how to use VC++ for h2xs as i dont 
have

> much prior working experience in VC++ except for some basic C++ coding.
>

'h2xs' is simply a batch file you run when you want to create your own perl
XS module. It just creates the basics of the files that you're going to
need.

Start with 'perldoc perlxstut'. Work through the examples it contains.
There's no fast way to be able to write XS code. It takes time and effort.

Another way, with a learning curve that is not so steep, is to use
Inline::C - which autogenerates the actual XS code for you, and then
compiles and runs it automatically for you, too. It comes with a cookbook 
of

examples (perldoc Inline::C-Cookbook) that show, among other things, how to
access functions in Windows dll's. It also requires that you have your C
compiler set up correctly. I recommend that you take that approach. (Again,
there are some things to learn.)

>
> I have made a default dll project which has a default exported method.

Probably the quickest way you'll be able to access that exported function
from perl on Win32 is to use Win32::API (which doesn't need VC++, or any
other compiler, at all). It's a quick and dirty way of getting the job
done - and I would prefer to see you use Inline::C or XS. But lots of 
people

use Win32::API and get good milage from it. I think it still requires that
your dll functions use the __stdcall calling conventions, which just means
that you include -Gz command line switch when building the dll. I don't 
know

how you invoke the __stdcall calling convention if you build the dll using
the Visual Studio IDE (point & click) - but there would be a way.

Cheers,
Rob



_
Get your own space on the web. Logon to MSN Spaces. 
http://spaces.msn.com/?mkt=en-in Share files, photos, ideas etc



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




calling C DLL from Perl using h2xs

2005-10-13 Thread sam joseph

Hi All

Has anyone tried calling an exported function from C DLL in a Perl Program.

I have a C DLL's source file and its header file
and using h2xs

D:\DLLProjects\simpledll3>h2xs -n ext2 simpledll3.h
Writing ext2/ext2.pm
Writing ext2/ext2.xs
Writing ext2/Makefile.PL
Writing ext2/README
Writing ext2/test.pl
Writing ext2/Changes
Writing ext2/MANIFEST

D:\DLLProjects\simpledll3>cd ext2

D:\DLLProjects\simpledll3\ext2>perl makefile.pl
Checking if your kit is complete...
Looks good
Writing Makefile for ext2

D:\DLLProjects\simpledll3\ext2>nmake

Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

   C:\Perl\bin\perl.exe -Ic:\Perl\lib -Ic:\Perl\lib 
C:\Perl\lib\ExtUtils/xs
ubpp  -typemap C:\Perl\lib\ExtUtils\typemap ext2.xs > ext2.xsc && 
C:\Perl\bin\pe

rl.exe -Ic:\Perl\lib -Ic:\Perl\lib -MExtUtils::Command -e mv ext2.xsc ext2.c
   cl -c  -nologo -O1 -MD -Zi -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT 
-DHAV
E_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS 
-DPERL_MSVCRT_READFIX -
O1 -MD -Zi -DNDEBUG-DVERSION=\"0.01\"  -DXS_VERSION=\"0.01\"  
-IC:\Perl\lib\

CORE  ext2.c
ext2.c
   cl -c  -nologo -O1 -MD -Zi -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT 
-DHAV
E_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS 
-DPERL_MSVCRT_READFIX -
O1 -MD -Zi -DNDEBUG-DVERSION=\"0.01\"  -DXS_VERSION=\"0.01\"  
-IC:\Perl\lib\

CORE  simpledll3.cpp
simpledll3.cpp
"Running Mkbootstrap for ext2 ()"
   C:\Perl\bin\perl.exe -Ic:\Perl\lib -Ic:\Perl\lib -MExtUtils::Command 
-e

chmod 644 ext2.bs
   link -out:blib\arch\auto\ext2\ext2.dll -dll -nologo -nodefaultlib 
-debug
-opt:ref,icf  -libpath:"c:\Perl\lib\CORE"  -machine:x86 ext2.obj 
simpledll3.obj
  C:\Perl\lib\CORE\perl56.lib "C:\Program Files\Microsoft Visual 
Studio\VC98\Li
b\oldnames.lib" "C:\Program Files\Microsoft Visual 
Studio\VC98\Lib\kernel32.lib"
"C:\Program Files\Microsoft Visual Studio\VC98\Lib\user32.lib" "C:\Program 
File
s\Microsoft Visual Studio\VC98\Lib\gdi32.lib" "C:\Program Files\Microsoft 
Visual
Studio\VC98\Lib\winspool.lib"  "C:\Program Files\Microsoft Visual 
Studio\VC98\L
ib\comdlg32.lib" "C:\Program Files\Microsoft Visual 
Studio\VC98\Lib\advapi32.lib
" "C:\Program Files\Microsoft Visual Studio\VC98\Lib\shell32.lib" 
"C:\Program Fi
les\Microsoft Visual Studio\VC98\Lib\ole32.lib" "C:\Program Files\Microsoft 
Visu
al Studio\VC98\Lib\oleaut32.lib" "C:\Program Files\Microsoft Visual 
Studio\VC98\
Lib\netapi32.lib" "C:\Program Files\Microsoft Visual 
Studio\VC98\Lib\uuid.lib" "
C:\Program Files\Microsoft Visual Studio\VC98\Lib\wsock32.lib" "C:\Program 
Files
\Microsoft Visual Studio\VC98\Lib\mpr.lib" "C:\Program Files\Microsoft 
Visual St
udio\VC98\Lib\winmm.lib"  "C:\Program Files\Microsoft Visual 
Studio\VC98\Lib\ver
sion.lib" "C:\Program Files\Microsoft Visual Studio\VC98\Lib\odbc32.lib" 
"C:\Pro
gram Files\Microsoft Visual Studio\VC98\Lib\odbccp32.lib" "C:\Program 
Files\Micr

osoft Visual Studio\VC98\Lib\msvcrt.lib" -def:ext2.def
  Creating library blib\arch\auto\ext2\ext2.lib and object 
blib\arch\auto\ext2\

ext2.exp
ext2.obj : error LNK2001: unresolved external symbol _num
blib\arch\auto\ext2\ext2.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code '0x460'
Stop.


where num is the exported method which I have written in teh file 
SimpleDLL3.cpp


int _stdcall num(int x) {

return x+1;

}

I have written the XSUB in ext2.xs file as shown below:
int
num(x)
int x

Why does it give an error for _num or for that matter any exported function 
name.


Any help would be greatly appreciated.

Thanks,
Sam.

_
Spice up your IM conversations. New colourful, animated emoticons. Go 
chatting! http://server1.msn.co.in/SP05/emoticons/



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




using XS for calling exported methods from a DLL

2005-10-14 Thread sam joseph

Hi

Is there a way to call exported methods from a DLL without using win32::API.

Has anyone tried calling an exported function from C DLL in a Perl Program 
using XS.


I have a C DLL's source file and its header file
and using h2xs

D:\DLLProjects\simpledll3>h2xs -n ext2 simpledll3.h
Writing ext2/ext2.pm
Writing ext2/ext2.xs
Writing ext2/Makefile.PL
Writing ext2/README
Writing ext2/test.pl
Writing ext2/Changes
Writing ext2/MANIFEST

D:\DLLProjects\simpledll3>cd ext2

D:\DLLProjects\simpledll3\ext2>perl makefile.pl
Checking if your kit is complete...
Looks good
Writing Makefile for ext2

D:\DLLProjects\simpledll3\ext2>nmake

Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

  C:\Perl\bin\perl.exe -Ic:\Perl\lib -Ic:\Perl\lib 
C:\Perl\lib\ExtUtils/xs
ubpp  -typemap C:\Perl\lib\ExtUtils\typemap ext2.xs > ext2.xsc && 
C:\Perl\bin\pe

rl.exe -Ic:\Perl\lib -Ic:\Perl\lib -MExtUtils::Command -e mv ext2.xsc ext2.c
  cl -c  -nologo -O1 -MD -Zi -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT 
-DHAV
E_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS 
-DPERL_MSVCRT_READFIX -
O1 -MD -Zi -DNDEBUG-DVERSION=\"0.01\"  -DXS_VERSION=\"0.01\"  
-IC:\Perl\lib\

CORE  ext2.c
ext2.c
  cl -c  -nologo -O1 -MD -Zi -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT 
-DHAV
E_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS 
-DPERL_MSVCRT_READFIX -
O1 -MD -Zi -DNDEBUG-DVERSION=\"0.01\"  -DXS_VERSION=\"0.01\"  
-IC:\Perl\lib\

CORE  simpledll3.cpp
simpledll3.cpp
"Running Mkbootstrap for ext2 ()"
  C:\Perl\bin\perl.exe -Ic:\Perl\lib -Ic:\Perl\lib -MExtUtils::Command 
-e

chmod 644 ext2.bs
  link -out:blib\arch\auto\ext2\ext2.dll -dll -nologo -nodefaultlib 
-debug
-opt:ref,icf  -libpath:"c:\Perl\lib\CORE"  -machine:x86 ext2.obj 
simpledll3.obj
 C:\Perl\lib\CORE\perl56.lib "C:\Program Files\Microsoft Visual 
Studio\VC98\Li
b\oldnames.lib" "C:\Program Files\Microsoft Visual 
Studio\VC98\Lib\kernel32.lib"
"C:\Program Files\Microsoft Visual Studio\VC98\Lib\user32.lib" "C:\Program 
File
s\Microsoft Visual Studio\VC98\Lib\gdi32.lib" "C:\Program Files\Microsoft 
Visual
Studio\VC98\Lib\winspool.lib"  "C:\Program Files\Microsoft Visual 
Studio\VC98\L
ib\comdlg32.lib" "C:\Program Files\Microsoft Visual 
Studio\VC98\Lib\advapi32.lib
" "C:\Program Files\Microsoft Visual Studio\VC98\Lib\shell32.lib" 
"C:\Program Fi
les\Microsoft Visual Studio\VC98\Lib\ole32.lib" "C:\Program Files\Microsoft 
Visu
al Studio\VC98\Lib\oleaut32.lib" "C:\Program Files\Microsoft Visual 
Studio\VC98\
Lib\netapi32.lib" "C:\Program Files\Microsoft Visual 
Studio\VC98\Lib\uuid.lib" "
C:\Program Files\Microsoft Visual Studio\VC98\Lib\wsock32.lib" "C:\Program 
Files
\Microsoft Visual Studio\VC98\Lib\mpr.lib" "C:\Program Files\Microsoft 
Visual St
udio\VC98\Lib\winmm.lib"  "C:\Program Files\Microsoft Visual 
Studio\VC98\Lib\ver
sion.lib" "C:\Program Files\Microsoft Visual Studio\VC98\Lib\odbc32.lib" 
"C:\Pro
gram Files\Microsoft Visual Studio\VC98\Lib\odbccp32.lib" "C:\Program 
Files\Micr

osoft Visual Studio\VC98\Lib\msvcrt.lib" -def:ext2.def
 Creating library blib\arch\auto\ext2\ext2.lib and object 
blib\arch\auto\ext2\

ext2.exp
ext2.obj : error LNK2001: unresolved external symbol _num
blib\arch\auto\ext2\ext2.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code '0x460'
Stop.


where num is the exported method which I have written in teh file 
SimpleDLL3.cpp


int _stdcall num(int x) {

return x+1;

}

I have written the XSUB in ext2.xs file as shown below:
int
num(x)
int x

Why does it give an error for _num or for that matter any exported function 
name.


Any help would be greatly appreciated.

Thanks,
Sam.

_
A Camera Sells every 2 Minutes on eBay.Get Your's at a Great Price Now! 
http://adfarm.mediaplex.com/ad/ck/4686-26272-10936-699?ck=Cameras



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Timing out without alarm function

2004-02-03 Thread Sam Masiello

Hi all!

I am new to the list, and have a question which I hope isn't too
difficult to answer.

I have a script where I am sending some data over a socket, but after X
seconds I want the operation to time out.  I am currently using alarm to
enforce the timeout, but I don't want the script to die.  I want a way
to be able to gracefully move onto a different part of the script or
return some value.  

I am using a timeout value when creating the socket, but this timeout is
not enforced once the socket connection has been established and
back-and-forth communication is occurring.  I am trying to allot for a
hang in the middle of the connection.

Thank you in advance for any suggestions!

--Sam

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




RE: Timing out without alarm function

2004-02-03 Thread Sam Masiello

Thank you very much, Daniel!

--Sam



Daniel Staal wrote:
> --As off Tuesday, February 3, 2004 10:09 AM -0700, Sam Masiello is
> alleged to have said:
> 
>> I have a script where I am sending some data over a socket, but after
>> X seconds I want the operation to time out.  I am currently using
>> alarm to enforce the timeout, but I don't want the script to die.  I
>> want a way to be able to gracefully move onto a different part of the
>> script or return some value.
> 
> --As for the rest, it is mine.
> 
> What you need to do is catch the signal: perldoc perlipc
> 
> Daniel T. Staal
> 
> ---
> This email copyright the author.  Unless otherwise noted, you are
> expressly allowed to retransmit, quote, or otherwise use the contents
> for non-commercial purposes.  This copyright will expire 5 years
> after the author's death, or in 30 years, whichever is longer, unless
> such a period is in excess of local copyright law.
> ---


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




need help with a bug

2002-11-19 Thread Sam Harris
I hve the follwing lines which are ginving error on line 1, please help
, thanks

use Digest::MD5 qw(md5);
$md5 = new Digest::MD5;
open(PASSWD,"/etc/passwd") or die "Unable to open passwd:$!\n";
# these two lines called also be rolled into one:
#   print Digest::MD5->new->addfile(PASSWD)->hexdigest,"\n";
$md5->addfile(PASSWD);
print $md5->hexdigest."\n";

close(PASSWD);


Sam Harris, 
Internet Services
Franklin University
201 S. Grant Avenue
Columbus, Ohio  43215-5399
Work: (614)-744-8322
Toll free: 1-877-341-6300 ext. 8322
[EMAIL PROTECTED]
http://www.franklin.edu/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




< a very novice > file location

2002-12-05 Thread Sam Harris
I m very new to perl, please notice the errors I am including and tell
me how simple it is to correct them :)



 I have MD5.pm and Std.pm to be used in a directory above the one where
perl is, my script gives me an error that says 

# ./net_watch
../net_watch[2]: use:  not found
../net_watch[3]: use:  not found
../net_watch[4]: syntax error at line 4 : `(' unexpected

how do I solve the path requirement issue for perl for the error 1 -2,
then why is the third error is there from the following:

#/usr/perl5/5.00503/bin/perl
use Getopt::Std;
use Digest::MD5;
qw(md5);


again thank you for your help :)




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




error with external command

2002-12-12 Thread Sam Harris
I am having hard time figuring out why one of my lines is not working:

system"find . -ctime -1 -exec cp {}
/opt/WWW/web_stats/logs/daily/newfiles \";

the error is that :
Unquoted string "opt" may clash with future reserved word at
./process_web_log_files.pl line 25.

thanks for your help in advance.


Sam Harris, 
Internet Services
Franklin University
201 S. Grant Avenue
Columbus, Ohio  43215-5399
Work: (614)-744-8322
Toll free: 1-877-341-6300 ext. 8322
[EMAIL PROTECTED]
http://www.franklin.edu/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: error with external command..

2002-12-12 Thread Sam Harris
The way how it is in my code is on one line, the slash at the end has to
be there on unix command line for it to work !!???
so the line is :
 system"find . -ctime -1 -exec cp {}
/opt/WWW/web_stats/logs/daily/newfiles \";


Sam Harris, 
Internet Services
Franklin University
201 S. Grant Avenue
Columbus, Ohio  43215-5399
Work: (614)-744-8322
Toll free: 1-877-341-6300 ext. 8322
[EMAIL PROTECTED]
http://www.franklin.edu/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




web server 500 error

2003-02-04 Thread Sam Mauntz
To all you perl gurus out there...
I've got this file named schedule.pl...in the interest of
troubleshooting my problem, I've thinned
my script to the following code...

#!/usr/bin/perl


   print "\n";
   print "\n";
   print "Perl Test Page\n";
   print "\n";
   print "\n";
print "Perl Test Page\n";
print "\n";
print "\n";

Here's a printout of the perms on the file...

lsh110:~/www/cgi-bin$ ls -l schedule.pl
-rwxrwxr-x   1 portaven portaven  212 Feb  3 02:39 schedule.pl*

and I know the perl path is correct because the file runs correctly at
the command line if I type
perl schedule.pl

My problem is that when I try to run it from a browser I get a 500 web
error message.  Does anyone
have any ideas what might be causing this?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




very novice "date" question

2003-02-11 Thread Sam Harris
I am trying to extract last month's date from today's date as in "Jan" or "Feb"is 
there a switch to enable that ?

Thanks

Sam Harris, 
Internet Services
Franklin University
201 S. Grant Avenue
Columbus, Ohio  43215-5399
Work: (614)-744-8322
Toll free: 1-877-341-6300 ext. 8322
[EMAIL PROTECTED]
http://www.franklin.edu/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Changing unix user account using perl?

2002-09-06 Thread Sam Graves

Is it possible to `su - user` and send the password via perl?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Generic database access?

2003-09-29 Thread Sam Harris
search google for "Webmon".
also check out phpadmin.

good luck

Sam Harris, 
Systems Administrator
Franklin University
201 S. Grant Avenue
Columbus, Ohio  43215-5399
Work: (614)-744-8322
Toll free: 1-877-341-6300 ext. 8322
[EMAIL PROTECTED]
http://www.franklin.edu/
>>> [EMAIL PROTECTED] 09/29/03 09:56 AM >>>
Greetings!

Is there a Perl module --

"Don't be silly!", I hear you reply.  "There's a Perl module for
everything!"

OK, let me rephrase that.  I would like a program, probably but not
necessarily in Perl, that can run on a Perl-equipped Unix server that
will give me remote access through the Internet to a database system in
a way similar to how Microsoft Access provides a GUI for creating and
editing databases.  What would you recommend?

Thanks!

Rob

__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



thread problems

2001-11-02 Thread Petazzoni Maxime aka sam

hi there. i'm new on this mailing list. i've started programming perl a
very few weeks ago and i'm no confronted to threads. i've read the (very
good) article about thread on use Perl; web site, installed the
perl-5.005-thread package, and changed the line :
#!/usr/bin/perl -w
to
#!/usr/bin/perl-thread -w

but it doesn't not work very well. one time it runs the first thread but
not the second, one time it runs the second but not the first . making
me crazy.

here are my scripts : server.pl and client.pl
its purpose is to be a chat program, multi clients ...

hope you'll find what's wrong.
thx a lot
sam
-- 
..____.
| sam  <°)(°> mail : [EMAIL PROTECTED]|
| web: /\\//\ www.nova-mag.org - icq : 100551837 |
..__\_/\_/.
 client.pl
 server.pl

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


catching output in detached threads

2001-11-02 Thread Petazzoni Maxime aka sam

hello
i wanna know if it was possible to catching output in detached threads.
thx a lot
sam
-- 
...
| sam  <°)(°> mail : [EMAIL PROTECTED]|
| web: /\\//\ www.nova-mag.org - icq : 100551837 |
..__\_/\_/.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




finishing a thread

2001-11-02 Thread Petazzoni Maxime aka sam

hi
i wanna know how i could finish a thread that i've just detach.
is there a finish or kill like command ?
thx a lot
sam
-- 
..____.
| sam  <°)(°> mail : [EMAIL PROTECTED]|
| web: /\\//\ www.nova-mag.org - icq : 100551837 |
..__\_/\_/.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




thx for your help

2001-11-03 Thread Petazzoni Maxime aka sam

hi every one
i'm found the solution for my threads. i've replaced threads by the
select function, unsing vectors as described in the perlfunc manpage.
i obtain sthing like that (see attachement)

thx for your help
sam
-- 
..________.
| sam  <°)(°> mail : [EMAIL PROTECTED]|
| web: /\\//\ www.nova-mag.org - icq : 100551837 |
..__\_/\_/.
 client.pl

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]