Porting VB.Net to Perl

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • crokett
    The Full Monte
    • Jan 2003
    • 10627
    • Mebane, NC, USA.
    • Ryobi BT3000

    #1

    Porting VB.Net to Perl

    I've been writing some code to process the text files that I work with at work. Right now it is in VB. Before I add more function I want to port it to Perl so that it can run on a web server. Anybody have any ideas other than rewriting? I went looking for some converters but came up empty. I am not using anything that is .NET specific except the Dictionary Class but I believe that the Perl hash is an equivalent to that.
    David

    The chief cause of failure in this life is giving up what you want most for what you want at the moment.
  • windfall
    Forum Newbie
    • Mar 2007
    • 6

    #2
    Can you be a little more specfic? Are you trying to reproduce the functionality of a dotnet application with a Perl script? or do you just want to do some manipulation of some text files with a Perl program. Is this to be a web application -- like through a cgi interface or are you looking for a standalone tcl approach?

    http://www.perlmonks.org/ is a real good place to check out....

    Comment

    • Alex Franke
      Veteran Member
      • Feb 2007
      • 2641
      • Chapel Hill, NC
      • Ryobi BT3100

      #3
      Most things .Net will run just fine on a web server so long as the framework is installed (for a windows server) or Mono is installed for Linux servers. We run lots of .Net apps on web servers -- both Linux and Windows.

      So I would suggest don't even worry about porting it... I'll save you from having to learn a new language, and retest, etc.

      (btw, the .Net Framework or Mono are, in this case, roughly equivalent to the PERL interpreter.)
      Last edited by Alex Franke; 11-03-2008, 12:24 PM.
      online at http://www.theFrankes.com
      while ( !( succeed = try() ) ) ;
      "Life is short, Art long, Occasion sudden and dangerous, Experience deceitful, and Judgment difficult." -Hippocrates

      Comment

      • crokett
        The Full Monte
        • Jan 2003
        • 10627
        • Mebane, NC, USA.
        • Ryobi BT3000

        #4
        Thanks Alex. I will look into adding .NET on the web server in our lab. The current code is written as a standalone app so I may have to do some more work to get it running on our web server.

        To answer Windfall's question: Yes. I have existing code in VB that manipulates text files. I do some sticky bits with finding data within the files and don't want to recode all that if I don't have to.
        David

        The chief cause of failure in this life is giving up what you want most for what you want at the moment.

        Comment

        • Alex Franke
          Veteran Member
          • Feb 2007
          • 2641
          • Chapel Hill, NC
          • Ryobi BT3100

          #5
          If your users happen to be using Internet Explorer, the other thing you should be able to do is embed the whole thing into a web page. That would save you from having to rewrite anything at all.

          I haven't actually tried this myself, but if the hype is correct, it should be pretty easy. (Though if you're manipulating files, you'd surely have to give the application an appropriate trust level to get out of the internet zone sandbox.)
          online at http://www.theFrankes.com
          while ( !( succeed = try() ) ) ;
          "Life is short, Art long, Occasion sudden and dangerous, Experience deceitful, and Judgment difficult." -Hippocrates

          Comment

          • crokett
            The Full Monte
            • Jan 2003
            • 10627
            • Mebane, NC, USA.
            • Ryobi BT3000

            #6
            Hey Alex,

            I chatted with my Dad about this (he was out of town till last night), else I would have asked him. He is an actual software developer or was till he semi-retired. His advice is PHP for server side and javascript for client side instead of Perl. His reasoning is I can use something like Dreamweaver (which I already have) for the forms/pages and a good chunk of the PHP. He also pointed out that PHP has better object support and arrays can be accessed by either index or key. The other bonus is we have a coop at work now who actually knows PHP.
            David

            The chief cause of failure in this life is giving up what you want most for what you want at the moment.

            Comment

            • Alex Franke
              Veteran Member
              • Feb 2007
              • 2641
              • Chapel Hill, NC
              • Ryobi BT3100

              #7
              Yeah, PHP is good and quite popular -- I use it for my sites even. Of course it will require that you learn the language and port the code -- if you have the time I'd definitely consider this if only for personal development.

              If you really want an "other than re-writing" option, though, then the .Net "version" of PHP is called ASP.Net. There's a free version of Visual Studio (development environment) for writing ASP.Net applications.

              Keep in mind that many developers have a bias against .Net (or any Micro$oft technology) for a variety of reasons -- but mostly because they just don't know it or have learned the bias from others. There's really no technical reason that it can't perform as well as or better than the other technologies like PERL, Python, PHP, etc. In fact you can even get toolkits that allow you to write .Net applications using PHP, PERL, Python, etc.

              Of course I don't know how complicated your application is or how much time you can devote to porting it, but if it were me (and I develop professionally in both of these technologies), I'd take a good hard look at holding on to the investment that you've made in your current code base. That's my US$0.02 anyway.

              (BTW, I know all this talk of Microsoft versus non-Microsoft borders on a combination of both religion and politics, so you have my apologies up from for testing the bounds of the forum rules! )
              online at http://www.theFrankes.com
              while ( !( succeed = try() ) ) ;
              "Life is short, Art long, Occasion sudden and dangerous, Experience deceitful, and Judgment difficult." -Hippocrates

              Comment

              • crokett
                The Full Monte
                • Jan 2003
                • 10627
                • Mebane, NC, USA.
                • Ryobi BT3000

                #8
                I have the time and I think I will port it to PHP. In the long run I think it will be easier to maintain and will also be much more portable. I am looking long term at possibly putting this on a company wide site as opposed to just our internal dept server. I know that all that code is a mix of PHP and Perl I can also apply the PHP skills to my wife's website.
                Last edited by crokett; 11-04-2008, 11:41 AM.
                David

                The chief cause of failure in this life is giving up what you want most for what you want at the moment.

                Comment

                • Alex Franke
                  Veteran Member
                  • Feb 2007
                  • 2641
                  • Chapel Hill, NC
                  • Ryobi BT3100

                  #9
                  Okay, cool. Look up "associative array" in PHP as a replacement for your .Net IDictionary classes.
                  online at http://www.theFrankes.com
                  while ( !( succeed = try() ) ) ;
                  "Life is short, Art long, Occasion sudden and dangerous, Experience deceitful, and Judgment difficult." -Hippocrates

                  Comment

                  • gerti
                    Veteran Member
                    • Dec 2003
                    • 2233
                    • Minnetonka, MN, USA.
                    • BT3100 "Frankensaw"

                    #10
                    Originally posted by crokett
                    He also pointed out that PHP has better object support and arrays can be accessed by either index or key.
                    While I might agree with the other points, perl's object support is quite excellent. And it has hash tables and arrays. But PHP is probably easier to the uninitiated.

                    Comment

                    • crokett
                      The Full Monte
                      • Jan 2003
                      • 10627
                      • Mebane, NC, USA.
                      • Ryobi BT3000

                      #11
                      Originally posted by gerti
                      While I might agree with the other points, perl's object support is quite excellent. And it has hash tables and arrays. But PHP is probably easier to the uninitiated.
                      I've had a smattering of half a dozen languages. What I am stumbling over now is trying not to redesign the existing program. If I go to PHP I may have to.

                      VB lets me declare something thusly:
                      Code:
                      Public Class Fabric
                           ' typed hash where each hash holds a list of objects
                           ' each object then has its own attributes that can be set or retrieved
                            Public switchList As Dictionary(Of Integer, BaseSwitch)
                          'array list holds my connected switches 
                          Public switchConnectionList As Dictionary(Of Integer, SwitchConnection) = New SwitchConnectionList
                         
                      
                      End Class
                      I am not sure I can do the equivalent in PHP. I can create an associative array but I am not seeing where I can store anything other than string, int, etc. in it. I haven't checked with Perl.
                      David

                      The chief cause of failure in this life is giving up what you want most for what you want at the moment.

                      Comment

                      • Alex Franke
                        Veteran Member
                        • Feb 2007
                        • 2641
                        • Chapel Hill, NC
                        • Ryobi BT3100

                        #12
                        object oriented programming is supported in both php4 and php5, but is greatly enhanced (in fact completely re-written) in php5. php is very loosely typed, so you can pretty much stick anything you want into any variable. It's a lot harder to implement type safety in a loosely typed language. (If you're interested, here's a brief overview of type safety from on one of my sites.)
                        PHP Code:
                        class Fabric {
                             // typed hash where each hash holds a list of objects
                             // each object then has its own attributes that can be set or retrieved
                             var $switchList;
                             //array list holds my connected switches 
                             var $switchConnectionList;
                        
                            function addSwitch($number, $switch) {
                                $this->switchList[$number] += $switch;
                            }
                        
                            // etc... 
                        } 
                        
                        online at http://www.theFrankes.com
                        while ( !( succeed = try() ) ) ;
                        "Life is short, Art long, Occasion sudden and dangerous, Experience deceitful, and Judgment difficult." -Hippocrates

                        Comment

                        Working...